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 AccountUpdateNotifySettingsRequest struct {
Peer InputNotifyPeerClass
Settings InputPeerNotifySettings
}
const AccountUpdateNotifySettingsRequestTypeID = 0x84be5b93
var (
_ bin .Encoder = &AccountUpdateNotifySettingsRequest {}
_ bin .Decoder = &AccountUpdateNotifySettingsRequest {}
_ bin .BareEncoder = &AccountUpdateNotifySettingsRequest {}
_ bin .BareDecoder = &AccountUpdateNotifySettingsRequest {}
)
func (u *AccountUpdateNotifySettingsRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Peer == nil ) {
return false
}
if !(u .Settings .Zero ()) {
return false
}
return true
}
func (u *AccountUpdateNotifySettingsRequest ) String () string {
if u == nil {
return "AccountUpdateNotifySettingsRequest(nil)"
}
type Alias AccountUpdateNotifySettingsRequest
return fmt .Sprintf ("AccountUpdateNotifySettingsRequest%+v" , Alias (*u ))
}
func (u *AccountUpdateNotifySettingsRequest ) FillFrom (from interface {
GetPeer () (value InputNotifyPeerClass )
GetSettings () (value InputPeerNotifySettings )
}) {
u .Peer = from .GetPeer ()
u .Settings = from .GetSettings ()
}
func (*AccountUpdateNotifySettingsRequest ) TypeID () uint32 {
return AccountUpdateNotifySettingsRequestTypeID
}
func (*AccountUpdateNotifySettingsRequest ) TypeName () string {
return "account.updateNotifySettings"
}
func (u *AccountUpdateNotifySettingsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.updateNotifySettings" ,
ID : AccountUpdateNotifySettingsRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Settings" ,
SchemaName : "settings" ,
},
}
return typ
}
func (u *AccountUpdateNotifySettingsRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateNotifySettings#84be5b93 as nil" )
}
b .PutID (AccountUpdateNotifySettingsRequestTypeID )
return u .EncodeBare (b )
}
func (u *AccountUpdateNotifySettingsRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode account.updateNotifySettings#84be5b93 as nil" )
}
if u .Peer == nil {
return fmt .Errorf ("unable to encode account.updateNotifySettings#84be5b93: field peer is nil" )
}
if err := u .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateNotifySettings#84be5b93: field peer: %w" , err )
}
if err := u .Settings .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.updateNotifySettings#84be5b93: field settings: %w" , err )
}
return nil
}
func (u *AccountUpdateNotifySettingsRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateNotifySettings#84be5b93 to nil" )
}
if err := b .ConsumeID (AccountUpdateNotifySettingsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.updateNotifySettings#84be5b93: %w" , err )
}
return u .DecodeBare (b )
}
func (u *AccountUpdateNotifySettingsRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode account.updateNotifySettings#84be5b93 to nil" )
}
{
value , err := DecodeInputNotifyPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode account.updateNotifySettings#84be5b93: field peer: %w" , err )
}
u .Peer = value
}
{
if err := u .Settings .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.updateNotifySettings#84be5b93: field settings: %w" , err )
}
}
return nil
}
func (u *AccountUpdateNotifySettingsRequest ) GetPeer () (value InputNotifyPeerClass ) {
if u == nil {
return
}
return u .Peer
}
func (u *AccountUpdateNotifySettingsRequest ) GetSettings () (value InputPeerNotifySettings ) {
if u == nil {
return
}
return u .Settings
}
func (c *Client ) AccountUpdateNotifySettings (ctx context .Context , request *AccountUpdateNotifySettingsRequest ) (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.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 .