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