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 BotsExportBotTokenRequest struct {
Bot InputUserClass
Revoke bool
}
const BotsExportBotTokenRequestTypeID = 0xbd0d99eb
var (
_ bin .Encoder = &BotsExportBotTokenRequest {}
_ bin .Decoder = &BotsExportBotTokenRequest {}
_ bin .BareEncoder = &BotsExportBotTokenRequest {}
_ bin .BareDecoder = &BotsExportBotTokenRequest {}
)
func (e *BotsExportBotTokenRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Bot == nil ) {
return false
}
if !(e .Revoke == false ) {
return false
}
return true
}
func (e *BotsExportBotTokenRequest ) String () string {
if e == nil {
return "BotsExportBotTokenRequest(nil)"
}
type Alias BotsExportBotTokenRequest
return fmt .Sprintf ("BotsExportBotTokenRequest%+v" , Alias (*e ))
}
func (e *BotsExportBotTokenRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
GetRevoke () (value bool )
}) {
e .Bot = from .GetBot ()
e .Revoke = from .GetRevoke ()
}
func (*BotsExportBotTokenRequest ) TypeID () uint32 {
return BotsExportBotTokenRequestTypeID
}
func (*BotsExportBotTokenRequest ) TypeName () string {
return "bots.exportBotToken"
}
func (e *BotsExportBotTokenRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.exportBotToken" ,
ID : BotsExportBotTokenRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "Revoke" ,
SchemaName : "revoke" ,
},
}
return typ
}
func (e *BotsExportBotTokenRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode bots.exportBotToken#bd0d99eb as nil" )
}
b .PutID (BotsExportBotTokenRequestTypeID )
return e .EncodeBare (b )
}
func (e *BotsExportBotTokenRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode bots.exportBotToken#bd0d99eb as nil" )
}
if e .Bot == nil {
return fmt .Errorf ("unable to encode bots.exportBotToken#bd0d99eb: field bot is nil" )
}
if err := e .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.exportBotToken#bd0d99eb: field bot: %w" , err )
}
b .PutBool (e .Revoke )
return nil
}
func (e *BotsExportBotTokenRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode bots.exportBotToken#bd0d99eb to nil" )
}
if err := b .ConsumeID (BotsExportBotTokenRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.exportBotToken#bd0d99eb: %w" , err )
}
return e .DecodeBare (b )
}
func (e *BotsExportBotTokenRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode bots.exportBotToken#bd0d99eb to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.exportBotToken#bd0d99eb: field bot: %w" , err )
}
e .Bot = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode bots.exportBotToken#bd0d99eb: field revoke: %w" , err )
}
e .Revoke = value
}
return nil
}
func (e *BotsExportBotTokenRequest ) GetBot () (value InputUserClass ) {
if e == nil {
return
}
return e .Bot
}
func (e *BotsExportBotTokenRequest ) GetRevoke () (value bool ) {
if e == nil {
return
}
return e .Revoke
}
func (c *Client ) BotsExportBotToken (ctx context .Context , request *BotsExportBotTokenRequest ) (*BotsExportedBotToken , error ) {
var result BotsExportedBotToken
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 .