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 PaymentsStarGiftActiveAuctionsNotModified struct {
}
const PaymentsStarGiftActiveAuctionsNotModifiedTypeID = 0xdb33dad0
func (s PaymentsStarGiftActiveAuctionsNotModified ) construct () PaymentsStarGiftActiveAuctionsClass {
return &s
}
var (
_ bin .Encoder = &PaymentsStarGiftActiveAuctionsNotModified {}
_ bin .Decoder = &PaymentsStarGiftActiveAuctionsNotModified {}
_ bin .BareEncoder = &PaymentsStarGiftActiveAuctionsNotModified {}
_ bin .BareDecoder = &PaymentsStarGiftActiveAuctionsNotModified {}
_ PaymentsStarGiftActiveAuctionsClass = &PaymentsStarGiftActiveAuctionsNotModified {}
)
func (s *PaymentsStarGiftActiveAuctionsNotModified ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) String () string {
if s == nil {
return "PaymentsStarGiftActiveAuctionsNotModified(nil)"
}
type Alias PaymentsStarGiftActiveAuctionsNotModified
return fmt .Sprintf ("PaymentsStarGiftActiveAuctionsNotModified%+v" , Alias (*s ))
}
func (*PaymentsStarGiftActiveAuctionsNotModified ) TypeID () uint32 {
return PaymentsStarGiftActiveAuctionsNotModifiedTypeID
}
func (*PaymentsStarGiftActiveAuctionsNotModified ) TypeName () string {
return "payments.starGiftActiveAuctionsNotModified"
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.starGiftActiveAuctionsNotModified" ,
ID : PaymentsStarGiftActiveAuctionsNotModifiedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftActiveAuctionsNotModified#db33dad0 as nil" )
}
b .PutID (PaymentsStarGiftActiveAuctionsNotModifiedTypeID )
return s .EncodeBare (b )
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftActiveAuctionsNotModified#db33dad0 as nil" )
}
return nil
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftActiveAuctionsNotModified#db33dad0 to nil" )
}
if err := b .ConsumeID (PaymentsStarGiftActiveAuctionsNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctionsNotModified#db33dad0: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftActiveAuctionsNotModified#db33dad0 to nil" )
}
return nil
}
type PaymentsStarGiftActiveAuctions struct {
Auctions []StarGiftActiveAuctionState
Users []UserClass
Chats []ChatClass
}
const PaymentsStarGiftActiveAuctionsTypeID = 0xaef6abbc
func (s PaymentsStarGiftActiveAuctions ) construct () PaymentsStarGiftActiveAuctionsClass { return &s }
var (
_ bin .Encoder = &PaymentsStarGiftActiveAuctions {}
_ bin .Decoder = &PaymentsStarGiftActiveAuctions {}
_ bin .BareEncoder = &PaymentsStarGiftActiveAuctions {}
_ bin .BareDecoder = &PaymentsStarGiftActiveAuctions {}
_ PaymentsStarGiftActiveAuctionsClass = &PaymentsStarGiftActiveAuctions {}
)
func (s *PaymentsStarGiftActiveAuctions ) Zero () bool {
if s == nil {
return true
}
if !(s .Auctions == nil ) {
return false
}
if !(s .Users == nil ) {
return false
}
if !(s .Chats == nil ) {
return false
}
return true
}
func (s *PaymentsStarGiftActiveAuctions ) String () string {
if s == nil {
return "PaymentsStarGiftActiveAuctions(nil)"
}
type Alias PaymentsStarGiftActiveAuctions
return fmt .Sprintf ("PaymentsStarGiftActiveAuctions%+v" , Alias (*s ))
}
func (s *PaymentsStarGiftActiveAuctions ) FillFrom (from interface {
GetAuctions () (value []StarGiftActiveAuctionState )
GetUsers () (value []UserClass )
GetChats () (value []ChatClass )
}) {
s .Auctions = from .GetAuctions ()
s .Users = from .GetUsers ()
s .Chats = from .GetChats ()
}
func (*PaymentsStarGiftActiveAuctions ) TypeID () uint32 {
return PaymentsStarGiftActiveAuctionsTypeID
}
func (*PaymentsStarGiftActiveAuctions ) TypeName () string {
return "payments.starGiftActiveAuctions"
}
func (s *PaymentsStarGiftActiveAuctions ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.starGiftActiveAuctions" ,
ID : PaymentsStarGiftActiveAuctionsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Auctions" ,
SchemaName : "auctions" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
{
Name : "Chats" ,
SchemaName : "chats" ,
},
}
return typ
}
func (s *PaymentsStarGiftActiveAuctions ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftActiveAuctions#aef6abbc as nil" )
}
b .PutID (PaymentsStarGiftActiveAuctionsTypeID )
return s .EncodeBare (b )
}
func (s *PaymentsStarGiftActiveAuctions ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftActiveAuctions#aef6abbc as nil" )
}
b .PutVectorHeader (len (s .Auctions ))
for idx , v := range s .Auctions {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftActiveAuctions#aef6abbc: field auctions element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (s .Users ))
for idx , v := range s .Users {
if v == nil {
return fmt .Errorf ("unable to encode payments.starGiftActiveAuctions#aef6abbc: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftActiveAuctions#aef6abbc: field users element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (s .Chats ))
for idx , v := range s .Chats {
if v == nil {
return fmt .Errorf ("unable to encode payments.starGiftActiveAuctions#aef6abbc: field chats element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftActiveAuctions#aef6abbc: field chats element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *PaymentsStarGiftActiveAuctions ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftActiveAuctions#aef6abbc to nil" )
}
if err := b .ConsumeID (PaymentsStarGiftActiveAuctionsTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PaymentsStarGiftActiveAuctions ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftActiveAuctions#aef6abbc to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: field auctions: %w" , err )
}
if headerLen > 0 {
s .Auctions = make ([]StarGiftActiveAuctionState , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value StarGiftActiveAuctionState
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: field auctions: %w" , err )
}
s .Auctions = append (s .Auctions , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: field users: %w" , err )
}
if headerLen > 0 {
s .Users = make ([]UserClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeUser (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: field users: %w" , err )
}
s .Users = append (s .Users , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: field chats: %w" , err )
}
if headerLen > 0 {
s .Chats = make ([]ChatClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeChat (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftActiveAuctions#aef6abbc: field chats: %w" , err )
}
s .Chats = append (s .Chats , value )
}
}
return nil
}
func (s *PaymentsStarGiftActiveAuctions ) GetAuctions () (value []StarGiftActiveAuctionState ) {
if s == nil {
return
}
return s .Auctions
}
func (s *PaymentsStarGiftActiveAuctions ) GetUsers () (value []UserClass ) {
if s == nil {
return
}
return s .Users
}
func (s *PaymentsStarGiftActiveAuctions ) GetChats () (value []ChatClass ) {
if s == nil {
return
}
return s .Chats
}
func (s *PaymentsStarGiftActiveAuctions ) MapUsers () (value UserClassArray ) {
return UserClassArray (s .Users )
}
func (s *PaymentsStarGiftActiveAuctions ) MapChats () (value ChatClassArray ) {
return ChatClassArray (s .Chats )
}
const PaymentsStarGiftActiveAuctionsClassName = "payments.StarGiftActiveAuctions"
type PaymentsStarGiftActiveAuctionsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PaymentsStarGiftActiveAuctionsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*PaymentsStarGiftActiveAuctions , bool )
}
func (s *PaymentsStarGiftActiveAuctionsNotModified ) AsModified () (*PaymentsStarGiftActiveAuctions , bool ) {
return nil , false
}
func (s *PaymentsStarGiftActiveAuctions ) AsModified () (*PaymentsStarGiftActiveAuctions , bool ) {
return s , true
}
func DecodePaymentsStarGiftActiveAuctions (buf *bin .Buffer ) (PaymentsStarGiftActiveAuctionsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PaymentsStarGiftActiveAuctionsNotModifiedTypeID :
v := PaymentsStarGiftActiveAuctionsNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PaymentsStarGiftActiveAuctionsClass: %w" , err )
}
return &v , nil
case PaymentsStarGiftActiveAuctionsTypeID :
v := PaymentsStarGiftActiveAuctions {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PaymentsStarGiftActiveAuctionsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PaymentsStarGiftActiveAuctionsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PaymentsStarGiftActiveAuctionsBox struct {
StarGiftActiveAuctions PaymentsStarGiftActiveAuctionsClass
}
func (b *PaymentsStarGiftActiveAuctionsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PaymentsStarGiftActiveAuctionsBox to nil" )
}
v , err := DecodePaymentsStarGiftActiveAuctions (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .StarGiftActiveAuctions = v
return nil
}
func (b *PaymentsStarGiftActiveAuctionsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .StarGiftActiveAuctions == nil {
return fmt .Errorf ("unable to encode PaymentsStarGiftActiveAuctionsClass as nil" )
}
return b .StarGiftActiveAuctions .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 .