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 AccountSetContentSettingsRequest struct {
Flags bin .Fields
SensitiveEnabled bool
}
const AccountSetContentSettingsRequestTypeID = 0xb574b16b
var (
_ bin .Encoder = &AccountSetContentSettingsRequest {}
_ bin .Decoder = &AccountSetContentSettingsRequest {}
_ bin .BareEncoder = &AccountSetContentSettingsRequest {}
_ bin .BareDecoder = &AccountSetContentSettingsRequest {}
)
func (s *AccountSetContentSettingsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .SensitiveEnabled == false ) {
return false
}
return true
}
func (s *AccountSetContentSettingsRequest ) String () string {
if s == nil {
return "AccountSetContentSettingsRequest(nil)"
}
type Alias AccountSetContentSettingsRequest
return fmt .Sprintf ("AccountSetContentSettingsRequest%+v" , Alias (*s ))
}
func (s *AccountSetContentSettingsRequest ) FillFrom (from interface {
GetSensitiveEnabled () (value bool )
}) {
s .SensitiveEnabled = from .GetSensitiveEnabled ()
}
func (*AccountSetContentSettingsRequest ) TypeID () uint32 {
return AccountSetContentSettingsRequestTypeID
}
func (*AccountSetContentSettingsRequest ) TypeName () string {
return "account.setContentSettings"
}
func (s *AccountSetContentSettingsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.setContentSettings" ,
ID : AccountSetContentSettingsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SensitiveEnabled" ,
SchemaName : "sensitive_enabled" ,
Null : !s .Flags .Has (0 ),
},
}
return typ
}
func (s *AccountSetContentSettingsRequest ) SetFlags () {
if !(s .SensitiveEnabled == false ) {
s .Flags .Set (0 )
}
}
func (s *AccountSetContentSettingsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.setContentSettings#b574b16b as nil" )
}
b .PutID (AccountSetContentSettingsRequestTypeID )
return s .EncodeBare (b )
}
func (s *AccountSetContentSettingsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.setContentSettings#b574b16b as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.setContentSettings#b574b16b: field flags: %w" , err )
}
return nil
}
func (s *AccountSetContentSettingsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.setContentSettings#b574b16b to nil" )
}
if err := b .ConsumeID (AccountSetContentSettingsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.setContentSettings#b574b16b: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSetContentSettingsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.setContentSettings#b574b16b to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.setContentSettings#b574b16b: field flags: %w" , err )
}
}
s .SensitiveEnabled = s .Flags .Has (0 )
return nil
}
func (s *AccountSetContentSettingsRequest ) SetSensitiveEnabled (value bool ) {
if value {
s .Flags .Set (0 )
s .SensitiveEnabled = true
} else {
s .Flags .Unset (0 )
s .SensitiveEnabled = false
}
}
func (s *AccountSetContentSettingsRequest ) GetSensitiveEnabled () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (0 )
}
func (c *Client ) AccountSetContentSettings (ctx context .Context , request *AccountSetContentSettingsRequest ) (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 .