当我创建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();
您可以发表示例如何使用此依赖项来检索webhooks吗?我不知道使用什么类来调用webhook方法。
您不能自己调用构造函数。使用the factory method:
Twitter twitter = Twitter.getInstance(twitterConfiguration);