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

org.whispersystems.signalservice.internal.websocket.WebSocketResponseMessage.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.WebSocketResponseMessage in WebSocketResources.proto
package org.whispersystems.signalservice.`internal`.websocket

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`.checkElementsNotNull
import com.squareup.wire.`internal`.immutableCopyOf
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.collections.List
import kotlin.jvm.JvmField
import okio.ByteString

public class WebSocketResponseMessage(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#UINT64",
  )
  @JvmField
  public val id: Long? = null,
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#UINT32",
  )
  @JvmField
  public val status: Int? = null,
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val message: String? = null,
  headers: List = emptyList(),
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val body: ByteString? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @field:WireField(
    tag = 5,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.REPEATED,
  )
  @JvmField
  public val headers: List = immutableCopyOf("headers", headers)

  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.id = id
    builder.status = status
    builder.message = message
    builder.headers = headers
    builder.body = body
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is WebSocketResponseMessage) return false
    if (unknownFields != other.unknownFields) return false
    if (id != other.id) return false
    if (status != other.status) return false
    if (message != other.message) return false
    if (headers != other.headers) 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 + (id?.hashCode() ?: 0)
      result = result * 37 + (status?.hashCode() ?: 0)
      result = result * 37 + (message?.hashCode() ?: 0)
      result = result * 37 + headers.hashCode()
      result = result * 37 + (body?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (id != null) result += """id=$id"""
    if (status != null) result += """status=$status"""
    if (message != null) result += """message=${sanitize(message)}"""
    if (headers.isNotEmpty()) result += """headers=${sanitize(headers)}"""
    if (body != null) result += """body=$body"""
    return result.joinToString(prefix = "WebSocketResponseMessage{", separator = ", ", postfix =
        "}")
  }

  public fun copy(
    id: Long? = this.id,
    status: Int? = this.status,
    message: String? = this.message,
    headers: List = this.headers,
    body: ByteString? = this.body,
    unknownFields: ByteString = this.unknownFields,
  ): WebSocketResponseMessage = WebSocketResponseMessage(id, status, message, headers, body,
      unknownFields)

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

    @JvmField
    public var status: Int? = null

    @JvmField
    public var message: String? = null

    @JvmField
    public var headers: List = emptyList()

    @JvmField
    public var body: ByteString? = null

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

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

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

    public fun headers(headers: List): Builder {
      checkElementsNotNull(headers)
      this.headers = headers
      return this
    }

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

    public override fun build(): WebSocketResponseMessage = WebSocketResponseMessage(
      id = id,
      status = status,
      message = message,
      headers = headers,
      body = body,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object :
        ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      WebSocketResponseMessage::class, 
      "type.googleapis.com/signalservice.WebSocketResponseMessage", 
      PROTO_2, 
      null, 
      "WebSocketResources.proto"
    ) {
      public override fun encodedSize(`value`: WebSocketResponseMessage): Int {
        var size = value.unknownFields.size
        size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.id)
        size += ProtoAdapter.UINT32.encodedSizeWithTag(2, value.status)
        size += ProtoAdapter.STRING.encodedSizeWithTag(3, value.message)
        size += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(5, value.headers)
        size += ProtoAdapter.BYTES.encodedSizeWithTag(4, value.body)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: WebSocketResponseMessage): Unit {
        ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.id)
        ProtoAdapter.UINT32.encodeWithTag(writer, 2, value.status)
        ProtoAdapter.STRING.encodeWithTag(writer, 3, value.message)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 5, value.headers)
        ProtoAdapter.BYTES.encodeWithTag(writer, 4, value.body)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: WebSocketResponseMessage):
          Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.BYTES.encodeWithTag(writer, 4, value.body)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 5, value.headers)
        ProtoAdapter.STRING.encodeWithTag(writer, 3, value.message)
        ProtoAdapter.UINT32.encodeWithTag(writer, 2, value.status)
        ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.id)
      }

      public override fun decode(reader: ProtoReader): WebSocketResponseMessage {
        var id: Long? = null
        var status: Int? = null
        var message: String? = null
        val headers = mutableListOf()
        var body: ByteString? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> id = ProtoAdapter.UINT64.decode(reader)
            2 -> status = ProtoAdapter.UINT32.decode(reader)
            3 -> message = ProtoAdapter.STRING.decode(reader)
            5 -> headers.add(ProtoAdapter.STRING.decode(reader))
            4 -> body = ProtoAdapter.BYTES.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return WebSocketResponseMessage(
          id = id,
          status = status,
          message = message,
          headers = headers,
          body = body,
          unknownFields = unknownFields
        )
      }

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

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy