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

commonMain.tools.ozone.moderation.getRecords.kt Maven / Gradle / Ivy

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

package tools.ozone.moderation

import kotlin.Any
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmInline
import kotlinx.collections.immutable.toImmutableList
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.AtUri
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface GetRecordsResponseRecordUnion {
  public class DetailSerializer : KSerializer by valueClassSerializer(
    serialName = "tools.ozone.moderation.defs#recordViewDetail",
    constructor = ::Detail,
    valueProvider = Detail::value,
    valueSerializerProvider = { RecordViewDetail.serializer() },
  )

  @Serializable(with = DetailSerializer::class)
  @JvmInline
  @SerialName("tools.ozone.moderation.defs#recordViewDetail")
  public value class Detail(
    public val `value`: RecordViewDetail,
  ) : GetRecordsResponseRecordUnion

  public class NotFoundSerializer : KSerializer by valueClassSerializer(
    serialName = "tools.ozone.moderation.defs#recordViewNotFound",
    constructor = ::NotFound,
    valueProvider = NotFound::value,
    valueSerializerProvider = { RecordViewNotFound.serializer() },
  )

  @Serializable(with = NotFoundSerializer::class)
  @JvmInline
  @SerialName("tools.ozone.moderation.defs#recordViewNotFound")
  public value class NotFound(
    public val `value`: RecordViewNotFound,
  ) : GetRecordsResponseRecordUnion
}

@Serializable
public data class GetRecordsQueryParams(
  public val uris: ReadOnlyList,
) {
  init {
    require(uris.count() <= 100) {
      "uris.count() must be <= 100, but was ${uris.count()}"
    }
  }

  public fun asList(): ReadOnlyList> = buildList {
    uris.forEach {
      add("uris" to it)
    }
  }.toImmutableList()
}

@Serializable
public data class GetRecordsResponse(
  public val records: ReadOnlyList,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy