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
241 lines
6.0 KiB
Go
Generated
241 lines
6.0 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{}
|
|
)
|
|
|
|
// PaymentsClearSavedInfoRequest represents TL type `payments.clearSavedInfo#d83d70c1`.
|
|
// Clear saved payment information
|
|
//
|
|
// See https://core.telegram.org/method/payments.clearSavedInfo for reference.
|
|
type PaymentsClearSavedInfoRequest struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Remove saved payment credentials
|
|
Credentials bool
|
|
// Clear the last order settings saved by the user
|
|
Info bool
|
|
}
|
|
|
|
// PaymentsClearSavedInfoRequestTypeID is TL type id of PaymentsClearSavedInfoRequest.
|
|
const PaymentsClearSavedInfoRequestTypeID = 0xd83d70c1
|
|
|
|
// Ensuring interfaces in compile-time for PaymentsClearSavedInfoRequest.
|
|
var (
|
|
_ bin.Encoder = &PaymentsClearSavedInfoRequest{}
|
|
_ bin.Decoder = &PaymentsClearSavedInfoRequest{}
|
|
_ bin.BareEncoder = &PaymentsClearSavedInfoRequest{}
|
|
_ bin.BareDecoder = &PaymentsClearSavedInfoRequest{}
|
|
)
|
|
|
|
func (c *PaymentsClearSavedInfoRequest) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.Credentials == false) {
|
|
return false
|
|
}
|
|
if !(c.Info == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *PaymentsClearSavedInfoRequest) String() string {
|
|
if c == nil {
|
|
return "PaymentsClearSavedInfoRequest(nil)"
|
|
}
|
|
type Alias PaymentsClearSavedInfoRequest
|
|
return fmt.Sprintf("PaymentsClearSavedInfoRequest%+v", Alias(*c))
|
|
}
|
|
|
|
// FillFrom fills PaymentsClearSavedInfoRequest from given interface.
|
|
func (c *PaymentsClearSavedInfoRequest) FillFrom(from interface {
|
|
GetCredentials() (value bool)
|
|
GetInfo() (value bool)
|
|
}) {
|
|
c.Credentials = from.GetCredentials()
|
|
c.Info = from.GetInfo()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*PaymentsClearSavedInfoRequest) TypeID() uint32 {
|
|
return PaymentsClearSavedInfoRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*PaymentsClearSavedInfoRequest) TypeName() string {
|
|
return "payments.clearSavedInfo"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *PaymentsClearSavedInfoRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "payments.clearSavedInfo",
|
|
ID: PaymentsClearSavedInfoRequestTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Credentials",
|
|
SchemaName: "credentials",
|
|
Null: !c.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Info",
|
|
SchemaName: "info",
|
|
Null: !c.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (c *PaymentsClearSavedInfoRequest) SetFlags() {
|
|
if !(c.Credentials == false) {
|
|
c.Flags.Set(0)
|
|
}
|
|
if !(c.Info == false) {
|
|
c.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *PaymentsClearSavedInfoRequest) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode payments.clearSavedInfo#d83d70c1 as nil")
|
|
}
|
|
b.PutID(PaymentsClearSavedInfoRequestTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *PaymentsClearSavedInfoRequest) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode payments.clearSavedInfo#d83d70c1 as nil")
|
|
}
|
|
c.SetFlags()
|
|
if err := c.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode payments.clearSavedInfo#d83d70c1: field flags: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *PaymentsClearSavedInfoRequest) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode payments.clearSavedInfo#d83d70c1 to nil")
|
|
}
|
|
if err := b.ConsumeID(PaymentsClearSavedInfoRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode payments.clearSavedInfo#d83d70c1: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *PaymentsClearSavedInfoRequest) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode payments.clearSavedInfo#d83d70c1 to nil")
|
|
}
|
|
{
|
|
if err := c.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode payments.clearSavedInfo#d83d70c1: field flags: %w", err)
|
|
}
|
|
}
|
|
c.Credentials = c.Flags.Has(0)
|
|
c.Info = c.Flags.Has(1)
|
|
return nil
|
|
}
|
|
|
|
// SetCredentials sets value of Credentials conditional field.
|
|
func (c *PaymentsClearSavedInfoRequest) SetCredentials(value bool) {
|
|
if value {
|
|
c.Flags.Set(0)
|
|
c.Credentials = true
|
|
} else {
|
|
c.Flags.Unset(0)
|
|
c.Credentials = false
|
|
}
|
|
}
|
|
|
|
// GetCredentials returns value of Credentials conditional field.
|
|
func (c *PaymentsClearSavedInfoRequest) GetCredentials() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Flags.Has(0)
|
|
}
|
|
|
|
// SetInfo sets value of Info conditional field.
|
|
func (c *PaymentsClearSavedInfoRequest) SetInfo(value bool) {
|
|
if value {
|
|
c.Flags.Set(1)
|
|
c.Info = true
|
|
} else {
|
|
c.Flags.Unset(1)
|
|
c.Info = false
|
|
}
|
|
}
|
|
|
|
// GetInfo returns value of Info conditional field.
|
|
func (c *PaymentsClearSavedInfoRequest) GetInfo() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Flags.Has(1)
|
|
}
|
|
|
|
// PaymentsClearSavedInfo invokes method payments.clearSavedInfo#d83d70c1 returning error if any.
|
|
// Clear saved payment information
|
|
//
|
|
// See https://core.telegram.org/method/payments.clearSavedInfo for reference.
|
|
func (c *Client) PaymentsClearSavedInfo(ctx context.Context, request *PaymentsClearSavedInfoRequest) (bool, error) {
|
|
var result BoolBox
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return false, err
|
|
}
|
|
_, ok := result.Bool.(*BoolTrue)
|
|
return ok, nil
|
|
}
|