org.whispersystems.signalservice.internal.push.ReceiptMessage.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java, unofficial fork
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: signalservice.ReceiptMessage 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 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 ReceiptMessage(
@field:WireField(
tag = 1,
adapter = "org.whispersystems.signalservice.internal.push.ReceiptMessage${'$'}Type#ADAPTER",
)
@JvmField
public val type: Type? = null,
timestamp: List = emptyList(),
unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
@field:WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
label = WireField.Label.REPEATED,
)
@JvmField
public val timestamp: List = immutableCopyOf("timestamp", timestamp)
public override fun newBuilder(): Builder {
val builder = Builder()
builder.type = type
builder.timestamp = timestamp
builder.addUnknownFields(unknownFields)
return builder
}
public override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is ReceiptMessage) return false
if (unknownFields != other.unknownFields) return false
if (type != other.type) return false
if (timestamp != other.timestamp) return false
return true
}
public override fun hashCode(): Int {
var result = super.hashCode
if (result == 0) {
result = unknownFields.hashCode()
result = result * 37 + (type?.hashCode() ?: 0)
result = result * 37 + timestamp.hashCode()
super.hashCode = result
}
return result
}
public override fun toString(): String {
val result = mutableListOf()
if (type != null) result += """type=$type"""
if (timestamp.isNotEmpty()) result += """timestamp=$timestamp"""
return result.joinToString(prefix = "ReceiptMessage{", separator = ", ", postfix = "}")
}
public fun copy(
type: Type? = this.type,
timestamp: List = this.timestamp,
unknownFields: ByteString = this.unknownFields,
): ReceiptMessage = ReceiptMessage(type, timestamp, unknownFields)
public class Builder : Message.Builder() {
@JvmField
public var type: Type? = null
@JvmField
public var timestamp: List = emptyList()
public fun type(type: Type?): Builder {
this.type = type
return this
}
public fun timestamp(timestamp: List): Builder {
checkElementsNotNull(timestamp)
this.timestamp = timestamp
return this
}
public override fun build(): ReceiptMessage = ReceiptMessage(
type = type,
timestamp = timestamp,
unknownFields = buildUnknownFields()
)
}
public companion object {
@JvmField
public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
FieldEncoding.LENGTH_DELIMITED,
ReceiptMessage::class,
"type.googleapis.com/signalservice.ReceiptMessage",
PROTO_2,
null,
"SignalService.proto"
) {
public override fun encodedSize(`value`: ReceiptMessage): Int {
var size = value.unknownFields.size
size += Type.ADAPTER.encodedSizeWithTag(1, value.type)
size += ProtoAdapter.UINT64.asRepeated().encodedSizeWithTag(2, value.timestamp)
return size
}
public override fun encode(writer: ProtoWriter, `value`: ReceiptMessage): Unit {
Type.ADAPTER.encodeWithTag(writer, 1, value.type)
ProtoAdapter.UINT64.asRepeated().encodeWithTag(writer, 2, value.timestamp)
writer.writeBytes(value.unknownFields)
}
public override fun encode(writer: ReverseProtoWriter, `value`: ReceiptMessage): Unit {
writer.writeBytes(value.unknownFields)
ProtoAdapter.UINT64.asRepeated().encodeWithTag(writer, 2, value.timestamp)
Type.ADAPTER.encodeWithTag(writer, 1, value.type)
}
public override fun decode(reader: ProtoReader): ReceiptMessage {
var type: Type? = null
val timestamp = mutableListOf()
val unknownFields = reader.forEachTag { tag ->
when (tag) {
1 -> try {
type = Type.ADAPTER.decode(reader)
} catch (e: ProtoAdapter.EnumConstantNotFoundException) {
reader.addUnknownField(tag, FieldEncoding.VARINT, e.value.toLong())
}
2 -> timestamp.add(ProtoAdapter.UINT64.decode(reader))
else -> reader.readUnknownField(tag)
}
}
return ReceiptMessage(
type = type,
timestamp = timestamp,
unknownFields = unknownFields
)
}
public override fun redact(`value`: ReceiptMessage): ReceiptMessage = value.copy(
unknownFields = ByteString.EMPTY
)
}
private const val serialVersionUID: Long = 0L
}
public enum class Type(
public override val `value`: Int,
) : WireEnum {
DELIVERY(0),
READ(1),
VIEWED(2),
;
public companion object {
@JvmField
public val ADAPTER: ProtoAdapter = object : EnumAdapter(
Type::class,
PROTO_2,
Type.DELIVERY
) {
public override fun fromValue(`value`: Int): Type? = Type.fromValue(value)
}
@JvmStatic
public fun fromValue(`value`: Int): Type? = when (value) {
0 -> DELIVERY
1 -> READ
2 -> VIEWED
else -> null
}
}
}
}