commonMain.socket.polls.Poll.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.Poll 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 Poll(
@field:WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "pollId",
)
public val poll_id: String = "",
@field:WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "createdBy",
)
public val created_by: String = "",
@field:WireField(
tag = 3,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "createdByUserId",
)
public val created_by_user_id: String = "",
@field:WireField(
tag = 4,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
label = WireField.Label.OMIT_IDENTITY,
)
public val question: String = "",
options: List = emptyList(),
@field:WireField(
tag = 6,
adapter = "com.squareup.wire.ProtoAdapter#BOOL",
label = WireField.Label.OMIT_IDENTITY,
jsonName = "hideVotes",
)
public val hide_votes: Boolean = false,
@field:WireField(
tag = 7,
adapter = "com.squareup.wire.ProtoAdapter#BOOL",
label = WireField.Label.OMIT_IDENTITY,
)
public val anonymous: Boolean = false,
votes: List = emptyList(),
unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
@field:WireField(
tag = 5,
adapter = "socket.polls.PollOption#ADAPTER",
label = WireField.Label.REPEATED,
)
public val options: List = immutableCopyOf("options", options)
@field:WireField(
tag = 8,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
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 Poll) return false
if (unknownFields != other.unknownFields) return false
if (poll_id != other.poll_id) return false
if (created_by != other.created_by) return false
if (created_by_user_id != other.created_by_user_id) return false
if (question != other.question) return false
if (options != other.options) return false
if (hide_votes != other.hide_votes) return false
if (anonymous != other.anonymous) 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 + poll_id.hashCode()
result = result * 37 + created_by.hashCode()
result = result * 37 + created_by_user_id.hashCode()
result = result * 37 + question.hashCode()
result = result * 37 + options.hashCode()
result = result * 37 + hide_votes.hashCode()
result = result * 37 + anonymous.hashCode()
result = result * 37 + votes.hashCode()
super.hashCode = result
}
return result
}
public override fun toString(): String {
val result = mutableListOf()
result += """poll_id=${sanitize(poll_id)}"""
result += """created_by=${sanitize(created_by)}"""
result += """created_by_user_id=${sanitize(created_by_user_id)}"""
result += """question=${sanitize(question)}"""
if (options.isNotEmpty()) result += """options=$options"""
result += """hide_votes=$hide_votes"""
result += """anonymous=$anonymous"""
if (votes.isNotEmpty()) result += """votes=${sanitize(votes)}"""
return result.joinToString(prefix = "Poll{", separator = ", ", postfix = "}")
}
public fun copy(
poll_id: String = this.poll_id,
created_by: String = this.created_by,
created_by_user_id: String = this.created_by_user_id,
question: String = this.question,
options: List = this.options,
hide_votes: Boolean = this.hide_votes,
anonymous: Boolean = this.anonymous,
votes: List = this.votes,
unknownFields: ByteString = this.unknownFields,
): Poll = Poll(poll_id, created_by, created_by_user_id, question, options, hide_votes, anonymous,
votes, unknownFields)
public companion object {
public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
FieldEncoding.LENGTH_DELIMITED,
Poll::class,
"type.googleapis.com/socket.polls.Poll",
PROTO_3,
null,
"socket/polls.proto"
) {
public override fun encodedSize(`value`: Poll): Int {
var size = value.unknownFields.size
if (value.poll_id != "") size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.poll_id)
if (value.created_by != "") size += ProtoAdapter.STRING.encodedSizeWithTag(2,
value.created_by)
if (value.created_by_user_id != "") size += ProtoAdapter.STRING.encodedSizeWithTag(3,
value.created_by_user_id)
if (value.question != "") size += ProtoAdapter.STRING.encodedSizeWithTag(4, value.question)
size += PollOption.ADAPTER.asRepeated().encodedSizeWithTag(5, value.options)
if (value.hide_votes != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(6,
value.hide_votes)
if (value.anonymous != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(7,
value.anonymous)
size += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(8, value.votes)
return size
}
public override fun encode(writer: ProtoWriter, `value`: Poll): Unit {
if (value.poll_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.poll_id)
if (value.created_by != "") ProtoAdapter.STRING.encodeWithTag(writer, 2, value.created_by)
if (value.created_by_user_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 3,
value.created_by_user_id)
if (value.question != "") ProtoAdapter.STRING.encodeWithTag(writer, 4, value.question)
PollOption.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.options)
if (value.hide_votes != false) ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.hide_votes)
if (value.anonymous != false) ProtoAdapter.BOOL.encodeWithTag(writer, 7, value.anonymous)
ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 8, value.votes)
writer.writeBytes(value.unknownFields)
}
public override fun encode(writer: ReverseProtoWriter, `value`: Poll): Unit {
writer.writeBytes(value.unknownFields)
ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 8, value.votes)
if (value.anonymous != false) ProtoAdapter.BOOL.encodeWithTag(writer, 7, value.anonymous)
if (value.hide_votes != false) ProtoAdapter.BOOL.encodeWithTag(writer, 6, value.hide_votes)
PollOption.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.options)
if (value.question != "") ProtoAdapter.STRING.encodeWithTag(writer, 4, value.question)
if (value.created_by_user_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 3,
value.created_by_user_id)
if (value.created_by != "") ProtoAdapter.STRING.encodeWithTag(writer, 2, value.created_by)
if (value.poll_id != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.poll_id)
}
public override fun decode(reader: ProtoReader): Poll {
var poll_id: String = ""
var created_by: String = ""
var created_by_user_id: String = ""
var question: String = ""
val options = mutableListOf()
var hide_votes: Boolean = false
var anonymous: Boolean = false
val votes = mutableListOf()
val unknownFields = reader.forEachTag { tag ->
when (tag) {
1 -> poll_id = ProtoAdapter.STRING.decode(reader)
2 -> created_by = ProtoAdapter.STRING.decode(reader)
3 -> created_by_user_id = ProtoAdapter.STRING.decode(reader)
4 -> question = ProtoAdapter.STRING.decode(reader)
5 -> options.add(PollOption.ADAPTER.decode(reader))
6 -> hide_votes = ProtoAdapter.BOOL.decode(reader)
7 -> anonymous = ProtoAdapter.BOOL.decode(reader)
8 -> votes.add(ProtoAdapter.STRING.decode(reader))
else -> reader.readUnknownField(tag)
}
}
return Poll(
poll_id = poll_id,
created_by = created_by,
created_by_user_id = created_by_user_id,
question = question,
options = options,
hide_votes = hide_votes,
anonymous = anonymous,
votes = votes,
unknownFields = unknownFields
)
}
public override fun redact(`value`: Poll): Poll = value.copy(
options = value.options.redactElements(PollOption.ADAPTER),
unknownFields = ByteString.EMPTY
)
}
private const val serialVersionUID: Long = 0L
}
}