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 AccountUpdateConnectedBotRequest struct {
Flags bin .Fields
Deleted bool
Rights BusinessBotRights
Bot InputUserClass
Recipients InputBusinessBotRecipients
}
const AccountUpdateConnectedBotRequestTypeID = 0x66a08c7e
var (
_ bin .Encoder = &AccountUpdateConnectedBotRequest {}
_ bin .Decoder = &AccountUpdateConnectedBotRequest {}
_ bin .BareEncoder = &AccountUpdateConnectedBotRequest {}
_ bin .BareDecoder = &AccountUpdateConnectedBotRequest {}
)
func (u *AccountUpdateConnectedBotRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Flags .Zero ()) {
return false
}
if !(u .Deleted == false ) {
return false
}
if !(u .Rights .Zero ()) {
return false
}
if !(u .Bot == nil ) {
return false
}
if !(u .Recipients .Zero ()) {
return false
}
return true
}
func (u *AccountUpdateConnectedBotRequest ) String () string {
if u == nil {
return "AccountUpdateConnectedBotRequest(nil)"
}
type Alias AccountUpdateConnectedBotRequest
return fmt .Sprintf ("AccountUpdateConnectedBotRequest%+v" , Alias (*u ))
}
func (u *AccountUpdateConnectedBotRequest ) FillFrom (from interface {
GetDeleted () (value bool )
GetRights () (value BusinessBotRights , ok bool )
GetBot () (value InputUserClass )
GetRecipients () (value InputBusinessBotRecipients )
}) {
u .Deleted = from .GetDeleted ()
if val , ok := from .GetRights (); ok {
u .Rights = val
}
u .Bot = from .GetBot ()
u .Recipients = from .GetRecipients ()
}
func (*AccountUpdateConnectedBotRequest ) TypeID () uint32 {
return AccountUpdateConnectedBotRequestTypeID
}
func (*AccountUpdateConnectedBotRequest ) TypeName () string {
return "account.updateConnectedBot"
}
func (u *AccountUpdateConnectedBotRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updateConnectedBot" ,
ID : AccountUpdateConnectedBotRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Deleted" ,
SchemaName : "deleted" ,
Null : !u .Flags .Has (1 ),
},
{
Name : "Rights" ,
SchemaName : "rights" ,
Null : !u .Flags .Has (0 ),
},
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "Recipients" ,
SchemaName : "recipients" ,
},
}
return typ
}
func (u *AccountUpdateConnectedBotRequest ) SetFlags () {
if !(u .Deleted == false ) {
u .Flags .Set (1 )
}
if !(u .Rights .Zero ()) {
u .Flags .Set (0 )
}
}
func (u *AccountUpdateConnectedBotRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateConnectedBot#66a08c7e as nil" )
}
b .PutID (AccountUpdateConnectedBotRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdateConnectedBotRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateConnectedBot#66a08c7e as nil" )
}
u .SetFlags ()
if err := u .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateConnectedBot#66a08c7e: field flags: %w" , err )
}
if u .Flags .Has (0 ) {
if err := u .Rights .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateConnectedBot#66a08c7e: field rights: %w" , err )
}
}
if u .Bot == nil {
return fmt .Errorf ("unable to encode account.updateConnectedBot#66a08c7e: field bot is nil" )
}
if err := u .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateConnectedBot#66a08c7e: field bot: %w" , err )
}
if err := u .Recipients .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateConnectedBot#66a08c7e: field recipients: %w" , err )
}
return nil
}
func (u *AccountUpdateConnectedBotRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateConnectedBot#66a08c7e to nil" )
}
if err := b .ConsumeID (AccountUpdateConnectedBotRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updateConnectedBot#66a08c7e: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdateConnectedBotRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateConnectedBot#66a08c7e to nil" )
}
{
if err := u .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateConnectedBot#66a08c7e: field flags: %w" , err )
}
}
u .Deleted = u .Flags .Has (1 )
if u .Flags .Has (0 ) {
if err := u .Rights .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateConnectedBot#66a08c7e: field rights: %w" , err )
}
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode account.updateConnectedBot#66a08c7e: field bot: %w" , err )
}
u .Bot = value
}
{
if err := u .Recipients .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateConnectedBot#66a08c7e: field recipients: %w" , err )
}
}
return nil
}
func (u *AccountUpdateConnectedBotRequest ) SetDeleted (value bool ) {
if value {
u .Flags .Set (1 )
u .Deleted = true
} else {
u .Flags .Unset (1 )
u .Deleted = false
}
}
func (u *AccountUpdateConnectedBotRequest ) GetDeleted () (value bool ) {
if u == nil {
return
}
return u .Flags .Has (1 )
}
func (u *AccountUpdateConnectedBotRequest ) SetRights (value BusinessBotRights ) {
u .Flags .Set (0 )
u .Rights = value
}
func (u *AccountUpdateConnectedBotRequest ) GetRights () (value BusinessBotRights , ok bool ) {
if u == nil {
return
}
if !u .Flags .Has (0 ) {
return value , false
}
return u .Rights , true
}
func (u *AccountUpdateConnectedBotRequest ) GetBot () (value InputUserClass ) {
if u == nil {
return
}
return u .Bot
}
func (u *AccountUpdateConnectedBotRequest ) GetRecipients () (value InputBusinessBotRecipients ) {
if u == nil {
return
}
return u .Recipients
}
func (c *Client ) AccountUpdateConnectedBot (ctx context .Context , request *AccountUpdateConnectedBotRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .