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 AuthDropTempAuthKeysRequest struct {
ExceptAuthKeys []int64
}
const AuthDropTempAuthKeysRequestTypeID = 0x8e48a188
var (
_ bin .Encoder = &AuthDropTempAuthKeysRequest {}
_ bin .Decoder = &AuthDropTempAuthKeysRequest {}
_ bin .BareEncoder = &AuthDropTempAuthKeysRequest {}
_ bin .BareDecoder = &AuthDropTempAuthKeysRequest {}
)
func (d *AuthDropTempAuthKeysRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .ExceptAuthKeys == nil ) {
return false
}
return true
}
func (d *AuthDropTempAuthKeysRequest ) String () string {
if d == nil {
return "AuthDropTempAuthKeysRequest(nil)"
}
type Alias AuthDropTempAuthKeysRequest
return fmt .Sprintf ("AuthDropTempAuthKeysRequest%+v" , Alias (*d ))
}
func (d *AuthDropTempAuthKeysRequest ) FillFrom (from interface {
GetExceptAuthKeys () (value []int64 )
}) {
d .ExceptAuthKeys = from .GetExceptAuthKeys ()
}
func (*AuthDropTempAuthKeysRequest ) TypeID () uint32 {
return AuthDropTempAuthKeysRequestTypeID
}
func (*AuthDropTempAuthKeysRequest ) TypeName () string {
return "auth.dropTempAuthKeys"
}
func (d *AuthDropTempAuthKeysRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.dropTempAuthKeys" ,
ID : AuthDropTempAuthKeysRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ExceptAuthKeys" ,
SchemaName : "except_auth_keys" ,
},
}
return typ
}
func (d *AuthDropTempAuthKeysRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode auth.dropTempAuthKeys#8e48a188 as nil" )
}
b .PutID (AuthDropTempAuthKeysRequestTypeID )
return d .EncodeBare (b )
}
func (d *AuthDropTempAuthKeysRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode auth.dropTempAuthKeys#8e48a188 as nil" )
}
b .PutVectorHeader (len (d .ExceptAuthKeys ))
for _ , v := range d .ExceptAuthKeys {
b .PutLong (v )
}
return nil
}
func (d *AuthDropTempAuthKeysRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode auth.dropTempAuthKeys#8e48a188 to nil" )
}
if err := b .ConsumeID (AuthDropTempAuthKeysRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.dropTempAuthKeys#8e48a188: %w" , err )
}
return d .DecodeBare (b )
}
func (d *AuthDropTempAuthKeysRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode auth.dropTempAuthKeys#8e48a188 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode auth.dropTempAuthKeys#8e48a188: field except_auth_keys: %w" , err )
}
if headerLen > 0 {
d .ExceptAuthKeys = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode auth.dropTempAuthKeys#8e48a188: field except_auth_keys: %w" , err )
}
d .ExceptAuthKeys = append (d .ExceptAuthKeys , value )
}
}
return nil
}
func (d *AuthDropTempAuthKeysRequest ) GetExceptAuthKeys () (value []int64 ) {
if d == nil {
return
}
return d .ExceptAuthKeys
}
func (c *Client ) AuthDropTempAuthKeys (ctx context .Context , exceptauthkeys []int64 ) (bool , error ) {
var result BoolBox
request := &AuthDropTempAuthKeysRequest {
ExceptAuthKeys : exceptauthkeys ,
}
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 .