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 AccountUpdatePersonalChannelRequest struct {
Channel InputChannelClass
}
const AccountUpdatePersonalChannelRequestTypeID = 0xd94305e0
var (
_ bin .Encoder = &AccountUpdatePersonalChannelRequest {}
_ bin .Decoder = &AccountUpdatePersonalChannelRequest {}
_ bin .BareEncoder = &AccountUpdatePersonalChannelRequest {}
_ bin .BareDecoder = &AccountUpdatePersonalChannelRequest {}
)
func (u *AccountUpdatePersonalChannelRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Channel == nil ) {
return false
}
return true
}
func (u *AccountUpdatePersonalChannelRequest ) String () string {
if u == nil {
return "AccountUpdatePersonalChannelRequest(nil)"
}
type Alias AccountUpdatePersonalChannelRequest
return fmt .Sprintf ("AccountUpdatePersonalChannelRequest%+v" , Alias (*u ))
}
func (u *AccountUpdatePersonalChannelRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
}) {
u .Channel = from .GetChannel ()
}
func (*AccountUpdatePersonalChannelRequest ) TypeID () uint32 {
return AccountUpdatePersonalChannelRequestTypeID
}
func (*AccountUpdatePersonalChannelRequest ) TypeName () string {
return "account.updatePersonalChannel"
}
func (u *AccountUpdatePersonalChannelRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updatePersonalChannel" ,
ID : AccountUpdatePersonalChannelRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
}
return typ
}
func (u *AccountUpdatePersonalChannelRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updatePersonalChannel#d94305e0 as nil" )
}
b .PutID (AccountUpdatePersonalChannelRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdatePersonalChannelRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updatePersonalChannel#d94305e0 as nil" )
}
if u .Channel == nil {
return fmt .Errorf ("unable to encode account.updatePersonalChannel#d94305e0: field channel is nil" )
}
if err := u .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updatePersonalChannel#d94305e0: field channel: %w" , err )
}
return nil
}
func (u *AccountUpdatePersonalChannelRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updatePersonalChannel#d94305e0 to nil" )
}
if err := b .ConsumeID (AccountUpdatePersonalChannelRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updatePersonalChannel#d94305e0: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdatePersonalChannelRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updatePersonalChannel#d94305e0 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode account.updatePersonalChannel#d94305e0: field channel: %w" , err )
}
u .Channel = value
}
return nil
}
func (u *AccountUpdatePersonalChannelRequest ) GetChannel () (value InputChannelClass ) {
if u == nil {
return
}
return u .Channel
}
func (u *AccountUpdatePersonalChannelRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return u .Channel .AsNotEmpty ()
}
func (c *Client ) AccountUpdatePersonalChannel (ctx context .Context , channel InputChannelClass ) (bool , error ) {
var result BoolBox
request := &AccountUpdatePersonalChannelRequest {
Channel : channel ,
}
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 .