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

commonMain.google.api.http.kt Maven / Gradle / Ivy

// Transform from google/api/http.proto
@file:GeneratorVersion(version = "0.6.0")

package google.api

import kotlin.Boolean
import kotlin.OptIn
import kotlin.String
import kotlin.collections.List
import kotlin.collections.emptyList
import kotlin.jvm.JvmInline
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kr.jadekim.protobuf.`annotation`.GeneratorVersion
import kr.jadekim.protobuf.`annotation`.ProtobufIndex
import kr.jadekim.protobuf.kotlinx.ProtobufConverterDecoder
import kr.jadekim.protobuf.kotlinx.ProtobufConverterEncoder
import kr.jadekim.protobuf.`annotation`.ProtobufMessage as AnnotationProtobufMessage
import kr.jadekim.protobuf.type.ProtobufMessage as TypeProtobufMessage

@AnnotationProtobufMessage(typeUrl = Http.TYPE_URL)
@Serializable(with = Http.KotlinxSerializer::class)
@SerialName(value = Http.TYPE_URL)
public data class Http(
  @ProtobufIndex(index = 1)
  public val rules: List = emptyList(),
  @ProtobufIndex(index = 2)
  public val fullyDecodeReservedExpansion: Boolean = false,
) : TypeProtobufMessage {
  public companion object {
    public const val TYPE_URL: String = "/google.api.Http"
  }

  @OptIn(ExperimentalSerializationApi::class)
  @Serializer(forClass = Http::class)
  private object ReflectSerializer

  public object KotlinxSerializer : KSerializer {
    private val delegator: KSerializer = ReflectSerializer

    override val descriptor: SerialDescriptor = delegator.descriptor

    override fun serialize(encoder: Encoder, `value`: Http) {
      if (encoder is ProtobufConverterEncoder) {
        encoder.serialize(HttpConverter, value)
        return
      }
      delegator.serialize(encoder, value)
    }

    override fun deserialize(decoder: Decoder): Http {
      if (decoder is ProtobufConverterDecoder) {
        return decoder.deserialize(HttpConverter)
      }
      return delegator.deserialize(decoder)
    }
  }
}

@AnnotationProtobufMessage(typeUrl = HttpRule.TYPE_URL)
@Serializable(with = HttpRule.KotlinxSerializer::class)
@SerialName(value = HttpRule.TYPE_URL)
public data class HttpRule(
  @ProtobufIndex(index = 1)
  public val selector: String = "",
  @ProtobufIndex(index = 7)
  public val body: String = "",
  @ProtobufIndex(index = 12)
  public val responseBody: String = "",
  @ProtobufIndex(index = 11)
  public val additionalBindings: List = emptyList(),
  public val pattern: PatternOneOf = PatternOneOf.Get(),
) : TypeProtobufMessage {
  public companion object {
    public const val TYPE_URL: String = "/google.api.HttpRule"
  }

  @Serializable
  public sealed interface PatternOneOf {
    @JvmInline
    public value class Get(
      @ProtobufIndex(index = 2)
      public val `value`: String = "",
    ) : PatternOneOf

    @JvmInline
    public value class Put(
      @ProtobufIndex(index = 3)
      public val `value`: String = "",
    ) : PatternOneOf

    @JvmInline
    public value class Post(
      @ProtobufIndex(index = 4)
      public val `value`: String = "",
    ) : PatternOneOf

    @JvmInline
    public value class Delete(
      @ProtobufIndex(index = 5)
      public val `value`: String = "",
    ) : PatternOneOf

    @JvmInline
    public value class Patch(
      @ProtobufIndex(index = 6)
      public val `value`: String = "",
    ) : PatternOneOf

    @JvmInline
    public value class Custom(
      @ProtobufIndex(index = 8)
      public val `value`: CustomHttpPattern = CustomHttpPattern(),
    ) : PatternOneOf
  }

  @OptIn(ExperimentalSerializationApi::class)
  @Serializer(forClass = HttpRule::class)
  private object ReflectSerializer

  public object KotlinxSerializer : KSerializer {
    private val delegator: KSerializer = ReflectSerializer

    override val descriptor: SerialDescriptor = delegator.descriptor

    override fun serialize(encoder: Encoder, `value`: HttpRule) {
      if (encoder is ProtobufConverterEncoder) {
        encoder.serialize(HttpRuleConverter, value)
        return
      }
      delegator.serialize(encoder, value)
    }

    override fun deserialize(decoder: Decoder): HttpRule {
      if (decoder is ProtobufConverterDecoder) {
        return decoder.deserialize(HttpRuleConverter)
      }
      return delegator.deserialize(decoder)
    }
  }
}

@AnnotationProtobufMessage(typeUrl = CustomHttpPattern.TYPE_URL)
@Serializable(with = CustomHttpPattern.KotlinxSerializer::class)
@SerialName(value = CustomHttpPattern.TYPE_URL)
public data class CustomHttpPattern(
  @ProtobufIndex(index = 1)
  public val kind: String = "",
  @ProtobufIndex(index = 2)
  public val path: String = "",
) : TypeProtobufMessage {
  public companion object {
    public const val TYPE_URL: String = "/google.api.CustomHttpPattern"
  }

  @OptIn(ExperimentalSerializationApi::class)
  @Serializer(forClass = CustomHttpPattern::class)
  private object ReflectSerializer

  public object KotlinxSerializer : KSerializer {
    private val delegator: KSerializer = ReflectSerializer

    override val descriptor: SerialDescriptor = delegator.descriptor

    override fun serialize(encoder: Encoder, `value`: CustomHttpPattern) {
      if (encoder is ProtobufConverterEncoder) {
        encoder.serialize(CustomHttpPatternConverter, value)
        return
      }
      delegator.serialize(encoder, value)
    }

    override fun deserialize(decoder: Decoder): CustomHttpPattern {
      if (decoder is ProtobufConverterDecoder) {
        return decoder.deserialize(CustomHttpPatternConverter)
      }
      return delegator.deserialize(decoder)
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy