com.github.stormbit.vksdk.objects.models.PrivacySettings.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!
@file:Suppress("unused")
package com.github.stormbit.vksdk.objects.models
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class PrivacySettings(
@SerialName("category") val category: Category? = null,
@SerialName("owners") val owners: Ids? = null,
@SerialName("lists") val lists: Ids? = null
) {
@Serializable
enum class Category(val value: String) {
@SerialName("all")
ALL("all"),
@SerialName("friends")
FRIENDS("friends"),
@SerialName("friends_of_friends")
FRIENDS_OF_FRIENDS("friends_of_friends"),
@SerialName("friends_of_friends_only")
FRIENDS_OF_FRIENDS_ONLY("friends_of_friends_only"),
@SerialName("only_me")
ONLY_ME("only_me"),
@SerialName("nobody")
NOBODY("nobody")
}
@Serializable
data class Ids(
@SerialName("allowed") val allowed: List? = null,
@SerialName("excluded") val excluded: List? = null
)
fun toRequestString(): String {
val result = mutableListOf()
if (category != null) result.add(category.value)
if (owners?.allowed != null) for (id in owners.allowed) result.add("$id")
if (owners?.excluded != null) for (id in owners.excluded) result.add("-$id")
if (lists?.allowed != null) for (id in lists.allowed) result.add("list$id")
if (lists?.excluded != null) for (id in lists.excluded) result.add("-list$id")
return result.joinToString(",")
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy