Twidere-App-Android-Twitter.../twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/MediaUploadResponse.java

178 lines
4.4 KiB
Java
Raw Normal View History

2015-05-09 07:20:47 +02:00
/*
* Twidere - Twitter client for Android
2015-05-09 07:20:47 +02:00
*
2017-04-20 16:18:45 +02:00
* Copyright 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
2015-05-09 07:20:47 +02:00
*
2017-04-20 16:18:45 +02:00
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
2015-05-09 07:20:47 +02:00
*
2017-04-20 16:18:45 +02:00
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
2015-05-09 07:20:47 +02:00
*/
2016-05-13 07:08:02 +02:00
package org.mariotaku.microblog.library.twitter.model;
2014-07-03 07:48:39 +02:00
2016-07-16 12:35:54 +02:00
import android.support.annotation.Nullable;
2016-05-25 14:06:28 +02:00
import android.support.annotation.StringDef;
2015-12-13 14:30:14 +01:00
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
2015-10-21 15:53:46 +02:00
2016-12-01 08:55:38 +01:00
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
2015-12-13 14:30:14 +01:00
/**
* Created by mariotaku on 15/5/7.
*/
@JsonObject
public class MediaUploadResponse extends TwitterResponseObject implements TwitterResponse {
2016-01-14 17:15:11 +01:00
@JsonField(name = "media_id")
String mediaId;
2016-01-14 17:15:11 +01:00
@JsonField(name = "size")
long size;
@JsonField(name = "image")
Image image;
@JsonField(name = "video")
Video video;
2016-05-25 14:06:28 +02:00
@JsonField(name = "processing_info")
2016-07-16 12:35:54 +02:00
@Nullable
2016-05-25 14:06:28 +02:00
ProcessingInfo processingInfo;
2016-01-14 17:15:11 +01:00
public String getId() {
2015-12-13 14:30:14 +01:00
return mediaId;
}
public Image getImage() {
return image;
}
public long getSize() {
return size;
}
2014-07-03 07:48:39 +02:00
2016-01-14 17:15:11 +01:00
public Video getVideo() {
return video;
}
2014-07-03 07:48:39 +02:00
2016-07-16 12:35:54 +02:00
@Nullable
2016-05-25 14:06:28 +02:00
public ProcessingInfo getProcessingInfo() {
return processingInfo;
}
@Override
public String toString() {
return "MediaUploadResponse{" +
"mediaId='" + mediaId + '\'' +
", size=" + size +
", image=" + image +
", video=" + video +
", processingInfo=" + processingInfo +
"} " + super.toString();
}
2016-01-14 17:15:11 +01:00
@JsonObject
public static class Video {
@JsonField(name = "video_type")
String videoType;
public String getVideoType() {
return videoType;
}
2016-05-25 14:06:28 +02:00
@Override
public String toString() {
return "Video{" +
"videoType='" + videoType + '\'' +
'}';
}
2016-01-14 17:15:11 +01:00
}
2014-07-03 07:48:39 +02:00
2015-12-13 14:30:14 +01:00
@JsonObject
public static class Image {
2014-07-03 07:48:39 +02:00
@JsonField(name = "w")
2015-12-13 14:30:14 +01:00
int width;
@JsonField(name = "h")
2015-12-13 14:30:14 +01:00
int height;
@JsonField(name = "image_type")
String imageType;
2014-07-03 07:48:39 +02:00
2015-12-13 14:30:14 +01:00
public int getHeight() {
return height;
}
2014-07-03 07:48:39 +02:00
2015-12-13 14:30:14 +01:00
public String getImageType() {
return imageType;
}
2014-07-03 07:48:39 +02:00
2015-12-13 14:30:14 +01:00
public int getWidth() {
return width;
}
2016-05-25 14:06:28 +02:00
@Override
public String toString() {
return "Image{" +
"width=" + width +
", height=" + height +
", imageType='" + imageType + '\'' +
'}';
}
}
@JsonObject
public static class ProcessingInfo {
@JsonField(name = "state")
@State
String state;
@JsonField(name = "check_after_secs")
long checkAfterSecs;
@JsonField(name = "progress_percent")
int progressPercent;
@JsonField(name = "error")
ErrorInfo error;
@State
public String getState() {
return state;
}
public long getCheckAfterSecs() {
return checkAfterSecs;
}
public int getProgressPercent() {
return progressPercent;
}
public ErrorInfo getError() {
return error;
}
@Override
public String toString() {
return "ProcessingInfo{" +
"state='" + state + '\'' +
", checkAfterSecs=" + checkAfterSecs +
'}';
}
@StringDef({State.PENDING, State.IN_PROGRESS, State.FAILED, State.SUCCEEDED})
2016-12-01 08:55:38 +01:00
@Retention(RetentionPolicy.SOURCE)
2016-05-25 14:06:28 +02:00
public @interface State {
String PENDING = "pending";
String IN_PROGRESS = "in_progress";
String FAILED = "failed";
String SUCCEEDED = "succeeded";
}
2015-05-07 15:31:13 +02:00
}
2014-07-03 07:48:39 +02:00
}