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

org.signal.svr2.proto.Response.kt Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: Response in SVR2.proto
package org.signal.svr2.proto

import com.squareup.wire.FieldEncoding
import com.squareup.wire.Message
import com.squareup.wire.ProtoAdapter
import com.squareup.wire.ProtoReader
import com.squareup.wire.ProtoWriter
import com.squareup.wire.ReverseProtoWriter
import com.squareup.wire.Syntax.PROTO_3
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.countNonDefa
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Unit
import kotlin.jvm.JvmField
import okio.ByteString

public class Response(
  @field:WireField(
    tag = 1,
    adapter = "org.signal.svr2.proto.BackupResponse#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val backup: BackupResponse? = null,
  @field:WireField(
    tag = 4,
    adapter = "org.signal.svr2.proto.ExposeResponse#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val expose: ExposeResponse? = null,
  @field:WireField(
    tag = 2,
    adapter = "org.signal.svr2.proto.RestoreResponse#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val restore: RestoreResponse? = null,
  @field:WireField(
    tag = 3,
    adapter = "org.signal.svr2.proto.DeleteResponse#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val delete: DeleteResponse? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  init {
    require(countNonDefa(backup, expose, restore, delete) <= 1) {
      "At most one of backup, expose, restore, delete may be non-null"
    }
  }

  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.backup = backup
    builder.expose = expose
    builder.restore = restore
    builder.delete = delete
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is Response) return false
    if (unknownFields != other.unknownFields) return false
    if (backup != other.backup) return false
    if (expose != other.expose) return false
    if (restore != other.restore) return false
    if (delete != other.delete) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + (backup?.hashCode() ?: 0)
      result = result * 37 + (expose?.hashCode() ?: 0)
      result = result * 37 + (restore?.hashCode() ?: 0)
      result = result * 37 + (delete?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (backup != null) result += """backup=$backup"""
    if (expose != null) result += """expose=$expose"""
    if (restore != null) result += """restore=$restore"""
    if (delete != null) result += """delete=$delete"""
    return result.joinToString(prefix = "Response{", separator = ", ", postfix = "}")
  }

  public fun copy(
    backup: BackupResponse? = this.backup,
    expose: ExposeResponse? = this.expose,
    restore: RestoreResponse? = this.restore,
    delete: DeleteResponse? = this.delete,
    unknownFields: ByteString = this.unknownFields,
  ): Response = Response(backup, expose, restore, delete, unknownFields)

  public class Builder : Message.Builder() {
    @JvmField
    public var backup: BackupResponse? = null

    @JvmField
    public var expose: ExposeResponse? = null

    @JvmField
    public var restore: RestoreResponse? = null

    @JvmField
    public var delete: DeleteResponse? = null

    public fun backup(backup: BackupResponse?): Builder {
      this.backup = backup
      this.expose = null
      this.restore = null
      this.delete = null
      return this
    }

    public fun expose(expose: ExposeResponse?): Builder {
      this.expose = expose
      this.backup = null
      this.restore = null
      this.delete = null
      return this
    }

    public fun restore(restore: RestoreResponse?): Builder {
      this.restore = restore
      this.backup = null
      this.expose = null
      this.delete = null
      return this
    }

    public fun delete(delete: DeleteResponse?): Builder {
      this.delete = delete
      this.backup = null
      this.expose = null
      this.restore = null
      return this
    }

    public override fun build(): Response = Response(
      backup = backup,
      expose = expose,
      restore = restore,
      delete = delete,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      Response::class, 
      "type.googleapis.com/Response", 
      PROTO_3, 
      null, 
      "SVR2.proto"
    ) {
      public override fun encodedSize(`value`: Response): Int {
        var size = value.unknownFields.size
        size += BackupResponse.ADAPTER.encodedSizeWithTag(1, value.backup)
        size += ExposeResponse.ADAPTER.encodedSizeWithTag(4, value.expose)
        size += RestoreResponse.ADAPTER.encodedSizeWithTag(2, value.restore)
        size += DeleteResponse.ADAPTER.encodedSizeWithTag(3, value.delete)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: Response): Unit {
        BackupResponse.ADAPTER.encodeWithTag(writer, 1, value.backup)
        ExposeResponse.ADAPTER.encodeWithTag(writer, 4, value.expose)
        RestoreResponse.ADAPTER.encodeWithTag(writer, 2, value.restore)
        DeleteResponse.ADAPTER.encodeWithTag(writer, 3, value.delete)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: Response): Unit {
        writer.writeBytes(value.unknownFields)
        DeleteResponse.ADAPTER.encodeWithTag(writer, 3, value.delete)
        RestoreResponse.ADAPTER.encodeWithTag(writer, 2, value.restore)
        ExposeResponse.ADAPTER.encodeWithTag(writer, 4, value.expose)
        BackupResponse.ADAPTER.encodeWithTag(writer, 1, value.backup)
      }

      public override fun decode(reader: ProtoReader): Response {
        var backup: BackupResponse? = null
        var expose: ExposeResponse? = null
        var restore: RestoreResponse? = null
        var delete: DeleteResponse? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> backup = BackupResponse.ADAPTER.decode(reader)
            4 -> expose = ExposeResponse.ADAPTER.decode(reader)
            2 -> restore = RestoreResponse.ADAPTER.decode(reader)
            3 -> delete = DeleteResponse.ADAPTER.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return Response(
          backup = backup,
          expose = expose,
          restore = restore,
          delete = delete,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: Response): Response = value.copy(
        backup = value.backup?.let(BackupResponse.ADAPTER::redact),
        expose = value.expose?.let(ExposeResponse.ADAPTER::redact),
        restore = value.restore?.let(RestoreResponse.ADAPTER::redact),
        delete = value.delete?.let(DeleteResponse.ADAPTER::redact),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy