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 AuthCheckPasswordRequest struct {
Password InputCheckPasswordSRPClass
}
const AuthCheckPasswordRequestTypeID = 0xd18b4d16
var (
_ bin .Encoder = &AuthCheckPasswordRequest {}
_ bin .Decoder = &AuthCheckPasswordRequest {}
_ bin .BareEncoder = &AuthCheckPasswordRequest {}
_ bin .BareDecoder = &AuthCheckPasswordRequest {}
)
func (c *AuthCheckPasswordRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Password == nil ) {
return false
}
return true
}
func (c *AuthCheckPasswordRequest ) String () string {
if c == nil {
return "AuthCheckPasswordRequest(nil)"
}
type Alias AuthCheckPasswordRequest
return fmt .Sprintf ("AuthCheckPasswordRequest%+v" , Alias (*c ))
}
func (c *AuthCheckPasswordRequest ) FillFrom (from interface {
GetPassword () (value InputCheckPasswordSRPClass )
}) {
c .Password = from .GetPassword ()
}
func (*AuthCheckPasswordRequest ) TypeID () uint32 {
return AuthCheckPasswordRequestTypeID
}
func (*AuthCheckPasswordRequest ) TypeName () string {
return "auth.checkPassword"
}
func (c *AuthCheckPasswordRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.checkPassword" ,
ID : AuthCheckPasswordRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Password" ,
SchemaName : "password" ,
},
}
return typ
}
func (c *AuthCheckPasswordRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode auth.checkPassword#d18b4d16 as nil" )
}
b .PutID (AuthCheckPasswordRequestTypeID )
return c .EncodeBare (b )
}
func (c *AuthCheckPasswordRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode auth.checkPassword#d18b4d16 as nil" )
}
if c .Password == nil {
return fmt .Errorf ("unable to encode auth.checkPassword#d18b4d16: field password is nil" )
}
if err := c .Password .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode auth.checkPassword#d18b4d16: field password: %w" , err )
}
return nil
}
func (c *AuthCheckPasswordRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode auth.checkPassword#d18b4d16 to nil" )
}
if err := b .ConsumeID (AuthCheckPasswordRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.checkPassword#d18b4d16: %w" , err )
}
return c .DecodeBare (b )
}
func (c *AuthCheckPasswordRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode auth.checkPassword#d18b4d16 to nil" )
}
{
value , err := DecodeInputCheckPasswordSRP (b )
if err != nil {
return fmt .Errorf ("unable to decode auth.checkPassword#d18b4d16: field password: %w" , err )
}
c .Password = value
}
return nil
}
func (c *AuthCheckPasswordRequest ) GetPassword () (value InputCheckPasswordSRPClass ) {
if c == nil {
return
}
return c .Password
}
func (c *AuthCheckPasswordRequest ) GetPasswordAsNotEmpty () (*InputCheckPasswordSRP , bool ) {
return c .Password .AsNotEmpty ()
}
func (c *Client ) AuthCheckPassword (ctx context .Context , password InputCheckPasswordSRPClass ) (AuthAuthorizationClass , error ) {
var result AuthAuthorizationBox
request := &AuthCheckPasswordRequest {
Password : password ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Authorization , 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 .