3168 lines
87 KiB
Go
Generated
3168 lines
87 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{}
|
|
)
|
|
|
|
// 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
|
|
// Also pay for an eventual upgrade of the gift to a collectible gift »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/gifts#collectible-gifts
|
|
IncludeUpgrade bool
|
|
// Receiver of the gift.
|
|
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. The maximum length for this field is
|
|
// specified in the stargifts_message_length_max client configuration value »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/config#stargifts-message-length-max
|
|
//
|
|
// 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`.
|
|
// Used to pay to upgrade a Gift to a collectible gift¹, see the collectible gifts »²
|
|
// documentation for more info on the full flow.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/gifts#upgrade-a-gift-to-a-collectible-gift
|
|
// 2. https://core.telegram.org/api/gifts#collectible-gifts
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftUpgrade for reference.
|
|
type InputInvoiceStarGiftUpgrade struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Set this flag to keep the original gift text, sender and receiver in the upgraded gift
|
|
// as a starGiftAttributeOriginalDetails¹ attribute.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/starGiftAttributeOriginalDetails
|
|
KeepOriginalDetails bool
|
|
// The identifier of the received gift to upgrade.
|
|
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`.
|
|
// Used to pay to transfer a collectible gift to another peer¹, see the gifts »²
|
|
// documentation for more info.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/gifts#transferring-collectible-gifts
|
|
// 2. https://core.telegram.org/api/gifts#transferring-collectible-gifts
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftTransfer for reference.
|
|
type InputInvoiceStarGiftTransfer struct {
|
|
// The identifier of the received gift
|
|
Stargift InputSavedStarGiftClass
|
|
// The destination peer
|
|
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`.
|
|
// Used to gift a Telegram Premium¹ subscription to another user, paying with Telegram
|
|
// Stars².
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/premium
|
|
// 2. https://core.telegram.org/api/stars
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoicePremiumGiftStars for reference.
|
|
type InputInvoicePremiumGiftStars struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Who will receive the gifted subscription.
|
|
UserID InputUserClass
|
|
// Duration of the subscription in months, must be one of the options with currency ==
|
|
// "XTR" returned by payments.getPremiumGiftCodeOptions¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/method/payments.getPremiumGiftCodeOptions
|
|
Months int
|
|
// Message attached with the gift.
|
|
//
|
|
// 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`.
|
|
// Transfer stars from the balance of a user account connected to a business bot¹, to
|
|
// the balance of the business bot², see here »³ for more info on the full flow.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/connected-business-bots
|
|
// 2. https://core.telegram.org/api/bots/connected-business-bots
|
|
// 3. https://core.telegram.org/api/stars#transferring-stars-from-a-business-account-to-the-business-bot
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceBusinessBotTransferStars for reference.
|
|
type InputInvoiceBusinessBotTransferStars struct {
|
|
// Always inputUserSelf¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/inputUserSelf
|
|
Bot InputUserClass
|
|
// The number of stars to transfer.
|
|
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#c39f5324`.
|
|
// Used to buy a collectible gift¹ currently up on resale, see here² for more info on
|
|
// the full flow.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/gifts#collectible-gifts
|
|
// 2. https://core.telegram.org/api/gifts#reselling-collectible-gifts
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftResale for reference.
|
|
type InputInvoiceStarGiftResale struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Buy the gift using TON.
|
|
Ton bool
|
|
// Slug of the gift to buy.
|
|
Slug string
|
|
// The receiver of the gift.
|
|
ToID InputPeerClass
|
|
}
|
|
|
|
// InputInvoiceStarGiftResaleTypeID is TL type id of InputInvoiceStarGiftResale.
|
|
const InputInvoiceStarGiftResaleTypeID = 0xc39f5324
|
|
|
|
// 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.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Ton == false) {
|
|
return false
|
|
}
|
|
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 {
|
|
GetTon() (value bool)
|
|
GetSlug() (value string)
|
|
GetToID() (value InputPeerClass)
|
|
}) {
|
|
i.Ton = from.GetTon()
|
|
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: "Ton",
|
|
SchemaName: "ton",
|
|
Null: !i.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Slug",
|
|
SchemaName: "slug",
|
|
},
|
|
{
|
|
Name: "ToID",
|
|
SchemaName: "to_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (i *InputInvoiceStarGiftResale) SetFlags() {
|
|
if !(i.Ton == false) {
|
|
i.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftResale) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftResale#c39f5324 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#c39f5324 as nil")
|
|
}
|
|
i.SetFlags()
|
|
if err := i.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftResale#c39f5324: field flags: %w", err)
|
|
}
|
|
b.PutString(i.Slug)
|
|
if i.ToID == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftResale#c39f5324: field to_id is nil")
|
|
}
|
|
if err := i.ToID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftResale#c39f5324: 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#c39f5324 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftResaleTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#c39f5324: %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#c39f5324 to nil")
|
|
}
|
|
{
|
|
if err := i.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#c39f5324: field flags: %w", err)
|
|
}
|
|
}
|
|
i.Ton = i.Flags.Has(0)
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#c39f5324: field slug: %w", err)
|
|
}
|
|
i.Slug = value
|
|
}
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftResale#c39f5324: field to_id: %w", err)
|
|
}
|
|
i.ToID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetTon sets value of Ton conditional field.
|
|
func (i *InputInvoiceStarGiftResale) SetTon(value bool) {
|
|
if value {
|
|
i.Flags.Set(0)
|
|
i.Ton = true
|
|
} else {
|
|
i.Flags.Unset(0)
|
|
i.Ton = false
|
|
}
|
|
}
|
|
|
|
// GetTon returns value of Ton conditional field.
|
|
func (i *InputInvoiceStarGiftResale) GetTon() (value bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Flags.Has(0)
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// InputInvoiceStarGiftPrepaidUpgrade represents TL type `inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8`.
|
|
// Separately prepay for the upgrade of a gift »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/gifts#prepaying-for-someone-elses-upgrade
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftPrepaidUpgrade for reference.
|
|
type InputInvoiceStarGiftPrepaidUpgrade struct {
|
|
// The peer that owns the gift.
|
|
Peer InputPeerClass
|
|
// The upgrade hash from messageActionStarGift¹.prepaid_upgrade_hash or savedStarGift²
|
|
// prepaid_upgrade_hash.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/messageActionStarGift
|
|
// 2) https://core.telegram.org/constructor/savedStarGift
|
|
Hash string
|
|
}
|
|
|
|
// InputInvoiceStarGiftPrepaidUpgradeTypeID is TL type id of InputInvoiceStarGiftPrepaidUpgrade.
|
|
const InputInvoiceStarGiftPrepaidUpgradeTypeID = 0x9a0b48b8
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGiftPrepaidUpgrade) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGiftPrepaidUpgrade.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGiftPrepaidUpgrade{}
|
|
_ bin.Decoder = &InputInvoiceStarGiftPrepaidUpgrade{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGiftPrepaidUpgrade{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGiftPrepaidUpgrade{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGiftPrepaidUpgrade{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(i.Hash == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGiftPrepaidUpgrade(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGiftPrepaidUpgrade
|
|
return fmt.Sprintf("InputInvoiceStarGiftPrepaidUpgrade%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGiftPrepaidUpgrade from given interface.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) FillFrom(from interface {
|
|
GetPeer() (value InputPeerClass)
|
|
GetHash() (value string)
|
|
}) {
|
|
i.Peer = from.GetPeer()
|
|
i.Hash = from.GetHash()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStarGiftPrepaidUpgrade) TypeID() uint32 {
|
|
return InputInvoiceStarGiftPrepaidUpgradeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGiftPrepaidUpgrade) TypeName() string {
|
|
return "inputInvoiceStarGiftPrepaidUpgrade"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGiftPrepaidUpgrade",
|
|
ID: InputInvoiceStarGiftPrepaidUpgradeTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Hash",
|
|
SchemaName: "hash",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8 as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftPrepaidUpgradeTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8 as nil")
|
|
}
|
|
if i.Peer == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8: field peer is nil")
|
|
}
|
|
if err := i.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8: field peer: %w", err)
|
|
}
|
|
b.PutString(i.Hash)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftPrepaidUpgradeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8: field peer: %w", err)
|
|
}
|
|
i.Peer = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8: field hash: %w", err)
|
|
}
|
|
i.Hash = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) GetPeer() (value InputPeerClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Peer
|
|
}
|
|
|
|
// GetHash returns value of Hash field.
|
|
func (i *InputInvoiceStarGiftPrepaidUpgrade) GetHash() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Hash
|
|
}
|
|
|
|
// InputInvoicePremiumAuthCode represents TL type `inputInvoicePremiumAuthCode#3e77f614`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoicePremiumAuthCode for reference.
|
|
type InputInvoicePremiumAuthCode struct {
|
|
// Purpose field of InputInvoicePremiumAuthCode.
|
|
Purpose InputStorePaymentPurposeClass
|
|
}
|
|
|
|
// InputInvoicePremiumAuthCodeTypeID is TL type id of InputInvoicePremiumAuthCode.
|
|
const InputInvoicePremiumAuthCodeTypeID = 0x3e77f614
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoicePremiumAuthCode) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoicePremiumAuthCode.
|
|
var (
|
|
_ bin.Encoder = &InputInvoicePremiumAuthCode{}
|
|
_ bin.Decoder = &InputInvoicePremiumAuthCode{}
|
|
_ bin.BareEncoder = &InputInvoicePremiumAuthCode{}
|
|
_ bin.BareDecoder = &InputInvoicePremiumAuthCode{}
|
|
|
|
_ InputInvoiceClass = &InputInvoicePremiumAuthCode{}
|
|
)
|
|
|
|
func (i *InputInvoicePremiumAuthCode) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Purpose == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoicePremiumAuthCode) String() string {
|
|
if i == nil {
|
|
return "InputInvoicePremiumAuthCode(nil)"
|
|
}
|
|
type Alias InputInvoicePremiumAuthCode
|
|
return fmt.Sprintf("InputInvoicePremiumAuthCode%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoicePremiumAuthCode from given interface.
|
|
func (i *InputInvoicePremiumAuthCode) 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 (*InputInvoicePremiumAuthCode) TypeID() uint32 {
|
|
return InputInvoicePremiumAuthCodeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoicePremiumAuthCode) TypeName() string {
|
|
return "inputInvoicePremiumAuthCode"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoicePremiumAuthCode) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoicePremiumAuthCode",
|
|
ID: InputInvoicePremiumAuthCodeTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Purpose",
|
|
SchemaName: "purpose",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoicePremiumAuthCode) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoicePremiumAuthCode#3e77f614 as nil")
|
|
}
|
|
b.PutID(InputInvoicePremiumAuthCodeTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoicePremiumAuthCode) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoicePremiumAuthCode#3e77f614 as nil")
|
|
}
|
|
if i.Purpose == nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumAuthCode#3e77f614: field purpose is nil")
|
|
}
|
|
if err := i.Purpose.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoicePremiumAuthCode#3e77f614: field purpose: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoicePremiumAuthCode) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoicePremiumAuthCode#3e77f614 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoicePremiumAuthCodeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumAuthCode#3e77f614: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoicePremiumAuthCode) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoicePremiumAuthCode#3e77f614 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputStorePaymentPurpose(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoicePremiumAuthCode#3e77f614: field purpose: %w", err)
|
|
}
|
|
i.Purpose = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPurpose returns value of Purpose field.
|
|
func (i *InputInvoicePremiumAuthCode) GetPurpose() (value InputStorePaymentPurposeClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Purpose
|
|
}
|
|
|
|
// InputInvoiceStarGiftDropOriginalDetails represents TL type `inputInvoiceStarGiftDropOriginalDetails#923d8d1`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftDropOriginalDetails for reference.
|
|
type InputInvoiceStarGiftDropOriginalDetails struct {
|
|
// Stargift field of InputInvoiceStarGiftDropOriginalDetails.
|
|
Stargift InputSavedStarGiftClass
|
|
}
|
|
|
|
// InputInvoiceStarGiftDropOriginalDetailsTypeID is TL type id of InputInvoiceStarGiftDropOriginalDetails.
|
|
const InputInvoiceStarGiftDropOriginalDetailsTypeID = 0x923d8d1
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGiftDropOriginalDetails) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGiftDropOriginalDetails.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGiftDropOriginalDetails{}
|
|
_ bin.Decoder = &InputInvoiceStarGiftDropOriginalDetails{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGiftDropOriginalDetails{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGiftDropOriginalDetails{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGiftDropOriginalDetails{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Stargift == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGiftDropOriginalDetails(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGiftDropOriginalDetails
|
|
return fmt.Sprintf("InputInvoiceStarGiftDropOriginalDetails%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGiftDropOriginalDetails from given interface.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) FillFrom(from interface {
|
|
GetStargift() (value InputSavedStarGiftClass)
|
|
}) {
|
|
i.Stargift = from.GetStargift()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInvoiceStarGiftDropOriginalDetails) TypeID() uint32 {
|
|
return InputInvoiceStarGiftDropOriginalDetailsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGiftDropOriginalDetails) TypeName() string {
|
|
return "inputInvoiceStarGiftDropOriginalDetails"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGiftDropOriginalDetails",
|
|
ID: InputInvoiceStarGiftDropOriginalDetailsTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Stargift",
|
|
SchemaName: "stargift",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftDropOriginalDetails#923d8d1 as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftDropOriginalDetailsTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftDropOriginalDetails#923d8d1 as nil")
|
|
}
|
|
if i.Stargift == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftDropOriginalDetails#923d8d1: field stargift is nil")
|
|
}
|
|
if err := i.Stargift.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftDropOriginalDetails#923d8d1: field stargift: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftDropOriginalDetails#923d8d1 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftDropOriginalDetailsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftDropOriginalDetails#923d8d1: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftDropOriginalDetails#923d8d1 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputSavedStarGift(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftDropOriginalDetails#923d8d1: field stargift: %w", err)
|
|
}
|
|
i.Stargift = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetStargift returns value of Stargift field.
|
|
func (i *InputInvoiceStarGiftDropOriginalDetails) GetStargift() (value InputSavedStarGiftClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Stargift
|
|
}
|
|
|
|
// InputInvoiceStarGiftAuctionBid represents TL type `inputInvoiceStarGiftAuctionBid#1ecafa10`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputInvoiceStarGiftAuctionBid for reference.
|
|
type InputInvoiceStarGiftAuctionBid struct {
|
|
// Flags field of InputInvoiceStarGiftAuctionBid.
|
|
Flags bin.Fields
|
|
// HideName field of InputInvoiceStarGiftAuctionBid.
|
|
HideName bool
|
|
// UpdateBid field of InputInvoiceStarGiftAuctionBid.
|
|
UpdateBid bool
|
|
// Peer field of InputInvoiceStarGiftAuctionBid.
|
|
//
|
|
// Use SetPeer and GetPeer helpers.
|
|
Peer InputPeerClass
|
|
// GiftID field of InputInvoiceStarGiftAuctionBid.
|
|
GiftID int64
|
|
// BidAmount field of InputInvoiceStarGiftAuctionBid.
|
|
BidAmount int64
|
|
// Message field of InputInvoiceStarGiftAuctionBid.
|
|
//
|
|
// Use SetMessage and GetMessage helpers.
|
|
Message TextWithEntities
|
|
}
|
|
|
|
// InputInvoiceStarGiftAuctionBidTypeID is TL type id of InputInvoiceStarGiftAuctionBid.
|
|
const InputInvoiceStarGiftAuctionBidTypeID = 0x1ecafa10
|
|
|
|
// construct implements constructor of InputInvoiceClass.
|
|
func (i InputInvoiceStarGiftAuctionBid) construct() InputInvoiceClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInvoiceStarGiftAuctionBid.
|
|
var (
|
|
_ bin.Encoder = &InputInvoiceStarGiftAuctionBid{}
|
|
_ bin.Decoder = &InputInvoiceStarGiftAuctionBid{}
|
|
_ bin.BareEncoder = &InputInvoiceStarGiftAuctionBid{}
|
|
_ bin.BareDecoder = &InputInvoiceStarGiftAuctionBid{}
|
|
|
|
_ InputInvoiceClass = &InputInvoiceStarGiftAuctionBid{}
|
|
)
|
|
|
|
func (i *InputInvoiceStarGiftAuctionBid) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.HideName == false) {
|
|
return false
|
|
}
|
|
if !(i.UpdateBid == false) {
|
|
return false
|
|
}
|
|
if !(i.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(i.GiftID == 0) {
|
|
return false
|
|
}
|
|
if !(i.BidAmount == 0) {
|
|
return false
|
|
}
|
|
if !(i.Message.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInvoiceStarGiftAuctionBid) String() string {
|
|
if i == nil {
|
|
return "InputInvoiceStarGiftAuctionBid(nil)"
|
|
}
|
|
type Alias InputInvoiceStarGiftAuctionBid
|
|
return fmt.Sprintf("InputInvoiceStarGiftAuctionBid%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputInvoiceStarGiftAuctionBid from given interface.
|
|
func (i *InputInvoiceStarGiftAuctionBid) FillFrom(from interface {
|
|
GetHideName() (value bool)
|
|
GetUpdateBid() (value bool)
|
|
GetPeer() (value InputPeerClass, ok bool)
|
|
GetGiftID() (value int64)
|
|
GetBidAmount() (value int64)
|
|
GetMessage() (value TextWithEntities, ok bool)
|
|
}) {
|
|
i.HideName = from.GetHideName()
|
|
i.UpdateBid = from.GetUpdateBid()
|
|
if val, ok := from.GetPeer(); ok {
|
|
i.Peer = val
|
|
}
|
|
|
|
i.GiftID = from.GetGiftID()
|
|
i.BidAmount = from.GetBidAmount()
|
|
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 (*InputInvoiceStarGiftAuctionBid) TypeID() uint32 {
|
|
return InputInvoiceStarGiftAuctionBidTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInvoiceStarGiftAuctionBid) TypeName() string {
|
|
return "inputInvoiceStarGiftAuctionBid"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInvoiceStarGiftAuctionBid) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInvoiceStarGiftAuctionBid",
|
|
ID: InputInvoiceStarGiftAuctionBidTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "HideName",
|
|
SchemaName: "hide_name",
|
|
Null: !i.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "UpdateBid",
|
|
SchemaName: "update_bid",
|
|
Null: !i.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
Null: !i.Flags.Has(3),
|
|
},
|
|
{
|
|
Name: "GiftID",
|
|
SchemaName: "gift_id",
|
|
},
|
|
{
|
|
Name: "BidAmount",
|
|
SchemaName: "bid_amount",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
Null: !i.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (i *InputInvoiceStarGiftAuctionBid) SetFlags() {
|
|
if !(i.HideName == false) {
|
|
i.Flags.Set(0)
|
|
}
|
|
if !(i.UpdateBid == false) {
|
|
i.Flags.Set(2)
|
|
}
|
|
if !(i.Peer == nil) {
|
|
i.Flags.Set(3)
|
|
}
|
|
if !(i.Message.Zero()) {
|
|
i.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInvoiceStarGiftAuctionBid) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftAuctionBid#1ecafa10 as nil")
|
|
}
|
|
b.PutID(InputInvoiceStarGiftAuctionBidTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInvoiceStarGiftAuctionBid) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInvoiceStarGiftAuctionBid#1ecafa10 as nil")
|
|
}
|
|
i.SetFlags()
|
|
if err := i.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftAuctionBid#1ecafa10: field flags: %w", err)
|
|
}
|
|
if i.Flags.Has(3) {
|
|
if i.Peer == nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftAuctionBid#1ecafa10: field peer is nil")
|
|
}
|
|
if err := i.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftAuctionBid#1ecafa10: field peer: %w", err)
|
|
}
|
|
}
|
|
b.PutLong(i.GiftID)
|
|
b.PutLong(i.BidAmount)
|
|
if i.Flags.Has(1) {
|
|
if err := i.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInvoiceStarGiftAuctionBid#1ecafa10: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInvoiceStarGiftAuctionBid) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftAuctionBid#1ecafa10 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInvoiceStarGiftAuctionBidTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftAuctionBid#1ecafa10: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInvoiceStarGiftAuctionBid) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInvoiceStarGiftAuctionBid#1ecafa10 to nil")
|
|
}
|
|
{
|
|
if err := i.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftAuctionBid#1ecafa10: field flags: %w", err)
|
|
}
|
|
}
|
|
i.HideName = i.Flags.Has(0)
|
|
i.UpdateBid = i.Flags.Has(2)
|
|
if i.Flags.Has(3) {
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftAuctionBid#1ecafa10: field peer: %w", err)
|
|
}
|
|
i.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftAuctionBid#1ecafa10: field gift_id: %w", err)
|
|
}
|
|
i.GiftID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftAuctionBid#1ecafa10: field bid_amount: %w", err)
|
|
}
|
|
i.BidAmount = value
|
|
}
|
|
if i.Flags.Has(1) {
|
|
if err := i.Message.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInvoiceStarGiftAuctionBid#1ecafa10: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetHideName sets value of HideName conditional field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) 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 *InputInvoiceStarGiftAuctionBid) GetHideName() (value bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Flags.Has(0)
|
|
}
|
|
|
|
// SetUpdateBid sets value of UpdateBid conditional field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) SetUpdateBid(value bool) {
|
|
if value {
|
|
i.Flags.Set(2)
|
|
i.UpdateBid = true
|
|
} else {
|
|
i.Flags.Unset(2)
|
|
i.UpdateBid = false
|
|
}
|
|
}
|
|
|
|
// GetUpdateBid returns value of UpdateBid conditional field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) GetUpdateBid() (value bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Flags.Has(2)
|
|
}
|
|
|
|
// SetPeer sets value of Peer conditional field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) SetPeer(value InputPeerClass) {
|
|
i.Flags.Set(3)
|
|
i.Peer = value
|
|
}
|
|
|
|
// GetPeer returns value of Peer conditional field and
|
|
// boolean which is true if field was set.
|
|
func (i *InputInvoiceStarGiftAuctionBid) GetPeer() (value InputPeerClass, ok bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
if !i.Flags.Has(3) {
|
|
return value, false
|
|
}
|
|
return i.Peer, true
|
|
}
|
|
|
|
// GetGiftID returns value of GiftID field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) GetGiftID() (value int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.GiftID
|
|
}
|
|
|
|
// GetBidAmount returns value of BidAmount field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) GetBidAmount() (value int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.BidAmount
|
|
}
|
|
|
|
// SetMessage sets value of Message conditional field.
|
|
func (i *InputInvoiceStarGiftAuctionBid) 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 *InputInvoiceStarGiftAuctionBid) GetMessage() (value TextWithEntities, ok bool) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
if !i.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return i.Message, true
|
|
}
|
|
|
|
// 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#c39f5324
|
|
// case *tg.InputInvoiceStarGiftPrepaidUpgrade: // inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8
|
|
// case *tg.InputInvoicePremiumAuthCode: // inputInvoicePremiumAuthCode#3e77f614
|
|
// case *tg.InputInvoiceStarGiftDropOriginalDetails: // inputInvoiceStarGiftDropOriginalDetails#923d8d1
|
|
// case *tg.InputInvoiceStarGiftAuctionBid: // inputInvoiceStarGiftAuctionBid#1ecafa10
|
|
// 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#c39f5324.
|
|
v := InputInvoiceStarGiftResale{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftPrepaidUpgradeTypeID:
|
|
// Decoding inputInvoiceStarGiftPrepaidUpgrade#9a0b48b8.
|
|
v := InputInvoiceStarGiftPrepaidUpgrade{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoicePremiumAuthCodeTypeID:
|
|
// Decoding inputInvoicePremiumAuthCode#3e77f614.
|
|
v := InputInvoicePremiumAuthCode{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftDropOriginalDetailsTypeID:
|
|
// Decoding inputInvoiceStarGiftDropOriginalDetails#923d8d1.
|
|
v := InputInvoiceStarGiftDropOriginalDetails{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInvoiceStarGiftAuctionBidTypeID:
|
|
// Decoding inputInvoiceStarGiftAuctionBid#1ecafa10.
|
|
v := InputInvoiceStarGiftAuctionBid{}
|
|
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)
|
|
}
|