mattes3 / twittered

Twitter API client for Java developers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This project is a JAVA library which allows you to consume the Twitter API.

v2

Standard

Premium

/!\ Development in progress... Any feedback is welcome :) /!\

Configuration

In your pom.xml, add the following dependency :

<dependency>
  <groupId>com.github.redouane59.twitter</groupId>
  <artifactId>twittered</artifactId>
  <version>1.11</version>
</dependency>

In order to use your own developer credentials, you have several options :

Using a json file

File example :

{
  "apiKey": "xxx",
  "apiSecretKey": "xxx",
  "accessToken": "xxx",
  "accessTokenSecret": "xxx"
}
With program argument

Pass through java argument your file path like -Dtwitter.credentials.file.path=/your/path/to/json . Then instantiate the client like

TwitterClient client = new TwitterClient();

or

Using deserialization in your code
TwitterClient twitterClient = new TwitterClient(TwitterClient.OBJECT_MAPPER
                                                    .readValue(new File("/your/path/to/json"), TwitterCredentials.class));

With hard-coded values

TwitterClient twitterClient = new TwitterClient(TwitterCredentials.builder()
                                                            .accessToken("<access_token>")
                                                            .accessTokenSecret("<secret_token>")
                                                            .apiKey("<api_key>")
                                                            .apiSecretKey("<secret_key>")
                                                            .build());

NB : Your twitter credentials can be found in your twitter app page in the Key and tokens page.

Available methods

See :

Code samples

See :

Contribution

If you want to contribute to the project, don't hesitate to submit pull requests. To add a new feature :

  • Create the interface method in the related interface (e.g ITwitterClientV2.java)
  • If needed, add the endpoint URL in URLHelper.java
  • Implement your method in the child class (e.g TwitterClient.java)
  • Don't forget to add your unit tests in src/test/java/com/github/redouane59/twitter/unit

Code style is also available in .idea/codeStyles/GoogleStyle.xml file.

/!\ JDK 12 is needed to run the project /!\

External Resources

Twitter Developers docs

Special thanks

@hypr2771 @mmornati @andypiper @igorbrigadir @sparack

About

Twitter API client for Java developers


Languages

Language:Java 100.0%