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 AuthCheckPaidAuthRequest struct {
PhoneNumber string
PhoneCodeHash string
FormID int64
}
const AuthCheckPaidAuthRequestTypeID = 0x56e59f9c
var (
_ bin .Encoder = &AuthCheckPaidAuthRequest {}
_ bin .Decoder = &AuthCheckPaidAuthRequest {}
_ bin .BareEncoder = &AuthCheckPaidAuthRequest {}
_ bin .BareDecoder = &AuthCheckPaidAuthRequest {}
)
func (c *AuthCheckPaidAuthRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .PhoneNumber == "" ) {
return false
}
if !(c .PhoneCodeHash == "" ) {
return false
}
if !(c .FormID == 0 ) {
return false
}
return true
}
func (c *AuthCheckPaidAuthRequest ) String () string {
if c == nil {
return "AuthCheckPaidAuthRequest(nil)"
}
type Alias AuthCheckPaidAuthRequest
return fmt .Sprintf ("AuthCheckPaidAuthRequest%+v" , Alias (*c ))
}
func (c *AuthCheckPaidAuthRequest ) FillFrom (from interface {
GetPhoneNumber () (value string )
GetPhoneCodeHash () (value string )
GetFormID () (value int64 )
}) {
c .PhoneNumber = from .GetPhoneNumber ()
c .PhoneCodeHash = from .GetPhoneCodeHash ()
c .FormID = from .GetFormID ()
}
func (*AuthCheckPaidAuthRequest ) TypeID () uint32 {
return AuthCheckPaidAuthRequestTypeID
}
func (*AuthCheckPaidAuthRequest ) TypeName () string {
return "auth.checkPaidAuth"
}
func (c *AuthCheckPaidAuthRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.checkPaidAuth" ,
ID : AuthCheckPaidAuthRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PhoneNumber" ,
SchemaName : "phone_number" ,
},
{
Name : "PhoneCodeHash" ,
SchemaName : "phone_code_hash" ,
},
{
Name : "FormID" ,
SchemaName : "form_id" ,
},
}
return typ
}
func (c *AuthCheckPaidAuthRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode auth.checkPaidAuth#56e59f9c as nil" )
}
b .PutID (AuthCheckPaidAuthRequestTypeID )
return c .EncodeBare (b )
}
func (c *AuthCheckPaidAuthRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode auth.checkPaidAuth#56e59f9c as nil" )
}
b .PutString (c .PhoneNumber )
b .PutString (c .PhoneCodeHash )
b .PutLong (c .FormID )
return nil
}
func (c *AuthCheckPaidAuthRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode auth.checkPaidAuth#56e59f9c to nil" )
}
if err := b .ConsumeID (AuthCheckPaidAuthRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.checkPaidAuth#56e59f9c: %w" , err )
}
return c .DecodeBare (b )
}
func (c *AuthCheckPaidAuthRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode auth.checkPaidAuth#56e59f9c to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode auth.checkPaidAuth#56e59f9c: field phone_number: %w" , err )
}
c .PhoneNumber = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode auth.checkPaidAuth#56e59f9c: field phone_code_hash: %w" , err )
}
c .PhoneCodeHash = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode auth.checkPaidAuth#56e59f9c: field form_id: %w" , err )
}
c .FormID = value
}
return nil
}
func (c *AuthCheckPaidAuthRequest ) GetPhoneNumber () (value string ) {
if c == nil {
return
}
return c .PhoneNumber
}
func (c *AuthCheckPaidAuthRequest ) GetPhoneCodeHash () (value string ) {
if c == nil {
return
}
return c .PhoneCodeHash
}
func (c *AuthCheckPaidAuthRequest ) GetFormID () (value int64 ) {
if c == nil {
return
}
return c .FormID
}
func (c *Client ) AuthCheckPaidAuth (ctx context .Context , request *AuthCheckPaidAuthRequest ) (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.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .