Coder Social home page Coder Social logo

twittered's Introduction

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

Maven Central

In your pom.xml, add the following dependency and replace VERSION with the version you wish:

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

To be able to see library logs, also add sl4j references :

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.30</version>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-simple</artifactId>
  <version>1.7.30</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.

External Resources

Twitter Developers docs

Special thanks

@hypr2771 @mmornati @andypiper @igorbrigadir @sparack

twittered's People

Contributors

redouane59 avatar phantomydn avatar rakambda avatar dependabot[bot] avatar greg-m73 avatar jackhallam avatar mattes3 avatar matbroughty avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.