871 lines
23 KiB
Go
Generated
871 lines
23 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{}
|
|
)
|
|
|
|
// StarGiftAuctionStateNotModified represents TL type `starGiftAuctionStateNotModified#fe333952`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAuctionStateNotModified for reference.
|
|
type StarGiftAuctionStateNotModified struct {
|
|
}
|
|
|
|
// StarGiftAuctionStateNotModifiedTypeID is TL type id of StarGiftAuctionStateNotModified.
|
|
const StarGiftAuctionStateNotModifiedTypeID = 0xfe333952
|
|
|
|
// construct implements constructor of StarGiftAuctionStateClass.
|
|
func (s StarGiftAuctionStateNotModified) construct() StarGiftAuctionStateClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAuctionStateNotModified.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAuctionStateNotModified{}
|
|
_ bin.Decoder = &StarGiftAuctionStateNotModified{}
|
|
_ bin.BareEncoder = &StarGiftAuctionStateNotModified{}
|
|
_ bin.BareDecoder = &StarGiftAuctionStateNotModified{}
|
|
|
|
_ StarGiftAuctionStateClass = &StarGiftAuctionStateNotModified{}
|
|
)
|
|
|
|
func (s *StarGiftAuctionStateNotModified) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAuctionStateNotModified) String() string {
|
|
if s == nil {
|
|
return "StarGiftAuctionStateNotModified(nil)"
|
|
}
|
|
type Alias StarGiftAuctionStateNotModified
|
|
return fmt.Sprintf("StarGiftAuctionStateNotModified%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAuctionStateNotModified) TypeID() uint32 {
|
|
return StarGiftAuctionStateNotModifiedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAuctionStateNotModified) TypeName() string {
|
|
return "starGiftAuctionStateNotModified"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAuctionStateNotModified) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAuctionStateNotModified",
|
|
ID: StarGiftAuctionStateNotModifiedTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAuctionStateNotModified) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAuctionStateNotModified#fe333952 as nil")
|
|
}
|
|
b.PutID(StarGiftAuctionStateNotModifiedTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAuctionStateNotModified) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAuctionStateNotModified#fe333952 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAuctionStateNotModified) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAuctionStateNotModified#fe333952 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAuctionStateNotModifiedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionStateNotModified#fe333952: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAuctionStateNotModified) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAuctionStateNotModified#fe333952 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// StarGiftAuctionState represents TL type `starGiftAuctionState#5db04f4b`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAuctionState for reference.
|
|
type StarGiftAuctionState struct {
|
|
// Version field of StarGiftAuctionState.
|
|
Version int
|
|
// StartDate field of StarGiftAuctionState.
|
|
StartDate int
|
|
// EndDate field of StarGiftAuctionState.
|
|
EndDate int
|
|
// MinBidAmount field of StarGiftAuctionState.
|
|
MinBidAmount int64
|
|
// BidLevels field of StarGiftAuctionState.
|
|
BidLevels []AuctionBidLevel
|
|
// TopBidders field of StarGiftAuctionState.
|
|
TopBidders []int64
|
|
// NextRoundAt field of StarGiftAuctionState.
|
|
NextRoundAt int
|
|
// GiftsLeft field of StarGiftAuctionState.
|
|
GiftsLeft int
|
|
// CurrentRound field of StarGiftAuctionState.
|
|
CurrentRound int
|
|
// TotalRounds field of StarGiftAuctionState.
|
|
TotalRounds int
|
|
}
|
|
|
|
// StarGiftAuctionStateTypeID is TL type id of StarGiftAuctionState.
|
|
const StarGiftAuctionStateTypeID = 0x5db04f4b
|
|
|
|
// construct implements constructor of StarGiftAuctionStateClass.
|
|
func (s StarGiftAuctionState) construct() StarGiftAuctionStateClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAuctionState.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAuctionState{}
|
|
_ bin.Decoder = &StarGiftAuctionState{}
|
|
_ bin.BareEncoder = &StarGiftAuctionState{}
|
|
_ bin.BareDecoder = &StarGiftAuctionState{}
|
|
|
|
_ StarGiftAuctionStateClass = &StarGiftAuctionState{}
|
|
)
|
|
|
|
func (s *StarGiftAuctionState) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.Version == 0) {
|
|
return false
|
|
}
|
|
if !(s.StartDate == 0) {
|
|
return false
|
|
}
|
|
if !(s.EndDate == 0) {
|
|
return false
|
|
}
|
|
if !(s.MinBidAmount == 0) {
|
|
return false
|
|
}
|
|
if !(s.BidLevels == nil) {
|
|
return false
|
|
}
|
|
if !(s.TopBidders == nil) {
|
|
return false
|
|
}
|
|
if !(s.NextRoundAt == 0) {
|
|
return false
|
|
}
|
|
if !(s.GiftsLeft == 0) {
|
|
return false
|
|
}
|
|
if !(s.CurrentRound == 0) {
|
|
return false
|
|
}
|
|
if !(s.TotalRounds == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAuctionState) String() string {
|
|
if s == nil {
|
|
return "StarGiftAuctionState(nil)"
|
|
}
|
|
type Alias StarGiftAuctionState
|
|
return fmt.Sprintf("StarGiftAuctionState%+v", Alias(*s))
|
|
}
|
|
|
|
// FillFrom fills StarGiftAuctionState from given interface.
|
|
func (s *StarGiftAuctionState) FillFrom(from interface {
|
|
GetVersion() (value int)
|
|
GetStartDate() (value int)
|
|
GetEndDate() (value int)
|
|
GetMinBidAmount() (value int64)
|
|
GetBidLevels() (value []AuctionBidLevel)
|
|
GetTopBidders() (value []int64)
|
|
GetNextRoundAt() (value int)
|
|
GetGiftsLeft() (value int)
|
|
GetCurrentRound() (value int)
|
|
GetTotalRounds() (value int)
|
|
}) {
|
|
s.Version = from.GetVersion()
|
|
s.StartDate = from.GetStartDate()
|
|
s.EndDate = from.GetEndDate()
|
|
s.MinBidAmount = from.GetMinBidAmount()
|
|
s.BidLevels = from.GetBidLevels()
|
|
s.TopBidders = from.GetTopBidders()
|
|
s.NextRoundAt = from.GetNextRoundAt()
|
|
s.GiftsLeft = from.GetGiftsLeft()
|
|
s.CurrentRound = from.GetCurrentRound()
|
|
s.TotalRounds = from.GetTotalRounds()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAuctionState) TypeID() uint32 {
|
|
return StarGiftAuctionStateTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAuctionState) TypeName() string {
|
|
return "starGiftAuctionState"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAuctionState) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAuctionState",
|
|
ID: StarGiftAuctionStateTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
{
|
|
Name: "StartDate",
|
|
SchemaName: "start_date",
|
|
},
|
|
{
|
|
Name: "EndDate",
|
|
SchemaName: "end_date",
|
|
},
|
|
{
|
|
Name: "MinBidAmount",
|
|
SchemaName: "min_bid_amount",
|
|
},
|
|
{
|
|
Name: "BidLevels",
|
|
SchemaName: "bid_levels",
|
|
},
|
|
{
|
|
Name: "TopBidders",
|
|
SchemaName: "top_bidders",
|
|
},
|
|
{
|
|
Name: "NextRoundAt",
|
|
SchemaName: "next_round_at",
|
|
},
|
|
{
|
|
Name: "GiftsLeft",
|
|
SchemaName: "gifts_left",
|
|
},
|
|
{
|
|
Name: "CurrentRound",
|
|
SchemaName: "current_round",
|
|
},
|
|
{
|
|
Name: "TotalRounds",
|
|
SchemaName: "total_rounds",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAuctionState) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAuctionState#5db04f4b as nil")
|
|
}
|
|
b.PutID(StarGiftAuctionStateTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAuctionState#5db04f4b as nil")
|
|
}
|
|
b.PutInt(s.Version)
|
|
b.PutInt(s.StartDate)
|
|
b.PutInt(s.EndDate)
|
|
b.PutLong(s.MinBidAmount)
|
|
b.PutVectorHeader(len(s.BidLevels))
|
|
for idx, v := range s.BidLevels {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode starGiftAuctionState#5db04f4b: field bid_levels element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutVectorHeader(len(s.TopBidders))
|
|
for _, v := range s.TopBidders {
|
|
b.PutLong(v)
|
|
}
|
|
b.PutInt(s.NextRoundAt)
|
|
b.PutInt(s.GiftsLeft)
|
|
b.PutInt(s.CurrentRound)
|
|
b.PutInt(s.TotalRounds)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAuctionState) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAuctionState#5db04f4b to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAuctionStateTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAuctionState#5db04f4b to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field version: %w", err)
|
|
}
|
|
s.Version = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field start_date: %w", err)
|
|
}
|
|
s.StartDate = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field end_date: %w", err)
|
|
}
|
|
s.EndDate = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field min_bid_amount: %w", err)
|
|
}
|
|
s.MinBidAmount = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field bid_levels: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
s.BidLevels = make([]AuctionBidLevel, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value AuctionBidLevel
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field bid_levels: %w", err)
|
|
}
|
|
s.BidLevels = append(s.BidLevels, value)
|
|
}
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field top_bidders: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
s.TopBidders = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field top_bidders: %w", err)
|
|
}
|
|
s.TopBidders = append(s.TopBidders, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field next_round_at: %w", err)
|
|
}
|
|
s.NextRoundAt = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field gifts_left: %w", err)
|
|
}
|
|
s.GiftsLeft = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field current_round: %w", err)
|
|
}
|
|
s.CurrentRound = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionState#5db04f4b: field total_rounds: %w", err)
|
|
}
|
|
s.TotalRounds = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (s *StarGiftAuctionState) GetVersion() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.Version
|
|
}
|
|
|
|
// GetStartDate returns value of StartDate field.
|
|
func (s *StarGiftAuctionState) GetStartDate() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.StartDate
|
|
}
|
|
|
|
// GetEndDate returns value of EndDate field.
|
|
func (s *StarGiftAuctionState) GetEndDate() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.EndDate
|
|
}
|
|
|
|
// GetMinBidAmount returns value of MinBidAmount field.
|
|
func (s *StarGiftAuctionState) GetMinBidAmount() (value int64) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.MinBidAmount
|
|
}
|
|
|
|
// GetBidLevels returns value of BidLevels field.
|
|
func (s *StarGiftAuctionState) GetBidLevels() (value []AuctionBidLevel) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.BidLevels
|
|
}
|
|
|
|
// GetTopBidders returns value of TopBidders field.
|
|
func (s *StarGiftAuctionState) GetTopBidders() (value []int64) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.TopBidders
|
|
}
|
|
|
|
// GetNextRoundAt returns value of NextRoundAt field.
|
|
func (s *StarGiftAuctionState) GetNextRoundAt() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.NextRoundAt
|
|
}
|
|
|
|
// GetGiftsLeft returns value of GiftsLeft field.
|
|
func (s *StarGiftAuctionState) GetGiftsLeft() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.GiftsLeft
|
|
}
|
|
|
|
// GetCurrentRound returns value of CurrentRound field.
|
|
func (s *StarGiftAuctionState) GetCurrentRound() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.CurrentRound
|
|
}
|
|
|
|
// GetTotalRounds returns value of TotalRounds field.
|
|
func (s *StarGiftAuctionState) GetTotalRounds() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.TotalRounds
|
|
}
|
|
|
|
// StarGiftAuctionStateFinished represents TL type `starGiftAuctionStateFinished#7d967c3a`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAuctionStateFinished for reference.
|
|
type StarGiftAuctionStateFinished struct {
|
|
// StartDate field of StarGiftAuctionStateFinished.
|
|
StartDate int
|
|
// EndDate field of StarGiftAuctionStateFinished.
|
|
EndDate int
|
|
// AveragePrice field of StarGiftAuctionStateFinished.
|
|
AveragePrice int64
|
|
}
|
|
|
|
// StarGiftAuctionStateFinishedTypeID is TL type id of StarGiftAuctionStateFinished.
|
|
const StarGiftAuctionStateFinishedTypeID = 0x7d967c3a
|
|
|
|
// construct implements constructor of StarGiftAuctionStateClass.
|
|
func (s StarGiftAuctionStateFinished) construct() StarGiftAuctionStateClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAuctionStateFinished.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAuctionStateFinished{}
|
|
_ bin.Decoder = &StarGiftAuctionStateFinished{}
|
|
_ bin.BareEncoder = &StarGiftAuctionStateFinished{}
|
|
_ bin.BareDecoder = &StarGiftAuctionStateFinished{}
|
|
|
|
_ StarGiftAuctionStateClass = &StarGiftAuctionStateFinished{}
|
|
)
|
|
|
|
func (s *StarGiftAuctionStateFinished) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.StartDate == 0) {
|
|
return false
|
|
}
|
|
if !(s.EndDate == 0) {
|
|
return false
|
|
}
|
|
if !(s.AveragePrice == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAuctionStateFinished) String() string {
|
|
if s == nil {
|
|
return "StarGiftAuctionStateFinished(nil)"
|
|
}
|
|
type Alias StarGiftAuctionStateFinished
|
|
return fmt.Sprintf("StarGiftAuctionStateFinished%+v", Alias(*s))
|
|
}
|
|
|
|
// FillFrom fills StarGiftAuctionStateFinished from given interface.
|
|
func (s *StarGiftAuctionStateFinished) FillFrom(from interface {
|
|
GetStartDate() (value int)
|
|
GetEndDate() (value int)
|
|
GetAveragePrice() (value int64)
|
|
}) {
|
|
s.StartDate = from.GetStartDate()
|
|
s.EndDate = from.GetEndDate()
|
|
s.AveragePrice = from.GetAveragePrice()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAuctionStateFinished) TypeID() uint32 {
|
|
return StarGiftAuctionStateFinishedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAuctionStateFinished) TypeName() string {
|
|
return "starGiftAuctionStateFinished"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAuctionStateFinished) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAuctionStateFinished",
|
|
ID: StarGiftAuctionStateFinishedTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "StartDate",
|
|
SchemaName: "start_date",
|
|
},
|
|
{
|
|
Name: "EndDate",
|
|
SchemaName: "end_date",
|
|
},
|
|
{
|
|
Name: "AveragePrice",
|
|
SchemaName: "average_price",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAuctionStateFinished) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAuctionStateFinished#7d967c3a as nil")
|
|
}
|
|
b.PutID(StarGiftAuctionStateFinishedTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAuctionStateFinished) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAuctionStateFinished#7d967c3a as nil")
|
|
}
|
|
b.PutInt(s.StartDate)
|
|
b.PutInt(s.EndDate)
|
|
b.PutLong(s.AveragePrice)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAuctionStateFinished) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAuctionStateFinished#7d967c3a to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAuctionStateFinishedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAuctionStateFinished) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAuctionStateFinished#7d967c3a to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field start_date: %w", err)
|
|
}
|
|
s.StartDate = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field end_date: %w", err)
|
|
}
|
|
s.EndDate = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAuctionStateFinished#7d967c3a: field average_price: %w", err)
|
|
}
|
|
s.AveragePrice = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetStartDate returns value of StartDate field.
|
|
func (s *StarGiftAuctionStateFinished) GetStartDate() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.StartDate
|
|
}
|
|
|
|
// GetEndDate returns value of EndDate field.
|
|
func (s *StarGiftAuctionStateFinished) GetEndDate() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.EndDate
|
|
}
|
|
|
|
// GetAveragePrice returns value of AveragePrice field.
|
|
func (s *StarGiftAuctionStateFinished) GetAveragePrice() (value int64) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.AveragePrice
|
|
}
|
|
|
|
// StarGiftAuctionStateClassName is schema name of StarGiftAuctionStateClass.
|
|
const StarGiftAuctionStateClassName = "StarGiftAuctionState"
|
|
|
|
// StarGiftAuctionStateClass represents StarGiftAuctionState generic type.
|
|
//
|
|
// See https://core.telegram.org/type/StarGiftAuctionState for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodeStarGiftAuctionState(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.StarGiftAuctionStateNotModified: // starGiftAuctionStateNotModified#fe333952
|
|
// case *tg.StarGiftAuctionState: // starGiftAuctionState#5db04f4b
|
|
// case *tg.StarGiftAuctionStateFinished: // starGiftAuctionStateFinished#7d967c3a
|
|
// default: panic(v)
|
|
// }
|
|
type StarGiftAuctionStateClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() StarGiftAuctionStateClass
|
|
|
|
// 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
|
|
|
|
// AsModified tries to map StarGiftAuctionStateClass to ModifiedStarGiftAuctionState.
|
|
AsModified() (ModifiedStarGiftAuctionState, bool)
|
|
}
|
|
|
|
// ModifiedStarGiftAuctionState represents Modified subset of StarGiftAuctionStateClass.
|
|
type ModifiedStarGiftAuctionState interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() StarGiftAuctionStateClass
|
|
|
|
// 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
|
|
|
|
// StartDate field of StarGiftAuctionState.
|
|
GetStartDate() (value int)
|
|
|
|
// EndDate field of StarGiftAuctionState.
|
|
GetEndDate() (value int)
|
|
}
|
|
|
|
// AsModified tries to map StarGiftAuctionStateNotModified to ModifiedStarGiftAuctionState.
|
|
func (s *StarGiftAuctionStateNotModified) AsModified() (ModifiedStarGiftAuctionState, bool) {
|
|
value, ok := (StarGiftAuctionStateClass(s)).(ModifiedStarGiftAuctionState)
|
|
return value, ok
|
|
}
|
|
|
|
// AsModified tries to map StarGiftAuctionState to ModifiedStarGiftAuctionState.
|
|
func (s *StarGiftAuctionState) AsModified() (ModifiedStarGiftAuctionState, bool) {
|
|
value, ok := (StarGiftAuctionStateClass(s)).(ModifiedStarGiftAuctionState)
|
|
return value, ok
|
|
}
|
|
|
|
// AsModified tries to map StarGiftAuctionStateFinished to ModifiedStarGiftAuctionState.
|
|
func (s *StarGiftAuctionStateFinished) AsModified() (ModifiedStarGiftAuctionState, bool) {
|
|
value, ok := (StarGiftAuctionStateClass(s)).(ModifiedStarGiftAuctionState)
|
|
return value, ok
|
|
}
|
|
|
|
// DecodeStarGiftAuctionState implements binary de-serialization for StarGiftAuctionStateClass.
|
|
func DecodeStarGiftAuctionState(buf *bin.Buffer) (StarGiftAuctionStateClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case StarGiftAuctionStateNotModifiedTypeID:
|
|
// Decoding starGiftAuctionStateNotModified#fe333952.
|
|
v := StarGiftAuctionStateNotModified{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarGiftAuctionStateTypeID:
|
|
// Decoding starGiftAuctionState#5db04f4b.
|
|
v := StarGiftAuctionState{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarGiftAuctionStateFinishedTypeID:
|
|
// Decoding starGiftAuctionStateFinished#7d967c3a.
|
|
v := StarGiftAuctionStateFinished{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode StarGiftAuctionStateClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// StarGiftAuctionState boxes the StarGiftAuctionStateClass providing a helper.
|
|
type StarGiftAuctionStateBox struct {
|
|
StarGiftAuctionState StarGiftAuctionStateClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for StarGiftAuctionStateBox.
|
|
func (b *StarGiftAuctionStateBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode StarGiftAuctionStateBox to nil")
|
|
}
|
|
v, err := DecodeStarGiftAuctionState(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.StarGiftAuctionState = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for StarGiftAuctionStateBox.
|
|
func (b *StarGiftAuctionStateBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.StarGiftAuctionState == nil {
|
|
return fmt.Errorf("unable to encode StarGiftAuctionStateClass as nil")
|
|
}
|
|
return b.StarGiftAuctionState.Encode(buf)
|
|
}
|