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 AccountDeleteSecureValueRequest struct {
Types []SecureValueTypeClass
}
const AccountDeleteSecureValueRequestTypeID = 0xb880bc4b
var (
_ bin .Encoder = &AccountDeleteSecureValueRequest {}
_ bin .Decoder = &AccountDeleteSecureValueRequest {}
_ bin .BareEncoder = &AccountDeleteSecureValueRequest {}
_ bin .BareDecoder = &AccountDeleteSecureValueRequest {}
)
func (d *AccountDeleteSecureValueRequest ) Zero () bool {
if d == nil {
return true
}
if !(d .Types == nil ) {
return false
}
return true
}
func (d *AccountDeleteSecureValueRequest ) String () string {
if d == nil {
return "AccountDeleteSecureValueRequest(nil)"
}
type Alias AccountDeleteSecureValueRequest
return fmt .Sprintf ("AccountDeleteSecureValueRequest%+v" , Alias (*d ))
}
func (d *AccountDeleteSecureValueRequest ) FillFrom (from interface {
GetTypes () (value []SecureValueTypeClass )
}) {
d .Types = from .GetTypes ()
}
func (*AccountDeleteSecureValueRequest ) TypeID () uint32 {
return AccountDeleteSecureValueRequestTypeID
}
func (*AccountDeleteSecureValueRequest ) TypeName () string {
return "account.deleteSecureValue"
}
func (d *AccountDeleteSecureValueRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.deleteSecureValue" ,
ID : AccountDeleteSecureValueRequestTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Types" ,
SchemaName : "types" ,
},
}
return typ
}
func (d *AccountDeleteSecureValueRequest ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode account.deleteSecureValue#b880bc4b as nil" )
}
b .PutID (AccountDeleteSecureValueRequestTypeID )
return d .EncodeBare (b )
}
func (d *AccountDeleteSecureValueRequest ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode account.deleteSecureValue#b880bc4b as nil" )
}
b .PutVectorHeader (len (d .Types ))
for idx , v := range d .Types {
if v == nil {
return fmt .Errorf ("unable to encode account.deleteSecureValue#b880bc4b: field types element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.deleteSecureValue#b880bc4b: field types element with index %d: %w" , idx , err )
}
}
return nil
}
func (d *AccountDeleteSecureValueRequest ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode account.deleteSecureValue#b880bc4b to nil" )
}
if err := b .ConsumeID (AccountDeleteSecureValueRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.deleteSecureValue#b880bc4b: %w" , err )
}
return d .DecodeBare (b )
}
func (d *AccountDeleteSecureValueRequest ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode account.deleteSecureValue#b880bc4b to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode account.deleteSecureValue#b880bc4b: field types: %w" , err )
}
if headerLen > 0 {
d .Types = make ([]SecureValueTypeClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeSecureValueType (b )
if err != nil {
return fmt .Errorf ("unable to decode account.deleteSecureValue#b880bc4b: field types: %w" , err )
}
d .Types = append (d .Types , value )
}
}
return nil
}
func (d *AccountDeleteSecureValueRequest ) GetTypes () (value []SecureValueTypeClass ) {
if d == nil {
return
}
return d .Types
}
func (d *AccountDeleteSecureValueRequest ) MapTypes () (value SecureValueTypeClassArray ) {
return SecureValueTypeClassArray (d .Types )
}
func (c *Client ) AccountDeleteSecureValue (ctx context .Context , types []SecureValueTypeClass ) (bool , error ) {
var result BoolBox
request := &AccountDeleteSecureValueRequest {
Types : types ,
}
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 .