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 StarGiftActiveAuctionState struct {
Gift StarGiftClass
State StarGiftAuctionStateClass
UserState StarGiftAuctionUserState
}
const StarGiftActiveAuctionStateTypeID = 0xd31bc45d
var (
_ bin .Encoder = &StarGiftActiveAuctionState {}
_ bin .Decoder = &StarGiftActiveAuctionState {}
_ bin .BareEncoder = &StarGiftActiveAuctionState {}
_ bin .BareDecoder = &StarGiftActiveAuctionState {}
)
func (s *StarGiftActiveAuctionState ) Zero () bool {
if s == nil {
return true
}
if !(s .Gift == nil ) {
return false
}
if !(s .State == nil ) {
return false
}
if !(s .UserState .Zero ()) {
return false
}
return true
}
func (s *StarGiftActiveAuctionState ) String () string {
if s == nil {
return "StarGiftActiveAuctionState(nil)"
}
type Alias StarGiftActiveAuctionState
return fmt .Sprintf ("StarGiftActiveAuctionState%+v" , Alias (*s ))
}
func (s *StarGiftActiveAuctionState ) FillFrom (from interface {
GetGift () (value StarGiftClass )
GetState () (value StarGiftAuctionStateClass )
GetUserState () (value StarGiftAuctionUserState )
}) {
s .Gift = from .GetGift ()
s .State = from .GetState ()
s .UserState = from .GetUserState ()
}
func (*StarGiftActiveAuctionState ) TypeID () uint32 {
return StarGiftActiveAuctionStateTypeID
}
func (*StarGiftActiveAuctionState ) TypeName () string {
return "starGiftActiveAuctionState"
}
func (s *StarGiftActiveAuctionState ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftActiveAuctionState" ,
ID : StarGiftActiveAuctionStateTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Gift" ,
SchemaName : "gift" ,
},
{
Name : "State" ,
SchemaName : "state" ,
},
{
Name : "UserState" ,
SchemaName : "user_state" ,
},
}
return typ
}
func (s *StarGiftActiveAuctionState ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftActiveAuctionState#d31bc45d as nil" )
}
b .PutID (StarGiftActiveAuctionStateTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftActiveAuctionState ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftActiveAuctionState#d31bc45d as nil" )
}
if s .Gift == nil {
return fmt .Errorf ("unable to encode starGiftActiveAuctionState#d31bc45d: field gift is nil" )
}
if err := s .Gift .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode starGiftActiveAuctionState#d31bc45d: field gift: %w" , err )
}
if s .State == nil {
return fmt .Errorf ("unable to encode starGiftActiveAuctionState#d31bc45d: field state is nil" )
}
if err := s .State .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode starGiftActiveAuctionState#d31bc45d: field state: %w" , err )
}
if err := s .UserState .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode starGiftActiveAuctionState#d31bc45d: field user_state: %w" , err )
}
return nil
}
func (s *StarGiftActiveAuctionState ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftActiveAuctionState#d31bc45d to nil" )
}
if err := b .ConsumeID (StarGiftActiveAuctionStateTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftActiveAuctionState#d31bc45d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftActiveAuctionState ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftActiveAuctionState#d31bc45d to nil" )
}
{
value , err := DecodeStarGift (b )
if err != nil {
return fmt .Errorf ("unable to decode starGiftActiveAuctionState#d31bc45d: field gift: %w" , err )
}
s .Gift = value
}
{
value , err := DecodeStarGiftAuctionState (b )
if err != nil {
return fmt .Errorf ("unable to decode starGiftActiveAuctionState#d31bc45d: field state: %w" , err )
}
s .State = value
}
{
if err := s .UserState .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode starGiftActiveAuctionState#d31bc45d: field user_state: %w" , err )
}
}
return nil
}
func (s *StarGiftActiveAuctionState ) GetGift () (value StarGiftClass ) {
if s == nil {
return
}
return s .Gift
}
func (s *StarGiftActiveAuctionState ) GetState () (value StarGiftAuctionStateClass ) {
if s == nil {
return
}
return s .State
}
func (s *StarGiftActiveAuctionState ) GetUserState () (value StarGiftAuctionUserState ) {
if s == nil {
return
}
return s .UserState
}
func (s *StarGiftActiveAuctionState ) GetStateAsModified () (ModifiedStarGiftAuctionState , bool ) {
return s .State .AsModified ()
}
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 .