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

commonMain.com.atproto.sync.subscribeRepos.kt Maven / Gradle / Ivy

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

package com.atproto.sync

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 SubscribeReposMessageUnion {
  public class CommitSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#commit",
    constructor = ::Commit,
    valueProvider = Commit::value,
    valueSerializerProvider = { SubscribeReposCommit.serializer() },
  )

  @JvmInline
  @Serializable(with = CommitSerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#commit")
  public value class Commit(
    public val `value`: SubscribeReposCommit,
  ) : SubscribeReposMessageUnion

  public class IdentitySerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#identity",
    constructor = ::Identity,
    valueProvider = Identity::value,
    valueSerializerProvider = { SubscribeReposIdentity.serializer() },
  )

  @JvmInline
  @Serializable(with = IdentitySerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#identity")
  public value class Identity(
    public val `value`: SubscribeReposIdentity,
  ) : SubscribeReposMessageUnion

  public class AccountSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#account",
    constructor = ::Account,
    valueProvider = Account::value,
    valueSerializerProvider = { SubscribeReposAccount.serializer() },
  )

  @JvmInline
  @Serializable(with = AccountSerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#account")
  public value class Account(
    public val `value`: SubscribeReposAccount,
  ) : SubscribeReposMessageUnion

  public class HandleSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#handle",
    constructor = ::Handle,
    valueProvider = Handle::value,
    valueSerializerProvider = { SubscribeReposHandle.serializer() },
  )

  @JvmInline
  @Serializable(with = HandleSerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#handle")
  public value class Handle(
    public val `value`: SubscribeReposHandle,
  ) : SubscribeReposMessageUnion

  public class MigrateSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#migrate",
    constructor = ::Migrate,
    valueProvider = Migrate::value,
    valueSerializerProvider = { SubscribeReposMigrate.serializer() },
  )

  @JvmInline
  @Serializable(with = MigrateSerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#migrate")
  public value class Migrate(
    public val `value`: SubscribeReposMigrate,
  ) : SubscribeReposMessageUnion

  public class TombstoneSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#tombstone",
    constructor = ::Tombstone,
    valueProvider = Tombstone::value,
    valueSerializerProvider = { SubscribeReposTombstone.serializer() },
  )

  @JvmInline
  @Serializable(with = TombstoneSerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#tombstone")
  public value class Tombstone(
    public val `value`: SubscribeReposTombstone,
  ) : SubscribeReposMessageUnion

  public class InfoSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.sync.subscribeRepos#info",
    constructor = ::Info,
    valueProvider = Info::value,
    valueSerializerProvider = { SubscribeReposInfo.serializer() },
  )

  @JvmInline
  @Serializable(with = InfoSerializer::class)
  @SerialName("com.atproto.sync.subscribeRepos#info")
  public value class Info(
    public val `value`: SubscribeReposInfo,
  ) : SubscribeReposMessageUnion

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

/**
 * @param cursor The last known event seq number to backfill from.
 */
@Serializable
public data class SubscribeReposQueryParams(
  /**
   * The last known event seq number to backfill from.
   */
  public val cursor: Long? = null,
) {
  public fun asList(): List> = buildList {
    add("cursor" to cursor)
  }
}

public typealias SubscribeReposMessage = SubscribeReposMessageUnion




© 2015 - 2024 Weber Informatics LLC | Privacy Policy