api refactoring for retrofit2
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
package com.meloda.fast.api.model
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class BaseVKConversation(
|
||||
val peer: Peer,
|
||||
@SerializedName("last_message_id")
|
||||
val lastMessageId: Int,
|
||||
@SerializedName("in_read")
|
||||
val inRead: Int,
|
||||
@SerializedName("out_read")
|
||||
val outRead: Int,
|
||||
@SerializedName("sort_id")
|
||||
val sortId: SortId,
|
||||
@SerializedName("last_conversation_message_id")
|
||||
val lastConversationMessageId: Int,
|
||||
@SerializedName("is_marked_unread")
|
||||
val isMarkedUnread: Boolean,
|
||||
val important: Boolean,
|
||||
@SerializedName("push_settings")
|
||||
val pushSettings: PushSettings,
|
||||
@SerializedName("can_write")
|
||||
val canWrite: CanWrite,
|
||||
@SerializedName("can_send_money")
|
||||
val canSendMoney: Boolean,
|
||||
@SerializedName("can_receive_money")
|
||||
val canReceiveMoney: Boolean,
|
||||
@SerializedName("chat_settings")
|
||||
val chatSettings: ChatSettings
|
||||
) : Parcelable {
|
||||
|
||||
@Parcelize
|
||||
data class Peer(
|
||||
val id: Int,
|
||||
val type: String,
|
||||
@SerializedName("local_id")
|
||||
val localId: Int
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class SortId(
|
||||
@SerializedName("major_id")
|
||||
val majorId: Int,
|
||||
@SerializedName("minor_id")
|
||||
val minorId: Int
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class PushSettings(
|
||||
@SerializedName("disabled_forever")
|
||||
val disabledForever: Boolean,
|
||||
@SerializedName("no_sound")
|
||||
val noSound: Boolean,
|
||||
@SerializedName("disabled_mentions")
|
||||
val disabledMentions: Boolean,
|
||||
@SerializedName("disabled_mass_mentions")
|
||||
val disabledMassMentions: Boolean
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class CanWrite(
|
||||
val allowed: Boolean
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class ChatSettings(
|
||||
@SerializedName("owner_id")
|
||||
val ownerId: Int,
|
||||
val title: String,
|
||||
val state: String,
|
||||
val acl: Acl,
|
||||
@SerializedName("members_count")
|
||||
val membersCount: Int,
|
||||
@SerializedName("friends_count")
|
||||
val friendsCount: Int,
|
||||
val photo: Photo,
|
||||
@SerializedName("admin_ids")
|
||||
val adminsIds: List<Int>,
|
||||
@SerializedName("active_ids")
|
||||
val activeIds: List<Int>,
|
||||
@SerializedName("is_group_channel")
|
||||
val isGroupChannel: Boolean,
|
||||
@SerializedName("is_disappearing")
|
||||
val isDisappearing: Boolean,
|
||||
@SerializedName("is_service")
|
||||
val isService: Boolean
|
||||
) : Parcelable {
|
||||
|
||||
@Parcelize
|
||||
data class Acl(
|
||||
@SerializedName("can_change_info")
|
||||
val canChangeInfo: Boolean,
|
||||
@SerializedName("can_change_invite_link")
|
||||
val canChangeInviteLink: Boolean,
|
||||
@SerializedName("can_change_pin")
|
||||
val canChangePin: Boolean,
|
||||
@SerializedName("can_invite")
|
||||
val canInvite: Boolean,
|
||||
@SerializedName("can_promote_users")
|
||||
val canPromoteUsers: Boolean,
|
||||
@SerializedName("can_see_invite_link")
|
||||
val canSeeInviteLink: Boolean,
|
||||
@SerializedName("can_moderate")
|
||||
val canModerate: Boolean,
|
||||
@SerializedName("can_copy_chat")
|
||||
val canCopyChat: Boolean,
|
||||
@SerializedName("can_call")
|
||||
val canCall: Boolean,
|
||||
@SerializedName("can_use_mass_mentions")
|
||||
val canUseMassMentions: Boolean,
|
||||
@SerializedName("can_change_style")
|
||||
val canChangeStyle: Boolean
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Photo(
|
||||
@SerializedName("photo_50")
|
||||
val photo50: String,
|
||||
@SerializedName("photo_100")
|
||||
val photo100: String,
|
||||
@SerializedName("photo_200")
|
||||
val photo200: String,
|
||||
@SerializedName("is_default_photo")
|
||||
val isDefaultPhoto: Boolean
|
||||
) : Parcelable
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.meloda.fast.api.model
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import kotlinx.parcelize.RawValue
|
||||
|
||||
@Parcelize
|
||||
data class BaseVKMessage(
|
||||
val date: Int,
|
||||
@SerializedName("from_id")
|
||||
val fromId: Int,
|
||||
val id: Int,
|
||||
val out: Int,
|
||||
@SerializedName("peer_id")
|
||||
val peerId: Int,
|
||||
val text: String,
|
||||
@SerializedName("conversation_message_id")
|
||||
val conversationMessageId: Int,
|
||||
@SerializedName("fwd_messages")
|
||||
val fwdMessages: List<BaseVKMessage> = listOf(),
|
||||
val important: Boolean,
|
||||
@SerializedName("random_id")
|
||||
val randomId: Int,
|
||||
val attachments: @RawValue List<Any> = listOf(),
|
||||
@SerializedName("is_hidden")
|
||||
val isHidden: Boolean,
|
||||
val payload: String,
|
||||
val geo: Geo?
|
||||
) : Parcelable {
|
||||
|
||||
@Parcelize
|
||||
data class Geo(
|
||||
val type: String,
|
||||
val coordinates: Coordinates,
|
||||
val place: Place
|
||||
) : Parcelable {
|
||||
|
||||
|
||||
@Parcelize
|
||||
data class Coordinates(val latitude: Float, val longitude: Float) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Place(val country: String, val city: String, val title: String) : Parcelable
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.meloda.fast.api.model.attachments
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class BaseVKAttachmentItem(
|
||||
val type: String,
|
||||
val photo: VKPhotoAttachment?,
|
||||
val video: VKVideoAttachment?,
|
||||
val audio: VKAudioAttachment?,
|
||||
val doc: VKFileAttachment?,
|
||||
val link: VKLinkAttachment?
|
||||
) : Parcelable
|
||||
|
||||
abstract class BaseVKAttachment : Parcelable
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.meloda.fast.api.model.attachments
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class VKAudioAttachment(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
val artist: String,
|
||||
val duration: Int,
|
||||
val url: String,
|
||||
val date: Int,
|
||||
@SerializedName("owner_id")
|
||||
val ownerId: Int,
|
||||
@SerializedName("access_key")
|
||||
val accessKey: String,
|
||||
@SerializedName("is_explicit")
|
||||
val isExplicit: Boolean,
|
||||
@SerializedName("is_focus_track")
|
||||
val isFocusTrack: Boolean,
|
||||
@SerializedName("is_licensed")
|
||||
val isLicensed: Boolean,
|
||||
@SerializedName("track_code")
|
||||
val trackCode: String,
|
||||
@SerializedName("genre_id")
|
||||
val genreId: Int,
|
||||
val album: Album,
|
||||
@SerializedName("short_videos_allowed")
|
||||
val shortVideosAllowed: Boolean,
|
||||
@SerializedName("stories_allowed")
|
||||
val storiesAllowed: Boolean,
|
||||
@SerializedName("stories_cover_allowed")
|
||||
val storiesCoverAllowed: Boolean
|
||||
) : BaseVKAttachment() {
|
||||
|
||||
@Parcelize
|
||||
data class Album(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
@SerializedName("owner_id")
|
||||
val ownerId: Int,
|
||||
@SerializedName("access_key")
|
||||
val accessKey: String,
|
||||
val thumb: Thumb
|
||||
) : Parcelable {
|
||||
|
||||
@Parcelize
|
||||
data class Thumb(
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
@SerializedName("photo_34")
|
||||
val photo34: String,
|
||||
@SerializedName("photo_68")
|
||||
val photo68: String,
|
||||
@SerializedName("photo_135")
|
||||
val photo135: String,
|
||||
@SerializedName("photo_270")
|
||||
val photo270: String,
|
||||
@SerializedName("photo_300")
|
||||
val photo300: String,
|
||||
@SerializedName("photo_600")
|
||||
val photo600: String,
|
||||
@SerializedName("photo_1200")
|
||||
val photo1200: String
|
||||
) : Parcelable
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.meloda.fast.api.model.attachments
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class VKFileAttachment(
|
||||
val id: Int,
|
||||
@SerializedName("owner_id")
|
||||
val ownerId: Int,
|
||||
val title: String,
|
||||
val size: Int,
|
||||
val ext: String,
|
||||
val date: Int,
|
||||
val type: Int,
|
||||
val url: String,
|
||||
val preview: Preview?,
|
||||
@SerializedName("is_licensed")
|
||||
val isLicensed: Int,
|
||||
@SerializedName("access_key")
|
||||
val accessKey: String,
|
||||
@SerializedName("web_preview_url")
|
||||
val webPreviewUrl: String?
|
||||
) : BaseVKAttachment() {
|
||||
|
||||
@Parcelize
|
||||
data class Preview(
|
||||
val photo: Photo?,
|
||||
val video: Video?
|
||||
) : Parcelable {
|
||||
|
||||
@Parcelize
|
||||
data class Photo(val sizes: List<Size>) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Video(
|
||||
val src: String,
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
@SerializedName("file_size")
|
||||
val fileSize: Int
|
||||
) : Parcelable
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.meloda.fast.api.model.attachments
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class VKLinkAttachment(
|
||||
val url: String,
|
||||
val title: String,
|
||||
val caption: String,
|
||||
val photo: VKPhotoAttachment,
|
||||
val target: String,
|
||||
@SerializedName("is_favorite")
|
||||
val isFavorite: Boolean
|
||||
) : BaseVKAttachment()
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.meloda.fast.api.model.attachments
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class VKPhotoAttachment(
|
||||
@SerializedName("album_id")
|
||||
val albumId: Int,
|
||||
val date: Int,
|
||||
val id: Int,
|
||||
@SerializedName("owner_id")
|
||||
val ownerId: Int,
|
||||
@SerializedName("has_tags")
|
||||
val hasTags: Boolean,
|
||||
@SerializedName("access_key")
|
||||
val accessKey: String,
|
||||
val sizes: List<Size>,
|
||||
val text: String,
|
||||
@SerializedName("user_id")
|
||||
val userId: Int?
|
||||
) : BaseVKAttachment()
|
||||
|
||||
@Parcelize
|
||||
data class Size(
|
||||
val height: Int,
|
||||
val width: Int,
|
||||
val type: String,
|
||||
@SerializedName("url", alternate = ["src"])
|
||||
val url: String,
|
||||
) : Parcelable
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.meloda.fast.api.model.attachments
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class VKVideoAttachment(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
val duration: Int,
|
||||
val date: Int,
|
||||
val comments: Int,
|
||||
val description: String,
|
||||
val player: String,
|
||||
val added: Int,
|
||||
val type: String,
|
||||
val views: Int,
|
||||
@SerializedName("can_comment")
|
||||
val canComment: Int,
|
||||
@SerializedName("can_edit")
|
||||
val canEdit: Int,
|
||||
@SerializedName("can_like")
|
||||
val canLike: Int,
|
||||
@SerializedName("can_repost")
|
||||
val canRepost: Int,
|
||||
@SerializedName("can_subscribe")
|
||||
val canSubscribe: Int,
|
||||
@SerializedName("can_add_to_faves")
|
||||
val canAddToFaves: Int,
|
||||
@SerializedName("can_add")
|
||||
val canAdd: Int,
|
||||
@SerializedName("can_attach_link")
|
||||
val canAttachLink: Int,
|
||||
@SerializedName("access_key")
|
||||
val accessKey: String,
|
||||
@SerializedName("owner_id")
|
||||
val ownerId: Int,
|
||||
@SerializedName("ov_id")
|
||||
val ovId: String,
|
||||
@SerializedName("is_favorite")
|
||||
val isFavorite: Boolean,
|
||||
@SerializedName("track_code")
|
||||
val trackCode: String,
|
||||
val image: List<Image>,
|
||||
@SerializedName("first_frame")
|
||||
val firstFrame: List<FirstFrame>,
|
||||
val files: List<File>,
|
||||
@SerializedName("timeline_thumbs")
|
||||
val timelineThumbs: TimelineThumbs
|
||||
//ads
|
||||
) : BaseVKAttachment() {
|
||||
|
||||
@Parcelize
|
||||
data class Image(
|
||||
val height: Int,
|
||||
val width: Int,
|
||||
val url: String,
|
||||
@SerializedName("with_padding")
|
||||
val withPadding: Int
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class FirstFrame(
|
||||
val height: Int,
|
||||
val width: Int,
|
||||
val url: String
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class File(
|
||||
val mp4_240: String,
|
||||
val mp4_360: String,
|
||||
val mp4_480: String,
|
||||
val mp4_720: String,
|
||||
val mp4_1080: String,
|
||||
val mp4_1440: String,
|
||||
val hls: String,
|
||||
@SerializedName("dash_uni")
|
||||
val dashUni: String,
|
||||
@SerializedName("dash_sep")
|
||||
val dashSep: String,
|
||||
@SerializedName("hls_ondemand")
|
||||
val hlsOnDemand: String,
|
||||
@SerializedName("dash_ondemand")
|
||||
val dashOnDemand: String,
|
||||
@SerializedName("failover_host")
|
||||
val failOverHost: String
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class TimelineThumbs(
|
||||
@SerializedName("count_per_image")
|
||||
val countPerImage: Int,
|
||||
@SerializedName("count_per_row")
|
||||
val countPerRow: Int,
|
||||
@SerializedName("count_total")
|
||||
val countTotal: Int,
|
||||
@SerializedName("frame_height")
|
||||
val frameHeight: Int,
|
||||
@SerializedName("frame_width")
|
||||
val frameWidth: Float,
|
||||
val links: List<String>,
|
||||
@SerializedName("is_uv")
|
||||
val isUv: Boolean,
|
||||
val frequency: Int
|
||||
) : Parcelable
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user