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 AccountUpdateBirthdayRequest struct {
Flags bin .Fields
Birthday Birthday
}
const AccountUpdateBirthdayRequestTypeID = 0xcc6e0c11
var (
_ bin .Encoder = &AccountUpdateBirthdayRequest {}
_ bin .Decoder = &AccountUpdateBirthdayRequest {}
_ bin .BareEncoder = &AccountUpdateBirthdayRequest {}
_ bin .BareDecoder = &AccountUpdateBirthdayRequest {}
)
func (u *AccountUpdateBirthdayRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Flags .Zero ()) {
return false
}
if !(u .Birthday .Zero ()) {
return false
}
return true
}
func (u *AccountUpdateBirthdayRequest ) String () string {
if u == nil {
return "AccountUpdateBirthdayRequest(nil)"
}
type Alias AccountUpdateBirthdayRequest
return fmt .Sprintf ("AccountUpdateBirthdayRequest%+v" , Alias (*u ))
}
func (u *AccountUpdateBirthdayRequest ) FillFrom (from interface {
GetBirthday () (value Birthday , ok bool )
}) {
if val , ok := from .GetBirthday (); ok {
u .Birthday = val
}
}
func (*AccountUpdateBirthdayRequest ) TypeID () uint32 {
return AccountUpdateBirthdayRequestTypeID
}
func (*AccountUpdateBirthdayRequest ) TypeName () string {
return "account.updateBirthday"
}
func (u *AccountUpdateBirthdayRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updateBirthday" ,
ID : AccountUpdateBirthdayRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Birthday" ,
SchemaName : "birthday" ,
Null : !u .Flags .Has (0 ),
},
}
return typ
}
func (u *AccountUpdateBirthdayRequest ) SetFlags () {
if !(u .Birthday .Zero ()) {
u .Flags .Set (0 )
}
}
func (u *AccountUpdateBirthdayRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateBirthday#cc6e0c11 as nil" )
}
b .PutID (AccountUpdateBirthdayRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdateBirthdayRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateBirthday#cc6e0c11 as nil" )
}
u .SetFlags ()
if err := u .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateBirthday#cc6e0c11: field flags: %w" , err )
}
if u .Flags .Has (0 ) {
if err := u .Birthday .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateBirthday#cc6e0c11: field birthday: %w" , err )
}
}
return nil
}
func (u *AccountUpdateBirthdayRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateBirthday#cc6e0c11 to nil" )
}
if err := b .ConsumeID (AccountUpdateBirthdayRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updateBirthday#cc6e0c11: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdateBirthdayRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateBirthday#cc6e0c11 to nil" )
}
{
if err := u .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateBirthday#cc6e0c11: field flags: %w" , err )
}
}
if u .Flags .Has (0 ) {
if err := u .Birthday .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateBirthday#cc6e0c11: field birthday: %w" , err )
}
}
return nil
}
func (u *AccountUpdateBirthdayRequest ) SetBirthday (value Birthday ) {
u .Flags .Set (0 )
u .Birthday = value
}
func (u *AccountUpdateBirthdayRequest ) GetBirthday () (value Birthday , ok bool ) {
if u == nil {
return
}
if !u .Flags .Has (0 ) {
return value , false
}
return u .Birthday , true
}
func (c *Client ) AccountUpdateBirthday (ctx context .Context , request *AccountUpdateBirthdayRequest ) (bool , error ) {
var result BoolBox
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 .