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 AccountConfirmBotConnectionRequest struct {
BotID InputUserClass
}
const AccountConfirmBotConnectionRequestTypeID = 0x67ed1f68
var (
_ bin .Encoder = &AccountConfirmBotConnectionRequest {}
_ bin .Decoder = &AccountConfirmBotConnectionRequest {}
_ bin .BareEncoder = &AccountConfirmBotConnectionRequest {}
_ bin .BareDecoder = &AccountConfirmBotConnectionRequest {}
)
func (c *AccountConfirmBotConnectionRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .BotID == nil ) {
return false
}
return true
}
func (c *AccountConfirmBotConnectionRequest ) String () string {
if c == nil {
return "AccountConfirmBotConnectionRequest(nil)"
}
type Alias AccountConfirmBotConnectionRequest
return fmt .Sprintf ("AccountConfirmBotConnectionRequest%+v" , Alias (*c ))
}
func (c *AccountConfirmBotConnectionRequest ) FillFrom (from interface {
GetBotID () (value InputUserClass )
}) {
c .BotID = from .GetBotID ()
}
func (*AccountConfirmBotConnectionRequest ) TypeID () uint32 {
return AccountConfirmBotConnectionRequestTypeID
}
func (*AccountConfirmBotConnectionRequest ) TypeName () string {
return "account.confirmBotConnection"
}
func (c *AccountConfirmBotConnectionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.confirmBotConnection" ,
ID : AccountConfirmBotConnectionRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BotID" ,
SchemaName : "bot_id" ,
},
}
return typ
}
func (c *AccountConfirmBotConnectionRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode account.confirmBotConnection#67ed1f68 as nil" )
}
b .PutID (AccountConfirmBotConnectionRequestTypeID )
return c .EncodeBare (b )
}
func (c *AccountConfirmBotConnectionRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode account.confirmBotConnection#67ed1f68 as nil" )
}
if c .BotID == nil {
return fmt .Errorf ("unable to encode account.confirmBotConnection#67ed1f68: field bot_id is nil" )
}
if err := c .BotID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.confirmBotConnection#67ed1f68: field bot_id: %w" , err )
}
return nil
}
func (c *AccountConfirmBotConnectionRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode account.confirmBotConnection#67ed1f68 to nil" )
}
if err := b .ConsumeID (AccountConfirmBotConnectionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.confirmBotConnection#67ed1f68: %w" , err )
}
return c .DecodeBare (b )
}
func (c *AccountConfirmBotConnectionRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode account.confirmBotConnection#67ed1f68 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode account.confirmBotConnection#67ed1f68: field bot_id: %w" , err )
}
c .BotID = value
}
return nil
}
func (c *AccountConfirmBotConnectionRequest ) GetBotID () (value InputUserClass ) {
if c == nil {
return
}
return c .BotID
}
func (c *Client ) AccountConfirmBotConnection (ctx context .Context , botid InputUserClass ) (bool , error ) {
var result BoolBox
request := &AccountConfirmBotConnectionRequest {
BotID : botid ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .