package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type MessagesGetPollVotesRequest struct {
Flags bin .Fields
Peer InputPeerClass
ID int
Option []byte
Offset string
Limit int
}
const MessagesGetPollVotesRequestTypeID = 0xb86e380e
var (
_ bin .Encoder = &MessagesGetPollVotesRequest {}
_ bin .Decoder = &MessagesGetPollVotesRequest {}
_ bin .BareEncoder = &MessagesGetPollVotesRequest {}
_ bin .BareDecoder = &MessagesGetPollVotesRequest {}
)
func (g *MessagesGetPollVotesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .ID == 0 ) {
return false
}
if !(g .Option == nil ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *MessagesGetPollVotesRequest ) String () string {
if g == nil {
return "MessagesGetPollVotesRequest(nil)"
}
type Alias MessagesGetPollVotesRequest
return fmt .Sprintf ("MessagesGetPollVotesRequest%+v" , Alias (*g ))
}
func (g *MessagesGetPollVotesRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetID () (value int )
GetOption () (value []byte , ok bool )
GetOffset () (value string , ok bool )
GetLimit () (value int )
}) {
g .Peer = from .GetPeer ()
g .ID = from .GetID ()
if val , ok := from .GetOption (); ok {
g .Option = val
}
if val , ok := from .GetOffset (); ok {
g .Offset = val
}
g .Limit = from .GetLimit ()
}
func (*MessagesGetPollVotesRequest ) TypeID () uint32 {
return MessagesGetPollVotesRequestTypeID
}
func (*MessagesGetPollVotesRequest ) TypeName () string {
return "messages.getPollVotes"
}
func (g *MessagesGetPollVotesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getPollVotes" ,
ID : MessagesGetPollVotesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Option" ,
SchemaName : "option" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Offset" ,
SchemaName : "offset" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *MessagesGetPollVotesRequest ) SetFlags () {
if !(g .Option == nil ) {
g .Flags .Set (0 )
}
if !(g .Offset == "" ) {
g .Flags .Set (1 )
}
}
func (g *MessagesGetPollVotesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getPollVotes#b86e380e as nil" )
}
b .PutID (MessagesGetPollVotesRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetPollVotesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getPollVotes#b86e380e as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getPollVotes#b86e380e: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode messages.getPollVotes#b86e380e: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getPollVotes#b86e380e: field peer: %w" , err )
}
b .PutInt (g .ID )
if g .Flags .Has (0 ) {
b .PutBytes (g .Option )
}
if g .Flags .Has (1 ) {
b .PutString (g .Offset )
}
b .PutInt (g .Limit )
return nil
}
func (g *MessagesGetPollVotesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getPollVotes#b86e380e to nil" )
}
if err := b .ConsumeID (MessagesGetPollVotesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetPollVotesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getPollVotes#b86e380e to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: field flags: %w" , err )
}
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: field id: %w" , err )
}
g .ID = value
}
if g .Flags .Has (0 ) {
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: field option: %w" , err )
}
g .Option = value
}
if g .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getPollVotes#b86e380e: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *MessagesGetPollVotesRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *MessagesGetPollVotesRequest ) GetID () (value int ) {
if g == nil {
return
}
return g .ID
}
func (g *MessagesGetPollVotesRequest ) SetOption (value []byte ) {
g .Flags .Set (0 )
g .Option = value
}
func (g *MessagesGetPollVotesRequest ) GetOption () (value []byte , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (0 ) {
return value , false
}
return g .Option , true
}
func (g *MessagesGetPollVotesRequest ) SetOffset (value string ) {
g .Flags .Set (1 )
g .Offset = value
}
func (g *MessagesGetPollVotesRequest ) GetOffset () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (1 ) {
return value , false
}
return g .Offset , true
}
func (g *MessagesGetPollVotesRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) MessagesGetPollVotes (ctx context .Context , request *MessagesGetPollVotesRequest ) (*MessagesVotesList , error ) {
var result MessagesVotesList
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .