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 AuthInitPasskeyLoginRequest struct {
APIID int
APIHash string
}
const AuthInitPasskeyLoginRequestTypeID = 0x518ad0b7
var (
_ bin .Encoder = &AuthInitPasskeyLoginRequest {}
_ bin .Decoder = &AuthInitPasskeyLoginRequest {}
_ bin .BareEncoder = &AuthInitPasskeyLoginRequest {}
_ bin .BareDecoder = &AuthInitPasskeyLoginRequest {}
)
func (i *AuthInitPasskeyLoginRequest ) Zero () bool {
if i == nil {
return true
}
if !(i .APIID == 0 ) {
return false
}
if !(i .APIHash == "" ) {
return false
}
return true
}
func (i *AuthInitPasskeyLoginRequest ) String () string {
if i == nil {
return "AuthInitPasskeyLoginRequest(nil)"
}
type Alias AuthInitPasskeyLoginRequest
return fmt .Sprintf ("AuthInitPasskeyLoginRequest%+v" , Alias (*i ))
}
func (i *AuthInitPasskeyLoginRequest ) FillFrom (from interface {
GetAPIID () (value int )
GetAPIHash () (value string )
}) {
i .APIID = from .GetAPIID ()
i .APIHash = from .GetAPIHash ()
}
func (*AuthInitPasskeyLoginRequest ) TypeID () uint32 {
return AuthInitPasskeyLoginRequestTypeID
}
func (*AuthInitPasskeyLoginRequest ) TypeName () string {
return "auth.initPasskeyLogin"
}
func (i *AuthInitPasskeyLoginRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auth.initPasskeyLogin" ,
ID : AuthInitPasskeyLoginRequestTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "APIID" ,
SchemaName : "api_id" ,
},
{
Name : "APIHash" ,
SchemaName : "api_hash" ,
},
}
return typ
}
func (i *AuthInitPasskeyLoginRequest ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode auth.initPasskeyLogin#518ad0b7 as nil" )
}
b .PutID (AuthInitPasskeyLoginRequestTypeID )
return i .EncodeBare (b )
}
func (i *AuthInitPasskeyLoginRequest ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode auth.initPasskeyLogin#518ad0b7 as nil" )
}
b .PutInt (i .APIID )
b .PutString (i .APIHash )
return nil
}
func (i *AuthInitPasskeyLoginRequest ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode auth.initPasskeyLogin#518ad0b7 to nil" )
}
if err := b .ConsumeID (AuthInitPasskeyLoginRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode auth.initPasskeyLogin#518ad0b7: %w" , err )
}
return i .DecodeBare (b )
}
func (i *AuthInitPasskeyLoginRequest ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode auth.initPasskeyLogin#518ad0b7 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode auth.initPasskeyLogin#518ad0b7: field api_id: %w" , err )
}
i .APIID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode auth.initPasskeyLogin#518ad0b7: field api_hash: %w" , err )
}
i .APIHash = value
}
return nil
}
func (i *AuthInitPasskeyLoginRequest ) GetAPIID () (value int ) {
if i == nil {
return
}
return i .APIID
}
func (i *AuthInitPasskeyLoginRequest ) GetAPIHash () (value string ) {
if i == nil {
return
}
return i .APIHash
}
func (c *Client ) AuthInitPasskeyLogin (ctx context .Context , request *AuthInitPasskeyLoginRequest ) (*AuthPasskeyLoginOptions , error ) {
var result AuthPasskeyLoginOptions
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .