项目作者: abhaybd

项目描述 :
Addon for use with Twitter4J to allow for managing webhooks
高级语言: Java
项目地址: git://github.com/abhaybd/Twitter4J-Webhook.git
创建时间: 2020-11-16T01:44:03Z
项目社区:https://github.com/abhaybd/Twitter4J-Webhook

开源协议:MIT License

下载


Twitter4J-Webhook

Manage the Twitter account activity API. This adds some classes that can be used with Twitter4J to manage webhooks, as well as subscriptions to those webhooks.

Installation

Install with maven

  1. <dependency>
  2. <groupId>com.abhaybd</groupId>
  3. <artifactId>twitter4j-webhook</artifactId>
  4. <version>0.0.1</version>
  5. </dependency>

Usage

Create a webhook manager

  1. Twitter twitter = TwitterFactory.getSingleton();
  2. WebhookManager manager = new WebhookManager(twitter.getConfiguration(), "ENV_NAME");

Register a webhook at the given URI

  1. manager.addWebhook(URI.create("https://example.webhook.com/webhook"));

Unregister the currently registered webhook

  1. manager.removeWebhook();

Get the information for the currently registered webhook

  1. WebhookInfo info = manager.getWebhookInfo();
  2. System.out.println(info.getID());
  3. System.out.println(info.isValid());

Trigger a CRC check for the currently registered webhook

  1. manager.triggerCRC();

Register the currently authenticated user to this webhook

  1. manager.registerCurrentUser();

Unregister all users from this webhook

  1. manager.unregisterAllUsers();

Unregister a specific user from this webhook

  1. long userId = 1024L;
  2. manager.unregisterUser(userId);