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 AccountUpdateEmojiStatusRequest struct {
EmojiStatus EmojiStatusClass
}
const AccountUpdateEmojiStatusRequestTypeID = 0xfbd3de6b
var (
_ bin .Encoder = &AccountUpdateEmojiStatusRequest {}
_ bin .Decoder = &AccountUpdateEmojiStatusRequest {}
_ bin .BareEncoder = &AccountUpdateEmojiStatusRequest {}
_ bin .BareDecoder = &AccountUpdateEmojiStatusRequest {}
)
func (u *AccountUpdateEmojiStatusRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .EmojiStatus == nil ) {
return false
}
return true
}
func (u *AccountUpdateEmojiStatusRequest ) String () string {
if u == nil {
return "AccountUpdateEmojiStatusRequest(nil)"
}
type Alias AccountUpdateEmojiStatusRequest
return fmt .Sprintf ("AccountUpdateEmojiStatusRequest%+v" , Alias (*u ))
}
func (u *AccountUpdateEmojiStatusRequest ) FillFrom (from interface {
GetEmojiStatus () (value EmojiStatusClass )
}) {
u .EmojiStatus = from .GetEmojiStatus ()
}
func (*AccountUpdateEmojiStatusRequest ) TypeID () uint32 {
return AccountUpdateEmojiStatusRequestTypeID
}
func (*AccountUpdateEmojiStatusRequest ) TypeName () string {
return "account.updateEmojiStatus"
}
func (u *AccountUpdateEmojiStatusRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updateEmojiStatus" ,
ID : AccountUpdateEmojiStatusRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "EmojiStatus" ,
SchemaName : "emoji_status" ,
},
}
return typ
}
func (u *AccountUpdateEmojiStatusRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateEmojiStatus#fbd3de6b as nil" )
}
b .PutID (AccountUpdateEmojiStatusRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdateEmojiStatusRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateEmojiStatus#fbd3de6b as nil" )
}
if u .EmojiStatus == nil {
return fmt .Errorf ("unable to encode account.updateEmojiStatus#fbd3de6b: field emoji_status is nil" )
}
if err := u .EmojiStatus .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateEmojiStatus#fbd3de6b: field emoji_status: %w" , err )
}
return nil
}
func (u *AccountUpdateEmojiStatusRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateEmojiStatus#fbd3de6b to nil" )
}
if err := b .ConsumeID (AccountUpdateEmojiStatusRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updateEmojiStatus#fbd3de6b: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdateEmojiStatusRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateEmojiStatus#fbd3de6b to nil" )
}
{
value , err := DecodeEmojiStatus (b )
if err != nil {
return fmt .Errorf ("unable to decode account.updateEmojiStatus#fbd3de6b: field emoji_status: %w" , err )
}
u .EmojiStatus = value
}
return nil
}
func (u *AccountUpdateEmojiStatusRequest ) GetEmojiStatus () (value EmojiStatusClass ) {
if u == nil {
return
}
return u .EmojiStatus
}
func (u *AccountUpdateEmojiStatusRequest ) GetEmojiStatusAsNotEmpty () (NotEmptyEmojiStatus , bool ) {
return u .EmojiStatus .AsNotEmpty ()
}
func (c *Client ) AccountUpdateEmojiStatus (ctx context .Context , emojistatus EmojiStatusClass ) (bool , error ) {
var result BoolBox
request := &AccountUpdateEmojiStatusRequest {
EmojiStatus : emojistatus ,
}
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.6.7 . (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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .