package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type StarGiftAuctionStateNotModified struct {
}
const StarGiftAuctionStateNotModifiedTypeID = 0xfe333952
func (s StarGiftAuctionStateNotModified ) construct () StarGiftAuctionStateClass { return &s }
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
}
func (s *StarGiftAuctionStateNotModified ) String () string {
if s == nil {
return "StarGiftAuctionStateNotModified(nil)"
}
type Alias StarGiftAuctionStateNotModified
return fmt .Sprintf ("StarGiftAuctionStateNotModified%+v" , Alias (*s ))
}
func (*StarGiftAuctionStateNotModified ) TypeID () uint32 {
return StarGiftAuctionStateNotModifiedTypeID
}
func (*StarGiftAuctionStateNotModified ) TypeName () string {
return "starGiftAuctionStateNotModified"
}
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
}
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 )
}
func (s *StarGiftAuctionStateNotModified ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAuctionStateNotModified#fe333952 as nil" )
}
return nil
}
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 )
}
func (s *StarGiftAuctionStateNotModified ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAuctionStateNotModified#fe333952 to nil" )
}
return nil
}
type StarGiftAuctionState struct {
Version int
StartDate int
EndDate int
MinBidAmount int64
BidLevels []AuctionBidLevel
TopBidders []int64
NextRoundAt int
LastGiftNum int
GiftsLeft int
CurrentRound int
TotalRounds int
Rounds []StarGiftAuctionRoundClass
}
const StarGiftAuctionStateTypeID = 0x771a4e66
func (s StarGiftAuctionState ) construct () StarGiftAuctionStateClass { return &s }
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 .LastGiftNum == 0 ) {
return false
}
if !(s .GiftsLeft == 0 ) {
return false
}
if !(s .CurrentRound == 0 ) {
return false
}
if !(s .TotalRounds == 0 ) {
return false
}
if !(s .Rounds == nil ) {
return false
}
return true
}
func (s *StarGiftAuctionState ) String () string {
if s == nil {
return "StarGiftAuctionState(nil)"
}
type Alias StarGiftAuctionState
return fmt .Sprintf ("StarGiftAuctionState%+v" , Alias (*s ))
}
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 )
GetLastGiftNum () (value int )
GetGiftsLeft () (value int )
GetCurrentRound () (value int )
GetTotalRounds () (value int )
GetRounds () (value []StarGiftAuctionRoundClass )
}) {
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 .LastGiftNum = from .GetLastGiftNum ()
s .GiftsLeft = from .GetGiftsLeft ()
s .CurrentRound = from .GetCurrentRound ()
s .TotalRounds = from .GetTotalRounds ()
s .Rounds = from .GetRounds ()
}
func (*StarGiftAuctionState ) TypeID () uint32 {
return StarGiftAuctionStateTypeID
}
func (*StarGiftAuctionState ) TypeName () string {
return "starGiftAuctionState"
}
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 : "LastGiftNum" ,
SchemaName : "last_gift_num" ,
},
{
Name : "GiftsLeft" ,
SchemaName : "gifts_left" ,
},
{
Name : "CurrentRound" ,
SchemaName : "current_round" ,
},
{
Name : "TotalRounds" ,
SchemaName : "total_rounds" ,
},
{
Name : "Rounds" ,
SchemaName : "rounds" ,
},
}
return typ
}
func (s *StarGiftAuctionState ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAuctionState#771a4e66 as nil" )
}
b .PutID (StarGiftAuctionStateTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAuctionState ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAuctionState#771a4e66 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#771a4e66: 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 .LastGiftNum )
b .PutInt (s .GiftsLeft )
b .PutInt (s .CurrentRound )
b .PutInt (s .TotalRounds )
b .PutVectorHeader (len (s .Rounds ))
for idx , v := range s .Rounds {
if v == nil {
return fmt .Errorf ("unable to encode starGiftAuctionState#771a4e66: field rounds element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode starGiftAuctionState#771a4e66: field rounds element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *StarGiftAuctionState ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAuctionState#771a4e66 to nil" )
}
if err := b .ConsumeID (StarGiftAuctionStateTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAuctionState ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAuctionState#771a4e66 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field version: %w" , err )
}
s .Version = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field start_date: %w" , err )
}
s .StartDate = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field end_date: %w" , err )
}
s .EndDate = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field min_bid_amount: %w" , err )
}
s .MinBidAmount = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: 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#771a4e66: 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#771a4e66: 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#771a4e66: 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#771a4e66: field next_round_at: %w" , err )
}
s .NextRoundAt = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field last_gift_num: %w" , err )
}
s .LastGiftNum = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field gifts_left: %w" , err )
}
s .GiftsLeft = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field current_round: %w" , err )
}
s .CurrentRound = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field total_rounds: %w" , err )
}
s .TotalRounds = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field rounds: %w" , err )
}
if headerLen > 0 {
s .Rounds = make ([]StarGiftAuctionRoundClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeStarGiftAuctionRound (b )
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionState#771a4e66: field rounds: %w" , err )
}
s .Rounds = append (s .Rounds , value )
}
}
return nil
}
func (s *StarGiftAuctionState ) GetVersion () (value int ) {
if s == nil {
return
}
return s .Version
}
func (s *StarGiftAuctionState ) GetStartDate () (value int ) {
if s == nil {
return
}
return s .StartDate
}
func (s *StarGiftAuctionState ) GetEndDate () (value int ) {
if s == nil {
return
}
return s .EndDate
}
func (s *StarGiftAuctionState ) GetMinBidAmount () (value int64 ) {
if s == nil {
return
}
return s .MinBidAmount
}
func (s *StarGiftAuctionState ) GetBidLevels () (value []AuctionBidLevel ) {
if s == nil {
return
}
return s .BidLevels
}
func (s *StarGiftAuctionState ) GetTopBidders () (value []int64 ) {
if s == nil {
return
}
return s .TopBidders
}
func (s *StarGiftAuctionState ) GetNextRoundAt () (value int ) {
if s == nil {
return
}
return s .NextRoundAt
}
func (s *StarGiftAuctionState ) GetLastGiftNum () (value int ) {
if s == nil {
return
}
return s .LastGiftNum
}
func (s *StarGiftAuctionState ) GetGiftsLeft () (value int ) {
if s == nil {
return
}
return s .GiftsLeft
}
func (s *StarGiftAuctionState ) GetCurrentRound () (value int ) {
if s == nil {
return
}
return s .CurrentRound
}
func (s *StarGiftAuctionState ) GetTotalRounds () (value int ) {
if s == nil {
return
}
return s .TotalRounds
}
func (s *StarGiftAuctionState ) GetRounds () (value []StarGiftAuctionRoundClass ) {
if s == nil {
return
}
return s .Rounds
}
func (s *StarGiftAuctionState ) MapRounds () (value StarGiftAuctionRoundClassArray ) {
return StarGiftAuctionRoundClassArray (s .Rounds )
}
type StarGiftAuctionStateFinished struct {
Flags bin .Fields
StartDate int
EndDate int
AveragePrice int64
ListedCount int
FragmentListedCount int
FragmentListedURL string
}
const StarGiftAuctionStateFinishedTypeID = 0x972dabbf
func (s StarGiftAuctionStateFinished ) construct () StarGiftAuctionStateClass { return &s }
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 .Flags .Zero ()) {
return false
}
if !(s .StartDate == 0 ) {
return false
}
if !(s .EndDate == 0 ) {
return false
}
if !(s .AveragePrice == 0 ) {
return false
}
if !(s .ListedCount == 0 ) {
return false
}
if !(s .FragmentListedCount == 0 ) {
return false
}
if !(s .FragmentListedURL == "" ) {
return false
}
return true
}
func (s *StarGiftAuctionStateFinished ) String () string {
if s == nil {
return "StarGiftAuctionStateFinished(nil)"
}
type Alias StarGiftAuctionStateFinished
return fmt .Sprintf ("StarGiftAuctionStateFinished%+v" , Alias (*s ))
}
func (s *StarGiftAuctionStateFinished ) FillFrom (from interface {
GetStartDate () (value int )
GetEndDate () (value int )
GetAveragePrice () (value int64 )
GetListedCount () (value int , ok bool )
GetFragmentListedCount () (value int , ok bool )
GetFragmentListedURL () (value string , ok bool )
}) {
s .StartDate = from .GetStartDate ()
s .EndDate = from .GetEndDate ()
s .AveragePrice = from .GetAveragePrice ()
if val , ok := from .GetListedCount (); ok {
s .ListedCount = val
}
if val , ok := from .GetFragmentListedCount (); ok {
s .FragmentListedCount = val
}
if val , ok := from .GetFragmentListedURL (); ok {
s .FragmentListedURL = val
}
}
func (*StarGiftAuctionStateFinished ) TypeID () uint32 {
return StarGiftAuctionStateFinishedTypeID
}
func (*StarGiftAuctionStateFinished ) TypeName () string {
return "starGiftAuctionStateFinished"
}
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" ,
},
{
Name : "ListedCount" ,
SchemaName : "listed_count" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "FragmentListedCount" ,
SchemaName : "fragment_listed_count" ,
Null : !s .Flags .Has (1 ),
},
{
Name : "FragmentListedURL" ,
SchemaName : "fragment_listed_url" ,
Null : !s .Flags .Has (1 ),
},
}
return typ
}
func (s *StarGiftAuctionStateFinished ) SetFlags () {
if !(s .ListedCount == 0 ) {
s .Flags .Set (0 )
}
if !(s .FragmentListedCount == 0 ) {
s .Flags .Set (1 )
}
if !(s .FragmentListedURL == "" ) {
s .Flags .Set (1 )
}
}
func (s *StarGiftAuctionStateFinished ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAuctionStateFinished#972dabbf as nil" )
}
b .PutID (StarGiftAuctionStateFinishedTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAuctionStateFinished ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAuctionStateFinished#972dabbf as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode starGiftAuctionStateFinished#972dabbf: field flags: %w" , err )
}
b .PutInt (s .StartDate )
b .PutInt (s .EndDate )
b .PutLong (s .AveragePrice )
if s .Flags .Has (0 ) {
b .PutInt (s .ListedCount )
}
if s .Flags .Has (1 ) {
b .PutInt (s .FragmentListedCount )
}
if s .Flags .Has (1 ) {
b .PutString (s .FragmentListedURL )
}
return nil
}
func (s *StarGiftAuctionStateFinished ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAuctionStateFinished#972dabbf to nil" )
}
if err := b .ConsumeID (StarGiftAuctionStateFinishedTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAuctionStateFinished ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAuctionStateFinished#972dabbf to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field flags: %w" , err )
}
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field start_date: %w" , err )
}
s .StartDate = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field end_date: %w" , err )
}
s .EndDate = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field average_price: %w" , err )
}
s .AveragePrice = value
}
if s .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field listed_count: %w" , err )
}
s .ListedCount = value
}
if s .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field fragment_listed_count: %w" , err )
}
s .FragmentListedCount = value
}
if s .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAuctionStateFinished#972dabbf: field fragment_listed_url: %w" , err )
}
s .FragmentListedURL = value
}
return nil
}
func (s *StarGiftAuctionStateFinished ) GetStartDate () (value int ) {
if s == nil {
return
}
return s .StartDate
}
func (s *StarGiftAuctionStateFinished ) GetEndDate () (value int ) {
if s == nil {
return
}
return s .EndDate
}
func (s *StarGiftAuctionStateFinished ) GetAveragePrice () (value int64 ) {
if s == nil {
return
}
return s .AveragePrice
}
func (s *StarGiftAuctionStateFinished ) SetListedCount (value int ) {
s .Flags .Set (0 )
s .ListedCount = value
}
func (s *StarGiftAuctionStateFinished ) GetListedCount () (value int , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (0 ) {
return value , false
}
return s .ListedCount , true
}
func (s *StarGiftAuctionStateFinished ) SetFragmentListedCount (value int ) {
s .Flags .Set (1 )
s .FragmentListedCount = value
}
func (s *StarGiftAuctionStateFinished ) GetFragmentListedCount () (value int , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (1 ) {
return value , false
}
return s .FragmentListedCount , true
}
func (s *StarGiftAuctionStateFinished ) SetFragmentListedURL (value string ) {
s .Flags .Set (1 )
s .FragmentListedURL = value
}
func (s *StarGiftAuctionStateFinished ) GetFragmentListedURL () (value string , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (1 ) {
return value , false
}
return s .FragmentListedURL , true
}
const StarGiftAuctionStateClassName = "StarGiftAuctionState"
type StarGiftAuctionStateClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () StarGiftAuctionStateClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (ModifiedStarGiftAuctionState , bool )
}
type ModifiedStarGiftAuctionState interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () StarGiftAuctionStateClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetStartDate () (value int )
GetEndDate () (value int )
}
func (s *StarGiftAuctionStateNotModified ) AsModified () (ModifiedStarGiftAuctionState , bool ) {
value , ok := (StarGiftAuctionStateClass (s )).(ModifiedStarGiftAuctionState )
return value , ok
}
func (s *StarGiftAuctionState ) AsModified () (ModifiedStarGiftAuctionState , bool ) {
value , ok := (StarGiftAuctionStateClass (s )).(ModifiedStarGiftAuctionState )
return value , ok
}
func (s *StarGiftAuctionStateFinished ) AsModified () (ModifiedStarGiftAuctionState , bool ) {
value , ok := (StarGiftAuctionStateClass (s )).(ModifiedStarGiftAuctionState )
return value , ok
}
func DecodeStarGiftAuctionState (buf *bin .Buffer ) (StarGiftAuctionStateClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case StarGiftAuctionStateNotModifiedTypeID :
v := StarGiftAuctionStateNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAuctionStateClass: %w" , err )
}
return &v , nil
case StarGiftAuctionStateTypeID :
v := StarGiftAuctionState {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAuctionStateClass: %w" , err )
}
return &v , nil
case StarGiftAuctionStateFinishedTypeID :
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 ))
}
}
type StarGiftAuctionStateBox struct {
StarGiftAuctionState StarGiftAuctionStateClass
}
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
}
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 )
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .