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 AccountSendConfirmPhoneCodeRequest struct {
Hash string
Settings CodeSettings
}
const AccountSendConfirmPhoneCodeRequestTypeID = 0x1b3faa88
var (
_ bin .Encoder = &AccountSendConfirmPhoneCodeRequest {}
_ bin .Decoder = &AccountSendConfirmPhoneCodeRequest {}
_ bin .BareEncoder = &AccountSendConfirmPhoneCodeRequest {}
_ bin .BareDecoder = &AccountSendConfirmPhoneCodeRequest {}
)
func (s *AccountSendConfirmPhoneCodeRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Hash == "" ) {
return false
}
if !(s .Settings .Zero ()) {
return false
}
return true
}
func (s *AccountSendConfirmPhoneCodeRequest ) String () string {
if s == nil {
return "AccountSendConfirmPhoneCodeRequest(nil)"
}
type Alias AccountSendConfirmPhoneCodeRequest
return fmt .Sprintf ("AccountSendConfirmPhoneCodeRequest%+v" , Alias (*s ))
}
func (s *AccountSendConfirmPhoneCodeRequest ) FillFrom (from interface {
GetHash () (value string )
GetSettings () (value CodeSettings )
}) {
s .Hash = from .GetHash ()
s .Settings = from .GetSettings ()
}
func (*AccountSendConfirmPhoneCodeRequest ) TypeID () uint32 {
return AccountSendConfirmPhoneCodeRequestTypeID
}
func (*AccountSendConfirmPhoneCodeRequest ) TypeName () string {
return "account.sendConfirmPhoneCode"
}
func (s *AccountSendConfirmPhoneCodeRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.sendConfirmPhoneCode" ,
ID : AccountSendConfirmPhoneCodeRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Settings" ,
SchemaName : "settings" ,
},
}
return typ
}
func (s *AccountSendConfirmPhoneCodeRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.sendConfirmPhoneCode#1b3faa88 as nil" )
}
b .PutID (AccountSendConfirmPhoneCodeRequestTypeID )
return s .EncodeBare (b )
}
func (s *AccountSendConfirmPhoneCodeRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.sendConfirmPhoneCode#1b3faa88 as nil" )
}
b .PutString (s .Hash )
if err := s .Settings .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.sendConfirmPhoneCode#1b3faa88: field settings: %w" , err )
}
return nil
}
func (s *AccountSendConfirmPhoneCodeRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.sendConfirmPhoneCode#1b3faa88 to nil" )
}
if err := b .ConsumeID (AccountSendConfirmPhoneCodeRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.sendConfirmPhoneCode#1b3faa88: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSendConfirmPhoneCodeRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.sendConfirmPhoneCode#1b3faa88 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.sendConfirmPhoneCode#1b3faa88: field hash: %w" , err )
}
s .Hash = value
}
{
if err := s .Settings .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode account.sendConfirmPhoneCode#1b3faa88: field settings: %w" , err )
}
}
return nil
}
func (s *AccountSendConfirmPhoneCodeRequest ) GetHash () (value string ) {
if s == nil {
return
}
return s .Hash
}
func (s *AccountSendConfirmPhoneCodeRequest ) GetSettings () (value CodeSettings ) {
if s == nil {
return
}
return s .Settings
}
func (c *Client ) AccountSendConfirmPhoneCode (ctx context .Context , request *AccountSendConfirmPhoneCodeRequest ) (AuthSentCodeClass , error ) {
var result AuthSentCodeBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .SentCode , 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 .