implemented some apis
This commit is contained in:
parent
0a47a6bb92
commit
57cf2e7eff
|
@ -25,19 +25,15 @@ import org.mariotaku.simplerestapi.method.POST;
|
|||
import org.mariotaku.simplerestapi.param.Body;
|
||||
import org.mariotaku.simplerestapi.param.Form;
|
||||
import org.mariotaku.simplerestapi.param.Query;
|
||||
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.PageableResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.Paging;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
||||
import org.mariotaku.twidere.api.twitter.model.UserListUpdate;
|
||||
|
||||
/**
|
||||
* @author Joern Huxhorn - jhuxhorn at googlemail.com
|
||||
*/
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface ListsResources {
|
||||
@POST("/lists/members/create.json")
|
||||
|
@ -60,19 +56,33 @@ public interface ListsResources {
|
|||
@Body(BodyType.FORM)
|
||||
UserList createUserList(@Form UserListUpdate update) throws TwitterException;
|
||||
|
||||
UserList createUserListSubscription(@Query("list_id") long listId) throws TwitterException;
|
||||
@POST("/lists/subscribers/create.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList createUserListSubscription(@Form("list_id") long listId) throws TwitterException;
|
||||
|
||||
@POST("/lists/members/destroy.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList deleteUserListMember(@Query("list_id") long listId, @Query("user_id") long userId) throws TwitterException;
|
||||
|
||||
UserList deleteUserListMember(@Query("list_id") long listId, String screenName) throws TwitterException;
|
||||
@POST("/lists/members/destroy.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList deleteUserListMember(@Query("list_id") long listId, @Form("screen_name") String screenName) throws TwitterException;
|
||||
|
||||
UserList deleteUserListMembers(@Query("list_id") long listId, long[] userIds) throws TwitterException;
|
||||
@POST("/lists/members/destroy_all.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList deleteUserListMembers(@Form("list_id") long listId, @Form("user_id") long[] userIds) throws TwitterException;
|
||||
|
||||
UserList deleteUserListMembers(@Query("list_id") long listId, String[] screenNames) throws TwitterException;
|
||||
@POST("/lists/members/destroy_all.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList deleteUserListMembers(@Query("list_id") long listId, @Form("screen_name") String[] screenNames) throws TwitterException;
|
||||
|
||||
UserList destroyUserList(@Query("list_id") long listId) throws TwitterException;
|
||||
@POST("/lists/destroy.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList destroyUserList(@Form("list_id") long listId) throws TwitterException;
|
||||
|
||||
UserList destroyUserListSubscription(@Query("list_id") long listId) throws TwitterException;
|
||||
@POST("/lists/subscribers/destroy.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList destroyUserListSubscription(@Form("list_id") long listId) throws TwitterException;
|
||||
|
||||
@GET("/lists/members.json")
|
||||
PageableResponseList<User> getUserListMembers(@Query("list_id") long listId, @Query Paging paging) throws TwitterException;
|
||||
|
@ -160,5 +170,5 @@ public interface ListsResources {
|
|||
|
||||
@POST("/lists/update.json")
|
||||
@Body(BodyType.FORM)
|
||||
UserList updateUserList(@Query("list_id") long listId, @Form UserListUpdate update) throws TwitterException;
|
||||
UserList updateUserList(@Form("list_id") long listId, @Form UserListUpdate update) throws TwitterException;
|
||||
}
|
||||
|
|
|
@ -31,20 +31,6 @@ public interface AccountSettings extends TwitterResponse {
|
|||
*/
|
||||
String getLanguage();
|
||||
|
||||
/**
|
||||
* Returns sleep end time.
|
||||
*
|
||||
* @return sleep end time
|
||||
*/
|
||||
String getSleepEndTime();
|
||||
|
||||
/**
|
||||
* Returns sleep start time.
|
||||
*
|
||||
* @return sleep start time
|
||||
*/
|
||||
String getSleepStartTime();
|
||||
|
||||
/**
|
||||
* Returns the timezone configured for this user.
|
||||
*
|
||||
|
@ -66,12 +52,6 @@ public interface AccountSettings extends TwitterResponse {
|
|||
*/
|
||||
boolean isAlwaysUseHttps();
|
||||
|
||||
/**
|
||||
* Returns true if the user is discoverable by email.
|
||||
*
|
||||
* @return true if the user is discoverable by email
|
||||
*/
|
||||
boolean isDiscoverableByEmail();
|
||||
|
||||
/**
|
||||
* Return true if the user is enabling geo location
|
||||
|
@ -80,10 +60,4 @@ public interface AccountSettings extends TwitterResponse {
|
|||
*/
|
||||
boolean isGeoEnabled();
|
||||
|
||||
/**
|
||||
* Returns true if the user enabled sleep time.
|
||||
*
|
||||
* @return true if the user enabled sleep time
|
||||
*/
|
||||
boolean isSleepTimeEnabled();
|
||||
}
|
||||
|
|
|
@ -19,15 +19,13 @@
|
|||
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Alessandro Bahgat - ale.bahgat at gmail.com
|
||||
*/
|
||||
public interface TimeZone extends Serializable {
|
||||
String getName();
|
||||
public interface TimeZone {
|
||||
String getName();
|
||||
|
||||
String tzinfoName();
|
||||
String getTzInfoName();
|
||||
|
||||
int utcOffset();
|
||||
int getUtcOffset();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import org.mariotaku.twidere.api.twitter.model.AccountSettings;
|
||||
import org.mariotaku.twidere.api.twitter.model.Location;
|
||||
import org.mariotaku.twidere.api.twitter.model.TimeZone;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/5/13.
|
||||
*/
|
||||
@JsonObject
|
||||
public class AccountSettingsImpl extends TwitterResponseImpl implements AccountSettings {
|
||||
|
||||
@JsonField(name = "geo_enabled")
|
||||
boolean geoEnabled;
|
||||
@JsonField(name = "trend_location")
|
||||
Location[] trendLocations;
|
||||
@JsonField(name = "language")
|
||||
String language;
|
||||
@JsonField(name = "always_use_https")
|
||||
boolean alwaysUseHttps;
|
||||
@JsonField(name = "time_zone")
|
||||
TimeZone timezone;
|
||||
|
||||
@Override
|
||||
public boolean isAlwaysUseHttps() {
|
||||
return alwaysUseHttps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeZone getTimeZone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location[] getTrendLocations() {
|
||||
return trendLocations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeoEnabled() {
|
||||
return geoEnabled;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import org.mariotaku.twidere.api.twitter.model.TimeZone;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/5/13.
|
||||
*/
|
||||
@JsonObject
|
||||
public class TimeZoneImpl implements TimeZone {
|
||||
|
||||
@JsonField(name = "utc_offset")
|
||||
int utcOffset;
|
||||
@JsonField(name = "name")
|
||||
String name;
|
||||
@JsonField(name = "tzinfo_name")
|
||||
String tzInfoName;
|
||||
|
||||
@Override
|
||||
public int getUtcOffset() {
|
||||
return utcOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTzInfoName() {
|
||||
return tzInfoName;
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ import org.mariotaku.simplerestapi.http.RestHttpResponse;
|
|||
import org.mariotaku.simplerestapi.http.mime.TypedData;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.auth.OAuthToken;
|
||||
import org.mariotaku.twidere.api.twitter.model.AccountSettings;
|
||||
import org.mariotaku.twidere.api.twitter.model.Activity;
|
||||
import org.mariotaku.twidere.api.twitter.model.CardEntity;
|
||||
import org.mariotaku.twidere.api.twitter.model.DirectMessage;
|
||||
|
@ -51,6 +52,7 @@ import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|||
import org.mariotaku.twidere.api.twitter.model.SavedSearch;
|
||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
||||
import org.mariotaku.twidere.api.twitter.model.StatusActivitySummary;
|
||||
import org.mariotaku.twidere.api.twitter.model.TimeZone;
|
||||
import org.mariotaku.twidere.api.twitter.model.TranslationResult;
|
||||
import org.mariotaku.twidere.api.twitter.model.Trend;
|
||||
import org.mariotaku.twidere.api.twitter.model.Trends;
|
||||
|
@ -58,6 +60,7 @@ import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
|||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
||||
import org.mariotaku.twidere.api.twitter.model.UserMentionEntity;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.AccountSettingsImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.ActivityImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.CardEntityImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.DirectMessageImpl;
|
||||
|
@ -78,6 +81,7 @@ import org.mariotaku.twidere.api.twitter.model.impl.ResponseListImpl;
|
|||
import org.mariotaku.twidere.api.twitter.model.impl.SavedSearchImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.StatusActivitySummaryImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.StatusImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.TimeZoneImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.TranslationResultImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.TrendImpl;
|
||||
import org.mariotaku.twidere.api.twitter.model.impl.TrendsImpl;
|
||||
|
@ -137,6 +141,8 @@ public class TwitterConverter implements Converter {
|
|||
TypeConverterMapper.register(Location.class, LocationImpl.class);
|
||||
TypeConverterMapper.register(Location.PlaceType.class, LocationImpl.PlaceTypeImpl.class);
|
||||
TypeConverterMapper.register(StatusActivitySummary.class, StatusActivitySummaryImpl.class);
|
||||
TypeConverterMapper.register(TimeZone.class, TimeZoneImpl.class);
|
||||
TypeConverterMapper.register(AccountSettings.class, AccountSettingsImpl.class);
|
||||
TypeConverterMapper.register(IDs.class, IDsImpl.class, IDsImpl.MAPPER);
|
||||
TypeConverterMapper.register(Activity.class, ActivityImpl.class, ActivityImpl.MAPPER);
|
||||
|
||||
|
|
Loading…
Reference in New Issue