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 StatsGetPollStatsRequest struct {
Flags bin .Fields
Dark bool
Peer InputPeerClass
MsgID int
}
const StatsGetPollStatsRequestTypeID = 0xc27dfa68
var (
_ bin .Encoder = &StatsGetPollStatsRequest {}
_ bin .Decoder = &StatsGetPollStatsRequest {}
_ bin .BareEncoder = &StatsGetPollStatsRequest {}
_ bin .BareDecoder = &StatsGetPollStatsRequest {}
)
func (g *StatsGetPollStatsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Dark == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .MsgID == 0 ) {
return false
}
return true
}
func (g *StatsGetPollStatsRequest ) String () string {
if g == nil {
return "StatsGetPollStatsRequest(nil)"
}
type Alias StatsGetPollStatsRequest
return fmt .Sprintf ("StatsGetPollStatsRequest%+v" , Alias (*g ))
}
func (g *StatsGetPollStatsRequest ) FillFrom (from interface {
GetDark () (value bool )
GetPeer () (value InputPeerClass )
GetMsgID () (value int )
}) {
g .Dark = from .GetDark ()
g .Peer = from .GetPeer ()
g .MsgID = from .GetMsgID ()
}
func (*StatsGetPollStatsRequest ) TypeID () uint32 {
return StatsGetPollStatsRequestTypeID
}
func (*StatsGetPollStatsRequest ) TypeName () string {
return "stats.getPollStats"
}
func (g *StatsGetPollStatsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stats.getPollStats" ,
ID : StatsGetPollStatsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Dark" ,
SchemaName : "dark" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (g *StatsGetPollStatsRequest ) SetFlags () {
if !(g .Dark == false ) {
g .Flags .Set (0 )
}
}
func (g *StatsGetPollStatsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stats.getPollStats#c27dfa68 as nil" )
}
b .PutID (StatsGetPollStatsRequestTypeID )
return g .EncodeBare (b )
}
func (g *StatsGetPollStatsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stats.getPollStats#c27dfa68 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.getPollStats#c27dfa68: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode stats.getPollStats#c27dfa68: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.getPollStats#c27dfa68: field peer: %w" , err )
}
b .PutInt (g .MsgID )
return nil
}
func (g *StatsGetPollStatsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stats.getPollStats#c27dfa68 to nil" )
}
if err := b .ConsumeID (StatsGetPollStatsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stats.getPollStats#c27dfa68: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StatsGetPollStatsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stats.getPollStats#c27dfa68 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stats.getPollStats#c27dfa68: field flags: %w" , err )
}
}
g .Dark = g .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode stats.getPollStats#c27dfa68: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stats.getPollStats#c27dfa68: field msg_id: %w" , err )
}
g .MsgID = value
}
return nil
}
func (g *StatsGetPollStatsRequest ) SetDark (value bool ) {
if value {
g .Flags .Set (0 )
g .Dark = true
} else {
g .Flags .Unset (0 )
g .Dark = false
}
}
func (g *StatsGetPollStatsRequest ) GetDark () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *StatsGetPollStatsRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *StatsGetPollStatsRequest ) GetMsgID () (value int ) {
if g == nil {
return
}
return g .MsgID
}
func (c *Client ) StatsGetPollStats (ctx context .Context , request *StatsGetPollStatsRequest ) (*StatsPollStats , error ) {
var result StatsPollStats
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .