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

org.whispersystems.signalservice.internal.push.AttachmentPointer.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.AttachmentPointer in SignalService.proto
package org.whispersystems.signalservice.`internal`.push

import com.squareup.wire.EnumAdapter
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
import com.squareup.wire.Syntax.PROTO_2
import com.squareup.wire.WireEnum
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.countNonDefa
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Unit
import kotlin.jvm.JvmField
import kotlin.jvm.JvmStatic
import okio.ByteString

public class AttachmentPointer(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#FIXED64",
    oneofName = "attachment_identifier",
  )
  @JvmField
  public val cdnId: Long? = null,
  @field:WireField(
    tag = 15,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    oneofName = "attachment_identifier",
  )
  @JvmField
  public val cdnKey: String? = null,
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val contentType: String? = null,
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val key: ByteString? = null,
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val size: Int? = null,
  @field:WireField(
    tag = 5,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val thumbnail: ByteString? = null,
  @field:WireField(
    tag = 6,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val digest: ByteString? = null,
  @field:WireField(
    tag = 19,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val incrementalMac: ByteString? = null,
  @field:WireField(
    tag = 17,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val incrementalMacChunkSize: Int? = null,
  @field:WireField(
    tag = 7,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val fileName: String? = null,
  @field:WireField(
    tag = 8,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val flags: Int? = null,
  @field:WireField(
    tag = 9,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val width: Int? = null,
  @field:WireField(
    tag = 10,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val height: Int? = null,
  @field:WireField(
    tag = 11,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val caption: String? = null,
  @field:WireField(
    tag = 12,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val blurHash: String? = null,
  @field:WireField(
    tag = 13,
    adapter = "com.squareup.wire.ProtoAdapter#UINT64",
  )
  @JvmField
  public val uploadTimestamp: Long? = null,
  @field:WireField(
    tag = 14,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val cdnNumber: Int? = null,
  @field:WireField(
    tag = 20,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val uuid: ByteString? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  init {
    require(countNonDefa(cdnId, cdnKey) <= 1) {
      "At most one of cdnId, cdnKey may be non-null"
    }
  }

  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.cdnId = cdnId
    builder.cdnKey = cdnKey
    builder.contentType = contentType
    builder.key = key
    builder.size = size
    builder.thumbnail = thumbnail
    builder.digest = digest
    builder.incrementalMac = incrementalMac
    builder.incrementalMacChunkSize = incrementalMacChunkSize
    builder.fileName = fileName
    builder.flags = flags
    builder.width = width
    builder.height = height
    builder.caption = caption
    builder.blurHash = blurHash
    builder.uploadTimestamp = uploadTimestamp
    builder.cdnNumber = cdnNumber
    builder.uuid = uuid
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is AttachmentPointer) return false
    if (unknownFields != other.unknownFields) return false
    if (cdnId != other.cdnId) return false
    if (cdnKey != other.cdnKey) return false
    if (contentType != other.contentType) return false
    if (key != other.key) return false
    if (size != other.size) return false
    if (thumbnail != other.thumbnail) return false
    if (digest != other.digest) return false
    if (incrementalMac != other.incrementalMac) return false
    if (incrementalMacChunkSize != other.incrementalMacChunkSize) return false
    if (fileName != other.fileName) return false
    if (flags != other.flags) return false
    if (width != other.width) return false
    if (height != other.height) return false
    if (caption != other.caption) return false
    if (blurHash != other.blurHash) return false
    if (uploadTimestamp != other.uploadTimestamp) return false
    if (cdnNumber != other.cdnNumber) return false
    if (uuid != other.uuid) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + (cdnId?.hashCode() ?: 0)
      result = result * 37 + (cdnKey?.hashCode() ?: 0)
      result = result * 37 + (contentType?.hashCode() ?: 0)
      result = result * 37 + (key?.hashCode() ?: 0)
      result = result * 37 + (size?.hashCode() ?: 0)
      result = result * 37 + (thumbnail?.hashCode() ?: 0)
      result = result * 37 + (digest?.hashCode() ?: 0)
      result = result * 37 + (incrementalMac?.hashCode() ?: 0)
      result = result * 37 + (incrementalMacChunkSize?.hashCode() ?: 0)
      result = result * 37 + (fileName?.hashCode() ?: 0)
      result = result * 37 + (flags?.hashCode() ?: 0)
      result = result * 37 + (width?.hashCode() ?: 0)
      result = result * 37 + (height?.hashCode() ?: 0)
      result = result * 37 + (caption?.hashCode() ?: 0)
      result = result * 37 + (blurHash?.hashCode() ?: 0)
      result = result * 37 + (uploadTimestamp?.hashCode() ?: 0)
      result = result * 37 + (cdnNumber?.hashCode() ?: 0)
      result = result * 37 + (uuid?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (cdnId != null) result += """cdnId=$cdnId"""
    if (cdnKey != null) result += """cdnKey=${sanitize(cdnKey)}"""
    if (contentType != null) result += """contentType=${sanitize(contentType)}"""
    if (key != null) result += """key=$key"""
    if (size != null) result += """size=$size"""
    if (thumbnail != null) result += """thumbnail=$thumbnail"""
    if (digest != null) result += """digest=$digest"""
    if (incrementalMac != null) result += """incrementalMac=$incrementalMac"""
    if (incrementalMacChunkSize != null) result +=
        """incrementalMacChunkSize=$incrementalMacChunkSize"""
    if (fileName != null) result += """fileName=${sanitize(fileName)}"""
    if (flags != null) result += """flags=$flags"""
    if (width != null) result += """width=$width"""
    if (height != null) result += """height=$height"""
    if (caption != null) result += """caption=${sanitize(caption)}"""
    if (blurHash != null) result += """blurHash=${sanitize(blurHash)}"""
    if (uploadTimestamp != null) result += """uploadTimestamp=$uploadTimestamp"""
    if (cdnNumber != null) result += """cdnNumber=$cdnNumber"""
    if (uuid != null) result += """uuid=$uuid"""
    return result.joinToString(prefix = "AttachmentPointer{", separator = ", ", postfix = "}")
  }

  public fun copy(
    cdnId: Long? = this.cdnId,
    cdnKey: String? = this.cdnKey,
    contentType: String? = this.contentType,
    key: ByteString? = this.key,
    size: Int? = this.size,
    thumbnail: ByteString? = this.thumbnail,
    digest: ByteString? = this.digest,
    incrementalMac: ByteString? = this.incrementalMac,
    incrementalMacChunkSize: Int? = this.incrementalMacChunkSize,
    fileName: String? = this.fileName,
    flags: Int? = this.flags,
    width: Int? = this.width,
    height: Int? = this.height,
    caption: String? = this.caption,
    blurHash: String? = this.blurHash,
    uploadTimestamp: Long? = this.uploadTimestamp,
    cdnNumber: Int? = this.cdnNumber,
    uuid: ByteString? = this.uuid,
    unknownFields: ByteString = this.unknownFields,
  ): AttachmentPointer = AttachmentPointer(cdnId, cdnKey, contentType, key, size, thumbnail, digest,
      incrementalMac, incrementalMacChunkSize, fileName, flags, width, height, caption, blurHash,
      uploadTimestamp, cdnNumber, uuid, unknownFields)

  public class Builder : Message.Builder() {
    @JvmField
    public var cdnId: Long? = null

    @JvmField
    public var cdnKey: String? = null

    @JvmField
    public var contentType: String? = null

    @JvmField
    public var key: ByteString? = null

    @JvmField
    public var size: Int? = null

    @JvmField
    public var thumbnail: ByteString? = null

    @JvmField
    public var digest: ByteString? = null

    @JvmField
    public var incrementalMac: ByteString? = null

    @JvmField
    public var incrementalMacChunkSize: Int? = null

    @JvmField
    public var fileName: String? = null

    @JvmField
    public var flags: Int? = null

    @JvmField
    public var width: Int? = null

    @JvmField
    public var height: Int? = null

    @JvmField
    public var caption: String? = null

    @JvmField
    public var blurHash: String? = null

    @JvmField
    public var uploadTimestamp: Long? = null

    @JvmField
    public var cdnNumber: Int? = null

    @JvmField
    public var uuid: ByteString? = null

    public fun contentType(contentType: String?): Builder {
      this.contentType = contentType
      return this
    }

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

    public fun size(size: Int?): Builder {
      this.size = size
      return this
    }

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

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

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

    public fun incrementalMacChunkSize(incrementalMacChunkSize: Int?): Builder {
      this.incrementalMacChunkSize = incrementalMacChunkSize
      return this
    }

    public fun fileName(fileName: String?): Builder {
      this.fileName = fileName
      return this
    }

    public fun flags(flags: Int?): Builder {
      this.flags = flags
      return this
    }

    public fun width(width: Int?): Builder {
      this.width = width
      return this
    }

    public fun height(height: Int?): Builder {
      this.height = height
      return this
    }

    public fun caption(caption: String?): Builder {
      this.caption = caption
      return this
    }

    public fun blurHash(blurHash: String?): Builder {
      this.blurHash = blurHash
      return this
    }

    public fun uploadTimestamp(uploadTimestamp: Long?): Builder {
      this.uploadTimestamp = uploadTimestamp
      return this
    }

    public fun cdnNumber(cdnNumber: Int?): Builder {
      this.cdnNumber = cdnNumber
      return this
    }

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

    public fun cdnId(cdnId: Long?): Builder {
      this.cdnId = cdnId
      this.cdnKey = null
      return this
    }

    public fun cdnKey(cdnKey: String?): Builder {
      this.cdnKey = cdnKey
      this.cdnId = null
      return this
    }

    public override fun build(): AttachmentPointer = AttachmentPointer(
      cdnId = cdnId,
      cdnKey = cdnKey,
      contentType = contentType,
      key = key,
      size = size,
      thumbnail = thumbnail,
      digest = digest,
      incrementalMac = incrementalMac,
      incrementalMacChunkSize = incrementalMacChunkSize,
      fileName = fileName,
      flags = flags,
      width = width,
      height = height,
      caption = caption,
      blurHash = blurHash,
      uploadTimestamp = uploadTimestamp,
      cdnNumber = cdnNumber,
      uuid = uuid,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      AttachmentPointer::class, 
      "type.googleapis.com/signalservice.AttachmentPointer", 
      PROTO_2, 
      null, 
      "SignalService.proto"
    ) {
      public override fun encodedSize(`value`: AttachmentPointer): Int {
        var size_ = value.unknownFields.size
        size_ += ProtoAdapter.FIXED64.encodedSizeWithTag(1, value.cdnId)
        size_ += ProtoAdapter.STRING.encodedSizeWithTag(15, value.cdnKey)
        size_ += ProtoAdapter.STRING.encodedSizeWithTag(2, value.contentType)
        size_ += ProtoAdapter.BYTES.encodedSizeWithTag(3, value.key)
        size_ += ProtoAdapter.UINT32.encodedSizeWithTag(4, value.size)
        size_ += ProtoAdapter.BYTES.encodedSizeWithTag(5, value.thumbnail)
        size_ += ProtoAdapter.BYTES.encodedSizeWithTag(6, value.digest)
        size_ += ProtoAdapter.BYTES.encodedSizeWithTag(19, value.incrementalMac)
        size_ += ProtoAdapter.UINT32.encodedSizeWithTag(17, value.incrementalMacChunkSize)
        size_ += ProtoAdapter.STRING.encodedSizeWithTag(7, value.fileName)
        size_ += ProtoAdapter.UINT32.encodedSizeWithTag(8, value.flags)
        size_ += ProtoAdapter.UINT32.encodedSizeWithTag(9, value.width)
        size_ += ProtoAdapter.UINT32.encodedSizeWithTag(10, value.height)
        size_ += ProtoAdapter.STRING.encodedSizeWithTag(11, value.caption)
        size_ += ProtoAdapter.STRING.encodedSizeWithTag(12, value.blurHash)
        size_ += ProtoAdapter.UINT64.encodedSizeWithTag(13, value.uploadTimestamp)
        size_ += ProtoAdapter.UINT32.encodedSizeWithTag(14, value.cdnNumber)
        size_ += ProtoAdapter.BYTES.encodedSizeWithTag(20, value.uuid)
        return size_
      }

      public override fun encode(writer: ProtoWriter, `value`: AttachmentPointer): Unit {
        ProtoAdapter.STRING.encodeWithTag(writer, 2, value.contentType)
        ProtoAdapter.BYTES.encodeWithTag(writer, 3, value.key)
        ProtoAdapter.UINT32.encodeWithTag(writer, 4, value.size)
        ProtoAdapter.BYTES.encodeWithTag(writer, 5, value.thumbnail)
        ProtoAdapter.BYTES.encodeWithTag(writer, 6, value.digest)
        ProtoAdapter.BYTES.encodeWithTag(writer, 19, value.incrementalMac)
        ProtoAdapter.UINT32.encodeWithTag(writer, 17, value.incrementalMacChunkSize)
        ProtoAdapter.STRING.encodeWithTag(writer, 7, value.fileName)
        ProtoAdapter.UINT32.encodeWithTag(writer, 8, value.flags)
        ProtoAdapter.UINT32.encodeWithTag(writer, 9, value.width)
        ProtoAdapter.UINT32.encodeWithTag(writer, 10, value.height)
        ProtoAdapter.STRING.encodeWithTag(writer, 11, value.caption)
        ProtoAdapter.STRING.encodeWithTag(writer, 12, value.blurHash)
        ProtoAdapter.UINT64.encodeWithTag(writer, 13, value.uploadTimestamp)
        ProtoAdapter.UINT32.encodeWithTag(writer, 14, value.cdnNumber)
        ProtoAdapter.BYTES.encodeWithTag(writer, 20, value.uuid)
        ProtoAdapter.FIXED64.encodeWithTag(writer, 1, value.cdnId)
        ProtoAdapter.STRING.encodeWithTag(writer, 15, value.cdnKey)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: AttachmentPointer): Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.STRING.encodeWithTag(writer, 15, value.cdnKey)
        ProtoAdapter.FIXED64.encodeWithTag(writer, 1, value.cdnId)
        ProtoAdapter.BYTES.encodeWithTag(writer, 20, value.uuid)
        ProtoAdapter.UINT32.encodeWithTag(writer, 14, value.cdnNumber)
        ProtoAdapter.UINT64.encodeWithTag(writer, 13, value.uploadTimestamp)
        ProtoAdapter.STRING.encodeWithTag(writer, 12, value.blurHash)
        ProtoAdapter.STRING.encodeWithTag(writer, 11, value.caption)
        ProtoAdapter.UINT32.encodeWithTag(writer, 10, value.height)
        ProtoAdapter.UINT32.encodeWithTag(writer, 9, value.width)
        ProtoAdapter.UINT32.encodeWithTag(writer, 8, value.flags)
        ProtoAdapter.STRING.encodeWithTag(writer, 7, value.fileName)
        ProtoAdapter.UINT32.encodeWithTag(writer, 17, value.incrementalMacChunkSize)
        ProtoAdapter.BYTES.encodeWithTag(writer, 19, value.incrementalMac)
        ProtoAdapter.BYTES.encodeWithTag(writer, 6, value.digest)
        ProtoAdapter.BYTES.encodeWithTag(writer, 5, value.thumbnail)
        ProtoAdapter.UINT32.encodeWithTag(writer, 4, value.size)
        ProtoAdapter.BYTES.encodeWithTag(writer, 3, value.key)
        ProtoAdapter.STRING.encodeWithTag(writer, 2, value.contentType)
      }

      public override fun decode(reader: ProtoReader): AttachmentPointer {
        var cdnId: Long? = null
        var cdnKey: String? = null
        var contentType: String? = null
        var key: ByteString? = null
        var size: Int? = null
        var thumbnail: ByteString? = null
        var digest: ByteString? = null
        var incrementalMac: ByteString? = null
        var incrementalMacChunkSize: Int? = null
        var fileName: String? = null
        var flags: Int? = null
        var width: Int? = null
        var height: Int? = null
        var caption: String? = null
        var blurHash: String? = null
        var uploadTimestamp: Long? = null
        var cdnNumber: Int? = null
        var uuid: ByteString? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> cdnId = ProtoAdapter.FIXED64.decode(reader)
            15 -> cdnKey = ProtoAdapter.STRING.decode(reader)
            2 -> contentType = ProtoAdapter.STRING.decode(reader)
            3 -> key = ProtoAdapter.BYTES.decode(reader)
            4 -> size = ProtoAdapter.UINT32.decode(reader)
            5 -> thumbnail = ProtoAdapter.BYTES.decode(reader)
            6 -> digest = ProtoAdapter.BYTES.decode(reader)
            19 -> incrementalMac = ProtoAdapter.BYTES.decode(reader)
            17 -> incrementalMacChunkSize = ProtoAdapter.UINT32.decode(reader)
            7 -> fileName = ProtoAdapter.STRING.decode(reader)
            8 -> flags = ProtoAdapter.UINT32.decode(reader)
            9 -> width = ProtoAdapter.UINT32.decode(reader)
            10 -> height = ProtoAdapter.UINT32.decode(reader)
            11 -> caption = ProtoAdapter.STRING.decode(reader)
            12 -> blurHash = ProtoAdapter.STRING.decode(reader)
            13 -> uploadTimestamp = ProtoAdapter.UINT64.decode(reader)
            14 -> cdnNumber = ProtoAdapter.UINT32.decode(reader)
            20 -> uuid = ProtoAdapter.BYTES.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return AttachmentPointer(
          cdnId = cdnId,
          cdnKey = cdnKey,
          contentType = contentType,
          key = key,
          size = size,
          thumbnail = thumbnail,
          digest = digest,
          incrementalMac = incrementalMac,
          incrementalMacChunkSize = incrementalMacChunkSize,
          fileName = fileName,
          flags = flags,
          width = width,
          height = height,
          caption = caption,
          blurHash = blurHash,
          uploadTimestamp = uploadTimestamp,
          cdnNumber = cdnNumber,
          uuid = uuid,
          unknownFields = unknownFields
        )
      }

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

    private const val serialVersionUID: Long = 0L
  }

  public enum class Flags(
    public override val `value`: Int,
  ) : WireEnum {
    VOICE_MESSAGE(1),
    BORDERLESS(2),
    GIF(4),
    ;

    public companion object {
      @JvmField
      public val ADAPTER: ProtoAdapter = object : EnumAdapter(
        Flags::class, 
        PROTO_2, 
        null
      ) {
        public override fun fromValue(`value`: Int): Flags? = Flags.fromValue(value)
      }

      @JvmStatic
      public fun fromValue(`value`: Int): Flags? = when (value) {
        1 -> VOICE_MESSAGE
        2 -> BORDERLESS
        4 -> GIF
        else -> null
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy