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 StatsLoadAsyncGraphRequest struct {
Flags bin .Fields
Token string
X int64
}
const StatsLoadAsyncGraphRequestTypeID = 0x621d5fa0
var (
_ bin .Encoder = &StatsLoadAsyncGraphRequest {}
_ bin .Decoder = &StatsLoadAsyncGraphRequest {}
_ bin .BareEncoder = &StatsLoadAsyncGraphRequest {}
_ bin .BareDecoder = &StatsLoadAsyncGraphRequest {}
)
func (l *StatsLoadAsyncGraphRequest ) Zero () bool {
if l == nil {
return true
}
if !(l .Flags .Zero ()) {
return false
}
if !(l .Token == "" ) {
return false
}
if !(l .X == 0 ) {
return false
}
return true
}
func (l *StatsLoadAsyncGraphRequest ) String () string {
if l == nil {
return "StatsLoadAsyncGraphRequest(nil)"
}
type Alias StatsLoadAsyncGraphRequest
return fmt .Sprintf ("StatsLoadAsyncGraphRequest%+v" , Alias (*l ))
}
func (l *StatsLoadAsyncGraphRequest ) FillFrom (from interface {
GetToken () (value string )
GetX () (value int64 , ok bool )
}) {
l .Token = from .GetToken ()
if val , ok := from .GetX (); ok {
l .X = val
}
}
func (*StatsLoadAsyncGraphRequest ) TypeID () uint32 {
return StatsLoadAsyncGraphRequestTypeID
}
func (*StatsLoadAsyncGraphRequest ) TypeName () string {
return "stats.loadAsyncGraph"
}
func (l *StatsLoadAsyncGraphRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stats.loadAsyncGraph" ,
ID : StatsLoadAsyncGraphRequestTypeID ,
}
if l == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Token" ,
SchemaName : "token" ,
},
{
Name : "X" ,
SchemaName : "x" ,
Null : !l .Flags .Has (0 ),
},
}
return typ
}
func (l *StatsLoadAsyncGraphRequest ) SetFlags () {
if !(l .X == 0 ) {
l .Flags .Set (0 )
}
}
func (l *StatsLoadAsyncGraphRequest ) Encode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode stats.loadAsyncGraph#621d5fa0 as nil" )
}
b .PutID (StatsLoadAsyncGraphRequestTypeID )
return l .EncodeBare (b )
}
func (l *StatsLoadAsyncGraphRequest ) EncodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't encode stats.loadAsyncGraph#621d5fa0 as nil" )
}
l .SetFlags ()
if err := l .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.loadAsyncGraph#621d5fa0: field flags: %w" , err )
}
b .PutString (l .Token )
if l .Flags .Has (0 ) {
b .PutLong (l .X )
}
return nil
}
func (l *StatsLoadAsyncGraphRequest ) Decode (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode stats.loadAsyncGraph#621d5fa0 to nil" )
}
if err := b .ConsumeID (StatsLoadAsyncGraphRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stats.loadAsyncGraph#621d5fa0: %w" , err )
}
return l .DecodeBare (b )
}
func (l *StatsLoadAsyncGraphRequest ) DecodeBare (b *bin .Buffer ) error {
if l == nil {
return fmt .Errorf ("can't decode stats.loadAsyncGraph#621d5fa0 to nil" )
}
{
if err := l .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stats.loadAsyncGraph#621d5fa0: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode stats.loadAsyncGraph#621d5fa0: field token: %w" , err )
}
l .Token = value
}
if l .Flags .Has (0 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode stats.loadAsyncGraph#621d5fa0: field x: %w" , err )
}
l .X = value
}
return nil
}
func (l *StatsLoadAsyncGraphRequest ) GetToken () (value string ) {
if l == nil {
return
}
return l .Token
}
func (l *StatsLoadAsyncGraphRequest ) SetX (value int64 ) {
l .Flags .Set (0 )
l .X = value
}
func (l *StatsLoadAsyncGraphRequest ) GetX () (value int64 , ok bool ) {
if l == nil {
return
}
if !l .Flags .Has (0 ) {
return value , false
}
return l .X , true
}
func (c *Client ) StatsLoadAsyncGraph (ctx context .Context , request *StatsLoadAsyncGraphRequest ) (StatsGraphClass , error ) {
var result StatsGraphBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .StatsGraph , 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 .