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

commonMain.chat.bsky.convo.getMessages.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("DEPRECATION")

package chat.bsky.convo

import kotlin.Any
import kotlin.Long
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmInline
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.JsonContent
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface GetMessagesResponseMessageUnion {
  public class MessageViewSerializer : KSerializer by valueClassSerializer(
    serialName = "chat.bsky.convo.defs#messageView",
    constructor = ::MessageView,
    valueProvider = MessageView::value,
    valueSerializerProvider = { chat.bsky.convo.MessageView.serializer() },
  )

  @JvmInline
  @Serializable(with = MessageViewSerializer::class)
  @SerialName("chat.bsky.convo.defs#messageView")
  public value class MessageView(
    public val `value`: chat.bsky.convo.MessageView,
  ) : GetMessagesResponseMessageUnion

  public class DeletedMessageViewSerializer : KSerializer by valueClassSerializer(
    serialName = "chat.bsky.convo.defs#deletedMessageView",
    constructor = ::DeletedMessageView,
    valueProvider = DeletedMessageView::value,
    valueSerializerProvider = { chat.bsky.convo.DeletedMessageView.serializer() },
  )

  @JvmInline
  @Serializable(with = DeletedMessageViewSerializer::class)
  @SerialName("chat.bsky.convo.defs#deletedMessageView")
  public value class DeletedMessageView(
    public val `value`: chat.bsky.convo.DeletedMessageView,
  ) : GetMessagesResponseMessageUnion

  @JvmInline
  @Serializable
  public value class Unknown(
    public val `value`: JsonContent,
  ) : GetMessagesResponseMessageUnion
}

@Serializable
public data class GetMessagesQueryParams(
  public val convoId: String,
  public val limit: Long? = 50,
  public val cursor: String? = null,
) {
  init {
    require(limit == null || limit >= 1) {
      "limit must be >= 1, but was $limit"
    }
    require(limit == null || limit <= 100) {
      "limit must be <= 100, but was $limit"
    }
  }

  public fun asList(): List> = buildList {
    add("convoId" to convoId)
    add("limit" to limit)
    add("cursor" to cursor)
  }
}

@Serializable
public data class GetMessagesResponse(
  public val cursor: String? = null,
  public val messages: List,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy