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
2222 lines
60 KiB
Go
2222 lines
60 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{}
|
|
)
|
|
|
|
// InputInvoiceMessage represents TL type `inputInvoiceMessage#c5b56859`.
|
|
// An invoice contained in a messageMediaInvoice¹ message or paid media »².
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/constructor/messageMediaInvoice
|
|
// 2. https://core.telegram.org/api/paid-media
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceMessage for reference.
|
|
type InputInvoiceMessage struct {
|
|
// Chat where the invoice/paid media was sent
|
|
Peer InputPeerClass
|
|
// Message ID
|
|
MsgID int
|
|
}
|
|
|
|
// InputInvoiceMessageTypeID is TL type id of InputInvoiceMessage.
|
|
const InputInvoiceMessageTypeID = 0xc5b56859
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceMessage) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceMessage.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceMessage{}
|
|
_ bin.Decoder = &InputInvoiceMessage{}
|
|
_ bin.BareEncoder = &InputInvoiceMessage{}
|
|
_ bin.BareDecoder = &InputInvoiceMessage{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceMessage{}
|
|
)
|
|
|
|
func (i *InputInvoiceMessage) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(i.MsgID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceMessage) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceMessage(nil)"
|
|
}
|
|
type Alias InputInvoiceMessage
|
|
return fmt.Sprintf("InputInvoiceMessage%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceMessage from given interface.
|
|
func (i *InputInvoiceMessage) FillFrom(from interface {
|
|
GetPeer() (value InputPeerClass)
|
|
GetMsgID() (value int)
|
|
}) {
|
|
i.Peer = from.GetPeer()
|
|
i.MsgID = from.GetMsgID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceMessage) TypeID() uint32 {
|
|
return InputInvoiceMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceMessage) TypeName() string {
|
|
return "inputInvoiceMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceMessage",
|
|
ID: InputInvoiceMessageTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceMessage) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceMessage#c5b56859 as nil")
|
|
}
|
|
b.PutID(InputInvoiceMessageTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceMessage) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceMessage#c5b56859 as nil")
|
|
}
|
|
if i.Peer == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceMessage#c5b56859: field peer is nil")
|
|
}
|
|
if err := i.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceMessage#c5b56859: field peer: %w", err)
|
|
}
|
|
b.PutInt(i.MsgID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceMessage) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceMessage#c5b56859 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceMessage#c5b56859: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceMessage) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceMessage#c5b56859 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceMessage#c5b56859: field peer: %w", err)
|
|
}
|
|
i.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceMessage#c5b56859: field msg_id: %w", err)
|
|
}
|
|
i.MsgID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (i *InputInvoiceMessage) GetPeer() (value InputPeerClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (i *InputInvoiceMessage) GetMsgID() (value int) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.MsgID
|
|
}
|
|
|
|
// InputInvoiceSlug represents TL type `inputInvoiceSlug#c326caef`.
|
|
// An invoice slug taken from an invoice deep link¹ or from the premium_invoice_slug app
|
|
// config parameter »²
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/links#invoice-links
|
|
// 2. https://core.telegram.org/api/config#premium-invoice-slug
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceSlug for reference.
|
|
type InputInvoiceSlug struct {
|
|
// The invoice slug
|
|
Slug string
|
|
}
|
|
|
|
// InputInvoiceSlugTypeID is TL type id of InputInvoiceSlug.
|
|
const InputInvoiceSlugTypeID = 0xc326caef
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceSlug) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceSlug.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceSlug{}
|
|
_ bin.Decoder = &InputInvoiceSlug{}
|
|
_ bin.BareEncoder = &InputInvoiceSlug{}
|
|
_ bin.BareDecoder = &InputInvoiceSlug{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceSlug{}
|
|
)
|
|
|
|
func (i *InputInvoiceSlug) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Slug == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceSlug) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceSlug(nil)"
|
|
}
|
|
type Alias InputInvoiceSlug
|
|
return fmt.Sprintf("InputInvoiceSlug%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceSlug from given interface.
|
|
func (i *InputInvoiceSlug) FillFrom(from interface {
|
|
GetSlug() (value string)
|
|
}) {
|
|
i.Slug = from.GetSlug()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceSlug) TypeID() uint32 {
|
|
return InputInvoiceSlugTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceSlug) TypeName() string {
|
|
return "inputInvoiceSlug"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceSlug) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceSlug",
|
|
ID: InputInvoiceSlugTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Slug",
|
|
SchemaName: "slug",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceSlug) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceSlug#c326caef as nil")
|
|
}
|
|
b.PutID(InputInvoiceSlugTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceSlug) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceSlug#c326caef as nil")
|
|
}
|
|
b.PutString(i.Slug)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceSlug) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceSlug#c326caef to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceSlugTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceSlug#c326caef: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceSlug) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceSlug#c326caef to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceSlug#c326caef: field slug: %w", err)
|
|
}
|
|
i.Slug = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetSlug returns value of Slug field.
|
|
func (i *InputInvoiceSlug) GetSlug() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Slug
|
|
}
|
|
|
|
// InputInvoicePremiumGiftCode represents TL type `inputInvoicePremiumGiftCode#98986c0d`.
|
|
// Used if the user wishes to start a channel/supergroup giveaway¹ or send some
|
|
// giftcodes² to members of a channel/supergroup, in exchange for boosts³.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/giveaways
|
|
// 2. https://core.telegram.org/api/giveaways
|
|
// 3. https://core.telegram.org/api/boost
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoicePremiumGiftCode for reference.
|
|
type InputInvoicePremiumGiftCode struct {
|
|
// Should be populated with inputStorePaymentPremiumGiveaway¹ for giveaways² and
|
|
// inputStorePaymentPremiumGiftCode³ for gifts⁴.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/inputStorePaymentPremiumGiveaway
|
|
// 2) https://core.telegram.org/api/giveaways
|
|
// 3) https://core.telegram.org/constructor/inputStorePaymentPremiumGiftCode
|
|
// 4) https://core.telegram.org/api/giveaways
|
|
Purpose InputStorePaymentPurposeClass
|
|
// Should be populated with one of the giveaway options returned by payments
|
|
// getPremiumGiftCodeOptions¹, see the giveaways »² documentation for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/method/payments.getPremiumGiftCodeOptions
|
|
// 2) https://core.telegram.org/api/giveaways
|
|
Option PremiumGiftCodeOption
|
|
}
|
|
|
|
// InputInvoicePremiumGiftCodeTypeID is TL type id of InputInvoicePremiumGiftCode.
|
|
const InputInvoicePremiumGiftCodeTypeID = 0x98986c0d
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoicePremiumGiftCode) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoicePremiumGiftCode.
|
|
var (
|
|
_ bin.Encoder = &InputInvoicePremiumGiftCode{}
|
|
_ bin.Decoder = &InputInvoicePremiumGiftCode{}
|
|
_ bin.BareEncoder = &InputInvoicePremiumGiftCode{}
|
|
_ bin.BareDecoder = &InputInvoicePremiumGiftCode{}
|
|
|
|
_ InputInvoiceClass = &InputInvoicePremiumGiftCode{}
|
|
)
|
|
|
|
func (i *InputInvoicePremiumGiftCode) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Purpose == nil) {
|
|
return false
|
|
}
|
|
if !(i.Option.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoicePremiumGiftCode) String() string {
|
|
if i == nil {
|
|
return "InputInvoicePremiumGiftCode(nil)"
|
|
}
|
|
type Alias InputInvoicePremiumGiftCode
|
|
return fmt.Sprintf("InputInvoicePremiumGiftCode%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoicePremiumGiftCode from given interface.
|
|
func (i *InputInvoicePremiumGiftCode) FillFrom(from interface {
|
|
GetPurpose() (value InputStorePaymentPurposeClass)
|
|
GetOption() (value PremiumGiftCodeOption)
|
|
}) {
|
|
i.Purpose = from.GetPurpose()
|
|
i.Option = from.GetOption()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoicePremiumGiftCode) TypeID() uint32 {
|
|
return InputInvoicePremiumGiftCodeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoicePremiumGiftCode) TypeName() string {
|
|
return "inputInvoicePremiumGiftCode"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoicePremiumGiftCode) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoicePremiumGiftCode",
|
|
ID: InputInvoicePremiumGiftCodeTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Purpose",
|
|
SchemaName: "purpose",
|
|
},
|
|
{
|
|
Name: "Option",
|
|
SchemaName: "option",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoicePremiumGiftCode) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoicePremiumGiftCode#98986c0d as nil")
|
|
}
|
|
b.PutID(InputInvoicePremiumGiftCodeTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoicePremiumGiftCode) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoicePremiumGiftCode#98986c0d as nil")
|
|
}
|
|
if i.Purpose == nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftCode#98986c0d: field purpose is nil")
|
|
}
|
|
if err := i.Purpose.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftCode#98986c0d: field purpose: %w", err)
|
|
}
|
|
if err := i.Option.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftCode#98986c0d: field option: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoicePremiumGiftCode) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoicePremiumGiftCode#98986c0d to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoicePremiumGiftCodeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftCode#98986c0d: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoicePremiumGiftCode) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoicePremiumGiftCode#98986c0d to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputStorePaymentPurpose(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftCode#98986c0d: field purpose: %w", err)
|
|
}
|
|
i.Purpose = value
|
|
}
|
|
{
|
|
if err := i.Option.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftCode#98986c0d: field option: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPurpose returns value of Purpose field.
|
|
func (i *InputInvoicePremiumGiftCode) GetPurpose() (value InputStorePaymentPurposeClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Purpose
|
|
}
|
|
|
|
// GetOption returns value of Option field.
|
|
func (i *InputInvoicePremiumGiftCode) GetOption() (value PremiumGiftCodeOption) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Option
|
|
}
|
|
|
|
// InputInvoiceStars represents TL type `inputInvoiceStars#65f00ce3`.
|
|
// Used to top up the Telegram Stars¹ balance of the current account or someone else's
|
|
// account, or to start a Telegram Star giveaway »².
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stars
|
|
// 2. https://core.telegram.org/api/giveaways#star-giveaways
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStars for reference.
|
|
type InputInvoiceStars struct {
|
|
// An inputStorePaymentStarsGiveaway¹, inputStorePaymentStarsTopup² or
|
|
// inputStorePaymentStarsGift³.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/inputStorePaymentStarsGiveaway
|
|
// 2) https://core.telegram.org/constructor/inputStorePaymentStarsTopup
|
|
// 3) https://core.telegram.org/constructor/inputStorePaymentStarsGift
|
|
Purpose InputStorePaymentPurposeClass
|
|
}
|
|
|
|
// InputInvoiceStarsTypeID is TL type id of InputInvoiceStars.
|
|
const InputInvoiceStarsTypeID = 0x65f00ce3
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStars) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStars.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStars{}
|
|
_ bin.Decoder = &InputInvoiceStars{}
|
|
_ bin.BareEncoder = &InputInvoiceStars{}
|
|
_ bin.BareDecoder = &InputInvoiceStars{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStars{}
|
|
)
|
|
|
|
func (i *InputInvoiceStars) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Purpose == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStars) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStars(nil)"
|
|
}
|
|
type Alias InputInvoiceStars
|
|
return fmt.Sprintf("InputInvoiceStars%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStars from given interface.
|
|
func (i *InputInvoiceStars) FillFrom(from interface {
|
|
GetPurpose() (value InputStorePaymentPurposeClass)
|
|
}) {
|
|
i.Purpose = from.GetPurpose()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStars) TypeID() uint32 {
|
|
return InputInvoiceStarsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStars) TypeName() string {
|
|
return "inputInvoiceStars"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStars) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStars",
|
|
ID: InputInvoiceStarsTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Purpose",
|
|
SchemaName: "purpose",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStars) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStars#65f00ce3 as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarsTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStars) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStars#65f00ce3 as nil")
|
|
}
|
|
if i.Purpose == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStars#65f00ce3: field purpose is nil")
|
|
}
|
|
if err := i.Purpose.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStars#65f00ce3: field purpose: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStars) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStars#65f00ce3 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStars#65f00ce3: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStars) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStars#65f00ce3 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputStorePaymentPurpose(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStars#65f00ce3: field purpose: %w", err)
|
|
}
|
|
i.Purpose = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPurpose returns value of Purpose field.
|
|
func (i *InputInvoiceStars) GetPurpose() (value InputStorePaymentPurposeClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Purpose
|
|
}
|
|
|
|
// InputInvoiceChatInviteSubscription represents TL type `inputInvoiceChatInviteSubscription#34e793f1`.
|
|
// Used to pay for a Telegram Star subscription »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stars#star-subscriptions
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceChatInviteSubscription for reference.
|
|
type InputInvoiceChatInviteSubscription struct {
|
|
// The invitation link of the Telegram Star subscription »¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stars#star-subscriptions
|
|
Hash string
|
|
}
|
|
|
|
// InputInvoiceChatInviteSubscriptionTypeID is TL type id of InputInvoiceChatInviteSubscription.
|
|
const InputInvoiceChatInviteSubscriptionTypeID = 0x34e793f1
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceChatInviteSubscription) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceChatInviteSubscription.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceChatInviteSubscription{}
|
|
_ bin.Decoder = &InputInvoiceChatInviteSubscription{}
|
|
_ bin.BareEncoder = &InputInvoiceChatInviteSubscription{}
|
|
_ bin.BareDecoder = &InputInvoiceChatInviteSubscription{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceChatInviteSubscription{}
|
|
)
|
|
|
|
func (i *InputInvoiceChatInviteSubscription) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Hash == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceChatInviteSubscription) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceChatInviteSubscription(nil)"
|
|
}
|
|
type Alias InputInvoiceChatInviteSubscription
|
|
return fmt.Sprintf("InputInvoiceChatInviteSubscription%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceChatInviteSubscription from given interface.
|
|
func (i *InputInvoiceChatInviteSubscription) FillFrom(from interface {
|
|
GetHash() (value string)
|
|
}) {
|
|
i.Hash = from.GetHash()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceChatInviteSubscription) TypeID() uint32 {
|
|
return InputInvoiceChatInviteSubscriptionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceChatInviteSubscription) TypeName() string {
|
|
return "inputInvoiceChatInviteSubscription"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceChatInviteSubscription) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceChatInviteSubscription",
|
|
ID: InputInvoiceChatInviteSubscriptionTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Hash",
|
|
SchemaName: "hash",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceChatInviteSubscription) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceChatInviteSubscription#34e793f1 as nil")
|
|
}
|
|
b.PutID(InputInvoiceChatInviteSubscriptionTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceChatInviteSubscription) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceChatInviteSubscription#34e793f1 as nil")
|
|
}
|
|
b.PutString(i.Hash)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceChatInviteSubscription) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceChatInviteSubscription#34e793f1 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceChatInviteSubscriptionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceChatInviteSubscription#34e793f1: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceChatInviteSubscription) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceChatInviteSubscription#34e793f1 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceChatInviteSubscription#34e793f1: field hash: %w", err)
|
|
}
|
|
i.Hash = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetHash returns value of Hash field.
|
|
func (i *InputInvoiceChatInviteSubscription) GetHash() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Hash
|
|
}
|
|
|
|
// InputInvoiceStarGift represents TL type `inputInvoiceStarGift#e8625e92`.
|
|
// Used to buy a Telegram Star Gift, see here »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/gifts
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGift for reference.
|
|
type InputInvoiceStarGift struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// If set, your name will be hidden if the destination user decides to display the gift
|
|
// on their profile (they will still see that you sent the gift)
|
|
HideName bool
|
|
// IncludeUpgrade field of InputInvoiceStarGift.
|
|
IncludeUpgrade bool
|
|
// Peer field of InputInvoiceStarGift.
|
|
Peer InputPeerClass
|
|
// Identifier of the gift, from starGift¹.id
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/starGift
|
|
GiftID int64
|
|
// Optional message, attached with the gift
|
|
//
|
|
// Use SetMessage and GetMessage helpers.
|
|
Message TextWithEntities
|
|
}
|
|
|
|
// InputInvoiceStarGiftTypeID is TL type id of InputInvoiceStarGift.
|
|
const InputInvoiceStarGiftTypeID = 0xe8625e92
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGift) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGift.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGift{}
|
|
_ bin.Decoder = &InputInvoiceStarGift{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGift{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGift{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGift{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGift) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.HideName == false) {
|
|
return false
|
|
}
|
|
if !(i.IncludeUpgrade == false) {
|
|
return false
|
|
}
|
|
if !(i.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(i.GiftID == 0) {
|
|
return false
|
|
}
|
|
if !(i.Message.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGift) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGift(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGift
|
|
return fmt.Sprintf("InputInvoiceStarGift%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGift from given interface.
|
|
func (i *InputInvoiceStarGift) FillFrom(from interface {
|
|
GetHideName() (value bool)
|
|
GetIncludeUpgrade() (value bool)
|
|
GetPeer() (value InputPeerClass)
|
|
GetGiftID() (value int64)
|
|
GetMessage() (value TextWithEntities, ok bool)
|
|
}) {
|
|
i.HideName = from.GetHideName()
|
|
i.IncludeUpgrade = from.GetIncludeUpgrade()
|
|
i.Peer = from.GetPeer()
|
|
i.GiftID = from.GetGiftID()
|
|
if val, ok := from.GetMessage(); ok {
|
|
i.Message = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStarGift) TypeID() uint32 {
|
|
return InputInvoiceStarGiftTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGift) TypeName() string {
|
|
return "inputInvoiceStarGift"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGift) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGift",
|
|
ID: InputInvoiceStarGiftTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "HideName",
|
|
SchemaName: "hide_name",
|
|
Null: !i.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "IncludeUpgrade",
|
|
SchemaName: "include_upgrade",
|
|
Null: !i.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "GiftID",
|
|
SchemaName: "gift_id",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
Null: !i.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (i *InputInvoiceStarGift) SetFlags() {
|
|
if !(i.HideName == false) {
|
|
i.Flags.Set(0)
|
|
}
|
|
if !(i.IncludeUpgrade == false) {
|
|
i.Flags.Set(2)
|
|
}
|
|
if !(i.Message.Zero()) {
|
|
i.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGift) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGift#e8625e92 as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGift) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGift#e8625e92 as nil")
|
|
}
|
|
i.SetFlags()
|
|
if err := i.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGift#e8625e92: field flags: %w", err)
|
|
}
|
|
if i.Peer == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGift#e8625e92: field peer is nil")
|
|
}
|
|
if err := i.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGift#e8625e92: field peer: %w", err)
|
|
}
|
|
b.PutLong(i.GiftID)
|
|
if i.Flags.Has(1) {
|
|
if err := i.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGift#e8625e92: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGift) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGift#e8625e92 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGift#e8625e92: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGift) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGift#e8625e92 to nil")
|
|
}
|
|
{
|
|
if err := i.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGift#e8625e92: field flags: %w", err)
|
|
}
|
|
}
|
|
i.HideName = i.Flags.Has(0)
|
|
i.IncludeUpgrade = i.Flags.Has(2)
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGift#e8625e92: field peer: %w", err)
|
|
}
|
|
i.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGift#e8625e92: field gift_id: %w", err)
|
|
}
|
|
i.GiftID = value
|
|
}
|
|
if i.Flags.Has(1) {
|
|
if err := i.Message.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGift#e8625e92: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetHideName sets value of HideName conditional field.
|
|
func (i *InputInvoiceStarGift) SetHideName(value bool) {
|
|
if value {
|
|
i.Flags.Set(0)
|
|
i.HideName = true
|
|
} else {
|
|
i.Flags.Unset(0)
|
|
i.HideName = false
|
|
}
|
|
}
|
|
|
|
// GetHideName returns value of HideName conditional field.
|
|
func (i *InputInvoiceStarGift) GetHideName() (value bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Flags.Has(0)
|
|
}
|
|
|
|
// SetIncludeUpgrade sets value of IncludeUpgrade conditional field.
|
|
func (i *InputInvoiceStarGift) SetIncludeUpgrade(value bool) {
|
|
if value {
|
|
i.Flags.Set(2)
|
|
i.IncludeUpgrade = true
|
|
} else {
|
|
i.Flags.Unset(2)
|
|
i.IncludeUpgrade = false
|
|
}
|
|
}
|
|
|
|
// GetIncludeUpgrade returns value of IncludeUpgrade conditional field.
|
|
func (i *InputInvoiceStarGift) GetIncludeUpgrade() (value bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Flags.Has(2)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (i *InputInvoiceStarGift) GetPeer() (value InputPeerClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Peer
|
|
}
|
|
|
|
// GetGiftID returns value of GiftID field.
|
|
func (i *InputInvoiceStarGift) GetGiftID() (value int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.GiftID
|
|
}
|
|
|
|
// SetMessage sets value of Message conditional field.
|
|
func (i *InputInvoiceStarGift) SetMessage(value TextWithEntities) {
|
|
i.Flags.Set(1)
|
|
i.Message = value
|
|
}
|
|
|
|
// GetMessage returns value of Message conditional field and
|
|
// boolean which is true if field was set.
|
|
func (i *InputInvoiceStarGift) GetMessage() (value TextWithEntities, ok bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
if !i.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return i.Message, true
|
|
}
|
|
|
|
// InputInvoiceStarGiftUpgrade represents TL type `inputInvoiceStarGiftUpgrade#4d818d5d`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftUpgrade for reference.
|
|
type InputInvoiceStarGiftUpgrade struct {
|
|
// Flags field of InputInvoiceStarGiftUpgrade.
|
|
Flags bin.Fields
|
|
// KeepOriginalDetails field of InputInvoiceStarGiftUpgrade.
|
|
KeepOriginalDetails bool
|
|
// Stargift field of InputInvoiceStarGiftUpgrade.
|
|
Stargift InputSavedStarGiftClass
|
|
}
|
|
|
|
// InputInvoiceStarGiftUpgradeTypeID is TL type id of InputInvoiceStarGiftUpgrade.
|
|
const InputInvoiceStarGiftUpgradeTypeID = 0x4d818d5d
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGiftUpgrade) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGiftUpgrade.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGiftUpgrade{}
|
|
_ bin.Decoder = &InputInvoiceStarGiftUpgrade{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGiftUpgrade{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGiftUpgrade{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGiftUpgrade{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGiftUpgrade) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.KeepOriginalDetails == false) {
|
|
return false
|
|
}
|
|
if !(i.Stargift == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGiftUpgrade) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGiftUpgrade(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGiftUpgrade
|
|
return fmt.Sprintf("InputInvoiceStarGiftUpgrade%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGiftUpgrade from given interface.
|
|
func (i *InputInvoiceStarGiftUpgrade) FillFrom(from interface {
|
|
GetKeepOriginalDetails() (value bool)
|
|
GetStargift() (value InputSavedStarGiftClass)
|
|
}) {
|
|
i.KeepOriginalDetails = from.GetKeepOriginalDetails()
|
|
i.Stargift = from.GetStargift()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStarGiftUpgrade) TypeID() uint32 {
|
|
return InputInvoiceStarGiftUpgradeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGiftUpgrade) TypeName() string {
|
|
return "inputInvoiceStarGiftUpgrade"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGiftUpgrade) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGiftUpgrade",
|
|
ID: InputInvoiceStarGiftUpgradeTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "KeepOriginalDetails",
|
|
SchemaName: "keep_original_details",
|
|
Null: !i.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Stargift",
|
|
SchemaName: "stargift",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (i *InputInvoiceStarGiftUpgrade) SetFlags() {
|
|
if !(i.KeepOriginalDetails == false) {
|
|
i.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftUpgrade) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftUpgrade#4d818d5d as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftUpgradeTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGiftUpgrade) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftUpgrade#4d818d5d as nil")
|
|
}
|
|
i.SetFlags()
|
|
if err := i.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftUpgrade#4d818d5d: field flags: %w", err)
|
|
}
|
|
if i.Stargift == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftUpgrade#4d818d5d: field stargift is nil")
|
|
}
|
|
if err := i.Stargift.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftUpgrade#4d818d5d: field stargift: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGiftUpgrade) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftUpgrade#4d818d5d to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftUpgradeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftUpgrade#4d818d5d: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGiftUpgrade) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftUpgrade#4d818d5d to nil")
|
|
}
|
|
{
|
|
if err := i.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftUpgrade#4d818d5d: field flags: %w", err)
|
|
}
|
|
}
|
|
i.KeepOriginalDetails = i.Flags.Has(0)
|
|
{
|
|
value, err := DecodeInputSavedStarGift(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftUpgrade#4d818d5d: field stargift: %w", err)
|
|
}
|
|
i.Stargift = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetKeepOriginalDetails sets value of KeepOriginalDetails conditional field.
|
|
func (i *InputInvoiceStarGiftUpgrade) SetKeepOriginalDetails(value bool) {
|
|
if value {
|
|
i.Flags.Set(0)
|
|
i.KeepOriginalDetails = true
|
|
} else {
|
|
i.Flags.Unset(0)
|
|
i.KeepOriginalDetails = false
|
|
}
|
|
}
|
|
|
|
// GetKeepOriginalDetails returns value of KeepOriginalDetails conditional field.
|
|
func (i *InputInvoiceStarGiftUpgrade) GetKeepOriginalDetails() (value bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Flags.Has(0)
|
|
}
|
|
|
|
// GetStargift returns value of Stargift field.
|
|
func (i *InputInvoiceStarGiftUpgrade) GetStargift() (value InputSavedStarGiftClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Stargift
|
|
}
|
|
|
|
// InputInvoiceStarGiftTransfer represents TL type `inputInvoiceStarGiftTransfer#4a5f5bd9`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftTransfer for reference.
|
|
type InputInvoiceStarGiftTransfer struct {
|
|
// Stargift field of InputInvoiceStarGiftTransfer.
|
|
Stargift InputSavedStarGiftClass
|
|
// ToID field of InputInvoiceStarGiftTransfer.
|
|
ToID InputPeerClass
|
|
}
|
|
|
|
// InputInvoiceStarGiftTransferTypeID is TL type id of InputInvoiceStarGiftTransfer.
|
|
const InputInvoiceStarGiftTransferTypeID = 0x4a5f5bd9
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGiftTransfer) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGiftTransfer.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGiftTransfer{}
|
|
_ bin.Decoder = &InputInvoiceStarGiftTransfer{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGiftTransfer{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGiftTransfer{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGiftTransfer{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGiftTransfer) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Stargift == nil) {
|
|
return false
|
|
}
|
|
if !(i.ToID == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGiftTransfer) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGiftTransfer(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGiftTransfer
|
|
return fmt.Sprintf("InputInvoiceStarGiftTransfer%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGiftTransfer from given interface.
|
|
func (i *InputInvoiceStarGiftTransfer) FillFrom(from interface {
|
|
GetStargift() (value InputSavedStarGiftClass)
|
|
GetToID() (value InputPeerClass)
|
|
}) {
|
|
i.Stargift = from.GetStargift()
|
|
i.ToID = from.GetToID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStarGiftTransfer) TypeID() uint32 {
|
|
return InputInvoiceStarGiftTransferTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGiftTransfer) TypeName() string {
|
|
return "inputInvoiceStarGiftTransfer"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGiftTransfer) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGiftTransfer",
|
|
ID: InputInvoiceStarGiftTransferTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Stargift",
|
|
SchemaName: "stargift",
|
|
},
|
|
{
|
|
Name: "ToID",
|
|
SchemaName: "to_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftTransfer) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftTransfer#4a5f5bd9 as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftTransferTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGiftTransfer) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftTransfer#4a5f5bd9 as nil")
|
|
}
|
|
if i.Stargift == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftTransfer#4a5f5bd9: field stargift is nil")
|
|
}
|
|
if err := i.Stargift.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftTransfer#4a5f5bd9: field stargift: %w", err)
|
|
}
|
|
if i.ToID == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftTransfer#4a5f5bd9: field to_id is nil")
|
|
}
|
|
if err := i.ToID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftTransfer#4a5f5bd9: field to_id: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGiftTransfer) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftTransfer#4a5f5bd9 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftTransferTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftTransfer#4a5f5bd9: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGiftTransfer) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftTransfer#4a5f5bd9 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputSavedStarGift(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftTransfer#4a5f5bd9: field stargift: %w", err)
|
|
}
|
|
i.Stargift = value
|
|
}
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftTransfer#4a5f5bd9: field to_id: %w", err)
|
|
}
|
|
i.ToID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetStargift returns value of Stargift field.
|
|
func (i *InputInvoiceStarGiftTransfer) GetStargift() (value InputSavedStarGiftClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Stargift
|
|
}
|
|
|
|
// GetToID returns value of ToID field.
|
|
func (i *InputInvoiceStarGiftTransfer) GetToID() (value InputPeerClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ToID
|
|
}
|
|
|
|
// InputInvoicePremiumGiftStars represents TL type `inputInvoicePremiumGiftStars#dabab2ef`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoicePremiumGiftStars for reference.
|
|
type InputInvoicePremiumGiftStars struct {
|
|
// Flags field of InputInvoicePremiumGiftStars.
|
|
Flags bin.Fields
|
|
// UserID field of InputInvoicePremiumGiftStars.
|
|
UserID InputUserClass
|
|
// Months field of InputInvoicePremiumGiftStars.
|
|
Months int
|
|
// Message field of InputInvoicePremiumGiftStars.
|
|
//
|
|
// Use SetMessage and GetMessage helpers.
|
|
Message TextWithEntities
|
|
}
|
|
|
|
// InputInvoicePremiumGiftStarsTypeID is TL type id of InputInvoicePremiumGiftStars.
|
|
const InputInvoicePremiumGiftStarsTypeID = 0xdabab2ef
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoicePremiumGiftStars) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoicePremiumGiftStars.
|
|
var (
|
|
_ bin.Encoder = &InputInvoicePremiumGiftStars{}
|
|
_ bin.Decoder = &InputInvoicePremiumGiftStars{}
|
|
_ bin.BareEncoder = &InputInvoicePremiumGiftStars{}
|
|
_ bin.BareDecoder = &InputInvoicePremiumGiftStars{}
|
|
|
|
_ InputInvoiceClass = &InputInvoicePremiumGiftStars{}
|
|
)
|
|
|
|
func (i *InputInvoicePremiumGiftStars) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.UserID == nil) {
|
|
return false
|
|
}
|
|
if !(i.Months == 0) {
|
|
return false
|
|
}
|
|
if !(i.Message.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoicePremiumGiftStars) String() string {
|
|
if i == nil {
|
|
return "InputInvoicePremiumGiftStars(nil)"
|
|
}
|
|
type Alias InputInvoicePremiumGiftStars
|
|
return fmt.Sprintf("InputInvoicePremiumGiftStars%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoicePremiumGiftStars from given interface.
|
|
func (i *InputInvoicePremiumGiftStars) FillFrom(from interface {
|
|
GetUserID() (value InputUserClass)
|
|
GetMonths() (value int)
|
|
GetMessage() (value TextWithEntities, ok bool)
|
|
}) {
|
|
i.UserID = from.GetUserID()
|
|
i.Months = from.GetMonths()
|
|
if val, ok := from.GetMessage(); ok {
|
|
i.Message = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoicePremiumGiftStars) TypeID() uint32 {
|
|
return InputInvoicePremiumGiftStarsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoicePremiumGiftStars) TypeName() string {
|
|
return "inputInvoicePremiumGiftStars"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoicePremiumGiftStars) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoicePremiumGiftStars",
|
|
ID: InputInvoicePremiumGiftStarsTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Months",
|
|
SchemaName: "months",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
Null: !i.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (i *InputInvoicePremiumGiftStars) SetFlags() {
|
|
if !(i.Message.Zero()) {
|
|
i.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoicePremiumGiftStars) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoicePremiumGiftStars#dabab2ef as nil")
|
|
}
|
|
b.PutID(InputInvoicePremiumGiftStarsTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoicePremiumGiftStars) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoicePremiumGiftStars#dabab2ef as nil")
|
|
}
|
|
i.SetFlags()
|
|
if err := i.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftStars#dabab2ef: field flags: %w", err)
|
|
}
|
|
if i.UserID == nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftStars#dabab2ef: field user_id is nil")
|
|
}
|
|
if err := i.UserID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftStars#dabab2ef: field user_id: %w", err)
|
|
}
|
|
b.PutInt(i.Months)
|
|
if i.Flags.Has(0) {
|
|
if err := i.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumGiftStars#dabab2ef: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoicePremiumGiftStars) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoicePremiumGiftStars#dabab2ef to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoicePremiumGiftStarsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftStars#dabab2ef: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoicePremiumGiftStars) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoicePremiumGiftStars#dabab2ef to nil")
|
|
}
|
|
{
|
|
if err := i.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftStars#dabab2ef: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeInputUser(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftStars#dabab2ef: field user_id: %w", err)
|
|
}
|
|
i.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftStars#dabab2ef: field months: %w", err)
|
|
}
|
|
i.Months = value
|
|
}
|
|
if i.Flags.Has(0) {
|
|
if err := i.Message.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumGiftStars#dabab2ef: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (i *InputInvoicePremiumGiftStars) GetUserID() (value InputUserClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.UserID
|
|
}
|
|
|
|
// GetMonths returns value of Months field.
|
|
func (i *InputInvoicePremiumGiftStars) GetMonths() (value int) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Months
|
|
}
|
|
|
|
// SetMessage sets value of Message conditional field.
|
|
func (i *InputInvoicePremiumGiftStars) SetMessage(value TextWithEntities) {
|
|
i.Flags.Set(0)
|
|
i.Message = value
|
|
}
|
|
|
|
// GetMessage returns value of Message conditional field and
|
|
// boolean which is true if field was set.
|
|
func (i *InputInvoicePremiumGiftStars) GetMessage() (value TextWithEntities, ok bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
if !i.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return i.Message, true
|
|
}
|
|
|
|
// InputInvoiceBusinessBotTransferStars represents TL type `inputInvoiceBusinessBotTransferStars#f4997e42`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceBusinessBotTransferStars for reference.
|
|
type InputInvoiceBusinessBotTransferStars struct {
|
|
// Bot field of InputInvoiceBusinessBotTransferStars.
|
|
Bot InputUserClass
|
|
// Stars field of InputInvoiceBusinessBotTransferStars.
|
|
Stars int64
|
|
}
|
|
|
|
// InputInvoiceBusinessBotTransferStarsTypeID is TL type id of InputInvoiceBusinessBotTransferStars.
|
|
const InputInvoiceBusinessBotTransferStarsTypeID = 0xf4997e42
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceBusinessBotTransferStars) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceBusinessBotTransferStars.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceBusinessBotTransferStars{}
|
|
_ bin.Decoder = &InputInvoiceBusinessBotTransferStars{}
|
|
_ bin.BareEncoder = &InputInvoiceBusinessBotTransferStars{}
|
|
_ bin.BareDecoder = &InputInvoiceBusinessBotTransferStars{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceBusinessBotTransferStars{}
|
|
)
|
|
|
|
func (i *InputInvoiceBusinessBotTransferStars) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Bot == nil) {
|
|
return false
|
|
}
|
|
if !(i.Stars == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceBusinessBotTransferStars) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceBusinessBotTransferStars(nil)"
|
|
}
|
|
type Alias InputInvoiceBusinessBotTransferStars
|
|
return fmt.Sprintf("InputInvoiceBusinessBotTransferStars%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceBusinessBotTransferStars from given interface.
|
|
func (i *InputInvoiceBusinessBotTransferStars) FillFrom(from interface {
|
|
GetBot() (value InputUserClass)
|
|
GetStars() (value int64)
|
|
}) {
|
|
i.Bot = from.GetBot()
|
|
i.Stars = from.GetStars()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceBusinessBotTransferStars) TypeID() uint32 {
|
|
return InputInvoiceBusinessBotTransferStarsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceBusinessBotTransferStars) TypeName() string {
|
|
return "inputInvoiceBusinessBotTransferStars"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceBusinessBotTransferStars) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceBusinessBotTransferStars",
|
|
ID: InputInvoiceBusinessBotTransferStarsTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Bot",
|
|
SchemaName: "bot",
|
|
},
|
|
{
|
|
Name: "Stars",
|
|
SchemaName: "stars",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceBusinessBotTransferStars) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceBusinessBotTransferStars#f4997e42 as nil")
|
|
}
|
|
b.PutID(InputInvoiceBusinessBotTransferStarsTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceBusinessBotTransferStars) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceBusinessBotTransferStars#f4997e42 as nil")
|
|
}
|
|
if i.Bot == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceBusinessBotTransferStars#f4997e42: field bot is nil")
|
|
}
|
|
if err := i.Bot.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceBusinessBotTransferStars#f4997e42: field bot: %w", err)
|
|
}
|
|
b.PutLong(i.Stars)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceBusinessBotTransferStars) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceBusinessBotTransferStars#f4997e42 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceBusinessBotTransferStarsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceBusinessBotTransferStars#f4997e42: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceBusinessBotTransferStars) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceBusinessBotTransferStars#f4997e42 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputUser(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceBusinessBotTransferStars#f4997e42: field bot: %w", err)
|
|
}
|
|
i.Bot = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceBusinessBotTransferStars#f4997e42: field stars: %w", err)
|
|
}
|
|
i.Stars = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetBot returns value of Bot field.
|
|
func (i *InputInvoiceBusinessBotTransferStars) GetBot() (value InputUserClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Bot
|
|
}
|
|
|
|
// GetStars returns value of Stars field.
|
|
func (i *InputInvoiceBusinessBotTransferStars) GetStars() (value int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Stars
|
|
}
|
|
|
|
// InputInvoiceStarGiftResale represents TL type `inputInvoiceStarGiftResale#63cbc38c`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftResale for reference.
|
|
type InputInvoiceStarGiftResale struct {
|
|
// Slug field of InputInvoiceStarGiftResale.
|
|
Slug string
|
|
// ToID field of InputInvoiceStarGiftResale.
|
|
ToID InputPeerClass
|
|
}
|
|
|
|
// InputInvoiceStarGiftResaleTypeID is TL type id of InputInvoiceStarGiftResale.
|
|
const InputInvoiceStarGiftResaleTypeID = 0x63cbc38c
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGiftResale) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGiftResale.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGiftResale{}
|
|
_ bin.Decoder = &InputInvoiceStarGiftResale{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGiftResale{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGiftResale{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGiftResale{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGiftResale) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Slug == "") {
|
|
return false
|
|
}
|
|
if !(i.ToID == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGiftResale) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGiftResale(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGiftResale
|
|
return fmt.Sprintf("InputInvoiceStarGiftResale%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGiftResale from given interface.
|
|
func (i *InputInvoiceStarGiftResale) FillFrom(from interface {
|
|
GetSlug() (value string)
|
|
GetToID() (value InputPeerClass)
|
|
}) {
|
|
i.Slug = from.GetSlug()
|
|
i.ToID = from.GetToID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStarGiftResale) TypeID() uint32 {
|
|
return InputInvoiceStarGiftResaleTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGiftResale) TypeName() string {
|
|
return "inputInvoiceStarGiftResale"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGiftResale) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGiftResale",
|
|
ID: InputInvoiceStarGiftResaleTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Slug",
|
|
SchemaName: "slug",
|
|
},
|
|
{
|
|
Name: "ToID",
|
|
SchemaName: "to_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftResale) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftResale#63cbc38c as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftResaleTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGiftResale) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftResale#63cbc38c as nil")
|
|
}
|
|
b.PutString(i.Slug)
|
|
if i.ToID == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftResale#63cbc38c: field to_id is nil")
|
|
}
|
|
if err := i.ToID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftResale#63cbc38c: field to_id: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGiftResale) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftResale#63cbc38c to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftResaleTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#63cbc38c: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGiftResale) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftResale#63cbc38c to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#63cbc38c: field slug: %w", err)
|
|
}
|
|
i.Slug = value
|
|
}
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#63cbc38c: field to_id: %w", err)
|
|
}
|
|
i.ToID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetSlug returns value of Slug field.
|
|
func (i *InputInvoiceStarGiftResale) GetSlug() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Slug
|
|
}
|
|
|
|
// GetToID returns value of ToID field.
|
|
func (i *InputInvoiceStarGiftResale) GetToID() (value InputPeerClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ToID
|
|
}
|
|
|
|
// InputInvoiceClassName is schema name of InputInvoiceClass.
|
|
const InputInvoiceClassName = "InputInvoice"
|
|
|
|
// InputInvoiceClass represents InputInvoice generic type.
|
|
//
|
|
// See https://core.telegram.org/type/InputInvoice for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodeInputInvoice(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.InputInvoiceMessage: // inputInvoiceMessage#c5b56859
|
|
// case *tg.InputInvoiceSlug: // inputInvoiceSlug#c326caef
|
|
// case *tg.InputInvoicePremiumGiftCode: // inputInvoicePremiumGiftCode#98986c0d
|
|
// case *tg.InputInvoiceStars: // inputInvoiceStars#65f00ce3
|
|
// case *tg.InputInvoiceChatInviteSubscription: // inputInvoiceChatInviteSubscription#34e793f1
|
|
// case *tg.InputInvoiceStarGift: // inputInvoiceStarGift#e8625e92
|
|
// case *tg.InputInvoiceStarGiftUpgrade: // inputInvoiceStarGiftUpgrade#4d818d5d
|
|
// case *tg.InputInvoiceStarGiftTransfer: // inputInvoiceStarGiftTransfer#4a5f5bd9
|
|
// case *tg.InputInvoicePremiumGiftStars: // inputInvoicePremiumGiftStars#dabab2ef
|
|
// case *tg.InputInvoiceBusinessBotTransferStars: // inputInvoiceBusinessBotTransferStars#f4997e42
|
|
// case *tg.InputInvoiceStarGiftResale: // inputInvoiceStarGiftResale#63cbc38c
|
|
// default: panic(v)
|
|
// }
|
|
type InputInvoiceClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() InputInvoiceClass
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
TypeID() uint32
|
|
// TypeName returns name of type in TL schema.
|
|
TypeName() string
|
|
// String implements fmt.Stringer.
|
|
String() string
|
|
// Zero returns true if current object has a zero value.
|
|
Zero() bool
|
|
}
|
|
|
|
// DecodeInputInvoice implements binary de-serialization for InputInvoiceClass.
|
|
func DecodeInputInvoice(buf *bin.Buffer) (InputInvoiceClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case InputInvoiceMessageTypeID:
|
|
// Decoding inputInvoiceMessage#c5b56859.
|
|
v := InputInvoiceMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceSlugTypeID:
|
|
// Decoding inputInvoiceSlug#c326caef.
|
|
v := InputInvoiceSlug{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoicePremiumGiftCodeTypeID:
|
|
// Decoding inputInvoicePremiumGiftCode#98986c0d.
|
|
v := InputInvoicePremiumGiftCode{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarsTypeID:
|
|
// Decoding inputInvoiceStars#65f00ce3.
|
|
v := InputInvoiceStars{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceChatInviteSubscriptionTypeID:
|
|
// Decoding inputInvoiceChatInviteSubscription#34e793f1.
|
|
v := InputInvoiceChatInviteSubscription{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftTypeID:
|
|
// Decoding inputInvoiceStarGift#e8625e92.
|
|
v := InputInvoiceStarGift{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftUpgradeTypeID:
|
|
// Decoding inputInvoiceStarGiftUpgrade#4d818d5d.
|
|
v := InputInvoiceStarGiftUpgrade{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftTransferTypeID:
|
|
// Decoding inputInvoiceStarGiftTransfer#4a5f5bd9.
|
|
v := InputInvoiceStarGiftTransfer{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoicePremiumGiftStarsTypeID:
|
|
// Decoding inputInvoicePremiumGiftStars#dabab2ef.
|
|
v := InputInvoicePremiumGiftStars{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceBusinessBotTransferStarsTypeID:
|
|
// Decoding inputInvoiceBusinessBotTransferStars#f4997e42.
|
|
v := InputInvoiceBusinessBotTransferStars{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftResaleTypeID:
|
|
// Decoding inputInvoiceStarGiftResale#63cbc38c.
|
|
v := InputInvoiceStarGiftResale{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// InputInvoice boxes the InputInvoiceClass providing a helper.
|
|
type InputInvoiceBox struct {
|
|
InputInvoice InputInvoiceClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for InputInvoiceBox.
|
|
func (b *InputInvoiceBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InputInvoiceBox to nil")
|
|
}
|
|
v, err := DecodeInputInvoice(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InputInvoice = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for InputInvoiceBox.
|
|
func (b *InputInvoiceBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.InputInvoice == nil {
|
|
return fmt.Errorf("unable to encode InputInvoiceClass as nil")
|
|
}
|
|
return b.InputInvoice.Encode(buf)
|
|
}
|