Twitter API wrapper for Java
Main API wrapping is implemented by standard library.
Json Decoding is implmented by org.json.
This wrapper's current java version is java8
About detail of params that send to api, please check API Reference
TwiJava twitter = new TwiJava();
twitter.authorize("consumerKey","consumerSecretKey","accessToken","accessTokenSecret");
twitter.tweet("Hello World");
twitter.deleteTweet("your tweet id_str");
twitter.searchTweet("Hello");
If you use optional param
TreeMap<String,String> customSearch = new TreeMap<>();
customSearch.put("q",ParamEncoder.encode("Hello"));
// Below is optional params
customSearch.put("count","25");
customSearch.put("locale","ja");
customSearch.put("result_type","popular");
HttpRequest httpRequest = new HttpRequest();
httpRequest.get(TwitterApiURLs.SEACH_URL,customSearch);
twitter.getUserTimeLine(100);
twitter.getHomeTimeLine(100);
twitter.getUserProfile("screen_name");
twitter.getFollowerList();
TreeMap<String,String> param = new TreeMap<>();
param.put("cursor","-1");
// Below is optional params
param.put("screen_name","twitter's @id");
param.put("count","30");
HttpRequest httpRequest = new HttpRequest();
httpRequest.get(TwitterApiURLs.FOLLOWERS_URL,param);
twitter.getFriendList();
TreeMap<String,String> param = new TreeMap<>();
param.put("cursor","-1");
// Below is optional params
param.put("screen_name","twitter's @id");
param.put("count","30");
HttpRequest httpRequest = new HttpRequest();
httpRequest.get(TwitterApiURLs.FRIENDS_URL,param);
String json = twitter.getHomeTimeLine(50);
JsonDecoder.decodeTimeLine(json);
POST /1.1/statuses/update.json
POST /1.1/statuses/destroy/:id.json
GET /1.1/statuses/user_timeline.json
GET /1.1/statuses/home_timeline.json
GET /1.1/search/tweets.json
GET /1.1/users/show.json
GET /1.1/followers/list.json
GET /1.1/friend/list.json
I welcome it. But if you pullrequest to this repository,you should write description of pullrequest content in English.
MIT License
Copyright (c) [2017] ItinoseSan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.