7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
242 lines
6.6 KiB
Go
242 lines
6.6 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{}
|
|
)
|
|
|
|
// SetApplicationVerificationTokenRequest represents TL type `setApplicationVerificationToken#3744af85`.
|
|
type SetApplicationVerificationTokenRequest struct {
|
|
// Unique identifier for the verification process as received from
|
|
// updateApplicationVerificationRequired or
|
|
// updateApplicationRecaptchaVerificationRequired
|
|
VerificationID int64
|
|
// Play Integrity API token for the Android application, or secret from push notification
|
|
// for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA
|
|
// verifications;
|
|
Token string
|
|
}
|
|
|
|
// SetApplicationVerificationTokenRequestTypeID is TL type id of SetApplicationVerificationTokenRequest.
|
|
const SetApplicationVerificationTokenRequestTypeID = 0x3744af85
|
|
|
|
// Ensuring interfaces in compile-time for SetApplicationVerificationTokenRequest.
|
|
var (
|
|
_ bin.Encoder = &SetApplicationVerificationTokenRequest{}
|
|
_ bin.Decoder = &SetApplicationVerificationTokenRequest{}
|
|
_ bin.BareEncoder = &SetApplicationVerificationTokenRequest{}
|
|
_ bin.BareDecoder = &SetApplicationVerificationTokenRequest{}
|
|
)
|
|
|
|
func (s *SetApplicationVerificationTokenRequest) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.VerificationID == 0) {
|
|
return false
|
|
}
|
|
if !(s.Token == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *SetApplicationVerificationTokenRequest) String() string {
|
|
if s == nil {
|
|
return "SetApplicationVerificationTokenRequest(nil)"
|
|
}
|
|
type Alias SetApplicationVerificationTokenRequest
|
|
return fmt.Sprintf("SetApplicationVerificationTokenRequest%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*SetApplicationVerificationTokenRequest) TypeID() uint32 {
|
|
return SetApplicationVerificationTokenRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*SetApplicationVerificationTokenRequest) TypeName() string {
|
|
return "setApplicationVerificationToken"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *SetApplicationVerificationTokenRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "setApplicationVerificationToken",
|
|
ID: SetApplicationVerificationTokenRequestTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "VerificationID",
|
|
SchemaName: "verification_id",
|
|
},
|
|
{
|
|
Name: "Token",
|
|
SchemaName: "token",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *SetApplicationVerificationTokenRequest) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setApplicationVerificationToken#3744af85 as nil")
|
|
}
|
|
b.PutID(SetApplicationVerificationTokenRequestTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *SetApplicationVerificationTokenRequest) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setApplicationVerificationToken#3744af85 as nil")
|
|
}
|
|
b.PutInt53(s.VerificationID)
|
|
b.PutString(s.Token)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *SetApplicationVerificationTokenRequest) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setApplicationVerificationToken#3744af85 to nil")
|
|
}
|
|
if err := b.ConsumeID(SetApplicationVerificationTokenRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *SetApplicationVerificationTokenRequest) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setApplicationVerificationToken#3744af85 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field verification_id: %w", err)
|
|
}
|
|
s.VerificationID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field token: %w", err)
|
|
}
|
|
s.Token = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *SetApplicationVerificationTokenRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setApplicationVerificationToken#3744af85 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("setApplicationVerificationToken")
|
|
b.Comma()
|
|
b.FieldStart("verification_id")
|
|
b.PutInt53(s.VerificationID)
|
|
b.Comma()
|
|
b.FieldStart("token")
|
|
b.PutString(s.Token)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *SetApplicationVerificationTokenRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setApplicationVerificationToken#3744af85 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("setApplicationVerificationToken"); err != nil {
|
|
return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: %w", err)
|
|
}
|
|
case "verification_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field verification_id: %w", err)
|
|
}
|
|
s.VerificationID = value
|
|
case "token":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field token: %w", err)
|
|
}
|
|
s.Token = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetVerificationID returns value of VerificationID field.
|
|
func (s *SetApplicationVerificationTokenRequest) GetVerificationID() (value int64) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.VerificationID
|
|
}
|
|
|
|
// GetToken returns value of Token field.
|
|
func (s *SetApplicationVerificationTokenRequest) GetToken() (value string) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.Token
|
|
}
|
|
|
|
// SetApplicationVerificationToken invokes method setApplicationVerificationToken#3744af85 returning error if any.
|
|
func (c *Client) SetApplicationVerificationToken(ctx context.Context, request *SetApplicationVerificationTokenRequest) error {
|
|
var ok Ok
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|