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 AuthResendCodeRequest struct {
PhoneNumber string
PhoneCodeHash string
}
const AuthResendCodeRequestTypeID = 0x3ef1a9bf
var (
_ bin .Encoder = &AuthResendCodeRequest {}
_ bin .Decoder = &AuthResendCodeRequest {}
_ bin .BareEncoder = &AuthResendCodeRequest {}
_ bin .BareDecoder = &AuthResendCodeRequest {}
)
func (r *AuthResendCodeRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .PhoneNumber == "" ) {
return false
}
if !(r .PhoneCodeHash == "" ) {
return false
}
return true
}
func (r *AuthResendCodeRequest ) String () string {
if r == nil {
return "AuthResendCodeRequest(nil)"
}
type Alias AuthResendCodeRequest
return fmt .Sprintf ("AuthResendCodeRequest%+v" , Alias (*r ))
}
func (r *AuthResendCodeRequest ) FillFrom (from interface {
GetPhoneNumber () (value string )
GetPhoneCodeHash () (value string )
}) {
r .PhoneNumber = from .GetPhoneNumber ()
r .PhoneCodeHash = from .GetPhoneCodeHash ()
}
func (*AuthResendCodeRequest ) TypeID () uint32 {
return AuthResendCodeRequestTypeID
}
func (*AuthResendCodeRequest ) TypeName () string {
return "auth.resendCode"
}
func (r *AuthResendCodeRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.resendCode" ,
ID : AuthResendCodeRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PhoneNumber" ,
SchemaName : "phone_number" ,
},
{
Name : "PhoneCodeHash" ,
SchemaName : "phone_code_hash" ,
},
}
return typ
}
func (r *AuthResendCodeRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode auth.resendCode#3ef1a9bf as nil" )
}
b .PutID (AuthResendCodeRequestTypeID )
return r .EncodeBare (b )
}
func (r *AuthResendCodeRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode auth.resendCode#3ef1a9bf as nil" )
}
b .PutString (r .PhoneNumber )
b .PutString (r .PhoneCodeHash )
return nil
}
func (r *AuthResendCodeRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode auth.resendCode#3ef1a9bf to nil" )
}
if err := b .ConsumeID (AuthResendCodeRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.resendCode#3ef1a9bf: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AuthResendCodeRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode auth.resendCode#3ef1a9bf to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode auth.resendCode#3ef1a9bf: field phone_number: %w" , err )
}
r .PhoneNumber = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode auth.resendCode#3ef1a9bf: field phone_code_hash: %w" , err )
}
r .PhoneCodeHash = value
}
return nil
}
func (r *AuthResendCodeRequest ) GetPhoneNumber () (value string ) {
if r == nil {
return
}
return r .PhoneNumber
}
func (r *AuthResendCodeRequest ) GetPhoneCodeHash () (value string ) {
if r == nil {
return
}
return r .PhoneCodeHash
}
func (c *Client ) AuthResendCode (ctx context .Context , request *AuthResendCodeRequest ) (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 .