logansqaure 1.3.4
This commit is contained in:
parent
11ff55a68a
commit
77e8793e67
|
@ -38,7 +38,6 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
apt 'com.bluelinelabs:logansquare-compiler:1.3.4'
|
apt 'com.bluelinelabs:logansquare-compiler:1.3.4'
|
||||||
apt 'com.hannesdorfmann.parcelableplease:processor:1.0.1'
|
apt 'com.hannesdorfmann.parcelableplease:processor:1.0.1'
|
||||||
apt 'com.github.mariotaku.LoganSquareExtension:processor:0.9.6-SNAPSHOT'
|
|
||||||
apt 'com.github.mariotaku.ObjectCursor:processor:0.9.2'
|
apt 'com.github.mariotaku.ObjectCursor:processor:0.9.2'
|
||||||
compile 'com.android.support:support-annotations:23.1.1'
|
compile 'com.android.support:support-annotations:23.1.1'
|
||||||
compile 'com.android.support:support-v4:23.1.1'
|
compile 'com.android.support:support-v4:23.1.1'
|
||||||
|
@ -47,7 +46,6 @@ dependencies {
|
||||||
compile 'com.github.mariotaku.RestFu:library:0.9.8'
|
compile 'com.github.mariotaku.RestFu:library:0.9.8'
|
||||||
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.1'
|
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.1'
|
||||||
compile 'com.github.mariotaku:SQLiteQB:88291f3a28'
|
compile 'com.github.mariotaku:SQLiteQB:88291f3a28'
|
||||||
compile 'com.github.mariotaku.LoganSquareExtension:core:0.9.6-SNAPSHOT'
|
|
||||||
compile 'com.github.mariotaku.ObjectCursor:core:0.9.2'
|
compile 'com.github.mariotaku.ObjectCursor:core:0.9.2'
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ import org.mariotaku.twidere.api.twitter.http.HttpResponseCode;
|
||||||
import org.mariotaku.twidere.api.twitter.model.ErrorInfo;
|
import org.mariotaku.twidere.api.twitter.model.ErrorInfo;
|
||||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
||||||
import org.mariotaku.twidere.api.twitter.model.TwitterResponse;
|
import org.mariotaku.twidere.api.twitter.model.TwitterResponse;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ErrorInfoImpl;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.RateLimitStatusJSONImpl;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -46,7 +44,7 @@ public class TwitterException extends Exception implements TwitterResponse, Http
|
||||||
|
|
||||||
private static final long serialVersionUID = -2623309261327598087L;
|
private static final long serialVersionUID = -2623309261327598087L;
|
||||||
@JsonField(name = "errors")
|
@JsonField(name = "errors")
|
||||||
ErrorInfoImpl[] errors;
|
ErrorInfo[] errors;
|
||||||
@JsonField(name = "error")
|
@JsonField(name = "error")
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
@JsonField(name = "request")
|
@JsonField(name = "request")
|
||||||
|
@ -118,7 +116,7 @@ public class TwitterException extends Exception implements TwitterResponse, Http
|
||||||
public void setHttpResponse(RestHttpResponse res) {
|
public void setHttpResponse(RestHttpResponse res) {
|
||||||
httpResponse = res;
|
httpResponse = res;
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
rateLimitStatus = RateLimitStatusJSONImpl.createFromResponseHeader(res);
|
rateLimitStatus = RateLimitStatus.createFromResponseHeader(res);
|
||||||
statusCode = res.getStatus();
|
statusCode = res.getStatus();
|
||||||
} else {
|
} else {
|
||||||
rateLimitStatus = null;
|
rateLimitStatus = null;
|
||||||
|
@ -280,7 +278,7 @@ public class TwitterException extends Exception implements TwitterResponse, Http
|
||||||
nested = true;
|
nested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SingleErrorInfo implements ErrorInfo {
|
static class SingleErrorInfo extends ErrorInfo {
|
||||||
private final String message;
|
private final String message;
|
||||||
private final String request;
|
private final String request;
|
||||||
private final int code;
|
private final int code;
|
||||||
|
@ -291,17 +289,14 @@ public class TwitterException extends Exception implements TwitterResponse, Http
|
||||||
this.code = -1;
|
this.code = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCode() {
|
public int getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRequest() {
|
public String getRequest() {
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,49 +19,44 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.AccountSettingsImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
* Created by mariotaku on 15/5/13.
|
||||||
* @since Twitter4J 2.1.9
|
|
||||||
*/
|
*/
|
||||||
@Implementation(AccountSettingsImpl.class)
|
@JsonObject
|
||||||
public interface AccountSettings extends TwitterResponse {
|
public class AccountSettings extends TwitterResponseObject {
|
||||||
/**
|
|
||||||
* Returns the language used to render Twitter's UII for this user.
|
|
||||||
*
|
|
||||||
* @return the language ISO 639-1 representation
|
|
||||||
*/
|
|
||||||
String getLanguage();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "geo_enabled")
|
||||||
* Returns the timezone configured for this user.
|
boolean geoEnabled;
|
||||||
*
|
@JsonField(name = "trend_location")
|
||||||
* @return the timezone (formated as a Rails TimeZone name)
|
Location[] trendLocations;
|
||||||
*/
|
@JsonField(name = "language")
|
||||||
TimeZone getTimeZone();
|
String language;
|
||||||
|
@JsonField(name = "always_use_https")
|
||||||
|
boolean alwaysUseHttps;
|
||||||
|
@JsonField(name = "time_zone")
|
||||||
|
TimeZone timezone;
|
||||||
|
|
||||||
/**
|
public boolean isAlwaysUseHttps() {
|
||||||
* Return the user's trend locations
|
return alwaysUseHttps;
|
||||||
*
|
}
|
||||||
* @return the user's trend locations
|
|
||||||
*/
|
|
||||||
Location[] getTrendLocations();
|
|
||||||
|
|
||||||
/**
|
public String getLanguage() {
|
||||||
* Returns true if the wants to always access twitter using HTTPS.
|
return language;
|
||||||
*
|
}
|
||||||
* @return true if the wants to always access twitter using HTTPS
|
|
||||||
*/
|
|
||||||
boolean isAlwaysUseHttps();
|
|
||||||
|
|
||||||
|
public TimeZone getTimeZone() {
|
||||||
|
return timezone;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public Location[] getTrendLocations() {
|
||||||
* Return true if the user is enabling geo location
|
return trendLocations;
|
||||||
*
|
}
|
||||||
* @return true if the user is enabling geo location
|
|
||||||
*/
|
public boolean isGeoEnabled() {
|
||||||
boolean isGeoEnabled();
|
return geoEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.1.9
|
|
||||||
*/
|
|
||||||
public interface AccountTotals extends TwitterResponse, Serializable {
|
|
||||||
/**
|
|
||||||
* Returns the number of total favorites.
|
|
||||||
*
|
|
||||||
* @return the number of total favorites
|
|
||||||
*/
|
|
||||||
int getFavorites();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of total followers.
|
|
||||||
*
|
|
||||||
* @return the number of total followers
|
|
||||||
*/
|
|
||||||
int getFollowers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of total friends.
|
|
||||||
*
|
|
||||||
* @return the number of total friends
|
|
||||||
*/
|
|
||||||
int getFriends();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of total updates.
|
|
||||||
*
|
|
||||||
* @return the number of total updates
|
|
||||||
*/
|
|
||||||
int getUpdates();
|
|
||||||
}
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.JsonMapper;
|
import com.bluelinelabs.logansquare.JsonMapper;
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
import com.bluelinelabs.logansquare.LoganSquare;
|
||||||
|
@ -25,25 +25,20 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonToken;
|
import com.fasterxml.jackson.core.JsonToken;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Activity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/10/21.
|
* Created by mariotaku on 15/10/21.
|
||||||
*/
|
*/
|
||||||
public class ActivityImplMapper extends JsonMapper<ActivityImpl> {
|
public class Activity$$JsonObjectMapper extends JsonMapper<Activity> {
|
||||||
|
|
||||||
public static final ActivityImplMapper INSTANCE = new ActivityImplMapper();
|
public static final Activity$$JsonObjectMapper INSTANCE = new Activity$$JsonObjectMapper();
|
||||||
|
|
||||||
@SuppressWarnings("TryWithIdenticalCatches")
|
@SuppressWarnings("TryWithIdenticalCatches")
|
||||||
@Override
|
@Override
|
||||||
public ActivityImpl parse(JsonParser jsonParser) throws IOException {
|
public Activity parse(JsonParser jsonParser) throws IOException {
|
||||||
ActivityImpl instance = new ActivityImpl();
|
Activity instance = new Activity();
|
||||||
if (jsonParser.getCurrentToken() == null) {
|
if (jsonParser.getCurrentToken() == null) {
|
||||||
jsonParser.nextToken();
|
jsonParser.nextToken();
|
||||||
}
|
}
|
||||||
|
@ -61,18 +56,18 @@ public class ActivityImplMapper extends JsonMapper<ActivityImpl> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ActivityImpl activity, JsonGenerator jsonGenerator, boolean writeStartAndEnd) {
|
public void serialize(Activity activity, JsonGenerator jsonGenerator, boolean writeStartAndEnd) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseField(ActivityImpl instance, String fieldName, JsonParser jsonParser) throws IOException {
|
public void parseField(Activity instance, String fieldName, JsonParser jsonParser) throws IOException {
|
||||||
if ("action".equals(fieldName)) {
|
if ("action".equals(fieldName)) {
|
||||||
final String rawAction = jsonParser.getValueAsString();
|
final String rawAction = jsonParser.getValueAsString();
|
||||||
instance.action = Activity.Action.parse(rawAction);
|
instance.action = Activity.Action.parse(rawAction);
|
||||||
instance.rawAction = rawAction;
|
instance.rawAction = rawAction;
|
||||||
} else if ("created_at".equals(fieldName)) {
|
} else if ("created_at".equals(fieldName)) {
|
||||||
try {
|
try {
|
||||||
instance.createdAt = ActivityImpl.DATE_FORMAT.parse(jsonParser.getValueAsString());
|
instance.createdAt = Activity.DATE_FORMAT.parse(jsonParser.getValueAsString());
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
|
@ -19,67 +19,164 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.EnumClass;
|
import android.support.annotation.NonNull;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ActivityImpl;
|
|
||||||
import org.mariotaku.twidere.util.AbsLogger;
|
import org.mariotaku.twidere.util.AbsLogger;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
@Implementation(ActivityImpl.class)
|
public class Activity extends TwitterResponseObject implements TwitterResponse, Comparable<Activity> {
|
||||||
public interface Activity extends TwitterResponse, Comparable<Activity> {
|
|
||||||
|
|
||||||
int ACTION_UNKNOWN = 0x00;
|
public static final int ACTION_UNKNOWN = 0x00;
|
||||||
int ACTION_FAVORITE = 0x01;
|
public static final int ACTION_FAVORITE = 0x01;
|
||||||
int ACTION_FOLLOW = 0x02;
|
public static final int ACTION_FOLLOW = 0x02;
|
||||||
int ACTION_MENTION = 0x03;
|
public static final int ACTION_MENTION = 0x03;
|
||||||
int ACTION_REPLY = 0x04;
|
public static final int ACTION_REPLY = 0x04;
|
||||||
int ACTION_RETWEET = 0x05;
|
public static final int ACTION_RETWEET = 0x05;
|
||||||
int ACTION_LIST_MEMBER_ADDED = 0x06;
|
public static final int ACTION_LIST_MEMBER_ADDED = 0x06;
|
||||||
int ACTION_LIST_CREATED = 0x07;
|
public static final int ACTION_LIST_CREATED = 0x07;
|
||||||
int ACTION_FAVORITED_RETWEET = 0x08;
|
public static final int ACTION_FAVORITED_RETWEET = 0x08;
|
||||||
int ACTION_RETWEETED_RETWEET = 0x09;
|
public static final int ACTION_RETWEETED_RETWEET = 0x09;
|
||||||
int ACTION_QUOTE = 0x0A;
|
public static final int ACTION_QUOTE = 0x0A;
|
||||||
int ACTION_RETWEETED_MENTION = 0x0B;
|
public static final int ACTION_RETWEETED_MENTION = 0x0B;
|
||||||
int ACTION_FAVORITED_MENTION = 0x0C;
|
public static final int ACTION_FAVORITED_MENTION = 0x0C;
|
||||||
int ACTION_JOINED_TWITTER = 0x0D;
|
public static final int ACTION_JOINED_TWITTER = 0x0D;
|
||||||
int ACTION_MEDIA_TAGGED = 0x0E;
|
public static final int ACTION_MEDIA_TAGGED = 0x0E;
|
||||||
int ACTION_FAVORITED_MEDIA_TAGGED = 0x0F;
|
public static final int ACTION_FAVORITED_MEDIA_TAGGED = 0x0F;
|
||||||
int ACTION_RETWEETED_MEDIA_TAGGED = 0x10;
|
public static final int ACTION_RETWEETED_MEDIA_TAGGED = 0x10;
|
||||||
|
static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
|
||||||
|
Action action;
|
||||||
|
String rawAction;
|
||||||
|
|
||||||
Action getAction();
|
Date createdAt;
|
||||||
|
|
||||||
String getRawAction();
|
User[] sources;
|
||||||
|
User[] targetUsers;
|
||||||
|
User[] targetObjectUsers;
|
||||||
|
Status[] targetObjectStatuses, targetStatuses;
|
||||||
|
UserList[] targetUserLists, targetObjectUserLists;
|
||||||
|
long maxPosition, minPosition;
|
||||||
|
int targetObjectsSize, targetsSize, sourcesSize;
|
||||||
|
|
||||||
Date getCreatedAt();
|
Activity() {
|
||||||
|
}
|
||||||
|
|
||||||
long getMaxPosition();
|
public String getRawAction() {
|
||||||
|
return rawAction;
|
||||||
|
}
|
||||||
|
|
||||||
long getMinPosition();
|
public User[] getTargetObjectUsers() {
|
||||||
|
return targetObjectUsers;
|
||||||
|
}
|
||||||
|
|
||||||
User[] getSources();
|
@Override
|
||||||
|
public int compareTo(@NonNull final Activity another) {
|
||||||
|
final Date thisDate = getCreatedAt(), thatDate = another.getCreatedAt();
|
||||||
|
if (thisDate == null || thatDate == null) return 0;
|
||||||
|
return thisDate.compareTo(thatDate);
|
||||||
|
}
|
||||||
|
|
||||||
int getSourcesSize();
|
public Action getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
int getTargetObjectsSize();
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
Status[] getTargetObjectStatuses();
|
public long getMaxPosition() {
|
||||||
|
return maxPosition;
|
||||||
|
}
|
||||||
|
|
||||||
UserList[] getTargetObjectUserLists();
|
public long getMinPosition() {
|
||||||
|
return minPosition;
|
||||||
|
}
|
||||||
|
|
||||||
int getTargetsSize();
|
public User[] getSources() {
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
Status[] getTargetStatuses();
|
public int getSourcesSize() {
|
||||||
|
return sourcesSize;
|
||||||
|
}
|
||||||
|
|
||||||
UserList[] getTargetUserLists();
|
public int getTargetObjectsSize() {
|
||||||
|
return targetObjectsSize;
|
||||||
|
}
|
||||||
|
|
||||||
User[] getTargetUsers();
|
public Status[] getTargetObjectStatuses() {
|
||||||
|
return targetObjectStatuses;
|
||||||
|
}
|
||||||
|
|
||||||
User[] getTargetObjectUsers();
|
public UserList[] getTargetObjectUserLists() {
|
||||||
|
return targetObjectUserLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTargetsSize() {
|
||||||
|
return targetsSize;
|
||||||
|
}
|
||||||
|
|
||||||
@EnumClass
|
public Status[] getTargetStatuses() {
|
||||||
enum Action {
|
return targetStatuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserList[] getTargetUserLists() {
|
||||||
|
return targetUserLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User[] getTargetUsers() {
|
||||||
|
return targetUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ActivityJSONImpl{" +
|
||||||
|
"action=" + action +
|
||||||
|
", createdAt=" + createdAt +
|
||||||
|
", sources=" + Arrays.toString(sources) +
|
||||||
|
", targetUsers=" + Arrays.toString(targetUsers) +
|
||||||
|
", targetObjectStatuses=" + Arrays.toString(targetObjectStatuses) +
|
||||||
|
", targetStatuses=" + Arrays.toString(targetStatuses) +
|
||||||
|
", targetUserLists=" + Arrays.toString(targetUserLists) +
|
||||||
|
", targetObjectUserLists=" + Arrays.toString(targetObjectUserLists) +
|
||||||
|
", maxPosition=" + maxPosition +
|
||||||
|
", minPosition=" + minPosition +
|
||||||
|
", targetObjectsSize=" + targetObjectsSize +
|
||||||
|
", targetsSize=" + targetsSize +
|
||||||
|
", sourcesSize=" + sourcesSize +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Activity fromMention(long accountId, Status status) {
|
||||||
|
final Activity activity = new Activity();
|
||||||
|
|
||||||
|
activity.maxPosition = activity.minPosition = status.getId();
|
||||||
|
activity.createdAt = status.getCreatedAt();
|
||||||
|
|
||||||
|
if (status.getInReplyToUserId() == accountId) {
|
||||||
|
activity.action = Action.REPLY;
|
||||||
|
activity.rawAction = "reply";
|
||||||
|
activity.targetStatuses = new Status[]{status};
|
||||||
|
|
||||||
|
//TODO set target statuses (in reply to status)
|
||||||
|
activity.targetObjectStatuses = new Status[0];
|
||||||
|
} else {
|
||||||
|
activity.action = Action.MENTION;
|
||||||
|
activity.rawAction = "mention";
|
||||||
|
activity.targetObjectStatuses = new Status[]{status};
|
||||||
|
|
||||||
|
// TODO set target users (mentioned users)
|
||||||
|
activity.targetUsers = null;
|
||||||
|
}
|
||||||
|
activity.sourcesSize = 1;
|
||||||
|
activity.sources = new User[]{status.getUser()};
|
||||||
|
return activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Action {
|
||||||
FAVORITE(ACTION_FAVORITE),
|
FAVORITE(ACTION_FAVORITE),
|
||||||
/**
|
/**
|
||||||
* Sources: followers to targets (User)
|
* Sources: followers to targets (User)
|
||||||
|
@ -139,4 +236,4 @@ public interface Activity extends TwitterResponse, Comparable<Activity> {
|
||||||
return actionId;
|
return actionId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,28 +19,62 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import android.support.v4.util.ArrayMap;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.CardEntityImpl;
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.OnJsonParseComplete;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 14/12/31.
|
* Created by mariotaku on 15/5/7.
|
||||||
*/
|
*/
|
||||||
@Implementation(CardEntityImpl.class)
|
@JsonObject
|
||||||
public interface CardEntity {
|
public class CardEntity {
|
||||||
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
String getUrl();
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
|
||||||
User[] getUsers();
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
|
||||||
BindingValue getBindingValue(String key);
|
@JsonField(name = "binding_values")
|
||||||
|
Map<String, RawBindingValue> rawBindingValues;
|
||||||
|
Map<String, BindingValue> bindingValues;
|
||||||
|
|
||||||
Map<String, BindingValue> getBindingValues();
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
interface BindingValue {
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User[] getUsers() {
|
||||||
|
return new User[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindingValue getBindingValue(String key) {
|
||||||
|
return bindingValues.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, BindingValue> getBindingValues() {
|
||||||
|
return bindingValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnJsonParseComplete
|
||||||
|
void onParseComplete() {
|
||||||
|
if (rawBindingValues != null) {
|
||||||
|
bindingValues = new ArrayMap<>();
|
||||||
|
for (Map.Entry<String, RawBindingValue> entry : rawBindingValues.entrySet()) {
|
||||||
|
bindingValues.put(entry.getKey(), entry.getValue().getBindingValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BindingValue {
|
||||||
|
|
||||||
String TYPE_STRING = "STRING";
|
String TYPE_STRING = "STRING";
|
||||||
String TYPE_IMAGE = "IMAGE";
|
String TYPE_IMAGE = "IMAGE";
|
||||||
|
@ -49,24 +83,98 @@ public interface CardEntity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class ImageValue implements BindingValue {
|
||||||
|
@JsonField(name = "width")
|
||||||
|
int width;
|
||||||
|
@JsonField(name = "height")
|
||||||
|
int height;
|
||||||
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
interface UserValue extends BindingValue {
|
|
||||||
long getUserId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StringValue extends BindingValue {
|
public static class BooleanValue implements BindingValue {
|
||||||
String getValue();
|
|
||||||
|
public BooleanValue(boolean value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean value;
|
||||||
|
|
||||||
|
public boolean getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BooleanValue extends BindingValue {
|
public static class StringValue implements BindingValue {
|
||||||
boolean getValue();
|
private final String value;
|
||||||
|
|
||||||
|
public StringValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImageValue extends BindingValue {
|
@JsonObject
|
||||||
int getWidth();
|
public static class UserValue implements BindingValue {
|
||||||
|
|
||||||
int getHeight();
|
@JsonField(name = "id")
|
||||||
|
long userId;
|
||||||
|
|
||||||
|
public long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class RawBindingValue {
|
||||||
|
|
||||||
|
@JsonField(name = "type")
|
||||||
|
String type;
|
||||||
|
@JsonField(name = "boolean_value")
|
||||||
|
boolean booleanValue;
|
||||||
|
@JsonField(name = "string_value")
|
||||||
|
String stringValue;
|
||||||
|
@JsonField(name = "image_value")
|
||||||
|
ImageValue imageValue;
|
||||||
|
@JsonField(name = "user_value")
|
||||||
|
UserValue userValue;
|
||||||
|
|
||||||
|
|
||||||
|
public BindingValue getBindingValue() {
|
||||||
|
if (type == null) return null;
|
||||||
|
switch (type) {
|
||||||
|
case BindingValue.TYPE_BOOLEAN: {
|
||||||
|
return new BooleanValue(booleanValue);
|
||||||
|
}
|
||||||
|
case BindingValue.TYPE_STRING: {
|
||||||
|
return new StringValue(stringValue);
|
||||||
|
}
|
||||||
|
case BindingValue.TYPE_IMAGE: {
|
||||||
|
return imageValue;
|
||||||
|
}
|
||||||
|
case BindingValue.TYPE_USER: {
|
||||||
|
return userValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String getUrl();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,36 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
@JsonObject
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
public class Category {
|
||||||
* @since Twitter4J 2.1.1
|
@JsonField(name = "name")
|
||||||
*/
|
String name;
|
||||||
public interface Category extends Serializable {
|
@JsonField(name = "size")
|
||||||
String getName();
|
long size;
|
||||||
|
@JsonField(name = "slug")
|
||||||
|
String slug;
|
||||||
|
|
||||||
int getSize();
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
String getSlug();
|
public long getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSlug() {
|
||||||
|
return slug;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Category{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
", size=" + size +
|
||||||
|
", slug='" + slug + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,39 +19,94 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.DirectMessageImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing sent/received direct message.
|
* Created by mariotaku on 15/5/7.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
*/
|
*/
|
||||||
@Implementation(DirectMessageImpl.class)
|
@JsonObject
|
||||||
public interface DirectMessage extends TwitterResponse, EntitySupport {
|
public class DirectMessage extends TwitterResponseObject implements TwitterResponse, EntitySupport {
|
||||||
|
|
||||||
/**
|
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
||||||
* @return created_at
|
Date createdAt;
|
||||||
* @since Twitter4J 1.1.0
|
|
||||||
*/
|
|
||||||
Date getCreatedAt();
|
|
||||||
|
|
||||||
long getId();
|
@JsonField(name = "sender")
|
||||||
|
User sender;
|
||||||
|
|
||||||
User getRecipient();
|
@JsonField(name = "recipient")
|
||||||
|
User recipient;
|
||||||
|
|
||||||
long getRecipientId();
|
@JsonField(name = "entities")
|
||||||
|
Entities entities;
|
||||||
|
|
||||||
String getRecipientScreenName();
|
@JsonField(name = "text")
|
||||||
|
String text;
|
||||||
|
|
||||||
User getSender();
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
|
||||||
long getSenderId();
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
String getSenderScreenName();
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
String getText();
|
@Override
|
||||||
|
public HashtagEntity[] getHashtagEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getHashtags();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MediaEntity[] getMediaEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getMedia();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UrlEntity[] getUrlEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getUrls();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserMentionEntity[] getUserMentionEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getUserMentions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getSender() {
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSenderId() {
|
||||||
|
return sender.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSenderScreenName() {
|
||||||
|
return sender.screenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getRecipient() {
|
||||||
|
return recipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRecipientId() {
|
||||||
|
return recipient.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecipientScreenName() {
|
||||||
|
return recipient.screenName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,40 +17,35 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.HashtagEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.MediaEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserMentionEntity;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/3/31.
|
* Created by mariotaku on 15/3/31.
|
||||||
*/
|
*/
|
||||||
@JsonObject
|
@JsonObject
|
||||||
public class EntitiesImpl {
|
public class Entities {
|
||||||
@JsonField(name = "hashtags")
|
@JsonField(name = "hashtags")
|
||||||
HashtagEntityImpl[] hashtags;
|
HashtagEntity[] hashtags;
|
||||||
|
|
||||||
@JsonField(name = "user_mentions")
|
@JsonField(name = "user_mentions")
|
||||||
UserMentionEntityImpl[] userMentions;
|
UserMentionEntity[] userMentions;
|
||||||
|
|
||||||
@JsonField(name = "urls")
|
@JsonField(name = "urls")
|
||||||
UrlEntityImpl[] urls;
|
UrlEntity[] urls;
|
||||||
|
|
||||||
@JsonField(name = "media")
|
@JsonField(name = "media")
|
||||||
MediaEntityImpl[] media;
|
MediaEntity[] media;
|
||||||
|
|
||||||
public HashtagEntity[] getHashtags() {
|
public org.mariotaku.twidere.api.twitter.model.HashtagEntity[] getHashtags() {
|
||||||
return hashtags;
|
return hashtags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserMentionEntity[] getUserMentions() {
|
public org.mariotaku.twidere.api.twitter.model.UserMentionEntity[] getUserMentions() {
|
||||||
return userMentions;
|
return userMentions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +59,7 @@ public class EntitiesImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EntitiesImpl{" +
|
return "Entities{" +
|
||||||
"hashtags=" + Arrays.toString(hashtags) +
|
"hashtags=" + Arrays.toString(hashtags) +
|
||||||
", userMentions=" + Arrays.toString(userMentions) +
|
", userMentions=" + Arrays.toString(userMentions) +
|
||||||
", urls=" + Arrays.toString(urls) +
|
", urls=" + Arrays.toString(urls) +
|
|
@ -19,18 +19,29 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ErrorInfoImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/5/7.
|
* Created by mariotaku on 15/5/7.
|
||||||
*/
|
*/
|
||||||
@Implementation(ErrorInfoImpl.class)
|
@JsonObject
|
||||||
public interface ErrorInfo {
|
public class ErrorInfo {
|
||||||
|
|
||||||
int getCode();
|
@JsonField(name = "code")
|
||||||
|
int code;
|
||||||
|
@JsonField(name = "message")
|
||||||
|
String message;
|
||||||
|
|
||||||
String getMessage();
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
String getRequest();
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRequest() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,33 +19,65 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.EnumClass;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ExtendedProfileImpl;
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.ExtendedProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/7/8.
|
* Created by mariotaku on 15/7/8.
|
||||||
*/
|
*/
|
||||||
@Implementation(ExtendedProfileImpl.class)
|
@JsonObject
|
||||||
public interface ExtendedProfile {
|
public class ExtendedProfile {
|
||||||
|
|
||||||
long getId();
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
@JsonField(name = "birthdate")
|
||||||
|
Birthdate birthdate;
|
||||||
|
|
||||||
Birthdate getBirthdate();
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
interface Birthdate {
|
public Birthdate getBirthdate() {
|
||||||
int getDay();
|
return birthdate;
|
||||||
|
}
|
||||||
|
|
||||||
int getMonth();
|
@JsonObject
|
||||||
|
public static class Birthdate {
|
||||||
|
|
||||||
int getYear();
|
@JsonField(name = "day")
|
||||||
|
int day;
|
||||||
|
@JsonField(name = "month")
|
||||||
|
int month;
|
||||||
|
@JsonField(name = "year")
|
||||||
|
int year;
|
||||||
|
@JsonField(name = "visibility")
|
||||||
|
Visibility visibility;
|
||||||
|
@JsonField(name = "year_visibility")
|
||||||
|
Visibility yearVisibility;
|
||||||
|
|
||||||
Visibility getVisibility();
|
public int getDay() {
|
||||||
|
return day;
|
||||||
|
}
|
||||||
|
|
||||||
Visibility getYearVisibility();
|
public int getMonth() {
|
||||||
|
return month;
|
||||||
|
}
|
||||||
|
|
||||||
@EnumClass
|
public int getYear() {
|
||||||
enum Visibility {
|
return year;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Visibility getVisibility() {
|
||||||
|
return visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Visibility getYearVisibility() {
|
||||||
|
return yearVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Visibility {
|
||||||
MUTUALFOLLOW, PUBLIC, UNKNOWN;
|
MUTUALFOLLOW, PUBLIC, UNKNOWN;
|
||||||
|
|
||||||
public static Visibility parse(String s) {
|
public static Visibility parse(String s) {
|
||||||
|
@ -55,5 +87,4 @@ public interface ExtendedProfile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,18 +19,24 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
/**
|
public class Friendship {
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
public long getId() {
|
||||||
* @since Twitter4J 2.1.9
|
throw new UnsupportedOperationException();
|
||||||
*/
|
}
|
||||||
public interface Friendship {
|
|
||||||
long getId();
|
|
||||||
|
|
||||||
String getName();
|
public String getName() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getScreenName();
|
public String getScreenName() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isFollowedBy();
|
public boolean isFollowedBy() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isFollowing();
|
public boolean isFollowing() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Mapper;
|
|
||||||
import org.mariotaku.restfu.http.ValueMap;
|
import org.mariotaku.restfu.http.ValueMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
@ -2,7 +2,7 @@
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -19,35 +19,29 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.HashtagEntityImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing one single Hashtag entity.
|
* Created by mariotaku on 15/3/31.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.1.9
|
|
||||||
*/
|
*/
|
||||||
@Implementation(HashtagEntityImpl.class)
|
@JsonObject
|
||||||
public interface HashtagEntity {
|
public class HashtagEntity {
|
||||||
/**
|
|
||||||
* Returns the index of the end character of the hashtag.
|
|
||||||
*
|
|
||||||
* @return the index of the end character of the hashtag
|
|
||||||
*/
|
|
||||||
int getEnd();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "text")
|
||||||
* Returns the index of the start character of the hashtag.
|
String text;
|
||||||
*
|
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
||||||
* @return the index of the start character of the hashtag
|
Indices indices;
|
||||||
*/
|
|
||||||
int getStart();
|
|
||||||
|
|
||||||
/**
|
public int getEnd() {
|
||||||
* Returns the text of the hashtag without #.
|
return indices.getEnd();
|
||||||
*
|
}
|
||||||
* @return the text of the hashtag
|
|
||||||
*/
|
public int getStart() {
|
||||||
String getText();
|
return indices.getStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.JsonMapper;
|
import com.bluelinelabs.logansquare.JsonMapper;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonToken;
|
import com.fasterxml.jackson.core.JsonToken;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.IDs;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -33,14 +31,12 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/10/21.
|
* Created by mariotaku on 15/10/21.
|
||||||
*/
|
*/
|
||||||
public class IDsImplMapper extends JsonMapper<IDsImpl> {
|
public class IDs$$JsonObjectMapper extends JsonMapper<IDs> {
|
||||||
|
|
||||||
public static final IDsImplMapper INSTANCE = new IDsImplMapper();
|
|
||||||
|
|
||||||
@SuppressWarnings("TryWithIdenticalCatches")
|
@SuppressWarnings("TryWithIdenticalCatches")
|
||||||
@Override
|
@Override
|
||||||
public IDsImpl parse(JsonParser jsonParser) throws IOException {
|
public IDs parse(JsonParser jsonParser) throws IOException {
|
||||||
IDsImpl instance = new IDsImpl();
|
IDs instance = new IDs();
|
||||||
if (jsonParser.getCurrentToken() == null) {
|
if (jsonParser.getCurrentToken() == null) {
|
||||||
jsonParser.nextToken();
|
jsonParser.nextToken();
|
||||||
}
|
}
|
||||||
|
@ -61,11 +57,11 @@ public class IDsImplMapper extends JsonMapper<IDsImpl> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(IDsImpl activity, JsonGenerator jsonGenerator, boolean writeStartAndEnd) {
|
public void serialize(IDs activity, JsonGenerator jsonGenerator, boolean writeStartAndEnd) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseField(IDsImpl instance, String fieldName, JsonParser jsonParser) throws IOException {
|
public void parseField(IDs instance, String fieldName, JsonParser jsonParser) throws IOException {
|
||||||
if ("ids".equals(fieldName)) {
|
if ("ids".equals(fieldName)) {
|
||||||
parseIDsArray(instance, jsonParser);
|
parseIDsArray(instance, jsonParser);
|
||||||
} else if ("previous_cursor".equals(fieldName)) {
|
} else if ("previous_cursor".equals(fieldName)) {
|
||||||
|
@ -75,7 +71,7 @@ public class IDsImplMapper extends JsonMapper<IDsImpl> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseIDsArray(IDsImpl instance, JsonParser jsonParser) throws IOException {
|
private void parseIDsArray(IDs instance, JsonParser jsonParser) throws IOException {
|
||||||
List<Long> collection1 = new ArrayList<>();
|
List<Long> collection1 = new ArrayList<>();
|
||||||
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
|
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
|
||||||
collection1.add(jsonParser.getValueAsLong());
|
collection1.add(jsonParser.getValueAsLong());
|
|
@ -19,17 +19,37 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.IDsImpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing array of numeric IDs.
|
* Created by mariotaku on 15/5/10.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
*/
|
*/
|
||||||
@Implementation(IDsImpl.class)
|
public class IDs extends TwitterResponseObject implements TwitterResponse, CursorSupport {
|
||||||
public interface IDs extends TwitterResponse, CursorSupport {
|
|
||||||
|
|
||||||
long[] getIDs();
|
long previousCursor;
|
||||||
|
long nextCursor;
|
||||||
|
long[] ids;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getNextCursor() {
|
||||||
|
return nextCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getPreviousCursor() {
|
||||||
|
return previousCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return nextCursor != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return previousCursor != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long[] getIDs() {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/3/31.
|
* Created by mariotaku on 15/3/31.
|
|
@ -17,13 +17,15 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.typeconverters.TypeConverter;
|
import com.bluelinelabs.logansquare.typeconverters.TypeConverter;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonToken;
|
import com.fasterxml.jackson.core.JsonToken;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.Indices;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -19,17 +19,39 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.LanguageImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/5/10.
|
* Created by mariotaku on 15/5/10.
|
||||||
*/
|
*/
|
||||||
@Implementation(LanguageImpl.class)
|
@JsonObject
|
||||||
public interface Language {
|
public class Language {
|
||||||
String getCode();
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
@JsonField(name = "code")
|
||||||
|
String code;
|
||||||
|
@JsonField(name = "status")
|
||||||
|
String status;
|
||||||
|
|
||||||
String getName();
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
String getStatus();
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Language{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
", code='" + code + '\'' +
|
||||||
|
", status='" + status + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,32 +19,66 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.LocationImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
* Created by mariotaku on 15/5/10.
|
||||||
*/
|
*/
|
||||||
@Implementation(LocationImpl.class)
|
@JsonObject
|
||||||
public interface Location {
|
public class Location {
|
||||||
String getCountryCode();
|
|
||||||
|
|
||||||
String getCountryName();
|
@JsonField(name = "woeid")
|
||||||
|
int woeid;
|
||||||
|
@JsonField(name = "country")
|
||||||
|
String countryName;
|
||||||
|
@JsonField(name = "countryCode")
|
||||||
|
String countryCode;
|
||||||
|
@JsonField(name = "placeType")
|
||||||
|
PlaceTypeImpl placeType;
|
||||||
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
|
||||||
String getName();
|
public int getWoeid() {
|
||||||
|
return woeid;
|
||||||
|
}
|
||||||
|
|
||||||
String getUrl();
|
public String getCountryName() {
|
||||||
|
return countryName;
|
||||||
|
}
|
||||||
|
|
||||||
int getWoeid();
|
public String getCountryCode() {
|
||||||
|
return countryCode;
|
||||||
|
}
|
||||||
|
|
||||||
PlaceType getPlaceType();
|
public PlaceTypeImpl getPlaceType() {
|
||||||
|
return placeType;
|
||||||
|
}
|
||||||
|
|
||||||
@Implementation(LocationImpl.PlaceTypeImpl.class)
|
public String getName() {
|
||||||
interface PlaceType {
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
int getCode();
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
String getName();
|
@JsonObject
|
||||||
|
public static class PlaceTypeImpl {
|
||||||
|
|
||||||
}
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
@JsonField(name = "code")
|
||||||
|
int code;
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -21,34 +19,116 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.EnumClass;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.MediaEntityImpl;
|
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mariotaku on 15/3/31.
|
||||||
|
*/
|
||||||
|
@JsonObject
|
||||||
|
public class MediaEntity extends UrlEntity {
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
|
||||||
@Implementation(MediaEntityImpl.class)
|
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
||||||
public interface MediaEntity extends UrlEntity {
|
Indices indices;
|
||||||
|
|
||||||
long getId();
|
@JsonField(name = "media_url")
|
||||||
|
String mediaUrl;
|
||||||
|
|
||||||
|
@JsonField(name = "media_url_https")
|
||||||
|
String mediaUrlHttps;
|
||||||
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
@JsonField(name = "display_url")
|
||||||
|
String displayUrl;
|
||||||
|
@JsonField(name = "expanded_url")
|
||||||
|
String expandedUrl;
|
||||||
|
@JsonField(name = "type")
|
||||||
|
Type type;
|
||||||
|
@JsonField(name = "sizes")
|
||||||
|
HashMap<String, Size> sizes;
|
||||||
|
@JsonField(name = "source_status_id")
|
||||||
|
long sourceStatusId;
|
||||||
|
@JsonField(name = "source_user_id")
|
||||||
|
long sourceUserId;
|
||||||
|
@JsonField(name = "video_info")
|
||||||
|
VideoInfo videoInfo;
|
||||||
|
@JsonField(name = "features")
|
||||||
|
HashMap<String, Feature> features;
|
||||||
|
|
||||||
Map<String, Feature> getFeatures();
|
public Map<String, Feature> getFeatures() {
|
||||||
|
return features;
|
||||||
|
}
|
||||||
|
|
||||||
String getMediaUrl();
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MediaEntity{" +
|
||||||
|
"id=" + id +
|
||||||
|
", indices=" + indices +
|
||||||
|
", mediaUrl='" + mediaUrl + '\'' +
|
||||||
|
", mediaUrlHttps='" + mediaUrlHttps + '\'' +
|
||||||
|
", url='" + url + '\'' +
|
||||||
|
", displayUrl='" + displayUrl + '\'' +
|
||||||
|
", expandedUrl='" + expandedUrl + '\'' +
|
||||||
|
", type=" + type +
|
||||||
|
", sizes=" + sizes +
|
||||||
|
", sourceStatusId=" + sourceStatusId +
|
||||||
|
", sourceUserId=" + sourceUserId +
|
||||||
|
", videoInfo=" + videoInfo +
|
||||||
|
", features=" + features +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMediaUrl() {
|
||||||
|
return mediaUrl;
|
||||||
|
}
|
||||||
|
|
||||||
String getMediaUrlHttps();
|
public VideoInfo getVideoInfo() {
|
||||||
|
return videoInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMediaUrlHttps() {
|
||||||
|
return mediaUrlHttps;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Size> getSizes();
|
public String getExpandedUrl() {
|
||||||
|
return expandedUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayUrl() {
|
||||||
|
return displayUrl;
|
||||||
|
}
|
||||||
|
|
||||||
Type getType();
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
@EnumClass
|
public Type getType() {
|
||||||
enum Type {
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Size> getSizes() {
|
||||||
|
return sizes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnd() {
|
||||||
|
return indices.getEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStart() {
|
||||||
|
return indices.getStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
PHOTO, VIDEO, ANIMATED_GIF, UNKNOWN;
|
PHOTO, VIDEO, ANIMATED_GIF, UNKNOWN;
|
||||||
|
|
||||||
public static Type parse(String typeString) {
|
public static Type parse(String typeString) {
|
||||||
|
@ -63,61 +143,158 @@ public interface MediaEntity extends UrlEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoInfo getVideoInfo();
|
|
||||||
|
|
||||||
@Implementation(MediaEntityImpl.VideoInfoImpl.class)
|
@JsonObject
|
||||||
interface VideoInfo {
|
public static class Feature {
|
||||||
|
@JsonField(name = "faces")
|
||||||
|
Face[] faces;
|
||||||
|
|
||||||
Variant[] getVariants();
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Feature{" +
|
||||||
|
"faces=" + Arrays.toString(faces) +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
long[] getAspectRatio();
|
@JsonObject
|
||||||
|
public static class Face {
|
||||||
|
@JsonField(name = "x")
|
||||||
|
int x;
|
||||||
|
@JsonField(name = "y")
|
||||||
|
int y;
|
||||||
|
@JsonField(name = "h")
|
||||||
|
int height;
|
||||||
|
@JsonField(name = "w")
|
||||||
|
int width;
|
||||||
|
|
||||||
long getDuration();
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
@Implementation(MediaEntityImpl.VideoInfoImpl.VariantImpl.class)
|
public int getY() {
|
||||||
interface Variant {
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
String getContentType();
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Face{" +
|
||||||
|
"x=" + x +
|
||||||
|
", y=" + y +
|
||||||
|
", height=" + height +
|
||||||
|
", width=" + width +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
String getUrl();
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
long getBitrate();
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Implementation(MediaEntityImpl.SizeImpl.class)
|
@JsonObject
|
||||||
interface Size {
|
public static class VideoInfo {
|
||||||
String THUMB = "thumb";
|
|
||||||
String SMALL = "small";
|
|
||||||
String MEDIUM = "medium";
|
|
||||||
String LARGE = "large";
|
|
||||||
int FIT = 100;
|
|
||||||
int CROP = 101;
|
|
||||||
|
|
||||||
int getHeight();
|
@JsonField(name = "duration")
|
||||||
|
long duration;
|
||||||
|
@JsonField(name = "variants")
|
||||||
|
Variant[] variants;
|
||||||
|
@JsonField(name = "aspect_ratio")
|
||||||
|
long[] aspectRatio;
|
||||||
|
|
||||||
String getResize();
|
public Variant[] getVariants() {
|
||||||
|
return variants;
|
||||||
|
}
|
||||||
|
|
||||||
int getWidth();
|
public long[] getAspectRatio() {
|
||||||
|
return aspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VideoInfo{" +
|
||||||
|
"duration=" + duration +
|
||||||
|
", variants=" + Arrays.toString(variants) +
|
||||||
|
", aspectRatio=" + Arrays.toString(aspectRatio) +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Variant {
|
||||||
|
@JsonField(name = "bitrate")
|
||||||
|
long bitrate;
|
||||||
|
@JsonField(name = "content_type")
|
||||||
|
String contentType;
|
||||||
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Variant{" +
|
||||||
|
"bitrate=" + bitrate +
|
||||||
|
", contentType='" + contentType + '\'' +
|
||||||
|
", url='" + url + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContentType() {
|
||||||
|
return contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBitrate() {
|
||||||
|
return bitrate;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/3/31.
|
|
||||||
*/
|
|
||||||
@Implementation(MediaEntityImpl.FeatureImpl.class)
|
|
||||||
interface Feature {
|
|
||||||
|
|
||||||
@Implementation(MediaEntityImpl.FeatureImpl.FaceImpl.class)
|
@JsonObject
|
||||||
interface Face {
|
public static class Size {
|
||||||
|
|
||||||
int getX();
|
public static final String THUMB = "thumb";
|
||||||
|
public static final String SMALL = "small";
|
||||||
|
public static final String MEDIUM = "medium";
|
||||||
|
public static final String LARGE = "large";
|
||||||
|
public static final int FIT = 100;
|
||||||
|
public static final int CROP = 101;
|
||||||
|
@JsonField(name = "w")
|
||||||
|
int width;
|
||||||
|
@JsonField(name = "h")
|
||||||
|
int height;
|
||||||
|
@JsonField(name = "resize")
|
||||||
|
String resize;
|
||||||
|
|
||||||
int getY();
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Size{" +
|
||||||
|
"width=" + width +
|
||||||
|
", height=" + height +
|
||||||
|
", resize='" + resize + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
int getHeight();
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
int getWidth();
|
public String getResize() {
|
||||||
|
return resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,25 +19,55 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.MediaUploadResponseImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
@Implementation(MediaUploadResponseImpl.class)
|
/**
|
||||||
public interface MediaUploadResponse extends TwitterResponse {
|
* Created by mariotaku on 15/5/7.
|
||||||
|
*/
|
||||||
|
@JsonObject
|
||||||
|
public class MediaUploadResponse extends TwitterResponseObject implements TwitterResponse {
|
||||||
|
|
||||||
long getId();
|
public long getId() {
|
||||||
|
return mediaId;
|
||||||
|
}
|
||||||
|
|
||||||
Image getImage();
|
public Image getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
long getSize();
|
public long getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
@Implementation(MediaUploadResponseImpl.ImageImpl.class)
|
@JsonField(name = "media_id")
|
||||||
interface Image {
|
long mediaId;
|
||||||
|
@JsonField(name = "size")
|
||||||
|
long size;
|
||||||
|
@JsonField(name = "image")
|
||||||
|
Image image;
|
||||||
|
|
||||||
int getHeight();
|
|
||||||
|
|
||||||
String getImageType();
|
@JsonObject
|
||||||
|
public static class Image {
|
||||||
|
|
||||||
int getWidth();
|
@JsonField(name = "width")
|
||||||
|
int width;
|
||||||
|
@JsonField(name = "height")
|
||||||
|
int height;
|
||||||
|
@JsonField(name = "image_type")
|
||||||
|
String imageType;
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageType() {
|
||||||
|
return imageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,56 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.ParameterizedImplementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.TypeImplementation;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.PagableStatusListImpl;
|
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.PagableUserListImpl;
|
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.PagableUserListListImpl;
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResponseList with cursor support.
|
* Created by mariotaku on 15/5/7.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
*/
|
*/
|
||||||
@ParameterizedImplementation({
|
@JsonObject
|
||||||
@TypeImplementation(parameter = Status.class, implementation = PagableStatusListImpl.class),
|
public class PageableResponseList<T> extends ArrayList<T> implements TwitterResponse, CursorSupport {
|
||||||
@TypeImplementation(parameter = User.class, implementation = PagableUserListImpl.class),
|
|
||||||
@TypeImplementation(parameter = UserList.class, implementation = PagableUserListListImpl.class)
|
|
||||||
})
|
|
||||||
public interface PageableResponseList<T> extends ResponseList<T>, CursorSupport {
|
|
||||||
|
|
||||||
|
private int accessLevel;
|
||||||
|
private RateLimitStatus rateLimitStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void processResponseHeader(RestHttpResponse resp) {
|
||||||
|
rateLimitStatus = RateLimitStatus.createFromResponseHeader(resp);
|
||||||
|
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int getAccessLevel() {
|
||||||
|
return accessLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final RateLimitStatus getRateLimitStatus() {
|
||||||
|
return rateLimitStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getNextCursor() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getPreviousCursor() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return getNextCursor() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return getPreviousCursor() != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,38 +19,75 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import android.support.annotation.NonNull;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.PlaceImpl;
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
* Created by mariotaku on 15/5/7.
|
||||||
* @since Twitter4J 2.1.1
|
|
||||||
*/
|
*/
|
||||||
@Implementation(PlaceImpl.class)
|
@JsonObject
|
||||||
public interface Place extends TwitterResponse, Comparable<Place> {
|
public class Place extends TwitterResponseObject implements TwitterResponse, Comparable<Place> {
|
||||||
GeoLocation[][] getBoundingBoxCoordinates();
|
|
||||||
|
|
||||||
String getBoundingBoxType();
|
@JsonField(name = "full_name")
|
||||||
|
String fullName;
|
||||||
|
|
||||||
Place[] getContainedWithIn();
|
public GeoLocation[][] getBoundingBoxCoordinates() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getCountry();
|
public String getBoundingBoxType() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getCountryCode();
|
public Place[] getContainedWithIn() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getFullName();
|
public String getCountry() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
GeoLocation[][] getGeometryCoordinates();
|
public String getCountryCode() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getGeometryType();
|
public String getFullName() {
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
String getId();
|
public GeoLocation[][] getGeometryCoordinates() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getName();
|
public String getGeometryType() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getPlaceType();
|
public String getId() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String getStreetAddress();
|
public String getName() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlaceType() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreetAddress() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NonNull Place another) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
String getUrl();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,77 +19,224 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.EnumClass;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.Entities;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.EntitySupport;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.HashtagEntity;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.MediaEntity;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.User;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.UserMentionEntity;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/7/5.
|
* Created by mariotaku on 15/7/5.
|
||||||
*/
|
*/
|
||||||
public interface PrivateDirectMessages {
|
@JsonObject
|
||||||
|
public class PrivateDirectMessages {
|
||||||
|
|
||||||
UserEvents getUserEvents();
|
@JsonField(name = "user_inbox")
|
||||||
|
UserInbox userInbox;
|
||||||
|
@JsonField(name = "user_events")
|
||||||
|
UserEvents userEvents;
|
||||||
|
|
||||||
interface UserInbox {
|
public UserInbox getUserInbox() {
|
||||||
|
return userInbox;
|
||||||
User getUser(long userId);
|
|
||||||
|
|
||||||
Conversation getConversation(String conversationId);
|
|
||||||
|
|
||||||
Message[] getEntries();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UserEvents {
|
public UserEvents getUserEvents() {
|
||||||
String getCursor();
|
return userEvents;
|
||||||
|
|
||||||
long getLastSeenEventId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInbox getUserInbox();
|
public enum Status {
|
||||||
|
|
||||||
interface Message {
|
|
||||||
interface Data extends EntitySupport {
|
|
||||||
|
|
||||||
String getText();
|
|
||||||
|
|
||||||
String getConversationId();
|
|
||||||
|
|
||||||
long getId();
|
|
||||||
|
|
||||||
long getRecipientId();
|
|
||||||
|
|
||||||
long getSenderId();
|
|
||||||
|
|
||||||
long getTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Conversation {
|
|
||||||
Participant[] getParticipants();
|
|
||||||
|
|
||||||
String getConversationId();
|
|
||||||
|
|
||||||
long getLastReadEventId();
|
|
||||||
|
|
||||||
long getMaxEntryId();
|
|
||||||
|
|
||||||
long getMinEntryId();
|
|
||||||
|
|
||||||
boolean isNotificationsDisabled();
|
|
||||||
|
|
||||||
|
|
||||||
interface Participant {
|
|
||||||
|
|
||||||
long getUserId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EnumClass
|
|
||||||
enum Type {
|
|
||||||
ONE_TO_ONE, GROUP_DM
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EnumClass
|
|
||||||
enum Status {
|
|
||||||
HAS_MORE, AT_END
|
HAS_MORE, AT_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class UserInbox {
|
||||||
|
|
||||||
|
@JsonField(name = "users")
|
||||||
|
Map<String, User> users;
|
||||||
|
|
||||||
|
@JsonField(name = "conversations")
|
||||||
|
Map<String, Conversation> conversations;
|
||||||
|
|
||||||
|
@JsonField(name = "entries")
|
||||||
|
Message[] entries;
|
||||||
|
|
||||||
|
public User getUser(long userId) {
|
||||||
|
return users.get(String.valueOf(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Conversation getConversation(String conversationId) {
|
||||||
|
return conversations.get(conversationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message[] getEntries() {
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class UserEvents {
|
||||||
|
@JsonField(name = "cursor")
|
||||||
|
String cursor;
|
||||||
|
@JsonField(name = "last_seen_event_id")
|
||||||
|
long lastSeenEventId;
|
||||||
|
|
||||||
|
public String getCursor() {
|
||||||
|
return cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastSeenEventId() {
|
||||||
|
return lastSeenEventId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Message {
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Data implements EntitySupport {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonField(name = "entities")
|
||||||
|
Entities entities;
|
||||||
|
|
||||||
|
@JsonField(name = "sender_id")
|
||||||
|
long senderId;
|
||||||
|
@JsonField(name = "recipient_id")
|
||||||
|
long recipientId;
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
@JsonField(name = "conversation_id")
|
||||||
|
String conversationId;
|
||||||
|
@JsonField(name = "text")
|
||||||
|
String text;
|
||||||
|
@JsonField(name = "time")
|
||||||
|
long time;
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConversationId() {
|
||||||
|
return conversationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRecipientId() {
|
||||||
|
return recipientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSenderId() {
|
||||||
|
return senderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashtagEntity[] getHashtagEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getHashtags();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UrlEntity[] getUrlEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getUrls();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MediaEntity[] getMediaEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getMedia();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserMentionEntity[] getUserMentionEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getUserMentions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Conversation {
|
||||||
|
|
||||||
|
@JsonField(name = "conversation_id")
|
||||||
|
String conversationId;
|
||||||
|
@JsonField(name = "last_read_event_id")
|
||||||
|
long lastReadEventId;
|
||||||
|
@JsonField(name = "max_entry_id")
|
||||||
|
long maxEntryId;
|
||||||
|
@JsonField(name = "min_entry_id")
|
||||||
|
long minEntryId;
|
||||||
|
@JsonField(name = "notifications_disabled")
|
||||||
|
boolean notificationsDisabled;
|
||||||
|
@JsonField(name = "participants")
|
||||||
|
Participant[] participants;
|
||||||
|
@JsonField(name = "read_only")
|
||||||
|
boolean readOnly;
|
||||||
|
@JsonField(name = "sort_event_id")
|
||||||
|
long sortEventId;
|
||||||
|
@JsonField(name = "sort_timestamp")
|
||||||
|
long sortTimestamp;
|
||||||
|
@JsonField(name = "status")
|
||||||
|
Status status;
|
||||||
|
@JsonField(name = "type")
|
||||||
|
Type type;
|
||||||
|
|
||||||
|
public Participant[] getParticipants() {
|
||||||
|
return participants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConversationId() {
|
||||||
|
return conversationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastReadEventId() {
|
||||||
|
return lastReadEventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMaxEntryId() {
|
||||||
|
return maxEntryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMinEntryId() {
|
||||||
|
return minEntryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNotificationsDisabled() {
|
||||||
|
return notificationsDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
ONE_TO_ONE, GROUP_DM
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Participant {
|
||||||
|
|
||||||
|
@JsonField(name = "user_id")
|
||||||
|
long userId;
|
||||||
|
|
||||||
|
public long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,5 @@ package org.mariotaku.twidere.api.twitter.model;
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/10/21.
|
* Created by mariotaku on 15/10/21.
|
||||||
*/
|
*/
|
||||||
public interface PrivateSearchResult {
|
public class PrivateSearchResult {
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,25 +19,119 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.QueryResultImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
||||||
|
|
||||||
|
import java.util.AbstractList;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing search API response
|
* Created by mariotaku on 15/5/7.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
*/
|
*/
|
||||||
@Implementation(QueryResultImpl.class)
|
@JsonObject
|
||||||
public interface QueryResult extends ResponseList<Status>, CursorSupport {
|
public class QueryResult extends AbstractList<Status> implements TwitterResponse, CursorSupport {
|
||||||
double getCompletedIn();
|
|
||||||
|
|
||||||
long getMaxId();
|
@JsonField(name = "previous_cursor")
|
||||||
|
long previousCursor;
|
||||||
|
@JsonField(name = "next_cursor")
|
||||||
|
long nextCursor;
|
||||||
|
|
||||||
String getQuery();
|
@JsonField(name = "search_metadata")
|
||||||
|
SearchMetadata metadata;
|
||||||
|
|
||||||
int getResultsPerPage();
|
@JsonField(name = "statuses")
|
||||||
|
ArrayList<Status> statuses;
|
||||||
|
|
||||||
long getSinceId();
|
private int accessLevel;
|
||||||
|
private RateLimitStatus rateLimitStatus;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void processResponseHeader(RestHttpResponse resp) {
|
||||||
|
rateLimitStatus = RateLimitStatus.createFromResponseHeader(resp);
|
||||||
|
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int getAccessLevel() {
|
||||||
|
return accessLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final RateLimitStatus getRateLimitStatus() {
|
||||||
|
return rateLimitStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Status get(int index) {
|
||||||
|
return statuses.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return statuses.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getCompletedIn() {
|
||||||
|
return metadata.completedIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMaxId() {
|
||||||
|
return metadata.maxId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuery() {
|
||||||
|
return metadata.query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResultsPerPage() {
|
||||||
|
return metadata.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getNextCursor() {
|
||||||
|
return nextCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return nextCursor != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return previousCursor != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getPreviousCursor() {
|
||||||
|
return previousCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSinceId() {
|
||||||
|
return metadata.sinceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWarning() {
|
||||||
|
return metadata.warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class SearchMetadata {
|
||||||
|
@JsonField(name = "max_id")
|
||||||
|
long maxId;
|
||||||
|
@JsonField(name = "since_id")
|
||||||
|
long sinceId;
|
||||||
|
@JsonField(name = "count")
|
||||||
|
int count;
|
||||||
|
@JsonField(name = "completed_in")
|
||||||
|
double completedIn;
|
||||||
|
@JsonField(name = "query")
|
||||||
|
String query;
|
||||||
|
@JsonField(name = "warning")
|
||||||
|
String warning;
|
||||||
|
}
|
||||||
|
|
||||||
String getWarning();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,46 +19,161 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing Twitter REST API's rate limit status
|
* A data class representing Twitter REST API's rate limit status
|
||||||
*
|
*
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
* @author Yusuke Yamamoto - yusuke at mac.com
|
||||||
* @see <a href="https://dev.twitter.com/docs/rate-limiting">Rate Limiting |
|
* @see <a href="https://dev.twitter.com/docs/rate-limiting">Rate Limiting |
|
||||||
* Twitter Developers</a>
|
* Twitter Developers</a>
|
||||||
*/
|
*/
|
||||||
public interface RateLimitStatus {
|
@JsonObject
|
||||||
|
public final class RateLimitStatus {
|
||||||
|
|
||||||
int getLimit();
|
private final long creationTimeInMillis;
|
||||||
|
|
||||||
int getRemaining();
|
@JsonField(name = "remaining")
|
||||||
|
int remaining;
|
||||||
|
@JsonField(name = "limit")
|
||||||
|
int limit;
|
||||||
|
@JsonField(name = "reset")
|
||||||
|
int resetTimeInSeconds;
|
||||||
|
|
||||||
/**
|
private RateLimitStatus(final int limit, final int remaining, final int resetTimeInSeconds) {
|
||||||
* Returns the remaining number of API requests available.<br>
|
this();
|
||||||
* This value is identical to the "X-RateLimit-Remaining" response
|
this.limit = limit;
|
||||||
* header.
|
this.remaining = remaining;
|
||||||
*
|
this.resetTimeInSeconds = resetTimeInSeconds;
|
||||||
* @return the remaining number of API requests available
|
}
|
||||||
*/
|
|
||||||
int getRemainingHits();
|
|
||||||
|
|
||||||
/**
|
public RateLimitStatus() {
|
||||||
* Returns the seconds the current rate limiting period ends.<br>
|
creationTimeInMillis = System.currentTimeMillis();
|
||||||
* This should be a same as getResetTime().getTime()/1000.
|
}
|
||||||
*
|
|
||||||
* @return the seconds the current rate limiting period ends
|
|
||||||
* @since Twitter4J 2.0.9
|
|
||||||
*/
|
|
||||||
int getResetTimeInSeconds();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of seconds until the current rate limiting period
|
* {@inheritDoc}
|
||||||
* ends.<br>
|
*/
|
||||||
* This is a value provided/calculated only by Twitter4J for handiness and
|
public int getLimit() {
|
||||||
* not a part of the twitter API spec.
|
return limit;
|
||||||
*
|
}
|
||||||
* @return the amount of seconds until next rate limiting period
|
|
||||||
* @since Twitter4J 2.1.0
|
|
||||||
*/
|
|
||||||
int getSecondsUntilReset();
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public int getRemaining() {
|
||||||
|
return remaining;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public int getRemainingHits() {
|
||||||
|
return getRemaining();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public int getResetTimeInSeconds() {
|
||||||
|
return resetTimeInSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public int getSecondsUntilReset() {
|
||||||
|
return (int) ((resetTimeInSeconds * 1000L - creationTimeInMillis) / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
RateLimitStatus that = (RateLimitStatus) o;
|
||||||
|
|
||||||
|
if (creationTimeInMillis != that.creationTimeInMillis) return false;
|
||||||
|
if (remaining != that.remaining) return false;
|
||||||
|
if (limit != that.limit) return false;
|
||||||
|
return resetTimeInSeconds == that.resetTimeInSeconds;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = (int) (creationTimeInMillis ^ (creationTimeInMillis >>> 32));
|
||||||
|
result = 31 * result + remaining;
|
||||||
|
result = 31 * result + limit;
|
||||||
|
result = 31 * result + resetTimeInSeconds;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RateLimitStatus{" +
|
||||||
|
"creationTimeInMillis=" + creationTimeInMillis +
|
||||||
|
", remaining=" + remaining +
|
||||||
|
", limit=" + limit +
|
||||||
|
", resetTimeInSeconds=" + resetTimeInSeconds +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RateLimitStatus createFromResponseHeader(final RestHttpResponse res) {
|
||||||
|
if (null == res) return null;
|
||||||
|
int remainingHits;// "X-Rate-Limit-Remaining"
|
||||||
|
int limit;// "X-Rate-Limit-Limit"
|
||||||
|
int resetTimeInSeconds;// not included in the response header. Need to
|
||||||
|
// be calculated.
|
||||||
|
|
||||||
|
final String strLimit = res.getHeader("X-Rate-Limit-Limit");
|
||||||
|
if (strLimit != null) {
|
||||||
|
limit = Integer.parseInt(strLimit);
|
||||||
|
} else
|
||||||
|
return null;
|
||||||
|
final String remaining = res.getHeader("X-Rate-Limit-Remaining");
|
||||||
|
if (remaining != null) {
|
||||||
|
remainingHits = Integer.parseInt(remaining);
|
||||||
|
} else
|
||||||
|
return null;
|
||||||
|
final String reset = res.getHeader("X-Rate-Limit-Reset");
|
||||||
|
if (reset != null) {
|
||||||
|
final long longReset = Long.parseLong(reset);
|
||||||
|
resetTimeInSeconds = (int) longReset;
|
||||||
|
} else
|
||||||
|
return null;
|
||||||
|
return new RateLimitStatus(limit, remainingHits, resetTimeInSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static Map<String, RateLimitStatus> createRateLimitStatuses(final HttpResponse res, final Configuration conf)
|
||||||
|
// throws TwitterException {
|
||||||
|
// final JSONObject json = res.asJSONObject();
|
||||||
|
// final Map<String, RateLimitStatus> map = createRateLimitStatuses(json);
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static Map<String, RateLimitStatus> createRateLimitStatuses(final InputStream stream) throws TwitterException {
|
||||||
|
// final Map<String, RateLimitStatus> map = new HashMap<String, RateLimitStatus>();
|
||||||
|
// try {
|
||||||
|
// final JSONObject resources = json.getJSONObject("resources");
|
||||||
|
// final Iterator<?> resourceKeys = resources.keys();
|
||||||
|
// while (resourceKeys.hasNext()) {
|
||||||
|
// final JSONObject resource = resources.getJSONObject((String) resourceKeys.next());
|
||||||
|
// final Iterator<?> endpointKeys = resource.keys();
|
||||||
|
// while (endpointKeys.hasNext()) {
|
||||||
|
// final String endpoint = (String) endpointKeys.next();
|
||||||
|
// final JSONObject rateLimitStatusJSON = resource.getJSONObject(endpoint);
|
||||||
|
// final RateLimitStatus rateLimitStatus = new RateLimitStatus(rateLimitStatusJSON);
|
||||||
|
// map.put(endpoint, rateLimitStatus);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return Collections.unmodifiableMap(map);
|
||||||
|
// } catch (final JSONException jsone) {
|
||||||
|
// throw new TwitterException(jsone);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
|
@ -19,99 +19,143 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.RelationshipImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
@Implementation(RelationshipImpl.class)
|
/**
|
||||||
public interface Relationship extends TwitterResponse {
|
* Created by mariotaku on 15/5/7.
|
||||||
boolean canSourceDMTarget();
|
*/
|
||||||
|
@JsonObject
|
||||||
|
public class Relationship extends TwitterResponseObject implements TwitterResponse {
|
||||||
|
|
||||||
boolean canSourceMediaTagTarget();
|
@JsonField(name = "relationship")
|
||||||
|
RelationshipObject object;
|
||||||
|
|
||||||
/**
|
public boolean isSourceBlockingTarget() {
|
||||||
* Returns the source user id
|
return object.source.blocking;
|
||||||
*
|
}
|
||||||
* @return the source user id
|
|
||||||
*/
|
|
||||||
long getSourceUserId();
|
|
||||||
|
|
||||||
/**
|
public boolean isTargetFollowingSource() {
|
||||||
* Returns the source user screen name
|
return object.target.following;
|
||||||
*
|
}
|
||||||
* @return returns the source user screen name
|
|
||||||
*/
|
|
||||||
String getSourceUserScreenName();
|
|
||||||
|
|
||||||
/**
|
public boolean isTargetFollowedBySource() {
|
||||||
* Returns the target user id
|
return object.target.followedBy;
|
||||||
*
|
}
|
||||||
* @return target user id
|
|
||||||
*/
|
|
||||||
long getTargetUserId();
|
|
||||||
|
|
||||||
/**
|
public boolean isSourceNotificationsEnabled() {
|
||||||
* Returns the target user screen name
|
return object.source.notificationsEnabled;
|
||||||
*
|
}
|
||||||
* @return the target user screen name
|
|
||||||
*/
|
|
||||||
String getTargetUserScreenName();
|
|
||||||
|
|
||||||
/**
|
public boolean isSourceMutingTarget() {
|
||||||
* Returns if the source user is blocking the target user
|
return object.source.muting;
|
||||||
*
|
}
|
||||||
* @return if the source is blocking the target
|
|
||||||
*/
|
|
||||||
boolean isSourceBlockingTarget();
|
|
||||||
|
|
||||||
boolean isSourceBlockedByTarget();
|
public boolean isSourceMarkedTargetAsSpam() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public boolean isSourceFollowingTarget() {
|
||||||
* Checks if source user is being followed by target user
|
return object.source.following;
|
||||||
*
|
}
|
||||||
* @return true if source user is being followed by target user
|
|
||||||
*/
|
|
||||||
boolean isSourceFollowedByTarget();
|
|
||||||
|
|
||||||
/**
|
public boolean isSourceFollowedByTarget() {
|
||||||
* Checks if source user is following target user
|
return object.source.followedBy;
|
||||||
*
|
}
|
||||||
* @return true if source user is following target user
|
|
||||||
*/
|
|
||||||
boolean isSourceFollowingTarget();
|
|
||||||
|
|
||||||
boolean isSourceMarkedTargetAsSpam();
|
public boolean isSourceBlockedByTarget() {
|
||||||
|
return object.source.blockedBy;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isSourceMutingTarget();
|
public String getTargetUserScreenName() {
|
||||||
|
return object.target.screenName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public long getTargetUserId() {
|
||||||
* Checks if the source user has enabled notifications for updates of the
|
return object.target.id;
|
||||||
* target user
|
}
|
||||||
*
|
|
||||||
* @return true if source user enabled notifications for target user
|
|
||||||
*/
|
|
||||||
boolean isSourceNotificationsEnabled();
|
|
||||||
|
|
||||||
/**
|
public String getSourceUserScreenName() {
|
||||||
* Checks if target user is being followed by source user.<br>
|
return object.source.screenName;
|
||||||
* This method is equivalent to isSourceFollowingTarget().
|
}
|
||||||
*
|
|
||||||
* @return true if target user is being followed by source user
|
|
||||||
*/
|
|
||||||
boolean isTargetFollowedBySource();
|
|
||||||
|
|
||||||
/**
|
public long getSourceUserId() {
|
||||||
* Checks if target user is following source user.<br>
|
return object.source.id;
|
||||||
* This method is equivalent to isSourceFollowedByTarget().
|
}
|
||||||
*
|
|
||||||
* @return true if target user is following source user
|
|
||||||
*/
|
|
||||||
boolean isTargetFollowingSource();
|
|
||||||
|
|
||||||
boolean isSourceRequestedFollowingTarget();
|
public boolean canSourceMediaTagTarget() {
|
||||||
|
return object.source.canMediaTag;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isTargetRequestedFollowingSource();
|
public boolean canSourceDMTarget() {
|
||||||
|
return object.source.canDm;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isSourceWantRetweetsFromTarget();
|
public boolean isSourceRequestedFollowingTarget() {
|
||||||
|
return object.source.followingRequested;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isSourceNotificationsEnabledForTarget();
|
public boolean isTargetRequestedFollowingSource() {
|
||||||
|
return object.target.followingRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSourceWantRetweetsFromTarget() {
|
||||||
|
return object.source.wantRetweets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSourceNotificationsEnabledForTarget() {
|
||||||
|
return object.source.notificationsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class RelationshipObject {
|
||||||
|
|
||||||
|
@JsonField(name = "source")
|
||||||
|
Source source;
|
||||||
|
@JsonField(name = "target")
|
||||||
|
Target target;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Target {
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
@JsonField(name = "screen_name")
|
||||||
|
public String screenName;
|
||||||
|
@JsonField(name = "following")
|
||||||
|
boolean following;
|
||||||
|
@JsonField(name = "followed_by")
|
||||||
|
boolean followedBy;
|
||||||
|
@JsonField(name = "following_requested")
|
||||||
|
boolean followingRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonObject
|
||||||
|
public static class Source {
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
@JsonField(name = "screen_name")
|
||||||
|
public String screenName;
|
||||||
|
@JsonField(name = "blocked_by")
|
||||||
|
boolean blockedBy;
|
||||||
|
@JsonField(name = "blocking")
|
||||||
|
boolean blocking;
|
||||||
|
@JsonField(name = "muting")
|
||||||
|
boolean muting;
|
||||||
|
@JsonField(name = "following")
|
||||||
|
boolean following;
|
||||||
|
@JsonField(name = "followed_by")
|
||||||
|
boolean followedBy;
|
||||||
|
@JsonField(name = "following_requested")
|
||||||
|
boolean followingRequested;
|
||||||
|
@JsonField(name = "want_retweets")
|
||||||
|
boolean wantRetweets;
|
||||||
|
@JsonField(name = "notifications_enabled")
|
||||||
|
boolean notificationsEnabled;
|
||||||
|
@JsonField(name = "can_dm")
|
||||||
|
boolean canDm;
|
||||||
|
@JsonField(name = "can_media_tag")
|
||||||
|
boolean canMediaTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,53 +19,36 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.ParameterizedImplementation;
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.ParameterizedMapper;
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.TypeImplementation;
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.TypeMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseArrayList;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ScheduledStatusesListImpl;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.ActivityResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.DirectMessageResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.LanguageResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.LocationResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.PlaceResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.SavedSearchResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.StatusResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.TrendsResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.UserListResponseListMapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.mapper.list.UserResponseListMapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of TwitterResponse.
|
* Created by mariotaku on 15/5/7.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
*/
|
*/
|
||||||
@ParameterizedMapper({
|
@JsonObject
|
||||||
@TypeMapper(parameter = Activity.class, mapper = ActivityResponseListMapper.class),
|
public class ResponseList<T> extends ArrayList<T> implements TwitterResponse {
|
||||||
@TypeMapper(parameter = DirectMessage.class, mapper = DirectMessageResponseListMapper.class),
|
|
||||||
@TypeMapper(parameter = Language.class, mapper = LanguageResponseListMapper.class),
|
private int accessLevel;
|
||||||
@TypeMapper(parameter = Location.class, mapper = LocationResponseListMapper.class),
|
private RateLimitStatus rateLimitStatus;
|
||||||
@TypeMapper(parameter = Place.class, mapper = PlaceResponseListMapper.class),
|
|
||||||
@TypeMapper(parameter = SavedSearch.class, mapper = SavedSearchResponseListMapper.class),
|
|
||||||
@TypeMapper(parameter = Status.class, mapper = StatusResponseListMapper.class),
|
|
||||||
@TypeMapper(parameter = Trends.class, mapper = TrendsResponseListMapper.class),
|
|
||||||
@TypeMapper(parameter = UserList.class, mapper = UserListResponseListMapper.class),
|
|
||||||
@TypeMapper(parameter = User.class, mapper = UserResponseListMapper.class),
|
|
||||||
})
|
|
||||||
@ParameterizedImplementation({
|
|
||||||
@TypeImplementation(parameter = ScheduledStatus.class, implementation = ScheduledStatusesListImpl.class)
|
|
||||||
})
|
|
||||||
@Implementation(ResponseArrayList.class)
|
|
||||||
public interface ResponseList<T> extends TwitterResponse, List<T> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
RateLimitStatus getRateLimitStatus();
|
public final void processResponseHeader(RestHttpResponse resp) {
|
||||||
|
rateLimitStatus = RateLimitStatus.createFromResponseHeader(resp);
|
||||||
|
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int getAccessLevel() {
|
||||||
|
return accessLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final RateLimitStatus getRateLimitStatus() {
|
||||||
|
return rateLimitStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,27 +19,59 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import android.support.annotation.NonNull;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.SavedSearchImpl;
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing a Saved Search
|
* Created by mariotaku on 15/5/7.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.0.8
|
|
||||||
*/
|
*/
|
||||||
@Implementation(SavedSearchImpl.class)
|
@JsonObject
|
||||||
public interface SavedSearch extends Comparable<SavedSearch>, TwitterResponse {
|
public class SavedSearch extends TwitterResponseObject implements Comparable<SavedSearch>, TwitterResponse {
|
||||||
Date getCreatedAt();
|
|
||||||
|
|
||||||
long getId();
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
String getName();
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
int getPosition();
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
String getQuery();
|
public int getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuery() {
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
|
||||||
|
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
||||||
|
Date createdAt;
|
||||||
|
|
||||||
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
|
||||||
|
@JsonField(name = "position")
|
||||||
|
int position;
|
||||||
|
|
||||||
|
@JsonField(name = "query")
|
||||||
|
String query;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NonNull SavedSearch another) {
|
||||||
|
return (int) (id - another.id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,38 +19,75 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.EnumClass;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ScheduledStatusImpl;
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/7/6.
|
* Created by mariotaku on 15/7/6.
|
||||||
*/
|
*/
|
||||||
@Implementation(ScheduledStatusImpl.class)
|
@JsonObject
|
||||||
public interface ScheduledStatus {
|
public class ScheduledStatus {
|
||||||
|
|
||||||
long getUserId();
|
@JsonField(name = "updated_at", typeConverter = TwitterDateConverter.class)
|
||||||
|
Date updatedAt;
|
||||||
|
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
||||||
|
Date createdAt;
|
||||||
|
@JsonField(name = "execute_at", typeConverter = TwitterDateConverter.class)
|
||||||
|
Date executeAt;
|
||||||
|
@JsonField(name = "text")
|
||||||
|
String text;
|
||||||
|
@JsonField(name = "media_ids")
|
||||||
|
long[] mediaIds;
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
@JsonField(name = "possiblySensitive")
|
||||||
|
boolean possiblySensitive;
|
||||||
|
@JsonField(name = "user_id")
|
||||||
|
long userId;
|
||||||
|
@JsonField(name = "state")
|
||||||
|
State state;
|
||||||
|
|
||||||
boolean isPossiblySensitive();
|
public long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
long getId();
|
public boolean isPossiblySensitive() {
|
||||||
|
return possiblySensitive;
|
||||||
|
}
|
||||||
|
|
||||||
long[] getMediaIds();
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
Date getUpdatedAt();
|
public long[] getMediaIds() {
|
||||||
|
return mediaIds;
|
||||||
|
}
|
||||||
|
|
||||||
Date getCreatedAt();
|
public Date getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
Date getExecuteAt();
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
String getText();
|
public Date getExecuteAt() {
|
||||||
|
return executeAt;
|
||||||
|
}
|
||||||
|
|
||||||
State getState();
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
@EnumClass
|
public State getState() {
|
||||||
enum State {
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum State {
|
||||||
SCHEDULED("scheduled"), FAILED("failed"), CANCELED("canceled");
|
SCHEDULED("scheduled"), FAILED("failed"), CANCELED("canceled");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
|
@ -17,15 +17,16 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
import org.mariotaku.restfu.http.RestHttpResponse;
|
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
||||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.ScheduledStatus;
|
import org.mariotaku.twidere.api.twitter.model.ScheduledStatus;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.TwitterResponse;
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.TwitterResponseObject;
|
||||||
|
|
||||||
import java.util.AbstractList;
|
import java.util.AbstractList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,12 +35,12 @@ import java.util.List;
|
||||||
* Created by mariotaku on 15/7/9.
|
* Created by mariotaku on 15/7/9.
|
||||||
*/
|
*/
|
||||||
@JsonObject
|
@JsonObject
|
||||||
public class ScheduledStatusesListImpl extends AbstractList<ScheduledStatus> implements ResponseList<ScheduledStatus> {
|
public class ScheduledStatusesList extends AbstractList<ScheduledStatus> implements TwitterResponse {
|
||||||
|
|
||||||
@JsonField(name = "results")
|
@JsonField(name = "results")
|
||||||
List<ScheduledStatus> list;
|
List<ScheduledStatus> list;
|
||||||
|
|
||||||
TwitterResponseImpl response = new TwitterResponseImpl();
|
TwitterResponseObject response = new TwitterResponseObject();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processResponseHeader(RestHttpResponse resp) {
|
public void processResponseHeader(RestHttpResponse resp) {
|
|
@ -19,24 +19,5 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.GeoLocation;
|
public class SimilarPlaces extends ResponseList<Place> {
|
||||||
import org.mariotaku.twidere.api.twitter.model.Place;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.1.7
|
|
||||||
*/
|
|
||||||
public interface SimilarPlaces extends ResponseList<Place>, Serializable {
|
|
||||||
/**
|
|
||||||
* Returns the token needed to be able to create a new place with
|
|
||||||
* {@link org.mariotaku.twidere.api.twitter.api.PlacesGeoResources#createPlace(String, String, String, GeoLocation, String)}
|
|
||||||
* .
|
|
||||||
*
|
|
||||||
* @return token the token needed to be able to create a new place with
|
|
||||||
* {@link org.mariotaku.twidere.api.twitter.api.PlacesGeoResources#createPlace(String, String, String, GeoLocation, String)}
|
|
||||||
*/
|
|
||||||
String getToken();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,6 @@ import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import com.bluelinelabs.logansquare.annotation.OnJsonParseComplete;
|
import com.bluelinelabs.logansquare.annotation.OnJsonParseComplete;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.EntitiesImpl;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.GeoPoint;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.TwitterResponseImpl;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.UserImpl;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -39,7 +35,8 @@ import java.util.Date;
|
||||||
* Created by mariotaku on 15/5/5.
|
* Created by mariotaku on 15/5/5.
|
||||||
*/
|
*/
|
||||||
@JsonObject
|
@JsonObject
|
||||||
public class Status extends TwitterResponseImpl {
|
public class Status extends TwitterResponseObject implements Comparable<Status>, TwitterResponse,
|
||||||
|
ExtendedEntitySupport {
|
||||||
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
||||||
Date createdAt;
|
Date createdAt;
|
||||||
|
@ -57,10 +54,10 @@ public class Status extends TwitterResponseImpl {
|
||||||
boolean truncated;
|
boolean truncated;
|
||||||
|
|
||||||
@JsonField(name = "entities")
|
@JsonField(name = "entities")
|
||||||
EntitiesImpl entities;
|
Entities entities;
|
||||||
|
|
||||||
@JsonField(name = "extended_entities")
|
@JsonField(name = "extended_entities")
|
||||||
EntitiesImpl extendedEntities;
|
Entities extendedEntities;
|
||||||
|
|
||||||
@JsonField(name = "in_reply_to_status_id")
|
@JsonField(name = "in_reply_to_status_id")
|
||||||
long inReplyToStatusId;
|
long inReplyToStatusId;
|
||||||
|
@ -72,7 +69,7 @@ public class Status extends TwitterResponseImpl {
|
||||||
String inReplyToScreenName;
|
String inReplyToScreenName;
|
||||||
|
|
||||||
@JsonField(name = "user")
|
@JsonField(name = "user")
|
||||||
UserImpl user;
|
User user;
|
||||||
|
|
||||||
@JsonField(name = "geo")
|
@JsonField(name = "geo")
|
||||||
GeoPoint geo;
|
GeoPoint geo;
|
||||||
|
@ -116,6 +113,7 @@ public class Status extends TwitterResponseImpl {
|
||||||
|
|
||||||
@JsonField(name = "possibly_sensitive")
|
@JsonField(name = "possibly_sensitive")
|
||||||
boolean possiblySensitive;
|
boolean possiblySensitive;
|
||||||
|
private Status mThat;
|
||||||
|
|
||||||
public static void setQuotedStatus(Status status, Status quoted) {
|
public static void setQuotedStatus(Status status, Status quoted) {
|
||||||
if (!(status instanceof Status)) return;
|
if (!(status instanceof Status)) return;
|
||||||
|
@ -287,6 +285,7 @@ public class Status extends TwitterResponseImpl {
|
||||||
|
|
||||||
|
|
||||||
public int compareTo(@NonNull final Status that) {
|
public int compareTo(@NonNull final Status that) {
|
||||||
|
mThat = that;
|
||||||
final long delta = id - that.getId();
|
final long delta = id - that.getId();
|
||||||
if (delta < Integer.MIN_VALUE)
|
if (delta < Integer.MIN_VALUE)
|
||||||
return Integer.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
|
@ -295,6 +294,7 @@ public class Status extends TwitterResponseImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Status{" +
|
return "Status{" +
|
||||||
"createdAt=" + createdAt +
|
"createdAt=" + createdAt +
|
||||||
|
|
|
@ -19,24 +19,56 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.StatusActivitySummaryImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
@Implementation(StatusActivitySummaryImpl.class)
|
/**
|
||||||
public interface StatusActivitySummary extends TwitterResponse {
|
* Created by mariotaku on 15/5/13.
|
||||||
|
*/
|
||||||
|
@JsonObject
|
||||||
|
public class StatusActivitySummary extends TwitterResponseObject implements TwitterResponse {
|
||||||
|
|
||||||
long getDescendentReplyCount();
|
@JsonField(name = "favoriters")
|
||||||
|
IDs favoriters;
|
||||||
|
@JsonField(name = "repliers")
|
||||||
|
IDs repliers;
|
||||||
|
@JsonField(name = "retweeters")
|
||||||
|
IDs retweeters;
|
||||||
|
|
||||||
IDs getFavoriters();
|
@JsonField(name = "favoriters_count")
|
||||||
|
long favoritersCount;
|
||||||
|
@JsonField(name = "repliers_count")
|
||||||
|
long repliersCount;
|
||||||
|
@JsonField(name = "retweeters_count")
|
||||||
|
long retweetersCount;
|
||||||
|
@JsonField(name = "descendent_reply_count")
|
||||||
|
long descendentReplyCount;
|
||||||
|
|
||||||
long getFavoritersCount();
|
public IDs getFavoriters() {
|
||||||
|
return favoriters;
|
||||||
|
}
|
||||||
|
|
||||||
IDs getRepliers();
|
public IDs getRepliers() {
|
||||||
|
return repliers;
|
||||||
|
}
|
||||||
|
|
||||||
long getRepliersCount();
|
public IDs getRetweeters() {
|
||||||
|
return retweeters;
|
||||||
|
}
|
||||||
|
|
||||||
IDs getRetweeters();
|
public long getFavoritersCount() {
|
||||||
|
return favoritersCount;
|
||||||
|
}
|
||||||
|
|
||||||
long getRetweetersCount();
|
public long getRepliersCount() {
|
||||||
|
return repliersCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRetweetersCount() {
|
||||||
|
return retweetersCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDescendentReplyCount() {
|
||||||
|
return descendentReplyCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.StatusDeletionNoticeImpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/5/26.
|
* Created by mariotaku on 15/5/26.
|
||||||
*/
|
*/
|
||||||
@Implementation(StatusDeletionNoticeImpl.class)
|
@JsonObject
|
||||||
public interface StatusDeletionNotice {
|
public class StatusDeletionNotice {
|
||||||
long getStatusId();
|
public long getStatusId() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,33 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.TimeZoneImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.TimeZone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alessandro Bahgat - ale.bahgat at gmail.com
|
* Created by mariotaku on 15/5/13.
|
||||||
*/
|
*/
|
||||||
@Implementation(TimeZoneImpl.class)
|
@JsonObject
|
||||||
public interface TimeZone {
|
public class TimeZone {
|
||||||
String getName();
|
|
||||||
|
|
||||||
String getTzInfoName();
|
@JsonField(name = "utc_offset")
|
||||||
|
int utcOffset;
|
||||||
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
@JsonField(name = "tzinfo_name")
|
||||||
|
String tzInfoName;
|
||||||
|
|
||||||
int getUtcOffset();
|
public int getUtcOffset() {
|
||||||
|
return utcOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTzInfoName() {
|
||||||
|
return tzInfoName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,20 +19,43 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.TranslationResultImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
@Implementation(TranslationResultImpl.class)
|
/**
|
||||||
public interface TranslationResult extends TwitterResponse {
|
* Created by mariotaku on 15/5/7.
|
||||||
|
*/
|
||||||
|
@JsonObject
|
||||||
|
public class TranslationResult extends TwitterResponseObject implements TwitterResponse {
|
||||||
|
|
||||||
public long getId();
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
@JsonField(name = "lang")
|
||||||
|
String lang;
|
||||||
|
@JsonField(name = "translated_lang")
|
||||||
|
String translatedLang;
|
||||||
|
@JsonField(name = "translation_type")
|
||||||
|
String translationType;
|
||||||
|
@JsonField(name = "text")
|
||||||
|
String text;
|
||||||
|
|
||||||
public String getLang();
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public String getText();
|
public String getLang() {
|
||||||
|
return lang;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTranslatedLang();
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTranslationType();
|
public String getTranslatedLang() {
|
||||||
|
return translatedLang;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTranslationType() {
|
||||||
|
return translationType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,40 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.TrendImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing Trend.
|
* Created by mariotaku on 15/5/10.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.0.2
|
|
||||||
*/
|
*/
|
||||||
@Implementation(TrendImpl.class)
|
@JsonObject
|
||||||
public interface Trend {
|
public class Trend {
|
||||||
|
|
||||||
String getName();
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
@JsonField(name = "query")
|
||||||
|
String query;
|
||||||
|
|
||||||
String getQuery();
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
String getUrl();
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuery() {
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Trend{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
", url='" + url + '\'' +
|
||||||
|
", query='" + query + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,26 +19,48 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import android.support.annotation.NonNull;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.TrendsImpl;
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.TwitterTrendsDateConverter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data class representing Trends.
|
* Created by mariotaku on 15/5/10.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.0.2
|
|
||||||
*/
|
*/
|
||||||
@Implementation(TrendsImpl.class)
|
@JsonObject
|
||||||
public interface Trends extends TwitterResponse, Comparable<Trends>, Serializable {
|
public class Trends extends TwitterResponseObject implements TwitterResponse, Comparable<Trends> {
|
||||||
Date getAsOf();
|
|
||||||
|
|
||||||
Date getCreatedAt();
|
@JsonField(name = "as_of", typeConverter = TwitterTrendsDateConverter.class)
|
||||||
|
Date asOf;
|
||||||
|
@JsonField(name = "created_at", typeConverter = TwitterTrendsDateConverter.class)
|
||||||
|
Date createdAt;
|
||||||
|
@JsonField(name = "trends")
|
||||||
|
Trend[] trends;
|
||||||
|
@JsonField(name = "locations")
|
||||||
|
Location[] locations;
|
||||||
|
|
||||||
Location[] getLocations();
|
public Date getAsOf() {
|
||||||
|
return asOf;
|
||||||
|
}
|
||||||
|
|
||||||
Trend[] getTrends();
|
public Trend[] getTrends() {
|
||||||
|
return trends;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location[] getLocations() {
|
||||||
|
return locations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NonNull Trends another) {
|
||||||
|
return asOf.compareTo(another.getAsOf());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,27 +19,34 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.MediaEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.TwitterResponse;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
public class TwitterAPIConfiguration extends TwitterResponseObject implements TwitterResponse {
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
public int getCharactersReservedPerMedia() {
|
||||||
* @since Twitter4J 2.2.3
|
throw new UnsupportedOperationException();
|
||||||
*/
|
}
|
||||||
public interface TwitterAPIConfiguration extends TwitterResponse {
|
|
||||||
int getCharactersReservedPerMedia();
|
|
||||||
|
|
||||||
int getMaxMediaPerUpload();
|
public int getMaxMediaPerUpload() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
String[] getNonUsernamePaths();
|
public String[] getNonUsernamePaths() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
int getPhotoSizeLimit();
|
public int getPhotoSizeLimit() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
Map<Integer, MediaEntity.Size> getPhotoSizes();
|
public Map<Integer, MediaEntity.Size> getPhotoSizes() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
int getShortUrlLength();
|
public int getShortUrlLength() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
int getShortUrlLengthHttps();
|
public int getShortUrlLengthHttps() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.restfu.http.RestHttpResponse;
|
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||||
|
|
||||||
|
@ -28,14 +28,14 @@ import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/5/7.
|
* Created by mariotaku on 15/5/7.
|
||||||
*/
|
*/
|
||||||
public class TwitterResponseImpl implements TwitterResponse {
|
public class TwitterResponseObject implements TwitterResponse {
|
||||||
|
|
||||||
private int accessLevel;
|
private int accessLevel;
|
||||||
private RateLimitStatus rateLimitStatus;
|
private RateLimitStatus rateLimitStatus;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void processResponseHeader(RestHttpResponse resp) {
|
public final void processResponseHeader(RestHttpResponse resp) {
|
||||||
rateLimitStatus = RateLimitStatusJSONImpl.createFromResponseHeader(resp);
|
rateLimitStatus = RateLimitStatus.createFromResponseHeader(resp);
|
||||||
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -19,54 +19,51 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.UrlEntityImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing one single URL entity.
|
* Created by mariotaku on 15/3/31.
|
||||||
*
|
|
||||||
* @author Mocel - mocel at guma.jp
|
|
||||||
* @since Twitter4J 2.1.9
|
|
||||||
*/
|
*/
|
||||||
@Implementation(UrlEntityImpl.class)
|
@JsonObject
|
||||||
public interface UrlEntity {
|
public class UrlEntity {
|
||||||
|
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
||||||
|
Indices indices;
|
||||||
|
@JsonField(name = "display_url")
|
||||||
|
String displayUrl;
|
||||||
|
@JsonField(name = "expanded_url")
|
||||||
|
String expandedUrl;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "url")
|
||||||
* Returns the display URL if mentioned URL is shorten.
|
String url;
|
||||||
*
|
|
||||||
* @return the display URL if mentioned URL is shorten, or null if no
|
|
||||||
* shorten URL was mentioned.
|
|
||||||
*/
|
|
||||||
String getDisplayUrl();
|
|
||||||
|
|
||||||
/**
|
public String getDisplayUrl() {
|
||||||
* Returns the index of the end character of the URL mentioned in the tweet.
|
return displayUrl;
|
||||||
*
|
}
|
||||||
* @return the index of the end character of the URL mentioned in the tweet
|
|
||||||
*/
|
|
||||||
int getEnd();
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the expanded URL if mentioned URL is shorten.
|
public String toString() {
|
||||||
*
|
return "UrlEntity{" +
|
||||||
* @return the expanded URL if mentioned URL is shorten, or null if no
|
"indices=" + indices +
|
||||||
* shorten URL was mentioned.
|
", displayUrl='" + displayUrl + '\'' +
|
||||||
*/
|
", expandedUrl='" + expandedUrl + '\'' +
|
||||||
String getExpandedUrl();
|
", url='" + url + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public int getEnd() {
|
||||||
* Returns the index of the start character of the URL mentioned in the
|
return indices.getEnd();
|
||||||
* tweet.
|
}
|
||||||
*
|
|
||||||
* @return the index of the start character of the URL mentioned in the
|
|
||||||
* tweet
|
|
||||||
*/
|
|
||||||
int getStart();
|
|
||||||
|
|
||||||
/**
|
public int getStart() {
|
||||||
* Returns the URL mentioned in the tweet.
|
return indices.getStart();
|
||||||
*
|
}
|
||||||
* @return the mentioned URL
|
|
||||||
*/
|
public String getExpandedUrl() {
|
||||||
String getUrl();
|
return expandedUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,209 +19,467 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.UserImpl;
|
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.OnJsonParseComplete;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing Basic user information element
|
* Created by mariotaku on 15/3/31.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
*/
|
*/
|
||||||
@Implementation(UserImpl.class)
|
@JsonObject
|
||||||
public interface User extends Comparable<User>, TwitterResponse {
|
public class User extends TwitterResponseObject implements Comparable<User> {
|
||||||
Date getCreatedAt();
|
|
||||||
|
|
||||||
boolean isDefaultProfile();
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "name")
|
||||||
* Returns the description of the user
|
String name;
|
||||||
*
|
|
||||||
* @return the description of the user
|
|
||||||
*/
|
|
||||||
String getDescription();
|
|
||||||
|
|
||||||
UrlEntity[] getDescriptionEntities();
|
@JsonField(name = "screen_name")
|
||||||
|
String screenName;
|
||||||
|
|
||||||
long getFavouritesCount();
|
@JsonField(name = "location")
|
||||||
|
String location;
|
||||||
|
|
||||||
boolean isFollowedBy();
|
@JsonField(name = "profile_location")
|
||||||
|
String profileLocation;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "description")
|
||||||
* Returns the number of followers
|
String description;
|
||||||
*
|
|
||||||
* @return the number of followers
|
|
||||||
* @since Twitter4J 1.0.4
|
|
||||||
*/
|
|
||||||
long getFollowersCount();
|
|
||||||
|
|
||||||
long getFriendsCount();
|
@JsonField(name = "url")
|
||||||
|
String url;
|
||||||
|
|
||||||
boolean hasCustomTimelines();
|
@JsonField(name = "entities")
|
||||||
|
UserEntities entities;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "protected")
|
||||||
* Returns the id of the user
|
boolean isProtected;
|
||||||
*
|
|
||||||
* @return the id of the user
|
|
||||||
*/
|
|
||||||
long getId();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "followers_count")
|
||||||
* Returns the preferred language of the user
|
long followersCount;
|
||||||
*
|
|
||||||
* @return the preferred language of the user
|
|
||||||
* @since Twitter4J 2.1.2
|
|
||||||
*/
|
|
||||||
String getLang();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "friends_count")
|
||||||
* Returns the number of public lists the user is listed on, or -1 if the
|
long friendsCount;
|
||||||
* count is unavailable.
|
|
||||||
*
|
|
||||||
* @return the number of public lists the user is listed on.
|
|
||||||
* @since Twitter4J 2.1.4
|
|
||||||
*/
|
|
||||||
long getListedCount();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "listed_count")
|
||||||
* Returns the location of the user
|
long listedCount;
|
||||||
*
|
|
||||||
* @return the location of the user
|
|
||||||
*/
|
|
||||||
String getLocation();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
||||||
* Returns the name of the user
|
Date createdAt;
|
||||||
*
|
|
||||||
* @return the name of the user
|
|
||||||
*/
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
boolean isNeedsPhoneVerification();
|
@JsonField(name = "favourites_count")
|
||||||
|
long favouritesCount;
|
||||||
|
|
||||||
boolean isNotifications();
|
@JsonField(name = "utc_offset")
|
||||||
|
int utcOffset;
|
||||||
|
|
||||||
String getProfileBackgroundColor();
|
@JsonField(name = "time_zone")
|
||||||
|
String timeZone;
|
||||||
|
|
||||||
String getProfileBackgroundImageUrl();
|
@JsonField(name = "geo_enabled")
|
||||||
|
boolean geoEnabled;
|
||||||
|
|
||||||
String getProfileBackgroundImageUrlHttps();
|
@JsonField(name = "verified")
|
||||||
|
boolean isVerified;
|
||||||
|
|
||||||
String getProfileBannerImageUrl();
|
@JsonField(name = "statuses_count")
|
||||||
|
long statusesCount;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "media_count")
|
||||||
* Returns the profile image url of the user
|
long mediaCount;
|
||||||
*
|
|
||||||
* @return the profile image url of the user
|
|
||||||
*/
|
|
||||||
String getProfileImageUrl();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "lang")
|
||||||
* Returns the profile image url of the user, served over SSL
|
String lang;
|
||||||
*
|
|
||||||
* @return the profile image url of the user, served over SSL
|
|
||||||
*/
|
|
||||||
String getProfileImageUrlHttps();
|
|
||||||
|
|
||||||
String getProfileLinkColor();
|
@JsonField(name = "status")
|
||||||
|
Status status;
|
||||||
|
|
||||||
String getProfileLocation();
|
@JsonField(name = "contributors_enabled")
|
||||||
|
boolean contributorsEnabled;
|
||||||
|
|
||||||
String getProfileSidebarBorderColor();
|
@JsonField(name = "is_translator")
|
||||||
|
boolean isTranslator;
|
||||||
|
|
||||||
String getProfileSidebarFillColor();
|
@JsonField(name = "is_translation_enabled")
|
||||||
|
boolean isTranslationEnabled;
|
||||||
|
|
||||||
String getProfileTextColor();
|
@JsonField(name = "profile_background_color")
|
||||||
|
String profileBackgroundColor;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "profile_background_image_url")
|
||||||
* Returns the screen name of the user
|
String profileBackgroundImageUrl;
|
||||||
*
|
|
||||||
* @return the screen name of the user
|
|
||||||
*/
|
|
||||||
String getScreenName();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "profile_background_image_url_https")
|
||||||
* Returns the current status of the user<br>
|
String profileBackgroundImageUrlHttps;
|
||||||
* This can be null if the instance if from Status.getUser().
|
|
||||||
*
|
|
||||||
* @return current status of the user
|
|
||||||
* @since Twitter4J 2.1.1
|
|
||||||
*/
|
|
||||||
Status getStatus();
|
|
||||||
|
|
||||||
long getStatusesCount();
|
@JsonField(name = "profile_background_tile")
|
||||||
|
boolean profileBackgroundTile;
|
||||||
|
|
||||||
long getMediaCount();
|
@JsonField(name = "profile_image_url")
|
||||||
|
String profileImageUrl;
|
||||||
|
|
||||||
boolean isSuspended();
|
@JsonField(name = "profile_image_url_https")
|
||||||
|
String profileImageUrlHttps;
|
||||||
|
|
||||||
String getTimeZone();
|
@JsonField(name = "profile_banner_url")
|
||||||
|
String profileBannerUrl;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "profile_link_color")
|
||||||
* Returns the url of the user
|
String profileLinkColor;
|
||||||
*
|
|
||||||
* @return the url of the user
|
|
||||||
*/
|
|
||||||
String getUrl();
|
|
||||||
|
|
||||||
UrlEntity[] getUrlEntities();
|
@JsonField(name = "profile_sidebar_border_color")
|
||||||
|
String profileSidebarBorderColor;
|
||||||
|
|
||||||
int getUtcOffset();
|
@JsonField(name = "profile_sidebar_fill_color")
|
||||||
|
String profileSidebarFillColor;
|
||||||
|
|
||||||
boolean canMediaTag();
|
@JsonField(name = "profile_text_color")
|
||||||
|
String profileTextColor;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "profile_use_background_image")
|
||||||
* Tests if the user is enabling contributors
|
boolean profileUseBackgroundImage;
|
||||||
*
|
|
||||||
* @return if the user is enabling contributors
|
|
||||||
* @since Twitter4J 2.1.2
|
|
||||||
*/
|
|
||||||
boolean isContributorsEnabled();
|
|
||||||
|
|
||||||
boolean isDefaultProfileImage();
|
@JsonField(name = "default_profile")
|
||||||
|
boolean defaultProfile;
|
||||||
|
|
||||||
boolean isFollowing();
|
@JsonField(name = "default_profile_image")
|
||||||
|
boolean defaultProfileImage;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "has_custom_timelines")
|
||||||
* Returns true if the authenticating user has requested to follow this
|
boolean hasCustomTimelines;
|
||||||
* user, otherwise false.
|
|
||||||
*
|
|
||||||
* @return true if the authenticating user has requested to follow this
|
|
||||||
* user.
|
|
||||||
* @since Twitter4J 2.1.4
|
|
||||||
*/
|
|
||||||
boolean isFollowRequestSent();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "can_media_tag")
|
||||||
* @return the user is enabling geo location
|
boolean canMediaTag;
|
||||||
* @since Twitter4J 2.0.10
|
|
||||||
*/
|
|
||||||
boolean isGeoEnabled();
|
|
||||||
|
|
||||||
boolean isProfileBackgroundTiled();
|
@JsonField(name = "followed_by")
|
||||||
|
boolean followedBy;
|
||||||
|
|
||||||
boolean isProfileUseBackgroundImage();
|
@JsonField(name = "following")
|
||||||
|
boolean following;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "follow_request_sent")
|
||||||
* Test if the user status is protected
|
boolean followRequestSent;
|
||||||
*
|
|
||||||
* @return true if the user status is protected
|
|
||||||
*/
|
|
||||||
boolean isProtected();
|
|
||||||
|
|
||||||
boolean isTranslationEnabled();
|
@JsonField(name = "notifications")
|
||||||
|
boolean notifications;
|
||||||
|
|
||||||
/**
|
@JsonField(name = "suspended")
|
||||||
* @return returns true if the user is a translator
|
boolean isSuspended;
|
||||||
* @since Twitter4J 2.1.9
|
|
||||||
*/
|
|
||||||
boolean isTranslator();
|
|
||||||
|
|
||||||
/**
|
@JsonField(name = "needs_phone_verification")
|
||||||
* @return returns true if the user is a verified celebrity
|
boolean needsPhoneVerification;
|
||||||
* @since Twitter4J 2.0.10
|
|
||||||
*/
|
|
||||||
boolean isVerified();
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean canMediaTag() {
|
||||||
|
return canMediaTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isContributorsEnabled() {
|
||||||
|
return contributorsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isDefaultProfile() {
|
||||||
|
return defaultProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UrlEntity[] getDescriptionEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getDescriptionEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getFavouritesCount() {
|
||||||
|
return favouritesCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isFollowRequestSent() {
|
||||||
|
return followRequestSent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isFollowedBy() {
|
||||||
|
return followedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getFollowersCount() {
|
||||||
|
return followersCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isFollowing() {
|
||||||
|
return following;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getFriendsCount() {
|
||||||
|
return friendsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isGeoEnabled() {
|
||||||
|
return geoEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isProfileBackgroundTiled() {
|
||||||
|
return profileBackgroundTile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean hasCustomTimelines() {
|
||||||
|
return hasCustomTimelines;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isTranslationEnabled() {
|
||||||
|
return isTranslationEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isTranslator() {
|
||||||
|
return isTranslator;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getLang() {
|
||||||
|
return lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getListedCount() {
|
||||||
|
return listedCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getMediaCount() {
|
||||||
|
return mediaCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isNeedsPhoneVerification() {
|
||||||
|
return needsPhoneVerification;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isNotifications() {
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileBackgroundColor() {
|
||||||
|
return profileBackgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileBackgroundImageUrl() {
|
||||||
|
return profileBackgroundImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileBackgroundImageUrlHttps() {
|
||||||
|
return profileBackgroundImageUrlHttps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileBannerImageUrl() {
|
||||||
|
return profileBannerUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileImageUrl() {
|
||||||
|
return profileImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileImageUrlHttps() {
|
||||||
|
return profileImageUrlHttps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileLinkColor() {
|
||||||
|
return profileLinkColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileLocation() {
|
||||||
|
return profileLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileSidebarBorderColor() {
|
||||||
|
return profileSidebarBorderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileSidebarFillColor() {
|
||||||
|
return profileSidebarFillColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isProfileUseBackgroundImage() {
|
||||||
|
return profileUseBackgroundImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isProtected() {
|
||||||
|
return isProtected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getScreenName() {
|
||||||
|
return screenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getStatusesCount() {
|
||||||
|
return statusesCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isSuspended() {
|
||||||
|
return isSuspended;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTimeZone() {
|
||||||
|
return timeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UrlEntity[] getUrlEntities() {
|
||||||
|
if (entities == null) return null;
|
||||||
|
return entities.getUrlEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getUtcOffset() {
|
||||||
|
return utcOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isVerified() {
|
||||||
|
return isVerified;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProfileTextColor() {
|
||||||
|
return profileTextColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isDefaultProfileImage() {
|
||||||
|
return defaultProfileImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "User{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", screenName='" + screenName + '\'' +
|
||||||
|
", location='" + location + '\'' +
|
||||||
|
", profileLocation='" + profileLocation + '\'' +
|
||||||
|
", description='" + description + '\'' +
|
||||||
|
", url='" + url + '\'' +
|
||||||
|
", entities=" + entities +
|
||||||
|
", isProtected=" + isProtected +
|
||||||
|
", followersCount=" + followersCount +
|
||||||
|
", friendsCount=" + friendsCount +
|
||||||
|
", listedCount=" + listedCount +
|
||||||
|
", createdAt=" + createdAt +
|
||||||
|
", favouritesCount=" + favouritesCount +
|
||||||
|
", utcOffset=" + utcOffset +
|
||||||
|
", timeZone='" + timeZone + '\'' +
|
||||||
|
", geoEnabled=" + geoEnabled +
|
||||||
|
", isVerified=" + isVerified +
|
||||||
|
", statusesCount=" + statusesCount +
|
||||||
|
", mediaCount=" + mediaCount +
|
||||||
|
", lang='" + lang + '\'' +
|
||||||
|
", status=" + status +
|
||||||
|
", contributorsEnabled=" + contributorsEnabled +
|
||||||
|
", isTranslator=" + isTranslator +
|
||||||
|
", isTranslationEnabled=" + isTranslationEnabled +
|
||||||
|
", profileBackgroundColor='" + profileBackgroundColor + '\'' +
|
||||||
|
", profileBackgroundImageUrl='" + profileBackgroundImageUrl + '\'' +
|
||||||
|
", profileBackgroundImageUrlHttps='" + profileBackgroundImageUrlHttps + '\'' +
|
||||||
|
", profileBackgroundTile=" + profileBackgroundTile +
|
||||||
|
", profileImageUrl='" + profileImageUrl + '\'' +
|
||||||
|
", profileImageUrlHttps='" + profileImageUrlHttps + '\'' +
|
||||||
|
", profileBannerUrl='" + profileBannerUrl + '\'' +
|
||||||
|
", profileLinkColor='" + profileLinkColor + '\'' +
|
||||||
|
", profileSidebarBorderColor='" + profileSidebarBorderColor + '\'' +
|
||||||
|
", profileSidebarFillColor='" + profileSidebarFillColor + '\'' +
|
||||||
|
", profileTextColor='" + profileTextColor + '\'' +
|
||||||
|
", profileUseBackgroundImage=" + profileUseBackgroundImage +
|
||||||
|
", defaultProfile=" + defaultProfile +
|
||||||
|
", defaultProfileImage=" + defaultProfileImage +
|
||||||
|
", hasCustomTimelines=" + hasCustomTimelines +
|
||||||
|
", canMediaTag=" + canMediaTag +
|
||||||
|
", followedBy=" + followedBy +
|
||||||
|
", following=" + following +
|
||||||
|
", followRequestSent=" + followRequestSent +
|
||||||
|
", notifications=" + notifications +
|
||||||
|
", isSuspended=" + isSuspended +
|
||||||
|
", needsPhoneVerification=" + needsPhoneVerification +
|
||||||
|
"} " + super.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NonNull final User that) {
|
||||||
|
return (int) (id - that.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnJsonParseComplete
|
||||||
|
void onJsonParseComplete() throws IOException {
|
||||||
|
if (id <= 0 || screenName == null) throw new IOException("Malformed User object");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,31 +17,25 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model.impl;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.Entities;
|
||||||
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/3/31.
|
* Created by mariotaku on 15/3/31.
|
||||||
*/
|
*/
|
||||||
@JsonObject
|
@JsonObject
|
||||||
public class UserEntitiesImpl {
|
public class UserEntities {
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UserEntitiesImpl{" +
|
|
||||||
"url=" + url +
|
|
||||||
", description=" + description +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonField(name = "url")
|
@JsonField(name = "url")
|
||||||
EntitiesImpl url;
|
Entities url;
|
||||||
|
|
||||||
@JsonField(name = "description")
|
@JsonField(name = "description")
|
||||||
EntitiesImpl description;
|
Entities description;
|
||||||
|
|
||||||
public UrlEntity[] getDescriptionEntities() {
|
public UrlEntity[] getDescriptionEntities() {
|
||||||
if (description == null) return null;
|
if (description == null) return null;
|
||||||
|
@ -52,4 +46,12 @@ public class UserEntitiesImpl {
|
||||||
if (url == null) return null;
|
if (url == null) return null;
|
||||||
return url.getUrls();
|
return url.getUrls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UserEntities{" +
|
||||||
|
"url=" + url +
|
||||||
|
", description=" + description +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -19,49 +19,129 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.EnumClass;
|
import android.support.annotation.NonNull;
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.UserListImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Implementation(UserListImpl.class)
|
/**
|
||||||
public interface UserList extends Comparable<UserList>, TwitterResponse {
|
* Created by mariotaku on 15/4/7.
|
||||||
Mode getMode();
|
*/
|
||||||
|
@JsonObject
|
||||||
|
public class UserList extends TwitterResponseObject implements Comparable<UserList>, TwitterResponse {
|
||||||
|
@JsonField(name = "id")
|
||||||
|
long id;
|
||||||
|
|
||||||
String getDescription();
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
|
|
||||||
|
@JsonField(name = "uri")
|
||||||
|
String uri;
|
||||||
|
|
||||||
|
@JsonField(name = "subscriber_count")
|
||||||
|
long subscriberCount;
|
||||||
|
|
||||||
|
@JsonField(name = "member_count")
|
||||||
|
long memberCount;
|
||||||
|
|
||||||
|
@JsonField(name = "mode")
|
||||||
|
Mode mode;
|
||||||
|
|
||||||
|
@JsonField(name = "description")
|
||||||
|
String description;
|
||||||
|
|
||||||
|
@JsonField(name = "slug")
|
||||||
|
String slug;
|
||||||
|
|
||||||
|
@JsonField(name = "full_name")
|
||||||
|
String fullName;
|
||||||
|
|
||||||
|
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
||||||
|
Date createdAt;
|
||||||
|
|
||||||
|
@JsonField(name = "following")
|
||||||
|
boolean following;
|
||||||
|
|
||||||
|
@JsonField(name = "user")
|
||||||
|
User user;
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String getFullName();
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
long getId();
|
public long getSubscriberCount() {
|
||||||
|
return subscriberCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMemberCount() {
|
||||||
|
return memberCount;
|
||||||
|
}
|
||||||
|
|
||||||
long getMemberCount();
|
public Mode getMode() {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
String getName();
|
public String getSlug() {
|
||||||
|
return slug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullName() {
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
String getSlug();
|
public Date getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFollowing() {
|
||||||
|
return following;
|
||||||
|
}
|
||||||
|
|
||||||
long getSubscriberCount();
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NonNull UserList another) {
|
||||||
|
return (int) (id - another.id);
|
||||||
|
}
|
||||||
|
|
||||||
String getUri();
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UserList{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", uri='" + uri + '\'' +
|
||||||
|
", subscriberCount=" + subscriberCount +
|
||||||
|
", memberCount=" + memberCount +
|
||||||
|
", mode=" + mode +
|
||||||
|
", description='" + description + '\'' +
|
||||||
|
", slug='" + slug + '\'' +
|
||||||
|
", fullName='" + fullName + '\'' +
|
||||||
|
", createdAt=" + createdAt +
|
||||||
|
", following=" + following +
|
||||||
|
", user=" + user +
|
||||||
|
"} " + super.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Mode {
|
||||||
User getUser();
|
|
||||||
|
|
||||||
|
|
||||||
Date getCreatedAt();
|
|
||||||
|
|
||||||
boolean isFollowing();
|
|
||||||
|
|
||||||
@EnumClass
|
|
||||||
enum Mode {
|
|
||||||
PUBLIC("public"), PRIVATE("private");
|
PUBLIC("public"), PRIVATE("private");
|
||||||
|
|
||||||
private final String mode;
|
private final String mode;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -19,49 +19,51 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.UserMentionEntityImpl;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data interface representing one single user mention entity.
|
* Created by mariotaku on 15/3/31.
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @since Twitter4J 2.1.9
|
|
||||||
*/
|
*/
|
||||||
@Implementation(UserMentionEntityImpl.class)
|
@JsonObject
|
||||||
public interface UserMentionEntity {
|
public class UserMentionEntity {
|
||||||
/**
|
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
||||||
* Returns the index of the end character of the user mention.
|
Indices indices;
|
||||||
*
|
@JsonField(name = "id")
|
||||||
* @return the index of the end character of the user mention
|
long id;
|
||||||
*/
|
@JsonField(name = "name")
|
||||||
int getEnd();
|
String name;
|
||||||
|
@JsonField(name = "screen_name")
|
||||||
|
String screenName;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the user id mentioned in the status.
|
public String toString() {
|
||||||
*
|
return "UserMentionEntity{" +
|
||||||
* @return the user id mentioned in the status
|
"indices=" + indices +
|
||||||
*/
|
", id=" + id +
|
||||||
long getId();
|
", name='" + name + '\'' +
|
||||||
|
", screenName='" + screenName + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public int getEnd() {
|
||||||
* Returns the name mentioned in the status.
|
return indices.getEnd();
|
||||||
*
|
}
|
||||||
* @return the name mentioned in the status
|
|
||||||
*/
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
/**
|
public long getId() {
|
||||||
* Returns the screen name mentioned in the status.
|
return id;
|
||||||
*
|
}
|
||||||
* @return the screen name mentioned in the status
|
|
||||||
*/
|
public String getName() {
|
||||||
String getScreenName();
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScreenName() {
|
||||||
|
return screenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStart() {
|
||||||
|
return indices.getStart();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the index of the start character of the user mention.
|
|
||||||
*
|
|
||||||
* @return the index of the start character of the user mention
|
|
||||||
*/
|
|
||||||
int getStart();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
|
|
||||||
package org.mariotaku.twidere.api.twitter.model;
|
package org.mariotaku.twidere.api.twitter.model;
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Implementation;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.WarningImpl;
|
|
||||||
|
import org.mariotaku.twidere.api.twitter.model.Warning;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/5/26.
|
* Created by mariotaku on 15/5/26.
|
||||||
*/
|
*/
|
||||||
@Implementation(WarningImpl.class)
|
@JsonObject
|
||||||
public interface Warning {
|
public class Warning {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* 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")
|
|
||||||
LocationImpl[] trendLocations;
|
|
||||||
@JsonField(name = "language")
|
|
||||||
String language;
|
|
||||||
@JsonField(name = "always_use_https")
|
|
||||||
boolean alwaysUseHttps;
|
|
||||||
@JsonField(name = "time_zone")
|
|
||||||
TimeZoneImpl 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,181 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.mariotaku.library.logansquare.extension.annotation.Mapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Activity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
@Mapper(ActivityImplMapper.class)
|
|
||||||
public class ActivityImpl extends TwitterResponseImpl implements Activity {
|
|
||||||
|
|
||||||
static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
|
|
||||||
Action action;
|
|
||||||
String rawAction;
|
|
||||||
|
|
||||||
Date createdAt;
|
|
||||||
|
|
||||||
User[] sources;
|
|
||||||
User[] targetUsers;
|
|
||||||
User[] targetObjectUsers;
|
|
||||||
Status[] targetObjectStatuses, targetStatuses;
|
|
||||||
UserList[] targetUserLists, targetObjectUserLists;
|
|
||||||
long maxPosition, minPosition;
|
|
||||||
int targetObjectsSize, targetsSize, sourcesSize;
|
|
||||||
|
|
||||||
ActivityImpl() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRawAction() {
|
|
||||||
return rawAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User[] getTargetObjectUsers() {
|
|
||||||
return targetObjectUsers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NonNull final Activity another) {
|
|
||||||
final Date thisDate = getCreatedAt(), thatDate = another.getCreatedAt();
|
|
||||||
if (thisDate == null || thatDate == null) return 0;
|
|
||||||
return thisDate.compareTo(thatDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Action getAction() {
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxPosition() {
|
|
||||||
return maxPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMinPosition() {
|
|
||||||
return minPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User[] getSources() {
|
|
||||||
return sources;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSourcesSize() {
|
|
||||||
return sourcesSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTargetObjectsSize() {
|
|
||||||
return targetObjectsSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Status[] getTargetObjectStatuses() {
|
|
||||||
return targetObjectStatuses;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserList[] getTargetObjectUserLists() {
|
|
||||||
return targetObjectUserLists;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTargetsSize() {
|
|
||||||
return targetsSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Status[] getTargetStatuses() {
|
|
||||||
return targetStatuses;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserList[] getTargetUserLists() {
|
|
||||||
return targetUserLists;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User[] getTargetUsers() {
|
|
||||||
return targetUsers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ActivityJSONImpl{" +
|
|
||||||
"action=" + action +
|
|
||||||
", createdAt=" + createdAt +
|
|
||||||
", sources=" + Arrays.toString(sources) +
|
|
||||||
", targetUsers=" + Arrays.toString(targetUsers) +
|
|
||||||
", targetObjectStatuses=" + Arrays.toString(targetObjectStatuses) +
|
|
||||||
", targetStatuses=" + Arrays.toString(targetStatuses) +
|
|
||||||
", targetUserLists=" + Arrays.toString(targetUserLists) +
|
|
||||||
", targetObjectUserLists=" + Arrays.toString(targetObjectUserLists) +
|
|
||||||
", maxPosition=" + maxPosition +
|
|
||||||
", minPosition=" + minPosition +
|
|
||||||
", targetObjectsSize=" + targetObjectsSize +
|
|
||||||
", targetsSize=" + targetsSize +
|
|
||||||
", sourcesSize=" + sourcesSize +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Activity fromMention(long accountId, Status status) {
|
|
||||||
final ActivityImpl activity = new ActivityImpl();
|
|
||||||
|
|
||||||
activity.maxPosition = activity.minPosition = status.getId();
|
|
||||||
activity.createdAt = status.getCreatedAt();
|
|
||||||
|
|
||||||
if (status.getInReplyToUserId() == accountId) {
|
|
||||||
activity.action = Action.REPLY;
|
|
||||||
activity.rawAction = "reply";
|
|
||||||
activity.targetStatuses = new Status[]{status};
|
|
||||||
|
|
||||||
//TODO set target statuses (in reply to status)
|
|
||||||
activity.targetObjectStatuses = new Status[0];
|
|
||||||
} else {
|
|
||||||
activity.action = Action.MENTION;
|
|
||||||
activity.rawAction = "mention";
|
|
||||||
activity.targetObjectStatuses = new Status[]{status};
|
|
||||||
|
|
||||||
// TODO set target users (mentioned users)
|
|
||||||
activity.targetUsers = null;
|
|
||||||
}
|
|
||||||
activity.sourcesSize = 1;
|
|
||||||
activity.sources = new User[]{status.getUser()};
|
|
||||||
return activity;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,185 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.v4.util.ArrayMap;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.OnJsonParseComplete;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.CardEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class CardEntityImpl implements CardEntity {
|
|
||||||
|
|
||||||
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
|
|
||||||
@JsonField(name = "binding_values")
|
|
||||||
Map<String, RawBindingValue> rawBindingValues;
|
|
||||||
Map<String, BindingValue> bindingValues;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User[] getUsers() {
|
|
||||||
return new User[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BindingValue getBindingValue(String key) {
|
|
||||||
return bindingValues.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, BindingValue> getBindingValues() {
|
|
||||||
return bindingValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnJsonParseComplete
|
|
||||||
void onParseComplete() {
|
|
||||||
if (rawBindingValues != null) {
|
|
||||||
bindingValues = new ArrayMap<>();
|
|
||||||
for (Map.Entry<String, RawBindingValue> entry : rawBindingValues.entrySet()) {
|
|
||||||
bindingValues.put(entry.getKey(), entry.getValue().getBindingValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class ImageValueImpl implements ImageValue {
|
|
||||||
@JsonField(name = "width")
|
|
||||||
int width;
|
|
||||||
@JsonField(name = "height")
|
|
||||||
int height;
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BooleanValueImpl implements BooleanValue {
|
|
||||||
|
|
||||||
public BooleanValueImpl(boolean value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean value;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class StringValueImpl implements StringValue {
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
public StringValueImpl(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class UserValueImpl implements UserValue {
|
|
||||||
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long userId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class RawBindingValue {
|
|
||||||
|
|
||||||
@JsonField(name = "type")
|
|
||||||
String type;
|
|
||||||
@JsonField(name = "boolean_value")
|
|
||||||
boolean booleanValue;
|
|
||||||
@JsonField(name = "string_value")
|
|
||||||
String stringValue;
|
|
||||||
@JsonField(name = "image_value")
|
|
||||||
ImageValueImpl imageValue;
|
|
||||||
@JsonField(name = "user_value")
|
|
||||||
UserValueImpl userValue;
|
|
||||||
|
|
||||||
|
|
||||||
public BindingValue getBindingValue() {
|
|
||||||
if (type == null) return null;
|
|
||||||
switch (type) {
|
|
||||||
case BindingValue.TYPE_BOOLEAN: {
|
|
||||||
return new BooleanValueImpl(booleanValue);
|
|
||||||
}
|
|
||||||
case BindingValue.TYPE_STRING: {
|
|
||||||
return new StringValueImpl(stringValue);
|
|
||||||
}
|
|
||||||
case BindingValue.TYPE_IMAGE: {
|
|
||||||
return imageValue;
|
|
||||||
}
|
|
||||||
case BindingValue.TYPE_USER: {
|
|
||||||
return userValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,127 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.util.TwitterDateConverter;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.DirectMessage;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.HashtagEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.MediaEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserMentionEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class DirectMessageImpl extends TwitterResponseImpl implements DirectMessage {
|
|
||||||
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date createdAt;
|
|
||||||
|
|
||||||
@JsonField(name = "sender")
|
|
||||||
UserImpl sender;
|
|
||||||
|
|
||||||
@JsonField(name = "recipient")
|
|
||||||
UserImpl recipient;
|
|
||||||
|
|
||||||
@JsonField(name = "entities")
|
|
||||||
EntitiesImpl entities;
|
|
||||||
|
|
||||||
@JsonField(name = "text")
|
|
||||||
String text;
|
|
||||||
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashtagEntity[] getHashtagEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getHashtags();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MediaEntity[] getMediaEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getMedia();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UrlEntity[] getUrlEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getUrls();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserMentionEntity[] getUserMentionEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getUserMentions();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserImpl getSender() {
|
|
||||||
return sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getSenderId() {
|
|
||||||
return sender.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSenderScreenName() {
|
|
||||||
return sender.screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserImpl getRecipient() {
|
|
||||||
return recipient;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getRecipientId() {
|
|
||||||
return recipient.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipientScreenName() {
|
|
||||||
return recipient.screenName;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.ErrorInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class ErrorInfoImpl implements ErrorInfo {
|
|
||||||
|
|
||||||
@JsonField(name = "code")
|
|
||||||
int code;
|
|
||||||
@JsonField(name = "message")
|
|
||||||
String message;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRequest() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.ExtendedProfile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/7/8.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class ExtendedProfileImpl implements ExtendedProfile {
|
|
||||||
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "birthdate")
|
|
||||||
BirthdateImpl birthdate;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Birthdate getBirthdate() {
|
|
||||||
return birthdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class BirthdateImpl implements Birthdate {
|
|
||||||
|
|
||||||
@JsonField(name = "day")
|
|
||||||
int day;
|
|
||||||
@JsonField(name = "month")
|
|
||||||
int month;
|
|
||||||
@JsonField(name = "year")
|
|
||||||
int year;
|
|
||||||
@JsonField(name = "visibility")
|
|
||||||
Visibility visibility;
|
|
||||||
@JsonField(name = "year_visibility")
|
|
||||||
Visibility yearVisibility;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDay() {
|
|
||||||
return day;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMonth() {
|
|
||||||
return month;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getYear() {
|
|
||||||
return year;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Visibility getVisibility() {
|
|
||||||
return visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Visibility getYearVisibility() {
|
|
||||||
return yearVisibility;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.HashtagEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/3/31.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class HashtagEntityImpl implements HashtagEntity {
|
|
||||||
|
|
||||||
@JsonField(name = "text")
|
|
||||||
String text;
|
|
||||||
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
|
||||||
Indices indices;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnd() {
|
|
||||||
return indices.getEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStart() {
|
|
||||||
return indices.getStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 org.mariotaku.library.logansquare.extension.annotation.Mapper;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.IDs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/10.
|
|
||||||
*/
|
|
||||||
@Mapper(IDsImplMapper.class)
|
|
||||||
public class IDsImpl extends TwitterResponseImpl implements IDs {
|
|
||||||
|
|
||||||
long previousCursor;
|
|
||||||
long nextCursor;
|
|
||||||
long[] ids;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getNextCursor() {
|
|
||||||
return nextCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPreviousCursor() {
|
|
||||||
return previousCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
return nextCursor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPrevious() {
|
|
||||||
return previousCursor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long[] getIDs() {
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Language;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/10.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class LanguageImpl implements Language {
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
@JsonField(name = "code")
|
|
||||||
String code;
|
|
||||||
@JsonField(name = "status")
|
|
||||||
String status;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Location;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/10.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class LocationImpl implements Location {
|
|
||||||
|
|
||||||
@JsonField(name = "woeid")
|
|
||||||
int woeid;
|
|
||||||
@JsonField(name = "country")
|
|
||||||
String countryName;
|
|
||||||
@JsonField(name = "countryCode")
|
|
||||||
String countryCode;
|
|
||||||
@JsonField(name = "placeType")
|
|
||||||
PlaceTypeImpl placeType;
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWoeid() {
|
|
||||||
return woeid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountryName() {
|
|
||||||
return countryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountryCode() {
|
|
||||||
return countryCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlaceTypeImpl getPlaceType() {
|
|
||||||
|
|
||||||
return placeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class PlaceTypeImpl implements PlaceType {
|
|
||||||
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
@JsonField(name = "code")
|
|
||||||
int code;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,305 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.MediaEntity;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/3/31.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class MediaEntityImpl implements MediaEntity {
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
|
|
||||||
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
|
||||||
Indices indices;
|
|
||||||
|
|
||||||
@JsonField(name = "media_url")
|
|
||||||
String mediaUrl;
|
|
||||||
|
|
||||||
@JsonField(name = "media_url_https")
|
|
||||||
String mediaUrlHttps;
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
@JsonField(name = "display_url")
|
|
||||||
String displayUrl;
|
|
||||||
@JsonField(name = "expanded_url")
|
|
||||||
String expandedUrl;
|
|
||||||
@JsonField(name = "type")
|
|
||||||
Type type;
|
|
||||||
@JsonField(name = "sizes")
|
|
||||||
HashMap<String, Size> sizes;
|
|
||||||
@JsonField(name = "source_status_id")
|
|
||||||
long sourceStatusId;
|
|
||||||
@JsonField(name = "source_user_id")
|
|
||||||
long sourceUserId;
|
|
||||||
@JsonField(name = "video_info")
|
|
||||||
VideoInfoImpl videoInfo;
|
|
||||||
@JsonField(name = "features")
|
|
||||||
HashMap<String, Feature> features;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Feature> getFeatures() {
|
|
||||||
return features;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MediaEntityImpl{" +
|
|
||||||
"id=" + id +
|
|
||||||
", indices=" + indices +
|
|
||||||
", mediaUrl='" + mediaUrl + '\'' +
|
|
||||||
", mediaUrlHttps='" + mediaUrlHttps + '\'' +
|
|
||||||
", url='" + url + '\'' +
|
|
||||||
", displayUrl='" + displayUrl + '\'' +
|
|
||||||
", expandedUrl='" + expandedUrl + '\'' +
|
|
||||||
", type=" + type +
|
|
||||||
", sizes=" + sizes +
|
|
||||||
", sourceStatusId=" + sourceStatusId +
|
|
||||||
", sourceUserId=" + sourceUserId +
|
|
||||||
", videoInfo=" + videoInfo +
|
|
||||||
", features=" + features +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaUrl() {
|
|
||||||
return mediaUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VideoInfo getVideoInfo() {
|
|
||||||
return videoInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaUrlHttps() {
|
|
||||||
return mediaUrlHttps;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExpandedUrl() {
|
|
||||||
return expandedUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDisplayUrl() {
|
|
||||||
return displayUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Type getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Size> getSizes() {
|
|
||||||
return sizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnd() {
|
|
||||||
return indices.getEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStart() {
|
|
||||||
return indices.getStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class FeatureImpl implements Feature {
|
|
||||||
@JsonField(name = "faces")
|
|
||||||
FaceImpl[] faces;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "FeatureImpl{" +
|
|
||||||
"faces=" + Arrays.toString(faces) +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class FaceImpl implements Face {
|
|
||||||
@JsonField(name = "x")
|
|
||||||
int x;
|
|
||||||
@JsonField(name = "y")
|
|
||||||
int y;
|
|
||||||
@JsonField(name = "h")
|
|
||||||
int height;
|
|
||||||
@JsonField(name = "w")
|
|
||||||
int width;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getX() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getY() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "FaceImpl{" +
|
|
||||||
"x=" + x +
|
|
||||||
", y=" + y +
|
|
||||||
", height=" + height +
|
|
||||||
", width=" + width +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class VideoInfoImpl implements VideoInfo {
|
|
||||||
|
|
||||||
@JsonField(name = "duration")
|
|
||||||
long duration;
|
|
||||||
@JsonField(name = "variants")
|
|
||||||
VariantImpl[] variants;
|
|
||||||
@JsonField(name = "aspect_ratio")
|
|
||||||
long[] aspectRatio;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Variant[] getVariants() {
|
|
||||||
return variants;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long[] getAspectRatio() {
|
|
||||||
return aspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "VideoInfoImpl{" +
|
|
||||||
"duration=" + duration +
|
|
||||||
", variants=" + Arrays.toString(variants) +
|
|
||||||
", aspectRatio=" + Arrays.toString(aspectRatio) +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDuration() {
|
|
||||||
return duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class VariantImpl implements Variant {
|
|
||||||
@JsonField(name = "bitrate")
|
|
||||||
long bitrate;
|
|
||||||
@JsonField(name = "content_type")
|
|
||||||
String contentType;
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "VariantImpl{" +
|
|
||||||
"bitrate=" + bitrate +
|
|
||||||
", contentType='" + contentType + '\'' +
|
|
||||||
", url='" + url + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getContentType() {
|
|
||||||
return contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getBitrate() {
|
|
||||||
return bitrate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class SizeImpl implements Size {
|
|
||||||
|
|
||||||
@JsonField(name = "w")
|
|
||||||
int width;
|
|
||||||
@JsonField(name = "h")
|
|
||||||
int height;
|
|
||||||
@JsonField(name = "resize")
|
|
||||||
String resize;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "SizeImpl{" +
|
|
||||||
"width=" + width +
|
|
||||||
", height=" + height +
|
|
||||||
", resize='" + resize + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getResize() {
|
|
||||||
return resize;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.MediaUploadResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class MediaUploadResponseImpl extends TwitterResponseImpl implements MediaUploadResponse {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Image getImage() {
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getSize() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonField(name = "media_id")
|
|
||||||
long mediaId;
|
|
||||||
@JsonField(name = "size")
|
|
||||||
long size;
|
|
||||||
@JsonField(name = "image")
|
|
||||||
ImageImpl image;
|
|
||||||
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class ImageImpl implements Image {
|
|
||||||
|
|
||||||
@JsonField(name = "width")
|
|
||||||
int width;
|
|
||||||
@JsonField(name = "height")
|
|
||||||
int height;
|
|
||||||
@JsonField(name = "image_type")
|
|
||||||
String imageType;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getImageType() {
|
|
||||||
return imageType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Status;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class PagableStatusListImpl extends PageableResponseListImpl<Status> {
|
|
||||||
|
|
||||||
@JsonField(name = "statuses")
|
|
||||||
ArrayList<Status> statuses;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Status get(int location) {
|
|
||||||
return statuses.get(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
if (statuses == null) return 0;
|
|
||||||
return statuses.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.User;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class PagableUserListImpl extends PageableResponseListImpl<User> {
|
|
||||||
|
|
||||||
@JsonField(name = "users")
|
|
||||||
ArrayList<User> user;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User get(int location) {
|
|
||||||
return user.get(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
if (user == null) return 0;
|
|
||||||
return user.size();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.UserList;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class PagableUserListListImpl extends PageableResponseListImpl<UserList> {
|
|
||||||
|
|
||||||
@JsonField(name = "lists")
|
|
||||||
ArrayList<UserList> lists;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserList get(int location) {
|
|
||||||
return lists.get(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
if (lists == null) return 0;
|
|
||||||
return lists.size();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.PageableResponseList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public abstract class PageableResponseListImpl<T> extends ResponseListImpl<T> implements PageableResponseList<T> {
|
|
||||||
|
|
||||||
@JsonField(name = "previous_cursor")
|
|
||||||
long previousCursor;
|
|
||||||
@JsonField(name = "next_cursor")
|
|
||||||
long nextCursor;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getNextCursor() {
|
|
||||||
return nextCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPreviousCursor() {
|
|
||||||
return previousCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
return nextCursor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPrevious() {
|
|
||||||
return previousCursor != 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,107 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.GeoLocation;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Place;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class PlaceImpl extends TwitterResponseImpl implements Place {
|
|
||||||
|
|
||||||
@JsonField(name = "full_name")
|
|
||||||
String fullName;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeoLocation[][] getBoundingBoxCoordinates() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBoundingBoxType() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Place[] getContainedWithIn() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountry() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountryCode() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return fullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeoLocation[][] getGeometryCoordinates() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getGeometryType() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPlaceType() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStreetAddress() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Place another) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,253 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.HashtagEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.MediaEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.PrivateDirectMessages;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserMentionEntity;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/7/5.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class PrivateDirectMessagesImpl implements PrivateDirectMessages {
|
|
||||||
|
|
||||||
@JsonField(name = "user_inbox")
|
|
||||||
UserInboxImpl userInbox;
|
|
||||||
@JsonField(name = "user_events")
|
|
||||||
UserEventsImpl userEvents;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserInbox getUserInbox() {
|
|
||||||
return userInbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserEvents getUserEvents() {
|
|
||||||
return userEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class UserInboxImpl implements UserInbox {
|
|
||||||
|
|
||||||
@JsonField(name = "users")
|
|
||||||
Map<String, UserImpl> users;
|
|
||||||
|
|
||||||
@JsonField(name = "conversations")
|
|
||||||
Map<String, ConversationImpl> conversations;
|
|
||||||
|
|
||||||
@JsonField(name = "entries")
|
|
||||||
MessageImpl[] entries;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User getUser(long userId) {
|
|
||||||
return users.get(String.valueOf(userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Conversation getConversation(String conversationId) {
|
|
||||||
return conversations.get(conversationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Message[] getEntries() {
|
|
||||||
return entries;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class UserEventsImpl implements UserEvents {
|
|
||||||
@JsonField(name = "cursor")
|
|
||||||
String cursor;
|
|
||||||
@JsonField(name = "last_seen_event_id")
|
|
||||||
long lastSeenEventId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCursor() {
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLastSeenEventId() {
|
|
||||||
return lastSeenEventId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class MessageImpl implements Message {
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class DataImpl implements Data {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@JsonField(name = "entities")
|
|
||||||
EntitiesImpl entities;
|
|
||||||
|
|
||||||
@JsonField(name = "sender_id")
|
|
||||||
long senderId;
|
|
||||||
@JsonField(name = "recipient_id")
|
|
||||||
long recipientId;
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "conversation_id")
|
|
||||||
String conversationId;
|
|
||||||
@JsonField(name = "text")
|
|
||||||
String text;
|
|
||||||
@JsonField(name = "time")
|
|
||||||
long time;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getConversationId() {
|
|
||||||
return conversationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getRecipientId() {
|
|
||||||
return recipientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getSenderId() {
|
|
||||||
return senderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getTime() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashtagEntity[] getHashtagEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getHashtags();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UrlEntity[] getUrlEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getUrls();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MediaEntity[] getMediaEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getMedia();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserMentionEntity[] getUserMentionEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getUserMentions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class ConversationImpl implements Conversation {
|
|
||||||
|
|
||||||
@JsonField(name = "conversation_id")
|
|
||||||
String conversationId;
|
|
||||||
@JsonField(name = "last_read_event_id")
|
|
||||||
long lastReadEventId;
|
|
||||||
@JsonField(name = "max_entry_id")
|
|
||||||
long maxEntryId;
|
|
||||||
@JsonField(name = "min_entry_id")
|
|
||||||
long minEntryId;
|
|
||||||
@JsonField(name = "notifications_disabled")
|
|
||||||
boolean notificationsDisabled;
|
|
||||||
@JsonField(name = "participants")
|
|
||||||
ParticipantImpl[] participants;
|
|
||||||
@JsonField(name = "read_only")
|
|
||||||
boolean readOnly;
|
|
||||||
@JsonField(name = "sort_event_id")
|
|
||||||
long sortEventId;
|
|
||||||
@JsonField(name = "sort_timestamp")
|
|
||||||
long sortTimestamp;
|
|
||||||
@JsonField(name = "status")
|
|
||||||
Status status;
|
|
||||||
@JsonField(name = "type")
|
|
||||||
Type type;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Participant[] getParticipants() {
|
|
||||||
return participants;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getConversationId() {
|
|
||||||
return conversationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLastReadEventId() {
|
|
||||||
return lastReadEventId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxEntryId() {
|
|
||||||
return maxEntryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMinEntryId() {
|
|
||||||
return minEntryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNotificationsDisabled() {
|
|
||||||
return notificationsDisabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class ParticipantImpl implements Participant {
|
|
||||||
|
|
||||||
@JsonField(name = "user_id")
|
|
||||||
long userId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 org.mariotaku.twidere.api.twitter.model.PrivateSearchResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/10/21.
|
|
||||||
*/
|
|
||||||
public class PrivateSearchResultImpl implements PrivateSearchResult {
|
|
||||||
}
|
|
|
@ -1,146 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.restfu.http.RestHttpResponse;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.QueryResult;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
|
||||||
|
|
||||||
import java.util.AbstractList;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class QueryResultImpl extends AbstractList<Status> implements QueryResult {
|
|
||||||
|
|
||||||
@JsonField(name = "previous_cursor")
|
|
||||||
long previousCursor;
|
|
||||||
@JsonField(name = "next_cursor")
|
|
||||||
long nextCursor;
|
|
||||||
|
|
||||||
@JsonField(name = "search_metadata")
|
|
||||||
SearchMetadata metadata;
|
|
||||||
|
|
||||||
@JsonField(name = "statuses")
|
|
||||||
ArrayList<Status> statuses;
|
|
||||||
|
|
||||||
private int accessLevel;
|
|
||||||
private RateLimitStatus rateLimitStatus;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void processResponseHeader(RestHttpResponse resp) {
|
|
||||||
rateLimitStatus = RateLimitStatusJSONImpl.createFromResponseHeader(resp);
|
|
||||||
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int getAccessLevel() {
|
|
||||||
return accessLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final RateLimitStatus getRateLimitStatus() {
|
|
||||||
return rateLimitStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Status get(int index) {
|
|
||||||
return statuses.get(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
return statuses.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getCompletedIn() {
|
|
||||||
return metadata.completedIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMaxId() {
|
|
||||||
return metadata.maxId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQuery() {
|
|
||||||
return metadata.query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getResultsPerPage() {
|
|
||||||
return metadata.count;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getNextCursor() {
|
|
||||||
return nextCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
return nextCursor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPrevious() {
|
|
||||||
return previousCursor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPreviousCursor() {
|
|
||||||
return previousCursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getSinceId() {
|
|
||||||
return metadata.sinceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getWarning() {
|
|
||||||
return metadata.warning;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class SearchMetadata {
|
|
||||||
@JsonField(name = "max_id")
|
|
||||||
long maxId;
|
|
||||||
@JsonField(name = "since_id")
|
|
||||||
long sinceId;
|
|
||||||
@JsonField(name = "count")
|
|
||||||
int count;
|
|
||||||
@JsonField(name = "completed_in")
|
|
||||||
double completedIn;
|
|
||||||
@JsonField(name = "query")
|
|
||||||
String query;
|
|
||||||
@JsonField(name = "warning")
|
|
||||||
String warning;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,186 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.restfu.http.RestHttpResponse;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A data class representing Twitter REST API's rate limit status
|
|
||||||
*
|
|
||||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
|
||||||
* @see <a href="https://dev.twitter.com/docs/rate-limiting">Rate Limiting |
|
|
||||||
* Twitter Developers</a>
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public final class RateLimitStatusJSONImpl implements RateLimitStatus {
|
|
||||||
|
|
||||||
private final long creationTimeInMillis;
|
|
||||||
|
|
||||||
@JsonField(name = "remaining")
|
|
||||||
int remaining;
|
|
||||||
@JsonField(name = "limit")
|
|
||||||
int limit;
|
|
||||||
@JsonField(name = "reset")
|
|
||||||
int resetTimeInSeconds;
|
|
||||||
|
|
||||||
private RateLimitStatusJSONImpl(final int limit, final int remaining, final int resetTimeInSeconds) {
|
|
||||||
this();
|
|
||||||
this.limit = limit;
|
|
||||||
this.remaining = remaining;
|
|
||||||
this.resetTimeInSeconds = resetTimeInSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RateLimitStatusJSONImpl() {
|
|
||||||
creationTimeInMillis = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getLimit() {
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getRemaining() {
|
|
||||||
return remaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getRemainingHits() {
|
|
||||||
return getRemaining();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getResetTimeInSeconds() {
|
|
||||||
return resetTimeInSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getSecondsUntilReset() {
|
|
||||||
return (int) ((resetTimeInSeconds * 1000L - creationTimeInMillis) / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
RateLimitStatusJSONImpl that = (RateLimitStatusJSONImpl) o;
|
|
||||||
|
|
||||||
if (creationTimeInMillis != that.creationTimeInMillis) return false;
|
|
||||||
if (remaining != that.remaining) return false;
|
|
||||||
if (limit != that.limit) return false;
|
|
||||||
return resetTimeInSeconds == that.resetTimeInSeconds;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = (int) (creationTimeInMillis ^ (creationTimeInMillis >>> 32));
|
|
||||||
result = 31 * result + remaining;
|
|
||||||
result = 31 * result + limit;
|
|
||||||
result = 31 * result + resetTimeInSeconds;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "RateLimitStatusJSONImpl{" +
|
|
||||||
"creationTimeInMillis=" + creationTimeInMillis +
|
|
||||||
", remaining=" + remaining +
|
|
||||||
", limit=" + limit +
|
|
||||||
", resetTimeInSeconds=" + resetTimeInSeconds +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RateLimitStatus createFromResponseHeader(final RestHttpResponse res) {
|
|
||||||
if (null == res) return null;
|
|
||||||
int remainingHits;// "X-Rate-Limit-Remaining"
|
|
||||||
int limit;// "X-Rate-Limit-Limit"
|
|
||||||
int resetTimeInSeconds;// not included in the response header. Need to
|
|
||||||
// be calculated.
|
|
||||||
|
|
||||||
final String strLimit = res.getHeader("X-Rate-Limit-Limit");
|
|
||||||
if (strLimit != null) {
|
|
||||||
limit = Integer.parseInt(strLimit);
|
|
||||||
} else
|
|
||||||
return null;
|
|
||||||
final String remaining = res.getHeader("X-Rate-Limit-Remaining");
|
|
||||||
if (remaining != null) {
|
|
||||||
remainingHits = Integer.parseInt(remaining);
|
|
||||||
} else
|
|
||||||
return null;
|
|
||||||
final String reset = res.getHeader("X-Rate-Limit-Reset");
|
|
||||||
if (reset != null) {
|
|
||||||
final long longReset = Long.parseLong(reset);
|
|
||||||
resetTimeInSeconds = (int) longReset;
|
|
||||||
} else
|
|
||||||
return null;
|
|
||||||
return new RateLimitStatusJSONImpl(limit, remainingHits, resetTimeInSeconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static Map<String, RateLimitStatus> createRateLimitStatuses(final HttpResponse res, final Configuration conf)
|
|
||||||
// throws TwitterException {
|
|
||||||
// final JSONObject json = res.asJSONObject();
|
|
||||||
// final Map<String, RateLimitStatus> map = createRateLimitStatuses(json);
|
|
||||||
// return map;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// static Map<String, RateLimitStatus> createRateLimitStatuses(final InputStream stream) throws TwitterException {
|
|
||||||
// final Map<String, RateLimitStatus> map = new HashMap<String, RateLimitStatus>();
|
|
||||||
// try {
|
|
||||||
// final JSONObject resources = json.getJSONObject("resources");
|
|
||||||
// final Iterator<?> resourceKeys = resources.keys();
|
|
||||||
// while (resourceKeys.hasNext()) {
|
|
||||||
// final JSONObject resource = resources.getJSONObject((String) resourceKeys.next());
|
|
||||||
// final Iterator<?> endpointKeys = resource.keys();
|
|
||||||
// while (endpointKeys.hasNext()) {
|
|
||||||
// final String endpoint = (String) endpointKeys.next();
|
|
||||||
// final JSONObject rateLimitStatusJSON = resource.getJSONObject(endpoint);
|
|
||||||
// final RateLimitStatus rateLimitStatus = new RateLimitStatusJSONImpl(rateLimitStatusJSON);
|
|
||||||
// map.put(endpoint, rateLimitStatus);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return Collections.unmodifiableMap(map);
|
|
||||||
// } catch (final JSONException jsone) {
|
|
||||||
// throw new TwitterException(jsone);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,182 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Relationship;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class RelationshipImpl extends TwitterResponseImpl implements Relationship {
|
|
||||||
|
|
||||||
@JsonField(name = "relationship")
|
|
||||||
RelationshipObject object;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceBlockingTarget() {
|
|
||||||
return object.source.blocking;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTargetFollowingSource() {
|
|
||||||
return object.target.following;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTargetFollowedBySource() {
|
|
||||||
return object.target.followedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceNotificationsEnabled() {
|
|
||||||
return object.source.notificationsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceMutingTarget() {
|
|
||||||
return object.source.muting;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceMarkedTargetAsSpam() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceFollowingTarget() {
|
|
||||||
return object.source.following;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceFollowedByTarget() {
|
|
||||||
return object.source.followedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceBlockedByTarget() {
|
|
||||||
return object.source.blockedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTargetUserScreenName() {
|
|
||||||
return object.target.screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getTargetUserId() {
|
|
||||||
return object.target.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSourceUserScreenName() {
|
|
||||||
return object.source.screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getSourceUserId() {
|
|
||||||
return object.source.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSourceMediaTagTarget() {
|
|
||||||
return object.source.canMediaTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSourceDMTarget() {
|
|
||||||
return object.source.canDm;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceRequestedFollowingTarget() {
|
|
||||||
return object.source.followingRequested;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTargetRequestedFollowingSource() {
|
|
||||||
return object.target.followingRequested;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceWantRetweetsFromTarget() {
|
|
||||||
return object.source.wantRetweets;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSourceNotificationsEnabledForTarget() {
|
|
||||||
return object.source.notificationsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class RelationshipObject {
|
|
||||||
|
|
||||||
@JsonField(name = "source")
|
|
||||||
Source source;
|
|
||||||
@JsonField(name = "target")
|
|
||||||
Target target;
|
|
||||||
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class Target {
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "screen_name")
|
|
||||||
public String screenName;
|
|
||||||
@JsonField(name = "following")
|
|
||||||
boolean following;
|
|
||||||
@JsonField(name = "followed_by")
|
|
||||||
boolean followedBy;
|
|
||||||
@JsonField(name = "following_requested")
|
|
||||||
boolean followingRequested;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonObject
|
|
||||||
public static class Source {
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "screen_name")
|
|
||||||
public String screenName;
|
|
||||||
@JsonField(name = "blocked_by")
|
|
||||||
boolean blockedBy;
|
|
||||||
@JsonField(name = "blocking")
|
|
||||||
boolean blocking;
|
|
||||||
@JsonField(name = "muting")
|
|
||||||
boolean muting;
|
|
||||||
@JsonField(name = "following")
|
|
||||||
boolean following;
|
|
||||||
@JsonField(name = "followed_by")
|
|
||||||
boolean followedBy;
|
|
||||||
@JsonField(name = "following_requested")
|
|
||||||
boolean followingRequested;
|
|
||||||
@JsonField(name = "want_retweets")
|
|
||||||
boolean wantRetweets;
|
|
||||||
@JsonField(name = "notifications_enabled")
|
|
||||||
boolean notificationsEnabled;
|
|
||||||
@JsonField(name = "can_dm")
|
|
||||||
boolean canDm;
|
|
||||||
@JsonField(name = "can_media_tag")
|
|
||||||
boolean canMediaTag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.JsonObject;
|
|
||||||
|
|
||||||
import org.mariotaku.restfu.http.RestHttpResponse;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class ResponseArrayList<T> extends ArrayList<T> implements ResponseList<T> {
|
|
||||||
|
|
||||||
private int accessLevel;
|
|
||||||
private RateLimitStatus rateLimitStatus;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void processResponseHeader(RestHttpResponse resp) {
|
|
||||||
rateLimitStatus = RateLimitStatusJSONImpl.createFromResponseHeader(resp);
|
|
||||||
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int getAccessLevel() {
|
|
||||||
return accessLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final RateLimitStatus getRateLimitStatus() {
|
|
||||||
return rateLimitStatus;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 org.mariotaku.restfu.http.RestHttpResponse;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.RateLimitStatus;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.InternalParseUtil;
|
|
||||||
|
|
||||||
import java.util.AbstractList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
public abstract class ResponseListImpl<T> extends AbstractList<T> implements ResponseList<T> {
|
|
||||||
|
|
||||||
private int accessLevel;
|
|
||||||
private RateLimitStatus rateLimitStatus;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void processResponseHeader(RestHttpResponse resp) {
|
|
||||||
rateLimitStatus = RateLimitStatusJSONImpl.createFromResponseHeader(resp);
|
|
||||||
accessLevel = InternalParseUtil.toAccessLevel(resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int getAccessLevel() {
|
|
||||||
return accessLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final RateLimitStatus getRateLimitStatus() {
|
|
||||||
return rateLimitStatus;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,7 +42,7 @@ public class ResponseListMapper<T> extends JsonMapper<ResponseList<T>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseList<T> parse(JsonParser jsonParser) throws IOException {
|
public ResponseList<T> parse(JsonParser jsonParser) throws IOException {
|
||||||
ResponseArrayList<T> list = new ResponseArrayList<>();
|
ResponseList<T> list = new ResponseList<>();
|
||||||
final JsonMapper<T> mapper = LoganSquare.mapperFor(elementCls);
|
final JsonMapper<T> mapper = LoganSquare.mapperFor(elementCls);
|
||||||
if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
|
if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
|
||||||
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
|
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.SavedSearch;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class SavedSearchImpl extends TwitterResponseImpl implements SavedSearch {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPosition() {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQuery() {
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date createdAt;
|
|
||||||
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
|
|
||||||
@JsonField(name = "position")
|
|
||||||
int position;
|
|
||||||
|
|
||||||
@JsonField(name = "query")
|
|
||||||
String query;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NonNull SavedSearch another) {
|
|
||||||
return (int) (id - another.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.ScheduledStatus;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/7/6.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class ScheduledStatusImpl implements ScheduledStatus {
|
|
||||||
|
|
||||||
@JsonField(name = "updated_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date updatedAt;
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date createdAt;
|
|
||||||
@JsonField(name = "execute_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date executeAt;
|
|
||||||
@JsonField(name = "text")
|
|
||||||
String text;
|
|
||||||
@JsonField(name = "media_ids")
|
|
||||||
long[] mediaIds;
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "possiblySensitive")
|
|
||||||
boolean possiblySensitive;
|
|
||||||
@JsonField(name = "user_id")
|
|
||||||
long userId;
|
|
||||||
@JsonField(name = "state")
|
|
||||||
State state;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPossiblySensitive() {
|
|
||||||
return possiblySensitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long[] getMediaIds() {
|
|
||||||
return mediaIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getUpdatedAt() {
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getExecuteAt() {
|
|
||||||
return executeAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public State getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.IDs;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.StatusActivitySummary;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/13.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class StatusActivitySummaryImpl extends TwitterResponseImpl implements StatusActivitySummary {
|
|
||||||
|
|
||||||
@JsonField(name = "favoriters")
|
|
||||||
IDs favoriters;
|
|
||||||
@JsonField(name = "repliers")
|
|
||||||
IDs repliers;
|
|
||||||
@JsonField(name = "retweeters")
|
|
||||||
IDs retweeters;
|
|
||||||
|
|
||||||
@JsonField(name = "favoriters_count")
|
|
||||||
long favoritersCount;
|
|
||||||
@JsonField(name = "repliers_count")
|
|
||||||
long repliersCount;
|
|
||||||
@JsonField(name = "retweeters_count")
|
|
||||||
long retweetersCount;
|
|
||||||
@JsonField(name = "descendent_reply_count")
|
|
||||||
long descendentReplyCount;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IDs getFavoriters() {
|
|
||||||
return favoriters;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IDs getRepliers() {
|
|
||||||
return repliers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IDs getRetweeters() {
|
|
||||||
return retweeters;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getFavoritersCount() {
|
|
||||||
return favoritersCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getRepliersCount() {
|
|
||||||
return repliersCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getRetweetersCount() {
|
|
||||||
return retweetersCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDescendentReplyCount() {
|
|
||||||
return descendentReplyCount;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.JsonObject;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.StatusDeletionNotice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/26.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class StatusDeletionNoticeImpl implements StatusDeletionNotice {
|
|
||||||
@Override
|
|
||||||
public long getStatusId() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.TranslationResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class TranslationResultImpl extends TwitterResponseImpl implements TranslationResult {
|
|
||||||
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "lang")
|
|
||||||
String lang;
|
|
||||||
@JsonField(name = "translated_lang")
|
|
||||||
String translatedLang;
|
|
||||||
@JsonField(name = "translation_type")
|
|
||||||
String translationType;
|
|
||||||
@JsonField(name = "text")
|
|
||||||
String text;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLang() {
|
|
||||||
return lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslatedLang() {
|
|
||||||
return translatedLang;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationType() {
|
|
||||||
return translationType;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.Trend;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/10.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class TrendImpl implements Trend {
|
|
||||||
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
@JsonField(name = "query")
|
|
||||||
String query;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQuery() {
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.JsonMapper;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.core.JsonToken;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Trends;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterTrendsDateConverter;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/10.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class TrendsImpl extends TwitterResponseImpl implements Trends {
|
|
||||||
|
|
||||||
@JsonField(name = "as_of", typeConverter = TwitterTrendsDateConverter.class)
|
|
||||||
Date asOf;
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterTrendsDateConverter.class)
|
|
||||||
Date createdAt;
|
|
||||||
@JsonField(name = "trends")
|
|
||||||
TrendImpl[] trends;
|
|
||||||
@JsonField(name = "locations")
|
|
||||||
LocationImpl[] locations;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getAsOf() {
|
|
||||||
return asOf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TrendImpl[] getTrends() {
|
|
||||||
return trends;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocationImpl[] getLocations() {
|
|
||||||
return locations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NonNull Trends another) {
|
|
||||||
return asOf.compareTo(another.getAsOf());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.JsonMapper;
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
|
||||||
import com.bluelinelabs.logansquare.typeconverters.TypeConverter;
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/5.
|
|
||||||
*/
|
|
||||||
public class TypeConverterMapper<T> implements TypeConverter<T> {
|
|
||||||
|
|
||||||
private final Class<? extends T> cls;
|
|
||||||
|
|
||||||
TypeConverterMapper(Class<? extends T> cls) {
|
|
||||||
this.cls = cls;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public T parse(JsonParser jsonParser) throws IOException {
|
|
||||||
return LoganSquare.mapperFor(cls).parse(jsonParser);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(T object, String fieldName, boolean writeFieldNameForObject, JsonGenerator jsonGenerator) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({"TryWithIdenticalCatches"})
|
|
||||||
public static <T> void register(Class<T> cls, Class<? extends T> impl) {
|
|
||||||
LoganSquare.registerTypeConverter(cls, new TypeConverterMapper<>(impl));
|
|
||||||
try {
|
|
||||||
//noinspection unchecked
|
|
||||||
register(cls, impl, (JsonMapper) Class.forName(impl.getName() + "$$JsonObjectMapper").newInstance());
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"TryWithIdenticalCatches"})
|
|
||||||
public static <T> void register(Class<T> cls, Class<? extends T> impl, JsonMapper<? extends T> mapper) {
|
|
||||||
LoganSquare.registerTypeConverter(cls, new TypeConverterMapper<>(impl));
|
|
||||||
try {
|
|
||||||
//noinspection unchecked
|
|
||||||
final Field objectMappersField = LoganSquare.class.getDeclaredField("OBJECT_MAPPERS");
|
|
||||||
objectMappersField.setAccessible(true);
|
|
||||||
//noinspection unchecked
|
|
||||||
final Map<Class, JsonMapper> mappers = (Map<Class, JsonMapper>) objectMappersField.get(null);
|
|
||||||
mappers.put(cls, mapper);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.UrlEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/3/31.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class UrlEntityImpl implements UrlEntity {
|
|
||||||
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
|
||||||
Indices indices;
|
|
||||||
@JsonField(name = "display_url")
|
|
||||||
String displayUrl;
|
|
||||||
@JsonField(name = "expanded_url")
|
|
||||||
String expandedUrl;
|
|
||||||
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDisplayUrl() {
|
|
||||||
return displayUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UrlEntityImpl{" +
|
|
||||||
"indices=" + indices +
|
|
||||||
", displayUrl='" + displayUrl + '\'' +
|
|
||||||
", expandedUrl='" + expandedUrl + '\'' +
|
|
||||||
", url='" + url + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnd() {
|
|
||||||
return indices.getEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStart() {
|
|
||||||
return indices.getStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExpandedUrl() {
|
|
||||||
return expandedUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,489 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.OnJsonParseComplete;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/3/31.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class UserImpl extends TwitterResponseImpl implements User {
|
|
||||||
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
|
|
||||||
@JsonField(name = "screen_name")
|
|
||||||
String screenName;
|
|
||||||
|
|
||||||
@JsonField(name = "location")
|
|
||||||
String location;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_location")
|
|
||||||
String profileLocation;
|
|
||||||
|
|
||||||
@JsonField(name = "description")
|
|
||||||
String description;
|
|
||||||
|
|
||||||
@JsonField(name = "url")
|
|
||||||
String url;
|
|
||||||
|
|
||||||
@JsonField(name = "entities")
|
|
||||||
UserEntitiesImpl entities;
|
|
||||||
|
|
||||||
@JsonField(name = "protected")
|
|
||||||
boolean isProtected;
|
|
||||||
|
|
||||||
@JsonField(name = "followers_count")
|
|
||||||
long followersCount;
|
|
||||||
|
|
||||||
@JsonField(name = "friends_count")
|
|
||||||
long friendsCount;
|
|
||||||
|
|
||||||
@JsonField(name = "listed_count")
|
|
||||||
long listedCount;
|
|
||||||
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date createdAt;
|
|
||||||
|
|
||||||
@JsonField(name = "favourites_count")
|
|
||||||
long favouritesCount;
|
|
||||||
|
|
||||||
@JsonField(name = "utc_offset")
|
|
||||||
int utcOffset;
|
|
||||||
|
|
||||||
@JsonField(name = "time_zone")
|
|
||||||
String timeZone;
|
|
||||||
|
|
||||||
@JsonField(name = "geo_enabled")
|
|
||||||
boolean geoEnabled;
|
|
||||||
|
|
||||||
@JsonField(name = "verified")
|
|
||||||
boolean isVerified;
|
|
||||||
|
|
||||||
@JsonField(name = "statuses_count")
|
|
||||||
long statusesCount;
|
|
||||||
|
|
||||||
@JsonField(name = "media_count")
|
|
||||||
long mediaCount;
|
|
||||||
|
|
||||||
@JsonField(name = "lang")
|
|
||||||
String lang;
|
|
||||||
|
|
||||||
@JsonField(name = "status")
|
|
||||||
Status status;
|
|
||||||
|
|
||||||
@JsonField(name = "contributors_enabled")
|
|
||||||
boolean contributorsEnabled;
|
|
||||||
|
|
||||||
@JsonField(name = "is_translator")
|
|
||||||
boolean isTranslator;
|
|
||||||
|
|
||||||
@JsonField(name = "is_translation_enabled")
|
|
||||||
boolean isTranslationEnabled;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_background_color")
|
|
||||||
String profileBackgroundColor;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_background_image_url")
|
|
||||||
String profileBackgroundImageUrl;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_background_image_url_https")
|
|
||||||
String profileBackgroundImageUrlHttps;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_background_tile")
|
|
||||||
boolean profileBackgroundTile;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_image_url")
|
|
||||||
String profileImageUrl;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_image_url_https")
|
|
||||||
String profileImageUrlHttps;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_banner_url")
|
|
||||||
String profileBannerUrl;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_link_color")
|
|
||||||
String profileLinkColor;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_sidebar_border_color")
|
|
||||||
String profileSidebarBorderColor;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_sidebar_fill_color")
|
|
||||||
String profileSidebarFillColor;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_text_color")
|
|
||||||
String profileTextColor;
|
|
||||||
|
|
||||||
@JsonField(name = "profile_use_background_image")
|
|
||||||
boolean profileUseBackgroundImage;
|
|
||||||
|
|
||||||
@JsonField(name = "default_profile")
|
|
||||||
boolean defaultProfile;
|
|
||||||
|
|
||||||
@JsonField(name = "default_profile_image")
|
|
||||||
boolean defaultProfileImage;
|
|
||||||
|
|
||||||
@JsonField(name = "has_custom_timelines")
|
|
||||||
boolean hasCustomTimelines;
|
|
||||||
|
|
||||||
@JsonField(name = "can_media_tag")
|
|
||||||
boolean canMediaTag;
|
|
||||||
|
|
||||||
@JsonField(name = "followed_by")
|
|
||||||
boolean followedBy;
|
|
||||||
|
|
||||||
@JsonField(name = "following")
|
|
||||||
boolean following;
|
|
||||||
|
|
||||||
@JsonField(name = "follow_request_sent")
|
|
||||||
boolean followRequestSent;
|
|
||||||
|
|
||||||
@JsonField(name = "notifications")
|
|
||||||
boolean notifications;
|
|
||||||
|
|
||||||
@JsonField(name = "suspended")
|
|
||||||
boolean isSuspended;
|
|
||||||
|
|
||||||
@JsonField(name = "needs_phone_verification")
|
|
||||||
boolean needsPhoneVerification;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canMediaTag() {
|
|
||||||
return canMediaTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isContributorsEnabled() {
|
|
||||||
return contributorsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDefaultProfile() {
|
|
||||||
return defaultProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UrlEntity[] getDescriptionEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getDescriptionEntities();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getFavouritesCount() {
|
|
||||||
return favouritesCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFollowRequestSent() {
|
|
||||||
return followRequestSent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFollowedBy() {
|
|
||||||
return followedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getFollowersCount() {
|
|
||||||
return followersCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFollowing() {
|
|
||||||
return following;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getFriendsCount() {
|
|
||||||
return friendsCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGeoEnabled() {
|
|
||||||
return geoEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isProfileBackgroundTiled() {
|
|
||||||
return profileBackgroundTile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomTimelines() {
|
|
||||||
return hasCustomTimelines;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTranslationEnabled() {
|
|
||||||
return isTranslationEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTranslator() {
|
|
||||||
return isTranslator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLang() {
|
|
||||||
return lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getListedCount() {
|
|
||||||
return listedCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMediaCount() {
|
|
||||||
return mediaCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNeedsPhoneVerification() {
|
|
||||||
return needsPhoneVerification;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNotifications() {
|
|
||||||
return notifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileBackgroundColor() {
|
|
||||||
return profileBackgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileBackgroundImageUrl() {
|
|
||||||
return profileBackgroundImageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileBackgroundImageUrlHttps() {
|
|
||||||
return profileBackgroundImageUrlHttps;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileBannerImageUrl() {
|
|
||||||
return profileBannerUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileImageUrl() {
|
|
||||||
return profileImageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileImageUrlHttps() {
|
|
||||||
return profileImageUrlHttps;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileLinkColor() {
|
|
||||||
return profileLinkColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileLocation() {
|
|
||||||
return profileLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileSidebarBorderColor() {
|
|
||||||
return profileSidebarBorderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileSidebarFillColor() {
|
|
||||||
return profileSidebarFillColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isProfileUseBackgroundImage() {
|
|
||||||
return profileUseBackgroundImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isProtected() {
|
|
||||||
return isProtected;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getScreenName() {
|
|
||||||
return screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Status getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getStatusesCount() {
|
|
||||||
return statusesCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSuspended() {
|
|
||||||
return isSuspended;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTimeZone() {
|
|
||||||
return timeZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UrlEntity[] getUrlEntities() {
|
|
||||||
if (entities == null) return null;
|
|
||||||
return entities.getUrlEntities();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getUtcOffset() {
|
|
||||||
return utcOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVerified() {
|
|
||||||
return isVerified;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfileTextColor() {
|
|
||||||
return profileTextColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UserImpl{" +
|
|
||||||
"id=" + id +
|
|
||||||
", name='" + name + '\'' +
|
|
||||||
", screenName='" + screenName + '\'' +
|
|
||||||
", location='" + location + '\'' +
|
|
||||||
", profileLocation='" + profileLocation + '\'' +
|
|
||||||
", description='" + description + '\'' +
|
|
||||||
", url='" + url + '\'' +
|
|
||||||
", entities=" + entities +
|
|
||||||
", isProtected=" + isProtected +
|
|
||||||
", followersCount=" + followersCount +
|
|
||||||
", friendsCount=" + friendsCount +
|
|
||||||
", listedCount=" + listedCount +
|
|
||||||
", createdAt=" + createdAt +
|
|
||||||
", favouritesCount=" + favouritesCount +
|
|
||||||
", utcOffset=" + utcOffset +
|
|
||||||
", timeZone='" + timeZone + '\'' +
|
|
||||||
", geoEnabled=" + geoEnabled +
|
|
||||||
", isVerified=" + isVerified +
|
|
||||||
", statusesCount=" + statusesCount +
|
|
||||||
", mediaCount=" + mediaCount +
|
|
||||||
", lang='" + lang + '\'' +
|
|
||||||
", status=" + status +
|
|
||||||
", contributorsEnabled=" + contributorsEnabled +
|
|
||||||
", isTranslator=" + isTranslator +
|
|
||||||
", isTranslationEnabled=" + isTranslationEnabled +
|
|
||||||
", profileBackgroundColor='" + profileBackgroundColor + '\'' +
|
|
||||||
", profileBackgroundImageUrl='" + profileBackgroundImageUrl + '\'' +
|
|
||||||
", profileBackgroundImageUrlHttps='" + profileBackgroundImageUrlHttps + '\'' +
|
|
||||||
", profileBackgroundTile=" + profileBackgroundTile +
|
|
||||||
", profileImageUrl='" + profileImageUrl + '\'' +
|
|
||||||
", profileImageUrlHttps='" + profileImageUrlHttps + '\'' +
|
|
||||||
", profileBannerUrl='" + profileBannerUrl + '\'' +
|
|
||||||
", profileLinkColor='" + profileLinkColor + '\'' +
|
|
||||||
", profileSidebarBorderColor='" + profileSidebarBorderColor + '\'' +
|
|
||||||
", profileSidebarFillColor='" + profileSidebarFillColor + '\'' +
|
|
||||||
", profileTextColor='" + profileTextColor + '\'' +
|
|
||||||
", profileUseBackgroundImage=" + profileUseBackgroundImage +
|
|
||||||
", defaultProfile=" + defaultProfile +
|
|
||||||
", defaultProfileImage=" + defaultProfileImage +
|
|
||||||
", hasCustomTimelines=" + hasCustomTimelines +
|
|
||||||
", canMediaTag=" + canMediaTag +
|
|
||||||
", followedBy=" + followedBy +
|
|
||||||
", following=" + following +
|
|
||||||
", followRequestSent=" + followRequestSent +
|
|
||||||
", notifications=" + notifications +
|
|
||||||
", isSuspended=" + isSuspended +
|
|
||||||
", needsPhoneVerification=" + needsPhoneVerification +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDefaultProfileImage() {
|
|
||||||
return defaultProfileImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NonNull final User that) {
|
|
||||||
return (int) (id - that.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnJsonParseComplete
|
|
||||||
void onJsonParseComplete() throws IOException {
|
|
||||||
if (id <= 0 || screenName == null) throw new IOException("Malformed User object");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 android.support.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/4/7.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class UserListImpl extends TwitterResponseImpl implements UserList {
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
|
|
||||||
@JsonField(name = "uri")
|
|
||||||
String uri;
|
|
||||||
|
|
||||||
@JsonField(name = "subscriber_count")
|
|
||||||
long subscriberCount;
|
|
||||||
|
|
||||||
@JsonField(name = "member_count")
|
|
||||||
long memberCount;
|
|
||||||
|
|
||||||
@JsonField(name = "mode")
|
|
||||||
Mode mode;
|
|
||||||
|
|
||||||
@JsonField(name = "description")
|
|
||||||
String description;
|
|
||||||
|
|
||||||
@JsonField(name = "slug")
|
|
||||||
String slug;
|
|
||||||
|
|
||||||
@JsonField(name = "full_name")
|
|
||||||
String fullName;
|
|
||||||
|
|
||||||
@JsonField(name = "created_at", typeConverter = TwitterDateConverter.class)
|
|
||||||
Date createdAt;
|
|
||||||
|
|
||||||
@JsonField(name = "following")
|
|
||||||
boolean following;
|
|
||||||
|
|
||||||
@JsonField(name = "user")
|
|
||||||
User user;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUri() {
|
|
||||||
return uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getSubscriberCount() {
|
|
||||||
return subscriberCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getMemberCount() {
|
|
||||||
return memberCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mode getMode() {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSlug() {
|
|
||||||
return slug;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return fullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFollowing() {
|
|
||||||
return following;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public User getUser() {
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NonNull UserList another) {
|
|
||||||
return (int) (id - another.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UserListImpl{" +
|
|
||||||
"id=" + id +
|
|
||||||
", name='" + name + '\'' +
|
|
||||||
", uri='" + uri + '\'' +
|
|
||||||
", subscriberCount=" + subscriberCount +
|
|
||||||
", memberCount=" + memberCount +
|
|
||||||
", mode=" + mode +
|
|
||||||
", description='" + description + '\'' +
|
|
||||||
", slug='" + slug + '\'' +
|
|
||||||
", fullName='" + fullName + '\'' +
|
|
||||||
", createdAt=" + createdAt +
|
|
||||||
", following=" + following +
|
|
||||||
", user=" + user +
|
|
||||||
"} " + super.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.UserMentionEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/3/31.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class UserMentionEntityImpl implements UserMentionEntity {
|
|
||||||
@JsonField(name = "indices", typeConverter = IndicesConverter.class)
|
|
||||||
Indices indices;
|
|
||||||
@JsonField(name = "id")
|
|
||||||
long id;
|
|
||||||
@JsonField(name = "name")
|
|
||||||
String name;
|
|
||||||
@JsonField(name = "screen_name")
|
|
||||||
String screenName;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UserMentionEntityImpl{" +
|
|
||||||
"indices=" + indices +
|
|
||||||
", id=" + id +
|
|
||||||
", name='" + name + '\'' +
|
|
||||||
", screenName='" + screenName + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnd() {
|
|
||||||
return indices.getEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getScreenName() {
|
|
||||||
return screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStart() {
|
|
||||||
return indices.getStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.JsonObject;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Warning;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/5/26.
|
|
||||||
*/
|
|
||||||
@JsonObject
|
|
||||||
public class WarningImpl implements Warning {
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Activity;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class ActivityResponseListMapper extends ResponseListMapper<Activity> {
|
|
||||||
public ActivityResponseListMapper() {
|
|
||||||
super(Activity.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.DirectMessage;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class DirectMessageResponseListMapper extends ResponseListMapper<DirectMessage> {
|
|
||||||
public DirectMessageResponseListMapper() {
|
|
||||||
super(DirectMessage.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Language;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class LanguageResponseListMapper extends ResponseListMapper<Language> {
|
|
||||||
public LanguageResponseListMapper() {
|
|
||||||
super(Language.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Location;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class LocationResponseListMapper extends ResponseListMapper<Location> {
|
|
||||||
public LocationResponseListMapper() {
|
|
||||||
super(Location.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Place;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class PlaceResponseListMapper extends ResponseListMapper<Place> {
|
|
||||||
public PlaceResponseListMapper() {
|
|
||||||
super(Place.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.SavedSearch;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class SavedSearchResponseListMapper extends ResponseListMapper<SavedSearch> {
|
|
||||||
public SavedSearchResponseListMapper() {
|
|
||||||
super(SavedSearch.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class StatusResponseListMapper extends ResponseListMapper<Status> {
|
|
||||||
public StatusResponseListMapper() {
|
|
||||||
super(Status.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.Trends;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class TrendsResponseListMapper extends ResponseListMapper<Trends> {
|
|
||||||
public TrendsResponseListMapper() {
|
|
||||||
super(Trends.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.UserList;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class UserListResponseListMapper extends ResponseListMapper<UserList> {
|
|
||||||
public UserListResponseListMapper() {
|
|
||||||
super(UserList.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.mapper.list;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.User;
|
|
||||||
import org.mariotaku.twidere.api.twitter.model.impl.ResponseListMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 15/12/13.
|
|
||||||
*/
|
|
||||||
public class UserResponseListMapper extends ResponseListMapper<User> {
|
|
||||||
public UserResponseListMapper() {
|
|
||||||
super(User.class);
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue