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

org.signal.cdsi.proto.ClientRequest.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: org.signal.cdsi.ClientRequest in CDSI.proto
package org.signal.cdsi.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 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 ClientRequest(
  /**
   * Each ACI/UAK pair is a 32-byte buffer, containing the 16-byte ACI followed
   * by its 16-byte UAK.
   */
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val aciUakPairs: ByteString = ByteString.EMPTY,
  /**
   * Each E164 is an 8-byte big-endian number, as 8 bytes.
   */
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val prevE164s: ByteString = ByteString.EMPTY,
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val newE164s: ByteString = ByteString.EMPTY,
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val discardE164s: ByteString = ByteString.EMPTY,
  /**
   * If true, the client has more pairs or e164s to send.  If false or unset,
   * this is the client's last request, and processing should commence.
   * NOT NECESSARY FOR CDSI
   * bool has_more = 5;
   * If set, a token which allows rate limiting to discount the e164s in
   * the request's prev_e164s, only counting new_e164s.  If not set, then
   * rate limiting considers both prev_e164s' and new_e164s' size.
   */
  @field:WireField(
    tag = 6,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val token: ByteString = ByteString.EMPTY,
  /**
   * After receiving a new token from the server, send back a message just
   * containing a token_ack.
   */
  @field:WireField(
    tag = 7,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val tokenAck: Boolean = false,
  /**
   * Request that, if the server allows, both ACI and PNI be returned even
   * if the aci_uak_pairs don't match.
   */
  @field:WireField(
    tag = 8,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
  )
  @JvmField
  public val returnAcisWithoutUaks: Boolean = false,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.aciUakPairs = aciUakPairs
    builder.prevE164s = prevE164s
    builder.newE164s = newE164s
    builder.discardE164s = discardE164s
    builder.token = token
    builder.tokenAck = tokenAck
    builder.returnAcisWithoutUaks = returnAcisWithoutUaks
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is ClientRequest) return false
    if (unknownFields != other.unknownFields) return false
    if (aciUakPairs != other.aciUakPairs) return false
    if (prevE164s != other.prevE164s) return false
    if (newE164s != other.newE164s) return false
    if (discardE164s != other.discardE164s) return false
    if (token != other.token) return false
    if (tokenAck != other.tokenAck) return false
    if (returnAcisWithoutUaks != other.returnAcisWithoutUaks) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + aciUakPairs.hashCode()
      result = result * 37 + prevE164s.hashCode()
      result = result * 37 + newE164s.hashCode()
      result = result * 37 + discardE164s.hashCode()
      result = result * 37 + token.hashCode()
      result = result * 37 + tokenAck.hashCode()
      result = result * 37 + returnAcisWithoutUaks.hashCode()
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    result += """aciUakPairs=$aciUakPairs"""
    result += """prevE164s=$prevE164s"""
    result += """newE164s=$newE164s"""
    result += """discardE164s=$discardE164s"""
    result += """token=$token"""
    result += """tokenAck=$tokenAck"""
    result += """returnAcisWithoutUaks=$returnAcisWithoutUaks"""
    return result.joinToString(prefix = "ClientRequest{", separator = ", ", postfix = "}")
  }

  public fun copy(
    aciUakPairs: ByteString = this.aciUakPairs,
    prevE164s: ByteString = this.prevE164s,
    newE164s: ByteString = this.newE164s,
    discardE164s: ByteString = this.discardE164s,
    token: ByteString = this.token,
    tokenAck: Boolean = this.tokenAck,
    returnAcisWithoutUaks: Boolean = this.returnAcisWithoutUaks,
    unknownFields: ByteString = this.unknownFields,
  ): ClientRequest = ClientRequest(aciUakPairs, prevE164s, newE164s, discardE164s, token, tokenAck,
      returnAcisWithoutUaks, unknownFields)

  public class Builder : Message.Builder() {
    @JvmField
    public var aciUakPairs: ByteString = ByteString.EMPTY

    @JvmField
    public var prevE164s: ByteString = ByteString.EMPTY

    @JvmField
    public var newE164s: ByteString = ByteString.EMPTY

    @JvmField
    public var discardE164s: ByteString = ByteString.EMPTY

    @JvmField
    public var token: ByteString = ByteString.EMPTY

    @JvmField
    public var tokenAck: Boolean = false

    @JvmField
    public var returnAcisWithoutUaks: Boolean = false

    /**
     * Each ACI/UAK pair is a 32-byte buffer, containing the 16-byte ACI followed
     * by its 16-byte UAK.
     */
    public fun aciUakPairs(aciUakPairs: ByteString): Builder {
      this.aciUakPairs = aciUakPairs
      return this
    }

    /**
     * Each E164 is an 8-byte big-endian number, as 8 bytes.
     */
    public fun prevE164s(prevE164s: ByteString): Builder {
      this.prevE164s = prevE164s
      return this
    }

    public fun newE164s(newE164s: ByteString): Builder {
      this.newE164s = newE164s
      return this
    }

    public fun discardE164s(discardE164s: ByteString): Builder {
      this.discardE164s = discardE164s
      return this
    }

    /**
     * If true, the client has more pairs or e164s to send.  If false or unset,
     * this is the client's last request, and processing should commence.
     * NOT NECESSARY FOR CDSI
     * bool has_more = 5;
     * If set, a token which allows rate limiting to discount the e164s in
     * the request's prev_e164s, only counting new_e164s.  If not set, then
     * rate limiting considers both prev_e164s' and new_e164s' size.
     */
    public fun token(token: ByteString): Builder {
      this.token = token
      return this
    }

    /**
     * After receiving a new token from the server, send back a message just
     * containing a token_ack.
     */
    public fun tokenAck(tokenAck: Boolean): Builder {
      this.tokenAck = tokenAck
      return this
    }

    /**
     * Request that, if the server allows, both ACI and PNI be returned even
     * if the aci_uak_pairs don't match.
     */
    public fun returnAcisWithoutUaks(returnAcisWithoutUaks: Boolean): Builder {
      this.returnAcisWithoutUaks = returnAcisWithoutUaks
      return this
    }

    public override fun build(): ClientRequest = ClientRequest(
      aciUakPairs = aciUakPairs,
      prevE164s = prevE164s,
      newE164s = newE164s,
      discardE164s = discardE164s,
      token = token,
      tokenAck = tokenAck,
      returnAcisWithoutUaks = returnAcisWithoutUaks,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      ClientRequest::class, 
      "type.googleapis.com/org.signal.cdsi.ClientRequest", 
      PROTO_3, 
      null, 
      "CDSI.proto"
    ) {
      public override fun encodedSize(`value`: ClientRequest): Int {
        var size = value.unknownFields.size
        if (value.aciUakPairs != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(1,
            value.aciUakPairs)
        if (value.prevE164s != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(2,
            value.prevE164s)
        if (value.newE164s != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(3,
            value.newE164s)
        if (value.discardE164s != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(4,
            value.discardE164s)
        if (value.token != ByteString.EMPTY) size += ProtoAdapter.BYTES.encodedSizeWithTag(6,
            value.token)
        if (value.tokenAck != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(7, value.tokenAck)
        if (value.returnAcisWithoutUaks != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(8,
            value.returnAcisWithoutUaks)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: ClientRequest): Unit {
        if (value.aciUakPairs != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 1,
            value.aciUakPairs)
        if (value.prevE164s != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 2,
            value.prevE164s)
        if (value.newE164s != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 3,
            value.newE164s)
        if (value.discardE164s != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 4,
            value.discardE164s)
        if (value.token != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 6,
            value.token)
        if (value.tokenAck != false) ProtoAdapter.BOOL.encodeWithTag(writer, 7, value.tokenAck)
        if (value.returnAcisWithoutUaks != false) ProtoAdapter.BOOL.encodeWithTag(writer, 8,
            value.returnAcisWithoutUaks)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: ClientRequest): Unit {
        writer.writeBytes(value.unknownFields)
        if (value.returnAcisWithoutUaks != false) ProtoAdapter.BOOL.encodeWithTag(writer, 8,
            value.returnAcisWithoutUaks)
        if (value.tokenAck != false) ProtoAdapter.BOOL.encodeWithTag(writer, 7, value.tokenAck)
        if (value.token != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 6,
            value.token)
        if (value.discardE164s != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 4,
            value.discardE164s)
        if (value.newE164s != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 3,
            value.newE164s)
        if (value.prevE164s != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 2,
            value.prevE164s)
        if (value.aciUakPairs != ByteString.EMPTY) ProtoAdapter.BYTES.encodeWithTag(writer, 1,
            value.aciUakPairs)
      }

      public override fun decode(reader: ProtoReader): ClientRequest {
        var aciUakPairs: ByteString = ByteString.EMPTY
        var prevE164s: ByteString = ByteString.EMPTY
        var newE164s: ByteString = ByteString.EMPTY
        var discardE164s: ByteString = ByteString.EMPTY
        var token: ByteString = ByteString.EMPTY
        var tokenAck: Boolean = false
        var returnAcisWithoutUaks: Boolean = false
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> aciUakPairs = ProtoAdapter.BYTES.decode(reader)
            2 -> prevE164s = ProtoAdapter.BYTES.decode(reader)
            3 -> newE164s = ProtoAdapter.BYTES.decode(reader)
            4 -> discardE164s = ProtoAdapter.BYTES.decode(reader)
            6 -> token = ProtoAdapter.BYTES.decode(reader)
            7 -> tokenAck = ProtoAdapter.BOOL.decode(reader)
            8 -> returnAcisWithoutUaks = ProtoAdapter.BOOL.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return ClientRequest(
          aciUakPairs = aciUakPairs,
          prevE164s = prevE164s,
          newE164s = newE164s,
          discardE164s = discardE164s,
          token = token,
          tokenAck = tokenAck,
          returnAcisWithoutUaks = returnAcisWithoutUaks,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: ClientRequest): ClientRequest = value.copy(
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy