com.github.stormbit.vksdk.objects.attachments.Audio.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vk-bot-sdk-kotlin Show documentation
Show all versions of vk-bot-sdk-kotlin Show documentation
The Kotlin library for working with VK api
The newest version!
package com.github.stormbit.vksdk.objects.attachments
import com.github.stormbit.vksdk.vkapi.methods.Attachment
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class Audio(
@SerialName("access_key") override val accessKey: String? = null,
@SerialName("ads") val ads: Ads? = null,
@SerialName("album") val album: Album? = null,
@SerialName("artist") val artist: String,
@SerialName("date") val date: Int,
@SerialName("duration") val duration: Int,
@SerialName("featured_artists") val featuredArtists: List? = null,
@SerialName("id") override val id: Int,
@SerialName("is_explicit") val isExplicit: Boolean,
@SerialName("is_focus_track") val isFocusTrack: Boolean,
@SerialName("is_licensed") val isLicensed: Boolean,
@SerialName("main_artists") val mainArtists: List? = null,
@SerialName("owner_id") override val ownerId: Int,
@SerialName("short_videos_allowed") val shortVideosAllowed: Boolean,
@SerialName("stories_allowed") val storiesAllowed: Boolean,
@SerialName("stories_cover_allowed") val storiesCoverAllowed: Boolean,
@SerialName("title") val title: String,
@SerialName("track_code") val trackCode: String,
@SerialName("url") val url: String
) : Attachment {
override val typeAttachment: AttachmentType get() = AttachmentType.AUDIO
@Suppress("unused")
val mp3Url by lazy {
val url = url.replace("/index.m3u8", ".mp3")
val parts = url.split("/")
parts.indices.filter { it != 4 }.joinToString("/") { parts[it] }
}
@Serializable
data class Ads(
@SerialName("account_age_type") val accountAgeType: String,
@SerialName("content_id") val contentId: String,
@SerialName("duration") val duration: String,
@SerialName("puid1") val puid1: String,
@SerialName("puid22") val puid22: String
)
@Serializable
data class Album(
@SerialName("access_key") val accessKey: String,
@SerialName("id") val id: Int,
@SerialName("owner_id") val ownerId: Int,
@SerialName("thumb") val thumb: Thumb? = null,
@SerialName("title") val title: String
) {
@Serializable
data class Thumb(
@SerialName("height") val height: Int,
@SerialName("photo_1200") val photo1200: String,
@SerialName("photo_135") val photo135: String,
@SerialName("photo_270") val photo270: String,
@SerialName("photo_300") val photo300: String,
@SerialName("photo_34") val photo34: String,
@SerialName("photo_600") val photo600: String,
@SerialName("photo_68") val photo68: String,
@SerialName("width") val width: Int
)
}
@Serializable
data class FeaturedArtist(
@SerialName("domain") val domain: String,
@SerialName("id") val id: String,
@SerialName("name") val name: String
)
@Serializable
data class MainArtist(
@SerialName("domain") val domain: String? = null,
@SerialName("id") val id: String? = null,
@SerialName("name") val name: String
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy