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
232 lines
6.2 KiB
Go
232 lines
6.2 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{}
|
|
)
|
|
|
|
// PaymentsUpgradeStarGiftRequest represents TL type `payments.upgradeStarGift#aed6e4f5`.
|
|
//
|
|
// See https://core.telegram.org/method/payments.upgradeStarGift for reference.
|
|
type PaymentsUpgradeStarGiftRequest struct {
|
|
// Flags field of PaymentsUpgradeStarGiftRequest.
|
|
Flags bin.Fields
|
|
// KeepOriginalDetails field of PaymentsUpgradeStarGiftRequest.
|
|
KeepOriginalDetails bool
|
|
// Stargift field of PaymentsUpgradeStarGiftRequest.
|
|
Stargift InputSavedStarGiftClass
|
|
}
|
|
|
|
// PaymentsUpgradeStarGiftRequestTypeID is TL type id of PaymentsUpgradeStarGiftRequest.
|
|
const PaymentsUpgradeStarGiftRequestTypeID = 0xaed6e4f5
|
|
|
|
// Ensuring interfaces in compile-time for PaymentsUpgradeStarGiftRequest.
|
|
var (
|
|
_ bin.Encoder = &PaymentsUpgradeStarGiftRequest{}
|
|
_ bin.Decoder = &PaymentsUpgradeStarGiftRequest{}
|
|
_ bin.BareEncoder = &PaymentsUpgradeStarGiftRequest{}
|
|
_ bin.BareDecoder = &PaymentsUpgradeStarGiftRequest{}
|
|
)
|
|
|
|
func (u *PaymentsUpgradeStarGiftRequest) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.KeepOriginalDetails == false) {
|
|
return false
|
|
}
|
|
if !(u.Stargift == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *PaymentsUpgradeStarGiftRequest) String() string {
|
|
if u == nil {
|
|
return "PaymentsUpgradeStarGiftRequest(nil)"
|
|
}
|
|
type Alias PaymentsUpgradeStarGiftRequest
|
|
return fmt.Sprintf("PaymentsUpgradeStarGiftRequest%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills PaymentsUpgradeStarGiftRequest from given interface.
|
|
func (u *PaymentsUpgradeStarGiftRequest) FillFrom(from interface {
|
|
GetKeepOriginalDetails() (value bool)
|
|
GetStargift() (value InputSavedStarGiftClass)
|
|
}) {
|
|
u.KeepOriginalDetails = from.GetKeepOriginalDetails()
|
|
u.Stargift = from.GetStargift()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*PaymentsUpgradeStarGiftRequest) TypeID() uint32 {
|
|
return PaymentsUpgradeStarGiftRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*PaymentsUpgradeStarGiftRequest) TypeName() string {
|
|
return "payments.upgradeStarGift"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *PaymentsUpgradeStarGiftRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "payments.upgradeStarGift",
|
|
ID: PaymentsUpgradeStarGiftRequestTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "KeepOriginalDetails",
|
|
SchemaName: "keep_original_details",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Stargift",
|
|
SchemaName: "stargift",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *PaymentsUpgradeStarGiftRequest) SetFlags() {
|
|
if !(u.KeepOriginalDetails == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *PaymentsUpgradeStarGiftRequest) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode payments.upgradeStarGift#aed6e4f5 as nil")
|
|
}
|
|
b.PutID(PaymentsUpgradeStarGiftRequestTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *PaymentsUpgradeStarGiftRequest) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode payments.upgradeStarGift#aed6e4f5 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode payments.upgradeStarGift#aed6e4f5: field flags: %w", err)
|
|
}
|
|
if u.Stargift == nil {
|
|
return fmt.Errorf("unable to encode payments.upgradeStarGift#aed6e4f5: field stargift is nil")
|
|
}
|
|
if err := u.Stargift.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode payments.upgradeStarGift#aed6e4f5: field stargift: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *PaymentsUpgradeStarGiftRequest) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode payments.upgradeStarGift#aed6e4f5 to nil")
|
|
}
|
|
if err := b.ConsumeID(PaymentsUpgradeStarGiftRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode payments.upgradeStarGift#aed6e4f5: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *PaymentsUpgradeStarGiftRequest) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode payments.upgradeStarGift#aed6e4f5 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode payments.upgradeStarGift#aed6e4f5: field flags: %w", err)
|
|
}
|
|
}
|
|
u.KeepOriginalDetails = u.Flags.Has(0)
|
|
{
|
|
value, err := DecodeInputSavedStarGift(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode payments.upgradeStarGift#aed6e4f5: field stargift: %w", err)
|
|
}
|
|
u.Stargift = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetKeepOriginalDetails sets value of KeepOriginalDetails conditional field.
|
|
func (u *PaymentsUpgradeStarGiftRequest) SetKeepOriginalDetails(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.KeepOriginalDetails = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.KeepOriginalDetails = false
|
|
}
|
|
}
|
|
|
|
// GetKeepOriginalDetails returns value of KeepOriginalDetails conditional field.
|
|
func (u *PaymentsUpgradeStarGiftRequest) GetKeepOriginalDetails() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetStargift returns value of Stargift field.
|
|
func (u *PaymentsUpgradeStarGiftRequest) GetStargift() (value InputSavedStarGiftClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Stargift
|
|
}
|
|
|
|
// PaymentsUpgradeStarGift invokes method payments.upgradeStarGift#aed6e4f5 returning error if any.
|
|
//
|
|
// See https://core.telegram.org/method/payments.upgradeStarGift for reference.
|
|
func (c *Client) PaymentsUpgradeStarGift(ctx context.Context, request *PaymentsUpgradeStarGiftRequest) (UpdatesClass, error) {
|
|
var result UpdatesBox
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return result.Updates, nil
|
|
}
|