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 AccountSetGlobalPrivacySettingsRequest struct {
Settings GlobalPrivacySettings
}
const AccountSetGlobalPrivacySettingsRequestTypeID = 0x1edaaac2
var (
_ bin .Encoder = &AccountSetGlobalPrivacySettingsRequest {}
_ bin .Decoder = &AccountSetGlobalPrivacySettingsRequest {}
_ bin .BareEncoder = &AccountSetGlobalPrivacySettingsRequest {}
_ bin .BareDecoder = &AccountSetGlobalPrivacySettingsRequest {}
)
func (s *AccountSetGlobalPrivacySettingsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Settings .Zero ()) {
return false
}
return true
}
func (s *AccountSetGlobalPrivacySettingsRequest ) String () string {
if s == nil {
return "AccountSetGlobalPrivacySettingsRequest(nil)"
}
type Alias AccountSetGlobalPrivacySettingsRequest
return fmt .Sprintf ("AccountSetGlobalPrivacySettingsRequest%+v" , Alias (*s ))
}
func (s *AccountSetGlobalPrivacySettingsRequest ) FillFrom (from interface {
GetSettings () (value GlobalPrivacySettings )
}) {
s .Settings = from .GetSettings ()
}
func (*AccountSetGlobalPrivacySettingsRequest ) TypeID () uint32 {
return AccountSetGlobalPrivacySettingsRequestTypeID
}
func (*AccountSetGlobalPrivacySettingsRequest ) TypeName () string {
return "account.setGlobalPrivacySettings"
}
func (s *AccountSetGlobalPrivacySettingsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.setGlobalPrivacySettings" ,
ID : AccountSetGlobalPrivacySettingsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Settings" ,
SchemaName : "settings" ,
},
}
return typ
}
func (s *AccountSetGlobalPrivacySettingsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.setGlobalPrivacySettings#1edaaac2 as nil" )
}
b .PutID (AccountSetGlobalPrivacySettingsRequestTypeID )
return s .EncodeBare (b )
}
func (s *AccountSetGlobalPrivacySettingsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.setGlobalPrivacySettings#1edaaac2 as nil" )
}
if err := s .Settings .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.setGlobalPrivacySettings#1edaaac2: field settings: %w" , err )
}
return nil
}
func (s *AccountSetGlobalPrivacySettingsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.setGlobalPrivacySettings#1edaaac2 to nil" )
}
if err := b .ConsumeID (AccountSetGlobalPrivacySettingsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.setGlobalPrivacySettings#1edaaac2: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSetGlobalPrivacySettingsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.setGlobalPrivacySettings#1edaaac2 to nil" )
}
{
if err := s .Settings .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.setGlobalPrivacySettings#1edaaac2: field settings: %w" , err )
}
}
return nil
}
func (s *AccountSetGlobalPrivacySettingsRequest ) GetSettings () (value GlobalPrivacySettings ) {
if s == nil {
return
}
return s .Settings
}
func (c *Client ) AccountSetGlobalPrivacySettings (ctx context .Context , settings GlobalPrivacySettings ) (*GlobalPrivacySettings , error ) {
var result GlobalPrivacySettings
request := &AccountSetGlobalPrivacySettingsRequest {
Settings : settings ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .