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

217 lines
5.0 KiB
Go

// 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{}
)
// InvokeWithApnsSecretRequest represents TL type `invokeWithApnsSecret#dae54f8`.
// Official clients only, invoke with Apple push verification.
//
// See https://core.telegram.org/constructor/invokeWithApnsSecret for reference.
type InvokeWithApnsSecretRequest struct {
// Nonce.
Nonce string
// Secret.
Secret string
// Query.
Query bin.Object
}
// InvokeWithApnsSecretRequestTypeID is TL type id of InvokeWithApnsSecretRequest.
const InvokeWithApnsSecretRequestTypeID = 0xdae54f8
// Ensuring interfaces in compile-time for InvokeWithApnsSecretRequest.
var (
_ bin.Encoder = &InvokeWithApnsSecretRequest{}
_ bin.Decoder = &InvokeWithApnsSecretRequest{}
_ bin.BareEncoder = &InvokeWithApnsSecretRequest{}
_ bin.BareDecoder = &InvokeWithApnsSecretRequest{}
)
func (i *InvokeWithApnsSecretRequest) Zero() bool {
if i == nil {
return true
}
if !(i.Nonce == "") {
return false
}
if !(i.Secret == "") {
return false
}
if !(i.Query == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InvokeWithApnsSecretRequest) String() string {
if i == nil {
return "InvokeWithApnsSecretRequest(nil)"
}
type Alias InvokeWithApnsSecretRequest
return fmt.Sprintf("InvokeWithApnsSecretRequest%+v", Alias(*i))
}
// FillFrom fills InvokeWithApnsSecretRequest from given interface.
func (i *InvokeWithApnsSecretRequest) FillFrom(from interface {
GetNonce() (value string)
GetSecret() (value string)
GetQuery() (value bin.Object)
}) {
i.Nonce = from.GetNonce()
i.Secret = from.GetSecret()
i.Query = from.GetQuery()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InvokeWithApnsSecretRequest) TypeID() uint32 {
return InvokeWithApnsSecretRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*InvokeWithApnsSecretRequest) TypeName() string {
return "invokeWithApnsSecret"
}
// TypeInfo returns info about TL type.
func (i *InvokeWithApnsSecretRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "invokeWithApnsSecret",
ID: InvokeWithApnsSecretRequestTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Nonce",
SchemaName: "nonce",
},
{
Name: "Secret",
SchemaName: "secret",
},
{
Name: "Query",
SchemaName: "query",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InvokeWithApnsSecretRequest) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode invokeWithApnsSecret#dae54f8 as nil")
}
b.PutID(InvokeWithApnsSecretRequestTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InvokeWithApnsSecretRequest) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode invokeWithApnsSecret#dae54f8 as nil")
}
b.PutString(i.Nonce)
b.PutString(i.Secret)
if err := i.Query.Encode(b); err != nil {
return fmt.Errorf("unable to encode invokeWithApnsSecret#dae54f8: field query: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (i *InvokeWithApnsSecretRequest) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode invokeWithApnsSecret#dae54f8 to nil")
}
if err := b.ConsumeID(InvokeWithApnsSecretRequestTypeID); err != nil {
return fmt.Errorf("unable to decode invokeWithApnsSecret#dae54f8: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InvokeWithApnsSecretRequest) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode invokeWithApnsSecret#dae54f8 to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode invokeWithApnsSecret#dae54f8: field nonce: %w", err)
}
i.Nonce = value
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode invokeWithApnsSecret#dae54f8: field secret: %w", err)
}
i.Secret = value
}
{
if err := i.Query.Decode(b); err != nil {
return fmt.Errorf("unable to decode invokeWithApnsSecret#dae54f8: field query: %w", err)
}
}
return nil
}
// GetNonce returns value of Nonce field.
func (i *InvokeWithApnsSecretRequest) GetNonce() (value string) {
if i == nil {
return
}
return i.Nonce
}
// GetSecret returns value of Secret field.
func (i *InvokeWithApnsSecretRequest) GetSecret() (value string) {
if i == nil {
return
}
return i.Secret
}
// GetQuery returns value of Query field.
func (i *InvokeWithApnsSecretRequest) GetQuery() (value bin.Object) {
if i == nil {
return
}
return i.Query
}