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