Files
mautrix-telegram/pkg/gotd/tdapi/tl_send_authentication_firebase_sms_gen.go
T
2025-06-27 20:03:37 -07:00

208 lines
5.5 KiB
Go

// Code generated by gotdgen, DO NOT EDIT.
package tdapi
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{}
)
// SendAuthenticationFirebaseSMSRequest represents TL type `sendAuthenticationFirebaseSms#15c15e3f`.
type SendAuthenticationFirebaseSMSRequest struct {
// Play Integrity API or SafetyNet Attestation API token for the Android application, or
// secret from push notification for the iOS application
Token string
}
// SendAuthenticationFirebaseSMSRequestTypeID is TL type id of SendAuthenticationFirebaseSMSRequest.
const SendAuthenticationFirebaseSMSRequestTypeID = 0x15c15e3f
// Ensuring interfaces in compile-time for SendAuthenticationFirebaseSMSRequest.
var (
_ bin.Encoder = &SendAuthenticationFirebaseSMSRequest{}
_ bin.Decoder = &SendAuthenticationFirebaseSMSRequest{}
_ bin.BareEncoder = &SendAuthenticationFirebaseSMSRequest{}
_ bin.BareDecoder = &SendAuthenticationFirebaseSMSRequest{}
)
func (s *SendAuthenticationFirebaseSMSRequest) Zero() bool {
if s == nil {
return true
}
if !(s.Token == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (s *SendAuthenticationFirebaseSMSRequest) String() string {
if s == nil {
return "SendAuthenticationFirebaseSMSRequest(nil)"
}
type Alias SendAuthenticationFirebaseSMSRequest
return fmt.Sprintf("SendAuthenticationFirebaseSMSRequest%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendAuthenticationFirebaseSMSRequest) TypeID() uint32 {
return SendAuthenticationFirebaseSMSRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*SendAuthenticationFirebaseSMSRequest) TypeName() string {
return "sendAuthenticationFirebaseSms"
}
// TypeInfo returns info about TL type.
func (s *SendAuthenticationFirebaseSMSRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "sendAuthenticationFirebaseSms",
ID: SendAuthenticationFirebaseSMSRequestTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Token",
SchemaName: "token",
},
}
return typ
}
// Encode implements bin.Encoder.
func (s *SendAuthenticationFirebaseSMSRequest) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode sendAuthenticationFirebaseSms#15c15e3f as nil")
}
b.PutID(SendAuthenticationFirebaseSMSRequestTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SendAuthenticationFirebaseSMSRequest) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode sendAuthenticationFirebaseSms#15c15e3f as nil")
}
b.PutString(s.Token)
return nil
}
// Decode implements bin.Decoder.
func (s *SendAuthenticationFirebaseSMSRequest) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode sendAuthenticationFirebaseSms#15c15e3f to nil")
}
if err := b.ConsumeID(SendAuthenticationFirebaseSMSRequestTypeID); err != nil {
return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SendAuthenticationFirebaseSMSRequest) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode sendAuthenticationFirebaseSms#15c15e3f to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: field token: %w", err)
}
s.Token = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SendAuthenticationFirebaseSMSRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode sendAuthenticationFirebaseSms#15c15e3f as nil")
}
b.ObjStart()
b.PutID("sendAuthenticationFirebaseSms")
b.Comma()
b.FieldStart("token")
b.PutString(s.Token)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SendAuthenticationFirebaseSMSRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode sendAuthenticationFirebaseSms#15c15e3f to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("sendAuthenticationFirebaseSms"); err != nil {
return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: %w", err)
}
case "token":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: field token: %w", err)
}
s.Token = value
default:
return b.Skip()
}
return nil
})
}
// GetToken returns value of Token field.
func (s *SendAuthenticationFirebaseSMSRequest) GetToken() (value string) {
if s == nil {
return
}
return s.Token
}
// SendAuthenticationFirebaseSMS invokes method sendAuthenticationFirebaseSms#15c15e3f returning error if any.
func (c *Client) SendAuthenticationFirebaseSMS(ctx context.Context, token string) error {
var ok Ok
request := &SendAuthenticationFirebaseSMSRequest{
Token: token,
}
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
return err
}
return nil
}