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

commonMain.sh.christian.ozone.api.xrpc.findSubscriptionSerializer.kt Maven / Gradle / Ivy

The newest version!
package sh.christian.ozone.api.xrpc

import com.atproto.label.SubscribeLabelsMessageUnion
import com.atproto.sync.SubscribeReposMessageUnion
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.reflect.KClass
import kotlinx.serialization.KSerializer

@Suppress("UNCHECKED_CAST")
public fun  findSubscriptionSerializer(parentType: KClass, serialName: String): KSerializer? = when(parentType) {
  SubscribeReposMessageUnion::class -> when {
    "com.atproto.sync.subscribeRepos#commit".endsWith(serialName) ->
        SubscribeReposMessageUnion.Commit.serializer()
    "com.atproto.sync.subscribeRepos#identity".endsWith(serialName) ->
        SubscribeReposMessageUnion.Identity.serializer()
    "com.atproto.sync.subscribeRepos#account".endsWith(serialName) ->
        SubscribeReposMessageUnion.Account.serializer()
    "com.atproto.sync.subscribeRepos#handle".endsWith(serialName) ->
        SubscribeReposMessageUnion.Handle.serializer()
    "com.atproto.sync.subscribeRepos#migrate".endsWith(serialName) ->
        SubscribeReposMessageUnion.Migrate.serializer()
    "com.atproto.sync.subscribeRepos#tombstone".endsWith(serialName) ->
        SubscribeReposMessageUnion.Tombstone.serializer()
    "com.atproto.sync.subscribeRepos#info".endsWith(serialName) ->
        SubscribeReposMessageUnion.Info.serializer()
    else -> null
  }
  SubscribeLabelsMessageUnion::class -> when {
    "com.atproto.label.subscribeLabels#labels".endsWith(serialName) ->
        SubscribeLabelsMessageUnion.Labels.serializer()
    "com.atproto.label.subscribeLabels#info".endsWith(serialName) ->
        SubscribeLabelsMessageUnion.Info.serializer()
    else -> null
  }
  else -> null
} as KSerializer?




© 2015 - 2024 Weber Informatics LLC | Privacy Policy