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

org.whispersystems.signalservice.internal.push.Preview.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.Preview in SignalService.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 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 okio.ByteString

public class Preview(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val url: String? = null,
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val title: String? = null,
  @field:WireField(
    tag = 3,
    adapter = "org.whispersystems.signalservice.internal.push.AttachmentPointer#ADAPTER",
  )
  @JvmField
  public val image: AttachmentPointer? = null,
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val description: String? = null,
  @field:WireField(
    tag = 5,
    adapter = "com.squareup.wire.ProtoAdapter#UINT64",
  )
  @JvmField
  public val date: Long? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.url = url
    builder.title = title
    builder.image = image
    builder.description = description
    builder.date = date
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is Preview) return false
    if (unknownFields != other.unknownFields) return false
    if (url != other.url) return false
    if (title != other.title) return false
    if (image != other.image) return false
    if (description != other.description) return false
    if (date != other.date) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + (url?.hashCode() ?: 0)
      result = result * 37 + (title?.hashCode() ?: 0)
      result = result * 37 + (image?.hashCode() ?: 0)
      result = result * 37 + (description?.hashCode() ?: 0)
      result = result * 37 + (date?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (url != null) result += """url=${sanitize(url)}"""
    if (title != null) result += """title=${sanitize(title)}"""
    if (image != null) result += """image=$image"""
    if (description != null) result += """description=${sanitize(description)}"""
    if (date != null) result += """date=$date"""
    return result.joinToString(prefix = "Preview{", separator = ", ", postfix = "}")
  }

  public fun copy(
    url: String? = this.url,
    title: String? = this.title,
    image: AttachmentPointer? = this.image,
    description: String? = this.description,
    date: Long? = this.date,
    unknownFields: ByteString = this.unknownFields,
  ): Preview = Preview(url, title, image, description, date, unknownFields)

  public class Builder : Message.Builder() {
    @JvmField
    public var url: String? = null

    @JvmField
    public var title: String? = null

    @JvmField
    public var image: AttachmentPointer? = null

    @JvmField
    public var description: String? = null

    @JvmField
    public var date: Long? = null

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

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

    public fun image(image: AttachmentPointer?): Builder {
      this.image = image
      return this
    }

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

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

    public override fun build(): Preview = Preview(
      url = url,
      title = title,
      image = image,
      description = description,
      date = date,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      Preview::class, 
      "type.googleapis.com/signalservice.Preview", 
      PROTO_2, 
      null, 
      "SignalService.proto"
    ) {
      public override fun encodedSize(`value`: Preview): Int {
        var size = value.unknownFields.size
        size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.url)
        size += ProtoAdapter.STRING.encodedSizeWithTag(2, value.title)
        size += AttachmentPointer.ADAPTER.encodedSizeWithTag(3, value.image)
        size += ProtoAdapter.STRING.encodedSizeWithTag(4, value.description)
        size += ProtoAdapter.UINT64.encodedSizeWithTag(5, value.date)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: Preview): Unit {
        ProtoAdapter.STRING.encodeWithTag(writer, 1, value.url)
        ProtoAdapter.STRING.encodeWithTag(writer, 2, value.title)
        AttachmentPointer.ADAPTER.encodeWithTag(writer, 3, value.image)
        ProtoAdapter.STRING.encodeWithTag(writer, 4, value.description)
        ProtoAdapter.UINT64.encodeWithTag(writer, 5, value.date)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: Preview): Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.UINT64.encodeWithTag(writer, 5, value.date)
        ProtoAdapter.STRING.encodeWithTag(writer, 4, value.description)
        AttachmentPointer.ADAPTER.encodeWithTag(writer, 3, value.image)
        ProtoAdapter.STRING.encodeWithTag(writer, 2, value.title)
        ProtoAdapter.STRING.encodeWithTag(writer, 1, value.url)
      }

      public override fun decode(reader: ProtoReader): Preview {
        var url: String? = null
        var title: String? = null
        var image: AttachmentPointer? = null
        var description: String? = null
        var date: Long? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> url = ProtoAdapter.STRING.decode(reader)
            2 -> title = ProtoAdapter.STRING.decode(reader)
            3 -> image = AttachmentPointer.ADAPTER.decode(reader)
            4 -> description = ProtoAdapter.STRING.decode(reader)
            5 -> date = ProtoAdapter.UINT64.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return Preview(
          url = url,
          title = title,
          image = image,
          description = description,
          date = date,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: Preview): Preview = value.copy(
        image = value.image?.let(AttachmentPointer.ADAPTER::redact),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy