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

org.whispersystems.signalservice.internal.push.ProvisionEnvelope.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: signalservice.ProvisionEnvelope in Provisioning.proto
package org.whispersystems.signalservice.`internal`.push

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_2
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 ProvisionEnvelope(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val publicKey: ByteString? = null,
  /**
   * Encrypted ProvisionMessage
   */
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val body: ByteString? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.publicKey = publicKey
    builder.body = body
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is ProvisionEnvelope) return false
    if (unknownFields != other.unknownFields) return false
    if (publicKey != other.publicKey) return false
    if (body != other.body) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + (publicKey?.hashCode() ?: 0)
      result = result * 37 + (body?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (publicKey != null) result += """publicKey=$publicKey"""
    if (body != null) result += """body=$body"""
    return result.joinToString(prefix = "ProvisionEnvelope{", separator = ", ", postfix = "}")
  }

  public fun copy(
    publicKey: ByteString? = this.publicKey,
    body: ByteString? = this.body,
    unknownFields: ByteString = this.unknownFields,
  ): ProvisionEnvelope = ProvisionEnvelope(publicKey, body, unknownFields)

  public class Builder : Message.Builder() {
    @JvmField
    public var publicKey: ByteString? = null

    @JvmField
    public var body: ByteString? = null

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

    /**
     * Encrypted ProvisionMessage
     */
    public fun body(body: ByteString?): Builder {
      this.body = body
      return this
    }

    public override fun build(): ProvisionEnvelope = ProvisionEnvelope(
      publicKey = publicKey,
      body = body,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      ProvisionEnvelope::class, 
      "type.googleapis.com/signalservice.ProvisionEnvelope", 
      PROTO_2, 
      null, 
      "Provisioning.proto"
    ) {
      public override fun encodedSize(`value`: ProvisionEnvelope): Int {
        var size = value.unknownFields.size
        size += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.publicKey)
        size += ProtoAdapter.BYTES.encodedSizeWithTag(2, value.body)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: ProvisionEnvelope): Unit {
        ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.publicKey)
        ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.body)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: ProvisionEnvelope): Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.body)
        ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.publicKey)
      }

      public override fun decode(reader: ProtoReader): ProvisionEnvelope {
        var publicKey: ByteString? = null
        var body: ByteString? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> publicKey = ProtoAdapter.BYTES.decode(reader)
            2 -> body = ProtoAdapter.BYTES.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return ProvisionEnvelope(
          publicKey = publicKey,
          body = body,
          unknownFields = unknownFields
        )
      }

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

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy