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

149 lines
3.7 KiB
Java
Raw Normal View History

2017-04-17 06:24:32 +02:00
/*
* Twidere - Twitter client for Android
*
2017-04-20 16:18:45 +02:00
* Copyright 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
2017-04-17 06:24:32 +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
2017-04-17 06:24:32 +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.
2017-04-17 06:24:32 +02:00
*/
package org.mariotaku.microblog.library.mastodon.model;
2020-05-28 09:16:02 +02:00
import androidx.annotation.Nullable;
2017-04-17 06:24:32 +02:00
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
2020-05-28 09:16:02 +02:00
import com.hannesdorfmann.parcelableplease.annotation.ParcelableThisPlease;
2017-04-17 06:24:32 +02:00
/**
* {@see https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#attachment}
*
* Created by mariotaku on 2017/4/17.
*/
@JsonObject
public class Attachment {
/**
* ID of the attachment
*/
@JsonField(name = "id")
String id;
/**
* One of: {@code image}, {@code video}, {@code gifv}
*/
@JsonField(name = "type")
String type;
/**
* URL of the locally hosted version of the image
*/
@JsonField(name = "url")
String url;
/**
* For remote images, the remote URL of the original image
*/
@JsonField(name = "remote_url")
String remoteUrl;
/**
* URL of the preview image
*/
@JsonField(name = "preview_url")
String previewUrl;
/**
* Shorter URL for the image, for insertion into text (only present on local images)
*/
@JsonField(name = "text_url")
String textUrl;
2020-05-28 09:16:02 +02:00
@JsonField(name = "meta")
MetaInfo meta;
2017-04-17 06:24:32 +02:00
public String getId() {
return id;
}
public String getType() {
return type;
}
public String getUrl() {
return url;
}
public String getRemoteUrl() {
return remoteUrl;
}
public String getPreviewUrl() {
return previewUrl;
}
public String getTextUrl() {
return textUrl;
}
2020-05-28 09:16:02 +02:00
public MetaInfo getMeta() {
return meta;
}
@JsonObject
public static class MetaInfo {
@ParcelableThisPlease
@JsonField(name = "focus")
@Nullable
public FocusInfo focus;
@ParcelableThisPlease
@JsonField(name = "original")
@Nullable
public MetaDataInfo original;
@ParcelableThisPlease
@JsonField(name = "small")
@Nullable
public MetaDataInfo small;
@JsonObject
public static class FocusInfo {
@ParcelableThisPlease
@JsonField(name = "x")
public float x;
@ParcelableThisPlease
@JsonField(name = "y")
public float y;
}
@JsonObject
public static class MetaDataInfo {
@ParcelableThisPlease
@JsonField(name = "width")
public long width;
@ParcelableThisPlease
@JsonField(name = "height")
public long height;
@ParcelableThisPlease
@JsonField(name = "aspect")
public float aspect;
}
}
2017-04-17 06:24:32 +02:00
@Override
public String toString() {
return "Attachment{" +
"id='" + id + '\'' +
", type='" + type + '\'' +
", url='" + url + '\'' +
", remoteUrl='" + remoteUrl + '\'' +
", previewUrl='" + previewUrl + '\'' +
", textUrl='" + textUrl + '\'' +
'}';
}
}