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

commonMain.socket.chat.ChatMessage.kt Maven / Gradle / Ivy

Go to download

KMP package which exports compiled protobuf entities to be used by other repos

There is a newer version: 2.89.0
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: socket.chat.ChatMessage in socket/chat.proto
package socket.chat

import com.squareup.wire.FieldEncoding
import com.squareup.wire.Instant
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`.immutableCopyOf
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.AssertionError
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.DeprecationLevel
import kotlin.Int
import kotlin.Long
import kotlin.Nothing
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import okio.ByteString

public class ChatMessage(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "chatId",
  )
  public val chat_id: String = "",
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "peerId",
  )
  public val peer_id: String = "",
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "userId",
  )
  public val user_id: String = "",
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "displayName",
  )
  public val display_name: String = "",
  @field:WireField(
    tag = 5,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
  )
  public val pinned: Boolean = false,
  @field:WireField(
    tag = 6,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "isEdited",
  )
  public val is_edited: Boolean = false,
  @field:WireField(
    tag = 7,
    adapter = "com.squareup.wire.ProtoAdapter#INT32",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "payloadType",
  )
  public val payload_type: Int = 0,
  @field:WireField(
    tag = 8,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
  )
  public val payload: String = "",
  @field:WireField(
    tag = 9,
    adapter = "com.squareup.wire.ProtoAdapter#INSTANT",
    jsonName = "obsoleteCreatedAt",
  )
  public val obsolete_created_at: Instant? = null,
  target_user_ids: List = emptyList(),
  @field:WireField(
    tag = 11,
    adapter = "com.squareup.wire.ProtoAdapter#UINT64",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "createdAt",
  )
  public val created_at: Long = 0L,
  @field:WireField(
    tag = 12,
    adapter = "com.squareup.wire.ProtoAdapter#UINT64",
    jsonName = "createdAtMs",
  )
  public val created_at_ms: Long? = null,
  @field:WireField(
    tag = 13,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    jsonName = "channelId",
  )
  public val channel_id: String? = null,
  /**
   * The index of this message within it's channel
   */
  @field:WireField(
    tag = 14,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    jsonName = "channelIndex",
  )
  public val channel_index: String? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @field:WireField(
    tag = 10,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.REPEATED,
    jsonName = "targetUserIds",
  )
  public val target_user_ids: List = immutableCopyOf("target_user_ids", target_user_ids)

  @Deprecated(
    message = "Shouldn't be used in Kotlin",
    level = DeprecationLevel.HIDDEN,
  )
  public override fun newBuilder(): Nothing = throw
      AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is ChatMessage) return false
    if (unknownFields != other.unknownFields) return false
    if (chat_id != other.chat_id) return false
    if (peer_id != other.peer_id) return false
    if (user_id != other.user_id) return false
    if (display_name != other.display_name) return false
    if (pinned != other.pinned) return false
    if (is_edited != other.is_edited) return false
    if (payload_type != other.payload_type) return false
    if (payload != other.payload) return false
    if (obsolete_created_at != other.obsolete_created_at) return false
    if (target_user_ids != other.target_user_ids) return false
    if (created_at != other.created_at) return false
    if (created_at_ms != other.created_at_ms) return false
    if (channel_id != other.channel_id) return false
    if (channel_index != other.channel_index) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + chat_id.hashCode()
      result = result * 37 + peer_id.hashCode()
      result = result * 37 + user_id.hashCode()
      result = result * 37 + display_name.hashCode()
      result = result * 37 + pinned.hashCode()
      result = result * 37 + is_edited.hashCode()
      result = result * 37 + payload_type.hashCode()
      result = result * 37 + payload.hashCode()
      result = result * 37 + (obsolete_created_at?.hashCode() ?: 0)
      result = result * 37 + target_user_ids.hashCode()
      result = result * 37 + created_at.hashCode()
      result = result * 37 + (created_at_ms?.hashCode() ?: 0)
      result = result * 37 + (channel_id?.hashCode() ?: 0)
      result = result * 37 + (channel_index?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    result += """chat_id=${sanitize(chat_id)}"""
    result += """peer_id=${sanitize(peer_id)}"""
    result += """user_id=${sanitize(user_id)}"""
    result += """display_name=${sanitize(display_name)}"""
    result += """pinned=$pinned"""
    result += """is_edited=$is_edited"""
    result += """payload_type=$payload_type"""
    result += """payload=${sanitize(payload)}"""
    if (obsolete_created_at != null) result += """obsolete_created_at=$obsolete_created_at"""
    if (target_user_ids.isNotEmpty()) result += """target_user_ids=${sanitize(target_user_ids)}"""
    result += """created_at=$created_at"""
    if (created_at_ms != null) result += """created_at_ms=$created_at_ms"""
    if (channel_id != null) result += """channel_id=${sanitize(channel_id)}"""
    if (channel_index != null) result += """channel_index=${sanitize(channel_index)}"""
    return result.joinToString(prefix = "ChatMessage{", separator = ", ", postfix = "}")
  }

  public fun copy(
    chat_id: String = this.chat_id,
    peer_id: String = this.peer_id,
    user_id: String = this.user_id,
    display_name: String = this.display_name,
    pinned: Boolean = this.pinned,
    is_edited: Boolean = this.is_edited,
    payload_type: Int = this.payload_type,
    payload: String = this.payload,
    obsolete_created_at: Instant? = this.obsolete_created_at,
    target_user_ids: List = this.target_user_ids,
    created_at: Long = this.created_at,
    created_at_ms: Long? = this.created_at_ms,
    channel_id: String? = this.channel_id,
    channel_index: String? = this.channel_index,
    unknownFields: ByteString = this.unknownFields,
  ): ChatMessage = ChatMessage(chat_id, peer_id, user_id, display_name, pinned, is_edited,
      payload_type, payload, obsolete_created_at, target_user_ids, created_at, created_at_ms,
      channel_id, channel_index, unknownFields)

  public companion object {
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      ChatMessage::class, 
      "type.googleapis.com/socket.chat.ChatMessage", 
      PROTO_3, 
      null, 
      "socket/chat.proto"
    ) {
      public override fun encodedSize(`value`: ChatMessage): Int {
        var size = value.unknownFields.size
        if (value.chat_id != "") size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.chat_id)
        if (value.peer_id != "") size += ProtoAdapter.STRING.encodedSizeWithTag(2, value.peer_id)
        if (value.user_id != "") size += ProtoAdapter.STRING.encodedSizeWithTag(3, value.user_id)
        if (value.display_name != "") size += ProtoAdapter.STRING.encodedSizeWithTag(4,
            value.display_name)
        if (value.pinned != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(5, value.pinned)
        if (value.is_edited != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(6,
            value.is_edited)
        if (value.payload_type != 0) size += ProtoAdapter.INT32.encodedSizeWithTag(7,
            value.payload_type)
        if (value.payload != "") size += ProtoAdapter.STRING.encodedSizeWithTag(8, value.payload)
        size += ProtoAdapter.INSTANT.encodedSizeWithTag(9, value.obsolete_created_at)
        size += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(10, value.target_user_ids)
        if (value.created_at != 0L) size += ProtoAdapter.UINT64.encodedSizeWithTag(11,
            value.created_at)
        size += ProtoAdapter.UINT64.encodedSizeWithTag(12, value.created_at_ms)
        size += ProtoAdapter.STRING.encodedSizeWithTag(13, value.channel_id)
        size += ProtoAdapter.STRING.encodedSizeWithTag(14, value.channel_index)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: ChatMessage): Unit {
        if (value.chat_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.chat_id)
        if (value.peer_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 2, value.peer_id)
        if (value.user_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 3, value.user_id)
        if (value.display_name != "") ProtoAdapter.STRING.encodeWithTag(writer, 4,
            value.display_name)
        if (value.pinned != false) ProtoAdapter.BOOL.encodeWithTag(writer, 5, value.pinned)
        if (value.is_edited != false) ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.is_edited)
        if (value.payload_type != 0) ProtoAdapter.INT32.encodeWithTag(writer, 7, value.payload_type)
        if (value.payload != "") ProtoAdapter.STRING.encodeWithTag(writer, 8, value.payload)
        ProtoAdapter.INSTANT.encodeWithTag(writer, 9, value.obsolete_created_at)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 10, value.target_user_ids)
        if (value.created_at != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 11, value.created_at)
        ProtoAdapter.UINT64.encodeWithTag(writer, 12, value.created_at_ms)
        ProtoAdapter.STRING.encodeWithTag(writer, 13, value.channel_id)
        ProtoAdapter.STRING.encodeWithTag(writer, 14, value.channel_index)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: ChatMessage): Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.STRING.encodeWithTag(writer, 14, value.channel_index)
        ProtoAdapter.STRING.encodeWithTag(writer, 13, value.channel_id)
        ProtoAdapter.UINT64.encodeWithTag(writer, 12, value.created_at_ms)
        if (value.created_at != 0L) ProtoAdapter.UINT64.encodeWithTag(writer, 11, value.created_at)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 10, value.target_user_ids)
        ProtoAdapter.INSTANT.encodeWithTag(writer, 9, value.obsolete_created_at)
        if (value.payload != "") ProtoAdapter.STRING.encodeWithTag(writer, 8, value.payload)
        if (value.payload_type != 0) ProtoAdapter.INT32.encodeWithTag(writer, 7, value.payload_type)
        if (value.is_edited != false) ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.is_edited)
        if (value.pinned != false) ProtoAdapter.BOOL.encodeWithTag(writer, 5, value.pinned)
        if (value.display_name != "") ProtoAdapter.STRING.encodeWithTag(writer, 4,
            value.display_name)
        if (value.user_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 3, value.user_id)
        if (value.peer_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 2, value.peer_id)
        if (value.chat_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.chat_id)
      }

      public override fun decode(reader: ProtoReader): ChatMessage {
        var chat_id: String = ""
        var peer_id: String = ""
        var user_id: String = ""
        var display_name: String = ""
        var pinned: Boolean = false
        var is_edited: Boolean = false
        var payload_type: Int = 0
        var payload: String = ""
        var obsolete_created_at: Instant? = null
        val target_user_ids = mutableListOf()
        var created_at: Long = 0L
        var created_at_ms: Long? = null
        var channel_id: String? = null
        var channel_index: String? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> chat_id = ProtoAdapter.STRING.decode(reader)
            2 -> peer_id = ProtoAdapter.STRING.decode(reader)
            3 -> user_id = ProtoAdapter.STRING.decode(reader)
            4 -> display_name = ProtoAdapter.STRING.decode(reader)
            5 -> pinned = ProtoAdapter.BOOL.decode(reader)
            6 -> is_edited = ProtoAdapter.BOOL.decode(reader)
            7 -> payload_type = ProtoAdapter.INT32.decode(reader)
            8 -> payload = ProtoAdapter.STRING.decode(reader)
            9 -> obsolete_created_at = ProtoAdapter.INSTANT.decode(reader)
            10 -> target_user_ids.add(ProtoAdapter.STRING.decode(reader))
            11 -> created_at = ProtoAdapter.UINT64.decode(reader)
            12 -> created_at_ms = ProtoAdapter.UINT64.decode(reader)
            13 -> channel_id = ProtoAdapter.STRING.decode(reader)
            14 -> channel_index = ProtoAdapter.STRING.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return ChatMessage(
          chat_id = chat_id,
          peer_id = peer_id,
          user_id = user_id,
          display_name = display_name,
          pinned = pinned,
          is_edited = is_edited,
          payload_type = payload_type,
          payload = payload,
          obsolete_created_at = obsolete_created_at,
          target_user_ids = target_user_ids,
          created_at = created_at,
          created_at_ms = created_at_ms,
          channel_id = channel_id,
          channel_index = channel_index,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: ChatMessage): ChatMessage = value.copy(
        obsolete_created_at = value.obsolete_created_at?.let(ProtoAdapter.INSTANT::redact),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy