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

commonMain.socket.polls.NewPollRequest.kt Maven / Gradle / Ivy

Go to download

KMP package which exports compiled protobuf entities to be used by other repos

There is a newer version: 2.89.0
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: socket.polls.NewPollRequest 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`.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 NewPollRequest(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
  )
  public val question: String = "",
  options: List = emptyList(),
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
  )
  public val anonymous: Boolean = false,
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "hideVotes",
  )
  public val hide_votes: Boolean = false,
  @field:WireField(
    tag = 5,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    jsonName = "createdBy",
  )
  public val created_by: String? = null,
  @field:WireField(
    tag = 6,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    jsonName = "createdByUserId",
  )
  public val created_by_user_id: String? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.REPEATED,
  )
  public val options: List = immutableCopyOf("options", options)

  @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 NewPollRequest) return false
    if (unknownFields != other.unknownFields) return false
    if (question != other.question) return false
    if (options != other.options) return false
    if (anonymous != other.anonymous) return false
    if (hide_votes != other.hide_votes) return false
    if (created_by != other.created_by) return false
    if (created_by_user_id != other.created_by_user_id) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + question.hashCode()
      result = result * 37 + options.hashCode()
      result = result * 37 + anonymous.hashCode()
      result = result * 37 + hide_votes.hashCode()
      result = result * 37 + (created_by?.hashCode() ?: 0)
      result = result * 37 + (created_by_user_id?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    result += """question=${sanitize(question)}"""
    if (options.isNotEmpty()) result += """options=${sanitize(options)}"""
    result += """anonymous=$anonymous"""
    result += """hide_votes=$hide_votes"""
    if (created_by != null) result += """created_by=${sanitize(created_by)}"""
    if (created_by_user_id != null) result +=
        """created_by_user_id=${sanitize(created_by_user_id)}"""
    return result.joinToString(prefix = "NewPollRequest{", separator = ", ", postfix = "}")
  }

  public fun copy(
    question: String = this.question,
    options: List = this.options,
    anonymous: Boolean = this.anonymous,
    hide_votes: Boolean = this.hide_votes,
    created_by: String? = this.created_by,
    created_by_user_id: String? = this.created_by_user_id,
    unknownFields: ByteString = this.unknownFields,
  ): NewPollRequest = NewPollRequest(question, options, anonymous, hide_votes, created_by,
      created_by_user_id, unknownFields)

  public companion object {
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      NewPollRequest::class, 
      "type.googleapis.com/socket.polls.NewPollRequest", 
      PROTO_3, 
      null, 
      "socket/polls.proto"
    ) {
      public override fun encodedSize(`value`: NewPollRequest): Int {
        var size = value.unknownFields.size
        if (value.question != "") size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.question)
        size += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(2, value.options)
        if (value.anonymous != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(3,
            value.anonymous)
        if (value.hide_votes != false) size += ProtoAdapter.BOOL.encodedSizeWithTag(4,
            value.hide_votes)
        size += ProtoAdapter.STRING.encodedSizeWithTag(5, value.created_by)
        size += ProtoAdapter.STRING.encodedSizeWithTag(6, value.created_by_user_id)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: NewPollRequest): Unit {
        if (value.question != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.question)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 2, value.options)
        if (value.anonymous != false) ProtoAdapter.BOOL.encodeWithTag(writer, 3, value.anonymous)
        if (value.hide_votes != false) ProtoAdapter.BOOL.encodeWithTag(writer, 4, value.hide_votes)
        ProtoAdapter.STRING.encodeWithTag(writer, 5, value.created_by)
        ProtoAdapter.STRING.encodeWithTag(writer, 6, value.created_by_user_id)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: NewPollRequest): Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.STRING.encodeWithTag(writer, 6, value.created_by_user_id)
        ProtoAdapter.STRING.encodeWithTag(writer, 5, value.created_by)
        if (value.hide_votes != false) ProtoAdapter.BOOL.encodeWithTag(writer, 4, value.hide_votes)
        if (value.anonymous != false) ProtoAdapter.BOOL.encodeWithTag(writer, 3, value.anonymous)
        ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 2, value.options)
        if (value.question != "") ProtoAdapter.STRING.encodeWithTag(writer, 1, value.question)
      }

      public override fun decode(reader: ProtoReader): NewPollRequest {
        var question: String = ""
        val options = mutableListOf()
        var anonymous: Boolean = false
        var hide_votes: Boolean = false
        var created_by: String? = null
        var created_by_user_id: String? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> question = ProtoAdapter.STRING.decode(reader)
            2 -> options.add(ProtoAdapter.STRING.decode(reader))
            3 -> anonymous = ProtoAdapter.BOOL.decode(reader)
            4 -> hide_votes = ProtoAdapter.BOOL.decode(reader)
            5 -> created_by = ProtoAdapter.STRING.decode(reader)
            6 -> created_by_user_id = ProtoAdapter.STRING.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return NewPollRequest(
          question = question,
          options = options,
          anonymous = anonymous,
          hide_votes = hide_votes,
          created_by = created_by,
          created_by_user_id = created_by_user_id,
          unknownFields = unknownFields
        )
      }

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

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy