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 AuthCheckRecoveryPasswordRequest struct {
Code string
}
const AuthCheckRecoveryPasswordRequestTypeID = 0xd36bf79
var (
_ bin .Encoder = &AuthCheckRecoveryPasswordRequest {}
_ bin .Decoder = &AuthCheckRecoveryPasswordRequest {}
_ bin .BareEncoder = &AuthCheckRecoveryPasswordRequest {}
_ bin .BareDecoder = &AuthCheckRecoveryPasswordRequest {}
)
func (c *AuthCheckRecoveryPasswordRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Code == "" ) {
return false
}
return true
}
func (c *AuthCheckRecoveryPasswordRequest ) String () string {
if c == nil {
return "AuthCheckRecoveryPasswordRequest(nil)"
}
type Alias AuthCheckRecoveryPasswordRequest
return fmt .Sprintf ("AuthCheckRecoveryPasswordRequest%+v" , Alias (*c ))
}
func (c *AuthCheckRecoveryPasswordRequest ) FillFrom (from interface {
GetCode () (value string )
}) {
c .Code = from .GetCode ()
}
func (*AuthCheckRecoveryPasswordRequest ) TypeID () uint32 {
return AuthCheckRecoveryPasswordRequestTypeID
}
func (*AuthCheckRecoveryPasswordRequest ) TypeName () string {
return "auth.checkRecoveryPassword"
}
func (c *AuthCheckRecoveryPasswordRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.checkRecoveryPassword" ,
ID : AuthCheckRecoveryPasswordRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Code" ,
SchemaName : "code" ,
},
}
return typ
}
func (c *AuthCheckRecoveryPasswordRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode auth.checkRecoveryPassword#d36bf79 as nil" )
}
b .PutID (AuthCheckRecoveryPasswordRequestTypeID )
return c .EncodeBare (b )
}
func (c *AuthCheckRecoveryPasswordRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode auth.checkRecoveryPassword#d36bf79 as nil" )
}
b .PutString (c .Code )
return nil
}
func (c *AuthCheckRecoveryPasswordRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode auth.checkRecoveryPassword#d36bf79 to nil" )
}
if err := b .ConsumeID (AuthCheckRecoveryPasswordRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.checkRecoveryPassword#d36bf79: %w" , err )
}
return c .DecodeBare (b )
}
func (c *AuthCheckRecoveryPasswordRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode auth.checkRecoveryPassword#d36bf79 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode auth.checkRecoveryPassword#d36bf79: field code: %w" , err )
}
c .Code = value
}
return nil
}
func (c *AuthCheckRecoveryPasswordRequest ) GetCode () (value string ) {
if c == nil {
return
}
return c .Code
}
func (c *Client ) AuthCheckRecoveryPassword (ctx context .Context , code string ) (bool , error ) {
var result BoolBox
request := &AuthCheckRecoveryPasswordRequest {
Code : code ,
}
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 .