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

org.whispersystems.signalservice.internal.push.GroupContext.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.GroupContext 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`.checkElementsNotNull
import com.squareup.wire.`internal`.immutableCopyOf
import com.squareup.wire.`internal`.redactElements
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 kotlin.jvm.JvmStatic
import okio.ByteString

public class GroupContext(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  @JvmField
  public val id: ByteString? = null,
  @field:WireField(
    tag = 2,
    adapter = "org.whispersystems.signalservice.internal.push.GroupContext${'$'}Type#ADAPTER",
  )
  @JvmField
  public val type: Type? = null,
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  @JvmField
  public val name: String? = null,
  membersE164: List = emptyList(),
  members: List = emptyList(),
  @field:WireField(
    tag = 5,
    adapter = "org.whispersystems.signalservice.internal.push.AttachmentPointer#ADAPTER",
  )
  @JvmField
  public val avatar: AttachmentPointer? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.REPEATED,
  )
  @JvmField
  public val membersE164: List = immutableCopyOf("membersE164", membersE164)

  @field:WireField(
    tag = 6,
    adapter = "org.whispersystems.signalservice.internal.push.GroupContext${'$'}Member#ADAPTER",
    label = WireField.Label.REPEATED,
  )
  @JvmField
  public val members: List = immutableCopyOf("members", members)

  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.id = id
    builder.type = type
    builder.name = name
    builder.membersE164 = membersE164
    builder.members = members
    builder.avatar = avatar
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is GroupContext) return false
    if (unknownFields != other.unknownFields) return false
    if (id != other.id) return false
    if (type != other.type) return false
    if (name != other.name) return false
    if (membersE164 != other.membersE164) return false
    if (members != other.members) return false
    if (avatar != other.avatar) 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 + (type?.hashCode() ?: 0)
      result = result * 37 + (name?.hashCode() ?: 0)
      result = result * 37 + membersE164.hashCode()
      result = result * 37 + members.hashCode()
      result = result * 37 + (avatar?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (id != null) result += """id=$id"""
    if (type != null) result += """type=$type"""
    if (name != null) result += """name=${sanitize(name)}"""
    if (membersE164.isNotEmpty()) result += """membersE164=${sanitize(membersE164)}"""
    if (members.isNotEmpty()) result += """members=$members"""
    if (avatar != null) result += """avatar=$avatar"""
    return result.joinToString(prefix = "GroupContext{", separator = ", ", postfix = "}")
  }

  public fun copy(
    id: ByteString? = this.id,
    type: Type? = this.type,
    name: String? = this.name,
    membersE164: List = this.membersE164,
    members: List = this.members,
    avatar: AttachmentPointer? = this.avatar,
    unknownFields: ByteString = this.unknownFields,
  ): GroupContext = GroupContext(id, type, name, membersE164, members, avatar, unknownFields)

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

    @JvmField
    public var type: Type? = null

    @JvmField
    public var name: String? = null

    @JvmField
    public var membersE164: List = emptyList()

    @JvmField
    public var members: List = emptyList()

    @JvmField
    public var avatar: AttachmentPointer? = null

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

    public fun type(type: Type?): Builder {
      this.type = type
      return this
    }

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

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

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

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

    public override fun build(): GroupContext = GroupContext(
      id = id,
      type = type,
      name = name,
      membersE164 = membersE164,
      members = members,
      avatar = avatar,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      GroupContext::class, 
      "type.googleapis.com/signalservice.GroupContext", 
      PROTO_2, 
      null, 
      "SignalService.proto"
    ) {
      public override fun encodedSize(`value`: GroupContext): Int {
        var size = value.unknownFields.size
        size += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.id)
        size += Type.ADAPTER.encodedSizeWithTag(2, value.type)
        size += ProtoAdapter.STRING.encodedSizeWithTag(3, value.name)
        size += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(4, value.membersE164)
        size += Member.ADAPTER.asRepeated().encodedSizeWithTag(6, value.members)
        size += AttachmentPointer.ADAPTER.encodedSizeWithTag(5, value.avatar)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: GroupContext): Unit {
        ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.id)
        Type.ADAPTER.encodeWithTag(writer, 2, value.type)
        ProtoAdapter.STRING.encodeWithTag(writer, 3, value.name)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 4, value.membersE164)
        Member.ADAPTER.asRepeated().encodeWithTag(writer, 6, value.members)
        AttachmentPointer.ADAPTER.encodeWithTag(writer, 5, value.avatar)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: GroupContext): Unit {
        writer.writeBytes(value.unknownFields)
        AttachmentPointer.ADAPTER.encodeWithTag(writer, 5, value.avatar)
        Member.ADAPTER.asRepeated().encodeWithTag(writer, 6, value.members)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 4, value.membersE164)
        ProtoAdapter.STRING.encodeWithTag(writer, 3, value.name)
        Type.ADAPTER.encodeWithTag(writer, 2, value.type)
        ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.id)
      }

      public override fun decode(reader: ProtoReader): GroupContext {
        var id: ByteString? = null
        var type: Type? = null
        var name: String? = null
        val membersE164 = mutableListOf()
        val members = mutableListOf()
        var avatar: AttachmentPointer? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> id = ProtoAdapter.BYTES.decode(reader)
            2 -> try {
              type = Type.ADAPTER.decode(reader)
            } catch (e: ProtoAdapter.EnumConstantNotFoundException) {
              reader.addUnknownField(tag, FieldEncoding.VARINT, e.value.toLong())
            }
            3 -> name = ProtoAdapter.STRING.decode(reader)
            4 -> membersE164.add(ProtoAdapter.STRING.decode(reader))
            6 -> members.add(Member.ADAPTER.decode(reader))
            5 -> avatar = AttachmentPointer.ADAPTER.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return GroupContext(
          id = id,
          type = type,
          name = name,
          membersE164 = membersE164,
          members = members,
          avatar = avatar,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: GroupContext): GroupContext = value.copy(
        members = value.members.redactElements(Member.ADAPTER),
        avatar = value.avatar?.let(AttachmentPointer.ADAPTER::redact),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }

  public enum class Type(
    public override val `value`: Int,
  ) : WireEnum {
    UNKNOWN(0),
    UPDATE(1),
    DELIVER(2),
    QUIT(3),
    REQUEST_INFO(4),
    ;

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

      @JvmStatic
      public fun fromValue(`value`: Int): Type? = when (value) {
        0 -> UNKNOWN
        1 -> UPDATE
        2 -> DELIVER
        3 -> QUIT
        4 -> REQUEST_INFO
        else -> null
      }
    }
  }

  public class Member(
    @field:WireField(
      tag = 2,
      adapter = "com.squareup.wire.ProtoAdapter#STRING",
    )
    @JvmField
    public val e164: String? = null,
    unknownFields: ByteString = ByteString.EMPTY,
  ) : Message(ADAPTER, unknownFields) {
    public override fun newBuilder(): Builder {
      val builder = Builder()
      builder.e164 = e164
      builder.addUnknownFields(unknownFields)
      return builder
    }

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

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

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

    public fun copy(e164: String? = this.e164, unknownFields: ByteString = this.unknownFields):
        Member = Member(e164, unknownFields)

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

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

      public override fun build(): Member = Member(
        e164 = e164,
        unknownFields = buildUnknownFields()
      )
    }

    public companion object {
      @JvmField
      public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
        FieldEncoding.LENGTH_DELIMITED, 
        Member::class, 
        "type.googleapis.com/signalservice.GroupContext.Member", 
        PROTO_2, 
        null, 
        "SignalService.proto"
      ) {
        public override fun encodedSize(`value`: Member): Int {
          var size = value.unknownFields.size
          size += ProtoAdapter.STRING.encodedSizeWithTag(2, value.e164)
          return size
        }

        public override fun encode(writer: ProtoWriter, `value`: Member): Unit {
          ProtoAdapter.STRING.encodeWithTag(writer, 2, value.e164)
          writer.writeBytes(value.unknownFields)
        }

        public override fun encode(writer: ReverseProtoWriter, `value`: Member): Unit {
          writer.writeBytes(value.unknownFields)
          ProtoAdapter.STRING.encodeWithTag(writer, 2, value.e164)
        }

        public override fun decode(reader: ProtoReader): Member {
          var e164: String? = null
          val unknownFields = reader.forEachTag { tag ->
            when (tag) {
              2 -> e164 = ProtoAdapter.STRING.decode(reader)
              else -> reader.readUnknownField(tag)
            }
          }
          return Member(
            e164 = e164,
            unknownFields = unknownFields
          )
        }

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

      private const val serialVersionUID: Long = 0L
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy