All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.stormbit.vksdk.objects.models.ServiceAction.kt Maven / Gradle / Ivy

The newest version!
package com.github.stormbit.vksdk.objects.models

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
sealed class ServiceAction(@SerialName("type") val type: Type) {

    @Serializable
    @SerialName("chat_photo_update")
    class ChatPhotoUpdate : ServiceAction(Type.CHAT_PHOTO_UPDATE)

    @Serializable
    @SerialName("chat_photo_remove")
    class ChatPhotoRemove : ServiceAction(Type.CHAT_PHOTO_REMOVE)

    @Serializable
    @SerialName("chat_create")
    class ChatCreate : ServiceAction(Type.CHAT_CREATE)

    @Serializable
    @SerialName("chat_title_update")
    data class ChatTitleUpdate(
        @SerialName("text") val newTitle: String
    ) : ServiceAction(Type.CHAT_TITLE_UPDATE)

    @Serializable
    @SerialName("chat_invite_user")
    data class ChatInviteUser(
        @SerialName("member_id") val memberId: Int,
    ) : ServiceAction(Type.CHAT_INVITE_USER) {
        val isActionFromEmail: Boolean get() = memberId < 0
    }

    @Serializable
    @SerialName("chat_invite_user_by_link")
    data class ChatInviteUserByLink(
        @SerialName("member_id") val memberId: Int
    ) : ServiceAction(Type.CHAT_INVITE_USER_BY_LINK)

    @Serializable
    @SerialName("chat_invite_user_by_call")
    data class ChatInviteUserByCall(
        @SerialName("member_id") val memberId: Int,
    ) : ServiceAction(Type.CHAT_INVITE_USER_BY_CALL)

    @Serializable
    @SerialName("chat_kick_user")
    data class ChatKickUser(
        @SerialName("member_id") val memberId: Int
    ) : ServiceAction(Type.CHAT_KICK_USER) {
        val isActionFromEmail: Boolean get() = memberId < 0
    }

    @Serializable
    @SerialName("chat_pin_message")
    data class ChatPinMessage(
        @SerialName("member_id") val memberId: Int,
        @SerialName("conversation_message_id") val conversationMessageId: Int,
        @SerialName("message") val message: String
    ) : ServiceAction(Type.CHAT_PIN_MESSAGE)

    @Serializable
    @SerialName("chat_unpin_message")
    data class ChatUnpinMessage(
        @SerialName("member_id") val memberId: Int,
        @SerialName("conversation_message_id") val conversationMessageId: Int
    ) : ServiceAction(Type.CHAT_UNPIN_MESSAGE)

    @Serializable
    @SerialName("chat_group_call_in_progress")
    class ChatGroupCallInProgress : ServiceAction(Type.CHAT_GROUP_CALL_IN_PROGRESS)

    @Serializable
    @SerialName("chat_screenshot")
    class ChatScreenshot : ServiceAction(Type.CHAT_SCREENSHOT)


    @Serializable
    enum class Type(val value: String) {
        @SerialName("chat_photo_update") CHAT_PHOTO_UPDATE("chat_photo_update"),
        @SerialName("chat_photo_remove") CHAT_PHOTO_REMOVE("chat_photo_remove"),
        @SerialName("chat_create") CHAT_CREATE("chat_create"),
        @SerialName("chat_title_update") CHAT_TITLE_UPDATE("chat_title_update"),
        @SerialName("chat_invite_user") CHAT_INVITE_USER("chat_invite_user"),
        @SerialName("chat_kick_user") CHAT_KICK_USER("chat_kick_user"),
        @SerialName("chat_pin_message") CHAT_PIN_MESSAGE("chat_pin_message"),
        @SerialName("chat_unpin_message") CHAT_UNPIN_MESSAGE("chat_unpin_message"),
        @SerialName("chat_invite_user_by_link") CHAT_INVITE_USER_BY_LINK("chat_invite_user_by_link"),
        @SerialName("chat_screenshot") CHAT_SCREENSHOT("chat_screenshot"),
        @SerialName("chat_group_call_in_progress") CHAT_GROUP_CALL_IN_PROGRESS("group_call_in_progress"),
        @SerialName("chat_invite_user_by_call") CHAT_INVITE_USER_BY_CALL("chat_invite_user_by_call")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy