Files
mautrix-telegram/pkg/gotd/tg/tl_auth_init_passkey_login_gen.go
T
2026-03-03 15:13:10 +02:00

201 lines
4.9 KiB
Go
Generated

// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
_ = tdjson.Encoder{}
)
// AuthInitPasskeyLoginRequest represents TL type `auth.initPasskeyLogin#518ad0b7`.
//
// See https://core.telegram.org/method/auth.initPasskeyLogin for reference.
type AuthInitPasskeyLoginRequest struct {
// APIID field of AuthInitPasskeyLoginRequest.
APIID int
// APIHash field of AuthInitPasskeyLoginRequest.
APIHash string
}
// AuthInitPasskeyLoginRequestTypeID is TL type id of AuthInitPasskeyLoginRequest.
const AuthInitPasskeyLoginRequestTypeID = 0x518ad0b7
// Ensuring interfaces in compile-time for AuthInitPasskeyLoginRequest.
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
}
// String implements fmt.Stringer.
func (i *AuthInitPasskeyLoginRequest) String() string {
if i == nil {
return "AuthInitPasskeyLoginRequest(nil)"
}
type Alias AuthInitPasskeyLoginRequest
return fmt.Sprintf("AuthInitPasskeyLoginRequest%+v", Alias(*i))
}
// FillFrom fills AuthInitPasskeyLoginRequest from given interface.
func (i *AuthInitPasskeyLoginRequest) FillFrom(from interface {
GetAPIID() (value int)
GetAPIHash() (value string)
}) {
i.APIID = from.GetAPIID()
i.APIHash = from.GetAPIHash()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*AuthInitPasskeyLoginRequest) TypeID() uint32 {
return AuthInitPasskeyLoginRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*AuthInitPasskeyLoginRequest) TypeName() string {
return "auth.initPasskeyLogin"
}
// TypeInfo returns info about TL type.
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
}
// Encode implements bin.Encoder.
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)
}
// EncodeBare implements bin.BareEncoder.
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
}
// Decode implements bin.Decoder.
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)
}
// DecodeBare implements bin.BareDecoder.
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
}
// GetAPIID returns value of APIID field.
func (i *AuthInitPasskeyLoginRequest) GetAPIID() (value int) {
if i == nil {
return
}
return i.APIID
}
// GetAPIHash returns value of APIHash field.
func (i *AuthInitPasskeyLoginRequest) GetAPIHash() (value string) {
if i == nil {
return
}
return i.APIHash
}
// AuthInitPasskeyLogin invokes method auth.initPasskeyLogin#518ad0b7 returning error if any.
//
// See https://core.telegram.org/method/auth.initPasskeyLogin for reference.
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
}