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

commonMain.tools.ozone.moderation.getRepos.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.Did
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.runtime.valueClassSerializer

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

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

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

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

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

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

@Serializable
public data class GetReposResponse(
  public val repos: ReadOnlyList,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy