【发布时间】:2020-05-07 10:02:36
【问题描述】:
当我创建 Twitter 类对象时,我收到一个错误,表明它在包中具有私有访问权限,我需要 Twitter 类来调用 webhooks 方法。我在代码部分描述了我想要得到的东西。
我使用 org.apache.streams:streams-provider-twitter 依赖项。 这是 org.apache.streams 的链接。
下面是我的代码:
TwitterConfiguration twitterConfiguration = new TwitterConfiguration();
TwitterOAuthConfiguration twitterOAuth = new TwitterOAuthConfiguration();
twitterOAuth.setAccessToken(accessToken);
twitterOAuth.setAccessTokenSecret(tokenSecret);
twitterOAuth.setConsumerKey(SecurityConstants.TWITTER_CONSUMER_KEY);
twitterOAuth.setConsumerSecret(SecurityConstants.TWITTER_CONSUMER_SECRET);
twitterConfiguration.setOauth(twitterOAuth);
Twitter twitter = new Twitter(); // here I get error that Twitter has private access,
//I need Twitter class to invoke:
twitter.registerWebhook("endopint");
twitter.getWebhooks();
您能发布示例如何使用此依赖项来检索 webhook 吗?我不知道使用什么类来调用 webhook 方法。
【问题讨论】: