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 AccountGetPrivacyRequest struct {
Key InputPrivacyKeyClass
}
const AccountGetPrivacyRequestTypeID = 0xdadbc950
var (
_ bin .Encoder = &AccountGetPrivacyRequest {}
_ bin .Decoder = &AccountGetPrivacyRequest {}
_ bin .BareEncoder = &AccountGetPrivacyRequest {}
_ bin .BareDecoder = &AccountGetPrivacyRequest {}
)
func (g *AccountGetPrivacyRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Key == nil ) {
return false
}
return true
}
func (g *AccountGetPrivacyRequest ) String () string {
if g == nil {
return "AccountGetPrivacyRequest(nil)"
}
type Alias AccountGetPrivacyRequest
return fmt .Sprintf ("AccountGetPrivacyRequest%+v" , Alias (*g ))
}
func (g *AccountGetPrivacyRequest ) FillFrom (from interface {
GetKey () (value InputPrivacyKeyClass )
}) {
g .Key = from .GetKey ()
}
func (*AccountGetPrivacyRequest ) TypeID () uint32 {
return AccountGetPrivacyRequestTypeID
}
func (*AccountGetPrivacyRequest ) TypeName () string {
return "account.getPrivacy"
}
func (g *AccountGetPrivacyRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getPrivacy" ,
ID : AccountGetPrivacyRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Key" ,
SchemaName : "key" ,
},
}
return typ
}
func (g *AccountGetPrivacyRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getPrivacy#dadbc950 as nil" )
}
b .PutID (AccountGetPrivacyRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetPrivacyRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getPrivacy#dadbc950 as nil" )
}
if g .Key == nil {
return fmt .Errorf ("unable to encode account.getPrivacy#dadbc950: field key is nil" )
}
if err := g .Key .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.getPrivacy#dadbc950: field key: %w" , err )
}
return nil
}
func (g *AccountGetPrivacyRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getPrivacy#dadbc950 to nil" )
}
if err := b .ConsumeID (AccountGetPrivacyRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getPrivacy#dadbc950: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetPrivacyRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getPrivacy#dadbc950 to nil" )
}
{
value , err := DecodeInputPrivacyKey (b )
if err != nil {
return fmt .Errorf ("unable to decode account.getPrivacy#dadbc950: field key: %w" , err )
}
g .Key = value
}
return nil
}
func (g *AccountGetPrivacyRequest ) GetKey () (value InputPrivacyKeyClass ) {
if g == nil {
return
}
return g .Key
}
func (c *Client ) AccountGetPrivacy (ctx context .Context , key InputPrivacyKeyClass ) (*AccountPrivacyRules , error ) {
var result AccountPrivacyRules
request := &AccountGetPrivacyRequest {
Key : key ,
}
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 .