commonMain.socket.polls.PollOption.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proto-entities Show documentation
Show all versions of proto-entities Show documentation
KMP package which exports compiled protobuf entities to be used by other repos
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: socket.polls.PollOption in socket/polls.proto
package socket.polls
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_3
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.immutableCopyOf
import com.squareup.wire.`internal`.redactElements
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 PollOption(
@field:WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.OMIT_IDENTITY,
)
public val text: String = "",
/**
* Optional because FE need not send this in New Poll
*/
@field:WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#UINT64",
)
public val count: Long? = null,
votes: List = emptyList(),
unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
@field:WireField(
tag = 3,
adapter = "socket.polls.PollVote#ADAPTER",
label = WireField.Label.REPEATED,
)
public val votes: List = immutableCopyOf("votes", votes)
@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 PollOption) return false
if (unknownFields != other.unknownFields) return false
if (text != other.text) return false
if (count != other.count) return false
if (votes != other.votes) return false
return true
}
public override fun hashCode(): Int {
var result = super.hashCode
if (result == 0) {
result = unknownFields.hashCode()
result = result * 37 + text.hashCode()
result = result * 37 + (count?.hashCode() ?: 0)
result = result * 37 + votes.hashCode()
super.hashCode = result
}
return result
}
public override fun toString(): String {
val result = mutableListOf()
result += """text=${sanitize(text)}"""
if (count != null) result += """count=$count"""
if (votes.isNotEmpty()) result += """votes=$votes"""
return result.joinToString(prefix = "PollOption{", separator = ", ", postfix = "}")
}
public fun copy(
text: String = this.text,
count: Long? = this.count,
votes: List = this.votes,
unknownFields: ByteString = this.unknownFields,
): PollOption = PollOption(text, count, votes, unknownFields)
public companion object {
public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
FieldEncoding.LENGTH_DELIMITED,
PollOption::class,
"type.googleapis.com/socket.polls.PollOption",
PROTO_3,
null,
"socket/polls.proto"
) {
public override fun encodedSize(`value`: PollOption): Int {
var size = value.unknownFields.size
if (value.text != "") size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.text)
size += ProtoAdapter.UINT64.encodedSizeWithTag(2, value.count)
size += PollVote.ADAPTER.asRepeated().encodedSizeWithTag(3, value.votes)
return size
}
public override fun encode(writer: ProtoWriter, `value`: PollOption): Unit {
if (value.text != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.text)
ProtoAdapter.UINT64.encodeWithTag(writer, 2, value.count)
PollVote.ADAPTER.asRepeated().encodeWithTag(writer, 3, value.votes)
writer.writeBytes(value.unknownFields)
}
public override fun encode(writer: ReverseProtoWriter, `value`: PollOption): Unit {
writer.writeBytes(value.unknownFields)
PollVote.ADAPTER.asRepeated().encodeWithTag(writer, 3, value.votes)
ProtoAdapter.UINT64.encodeWithTag(writer, 2, value.count)
if (value.text != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.text)
}
public override fun decode(reader: ProtoReader): PollOption {
var text: String = ""
var count: Long? = null
val votes = mutableListOf()
val unknownFields = reader.forEachTag { tag ->
when (tag) {
1 -> text = ProtoAdapter.STRING.decode(reader)
2 -> count = ProtoAdapter.UINT64.decode(reader)
3 -> votes.add(PollVote.ADAPTER.decode(reader))
else -> reader.readUnknownField(tag)
}
}
return PollOption(
text = text,
count = count,
votes = votes,
unknownFields = unknownFields
)
}
public override fun redact(`value`: PollOption): PollOption = value.copy(
votes = value.votes.redactElements(PollVote.ADAPTER),
unknownFields = ByteString.EMPTY
)
}
private const val serialVersionUID: Long = 0L
}
}