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 AccountInvalidateSignInCodesRequest struct {
Codes []string
}
const AccountInvalidateSignInCodesRequestTypeID = 0xca8ae8ba
var (
_ bin .Encoder = &AccountInvalidateSignInCodesRequest {}
_ bin .Decoder = &AccountInvalidateSignInCodesRequest {}
_ bin .BareEncoder = &AccountInvalidateSignInCodesRequest {}
_ bin .BareDecoder = &AccountInvalidateSignInCodesRequest {}
)
func (i *AccountInvalidateSignInCodesRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .Codes == nil ) {
return false
}
return true
}
func (i *AccountInvalidateSignInCodesRequest ) String () string {
if i == nil {
return "AccountInvalidateSignInCodesRequest(nil)"
}
type Alias AccountInvalidateSignInCodesRequest
return fmt .Sprintf ("AccountInvalidateSignInCodesRequest%+v" , Alias (*i ))
}
func (i *AccountInvalidateSignInCodesRequest ) FillFrom (from interface {
GetCodes () (value []string )
}) {
i .Codes = from .GetCodes ()
}
func (*AccountInvalidateSignInCodesRequest ) TypeID () uint32 {
return AccountInvalidateSignInCodesRequestTypeID
}
func (*AccountInvalidateSignInCodesRequest ) TypeName () string {
return "account.invalidateSignInCodes"
}
func (i *AccountInvalidateSignInCodesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.invalidateSignInCodes" ,
ID : AccountInvalidateSignInCodesRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Codes" ,
SchemaName : "codes" ,
},
}
return typ
}
func (i *AccountInvalidateSignInCodesRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode account.invalidateSignInCodes#ca8ae8ba as nil" )
}
b .PutID (AccountInvalidateSignInCodesRequestTypeID )
return i .EncodeBare (b )
}
func (i *AccountInvalidateSignInCodesRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode account.invalidateSignInCodes#ca8ae8ba as nil" )
}
b .PutVectorHeader (len (i .Codes ))
for _ , v := range i .Codes {
b .PutString (v )
}
return nil
}
func (i *AccountInvalidateSignInCodesRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode account.invalidateSignInCodes#ca8ae8ba to nil" )
}
if err := b .ConsumeID (AccountInvalidateSignInCodesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.invalidateSignInCodes#ca8ae8ba: %w" , err )
}
return i .DecodeBare (b )
}
func (i *AccountInvalidateSignInCodesRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode account.invalidateSignInCodes#ca8ae8ba to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode account.invalidateSignInCodes#ca8ae8ba: field codes: %w" , err )
}
if headerLen > 0 {
i .Codes = make ([]string , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.invalidateSignInCodes#ca8ae8ba: field codes: %w" , err )
}
i .Codes = append (i .Codes , value )
}
}
return nil
}
func (i *AccountInvalidateSignInCodesRequest ) GetCodes () (value []string ) {
if i == nil {
return
}
return i .Codes
}
func (c *Client ) AccountInvalidateSignInCodes (ctx context .Context , codes []string ) (bool , error ) {
var result BoolBox
request := &AccountInvalidateSignInCodesRequest {
Codes : codes ,
}
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 .