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

org.signal.svr2.proto.Request.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: Request 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 Request(
  @field:WireField(
    tag = 2,
    adapter = "org.signal.svr2.proto.BackupRequest#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val backup: BackupRequest? = null,
  @field:WireField(
    tag = 5,
    adapter = "org.signal.svr2.proto.ExposeRequest#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val expose: ExposeRequest? = null,
  @field:WireField(
    tag = 3,
    adapter = "org.signal.svr2.proto.RestoreRequest#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val restore: RestoreRequest? = null,
  @field:WireField(
    tag = 4,
    adapter = "org.signal.svr2.proto.DeleteRequest#ADAPTER",
    oneofName = "inner",
  )
  @JvmField
  public val delete: DeleteRequest? = 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 Request) 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 = "Request{", separator = ", ", postfix = "}")
  }

  public fun copy(
    backup: BackupRequest? = this.backup,
    expose: ExposeRequest? = this.expose,
    restore: RestoreRequest? = this.restore,
    delete: DeleteRequest? = this.delete,
    unknownFields: ByteString = this.unknownFields,
  ): Request = Request(backup, expose, restore, delete, unknownFields)

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

    @JvmField
    public var expose: ExposeRequest? = null

    @JvmField
    public var restore: RestoreRequest? = null

    @JvmField
    public var delete: DeleteRequest? = null

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

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

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

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

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

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      Request::class, 
      "type.googleapis.com/Request", 
      PROTO_3, 
      null, 
      "SVR2.proto"
    ) {
      public override fun encodedSize(`value`: Request): Int {
        var size = value.unknownFields.size
        size += BackupRequest.ADAPTER.encodedSizeWithTag(2, value.backup)
        size += ExposeRequest.ADAPTER.encodedSizeWithTag(5, value.expose)
        size += RestoreRequest.ADAPTER.encodedSizeWithTag(3, value.restore)
        size += DeleteRequest.ADAPTER.encodedSizeWithTag(4, value.delete)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: Request): Unit {
        BackupRequest.ADAPTER.encodeWithTag(writer, 2, value.backup)
        ExposeRequest.ADAPTER.encodeWithTag(writer, 5, value.expose)
        RestoreRequest.ADAPTER.encodeWithTag(writer, 3, value.restore)
        DeleteRequest.ADAPTER.encodeWithTag(writer, 4, value.delete)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: Request): Unit {
        writer.writeBytes(value.unknownFields)
        DeleteRequest.ADAPTER.encodeWithTag(writer, 4, value.delete)
        RestoreRequest.ADAPTER.encodeWithTag(writer, 3, value.restore)
        ExposeRequest.ADAPTER.encodeWithTag(writer, 5, value.expose)
        BackupRequest.ADAPTER.encodeWithTag(writer, 2, value.backup)
      }

      public override fun decode(reader: ProtoReader): Request {
        var backup: BackupRequest? = null
        var expose: ExposeRequest? = null
        var restore: RestoreRequest? = null
        var delete: DeleteRequest? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            2 -> backup = BackupRequest.ADAPTER.decode(reader)
            5 -> expose = ExposeRequest.ADAPTER.decode(reader)
            3 -> restore = RestoreRequest.ADAPTER.decode(reader)
            4 -> delete = DeleteRequest.ADAPTER.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return Request(
          backup = backup,
          expose = expose,
          restore = restore,
          delete = delete,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: Request): Request = value.copy(
        backup = value.backup?.let(BackupRequest.ADAPTER::redact),
        expose = value.expose?.let(ExposeRequest.ADAPTER::redact),
        restore = value.restore?.let(RestoreRequest.ADAPTER::redact),
        delete = value.delete?.let(DeleteRequest.ADAPTER::redact),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy