390 lines
10 KiB
Go
Generated
390 lines
10 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{}
|
|
)
|
|
|
|
// InputStarGiftAuction represents TL type `inputStarGiftAuction#2e16c98`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputStarGiftAuction for reference.
|
|
type InputStarGiftAuction struct {
|
|
// GiftID field of InputStarGiftAuction.
|
|
GiftID int64
|
|
}
|
|
|
|
// InputStarGiftAuctionTypeID is TL type id of InputStarGiftAuction.
|
|
const InputStarGiftAuctionTypeID = 0x2e16c98
|
|
|
|
// construct implements constructor of InputStarGiftAuctionClass.
|
|
func (i InputStarGiftAuction) construct() InputStarGiftAuctionClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputStarGiftAuction.
|
|
var (
|
|
_ bin.Encoder = &InputStarGiftAuction{}
|
|
_ bin.Decoder = &InputStarGiftAuction{}
|
|
_ bin.BareEncoder = &InputStarGiftAuction{}
|
|
_ bin.BareDecoder = &InputStarGiftAuction{}
|
|
|
|
_ InputStarGiftAuctionClass = &InputStarGiftAuction{}
|
|
)
|
|
|
|
func (i *InputStarGiftAuction) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.GiftID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputStarGiftAuction) String() string {
|
|
if i == nil {
|
|
return "InputStarGiftAuction(nil)"
|
|
}
|
|
type Alias InputStarGiftAuction
|
|
return fmt.Sprintf("InputStarGiftAuction%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputStarGiftAuction from given interface.
|
|
func (i *InputStarGiftAuction) FillFrom(from interface {
|
|
GetGiftID() (value int64)
|
|
}) {
|
|
i.GiftID = from.GetGiftID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputStarGiftAuction) TypeID() uint32 {
|
|
return InputStarGiftAuctionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputStarGiftAuction) TypeName() string {
|
|
return "inputStarGiftAuction"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputStarGiftAuction) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputStarGiftAuction",
|
|
ID: InputStarGiftAuctionTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "GiftID",
|
|
SchemaName: "gift_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputStarGiftAuction) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStarGiftAuction#2e16c98 as nil")
|
|
}
|
|
b.PutID(InputStarGiftAuctionTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputStarGiftAuction) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStarGiftAuction#2e16c98 as nil")
|
|
}
|
|
b.PutLong(i.GiftID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputStarGiftAuction) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStarGiftAuction#2e16c98 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputStarGiftAuctionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputStarGiftAuction#2e16c98: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputStarGiftAuction) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStarGiftAuction#2e16c98 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputStarGiftAuction#2e16c98: field gift_id: %w", err)
|
|
}
|
|
i.GiftID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetGiftID returns value of GiftID field.
|
|
func (i *InputStarGiftAuction) GetGiftID() (value int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.GiftID
|
|
}
|
|
|
|
// InputStarGiftAuctionSlug represents TL type `inputStarGiftAuctionSlug#7ab58308`.
|
|
//
|
|
// See https://core.telegram.org/constructor/inputStarGiftAuctionSlug for reference.
|
|
type InputStarGiftAuctionSlug struct {
|
|
// Slug field of InputStarGiftAuctionSlug.
|
|
Slug string
|
|
}
|
|
|
|
// InputStarGiftAuctionSlugTypeID is TL type id of InputStarGiftAuctionSlug.
|
|
const InputStarGiftAuctionSlugTypeID = 0x7ab58308
|
|
|
|
// construct implements constructor of InputStarGiftAuctionClass.
|
|
func (i InputStarGiftAuctionSlug) construct() InputStarGiftAuctionClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputStarGiftAuctionSlug.
|
|
var (
|
|
_ bin.Encoder = &InputStarGiftAuctionSlug{}
|
|
_ bin.Decoder = &InputStarGiftAuctionSlug{}
|
|
_ bin.BareEncoder = &InputStarGiftAuctionSlug{}
|
|
_ bin.BareDecoder = &InputStarGiftAuctionSlug{}
|
|
|
|
_ InputStarGiftAuctionClass = &InputStarGiftAuctionSlug{}
|
|
)
|
|
|
|
func (i *InputStarGiftAuctionSlug) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Slug == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputStarGiftAuctionSlug) String() string {
|
|
if i == nil {
|
|
return "InputStarGiftAuctionSlug(nil)"
|
|
}
|
|
type Alias InputStarGiftAuctionSlug
|
|
return fmt.Sprintf("InputStarGiftAuctionSlug%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputStarGiftAuctionSlug from given interface.
|
|
func (i *InputStarGiftAuctionSlug) 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 (*InputStarGiftAuctionSlug) TypeID() uint32 {
|
|
return InputStarGiftAuctionSlugTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputStarGiftAuctionSlug) TypeName() string {
|
|
return "inputStarGiftAuctionSlug"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputStarGiftAuctionSlug) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputStarGiftAuctionSlug",
|
|
ID: InputStarGiftAuctionSlugTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Slug",
|
|
SchemaName: "slug",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputStarGiftAuctionSlug) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStarGiftAuctionSlug#7ab58308 as nil")
|
|
}
|
|
b.PutID(InputStarGiftAuctionSlugTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputStarGiftAuctionSlug) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStarGiftAuctionSlug#7ab58308 as nil")
|
|
}
|
|
b.PutString(i.Slug)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputStarGiftAuctionSlug) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStarGiftAuctionSlug#7ab58308 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputStarGiftAuctionSlugTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputStarGiftAuctionSlug#7ab58308: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputStarGiftAuctionSlug) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStarGiftAuctionSlug#7ab58308 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputStarGiftAuctionSlug#7ab58308: field slug: %w", err)
|
|
}
|
|
i.Slug = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetSlug returns value of Slug field.
|
|
func (i *InputStarGiftAuctionSlug) GetSlug() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Slug
|
|
}
|
|
|
|
// InputStarGiftAuctionClassName is schema name of InputStarGiftAuctionClass.
|
|
const InputStarGiftAuctionClassName = "InputStarGiftAuction"
|
|
|
|
// InputStarGiftAuctionClass represents InputStarGiftAuction generic type.
|
|
//
|
|
// See https://core.telegram.org/type/InputStarGiftAuction for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodeInputStarGiftAuction(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.InputStarGiftAuction: // inputStarGiftAuction#2e16c98
|
|
// case *tg.InputStarGiftAuctionSlug: // inputStarGiftAuctionSlug#7ab58308
|
|
// default: panic(v)
|
|
// }
|
|
type InputStarGiftAuctionClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() InputStarGiftAuctionClass
|
|
|
|
// 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
|
|
}
|
|
|
|
// DecodeInputStarGiftAuction implements binary de-serialization for InputStarGiftAuctionClass.
|
|
func DecodeInputStarGiftAuction(buf *bin.Buffer) (InputStarGiftAuctionClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case InputStarGiftAuctionTypeID:
|
|
// Decoding inputStarGiftAuction#2e16c98.
|
|
v := InputStarGiftAuction{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputStarGiftAuctionClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputStarGiftAuctionSlugTypeID:
|
|
// Decoding inputStarGiftAuctionSlug#7ab58308.
|
|
v := InputStarGiftAuctionSlug{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputStarGiftAuctionClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InputStarGiftAuctionClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// InputStarGiftAuction boxes the InputStarGiftAuctionClass providing a helper.
|
|
type InputStarGiftAuctionBox struct {
|
|
InputStarGiftAuction InputStarGiftAuctionClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for InputStarGiftAuctionBox.
|
|
func (b *InputStarGiftAuctionBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InputStarGiftAuctionBox to nil")
|
|
}
|
|
v, err := DecodeInputStarGiftAuction(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InputStarGiftAuction = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for InputStarGiftAuctionBox.
|
|
func (b *InputStarGiftAuctionBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.InputStarGiftAuction == nil {
|
|
return fmt.Errorf("unable to encode InputStarGiftAuctionClass as nil")
|
|
}
|
|
return b.InputStarGiftAuction.Encode(buf)
|
|
}
|