142 lines
3.5 KiB
Go
Generated
142 lines
3.5 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{}
|
|
)
|
|
|
|
// AccountGetPasskeysRequest represents TL type `account.getPasskeys#ea1f0c52`.
|
|
//
|
|
// See https://core.telegram.org/method/account.getPasskeys for reference.
|
|
type AccountGetPasskeysRequest struct {
|
|
}
|
|
|
|
// AccountGetPasskeysRequestTypeID is TL type id of AccountGetPasskeysRequest.
|
|
const AccountGetPasskeysRequestTypeID = 0xea1f0c52
|
|
|
|
// Ensuring interfaces in compile-time for AccountGetPasskeysRequest.
|
|
var (
|
|
_ bin.Encoder = &AccountGetPasskeysRequest{}
|
|
_ bin.Decoder = &AccountGetPasskeysRequest{}
|
|
_ bin.BareEncoder = &AccountGetPasskeysRequest{}
|
|
_ bin.BareDecoder = &AccountGetPasskeysRequest{}
|
|
)
|
|
|
|
func (g *AccountGetPasskeysRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *AccountGetPasskeysRequest) String() string {
|
|
if g == nil {
|
|
return "AccountGetPasskeysRequest(nil)"
|
|
}
|
|
type Alias AccountGetPasskeysRequest
|
|
return fmt.Sprintf("AccountGetPasskeysRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AccountGetPasskeysRequest) TypeID() uint32 {
|
|
return AccountGetPasskeysRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AccountGetPasskeysRequest) TypeName() string {
|
|
return "account.getPasskeys"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *AccountGetPasskeysRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "account.getPasskeys",
|
|
ID: AccountGetPasskeysRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *AccountGetPasskeysRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode account.getPasskeys#ea1f0c52 as nil")
|
|
}
|
|
b.PutID(AccountGetPasskeysRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *AccountGetPasskeysRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode account.getPasskeys#ea1f0c52 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *AccountGetPasskeysRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode account.getPasskeys#ea1f0c52 to nil")
|
|
}
|
|
if err := b.ConsumeID(AccountGetPasskeysRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode account.getPasskeys#ea1f0c52: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *AccountGetPasskeysRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode account.getPasskeys#ea1f0c52 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// AccountGetPasskeys invokes method account.getPasskeys#ea1f0c52 returning error if any.
|
|
//
|
|
// See https://core.telegram.org/method/account.getPasskeys for reference.
|
|
func (c *Client) AccountGetPasskeys(ctx context.Context) (*AccountPasskeys, error) {
|
|
var result AccountPasskeys
|
|
|
|
request := &AccountGetPasskeysRequest{}
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return &result, nil
|
|
}
|