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 PaymentsStarGiftAuctionAcquiredGifts struct {
Gifts []StarGiftAuctionAcquiredGift
Users []UserClass
Chats []ChatClass
}
const PaymentsStarGiftAuctionAcquiredGiftsTypeID = 0x7d5bd1f0
var (
_ bin .Encoder = &PaymentsStarGiftAuctionAcquiredGifts {}
_ bin .Decoder = &PaymentsStarGiftAuctionAcquiredGifts {}
_ bin .BareEncoder = &PaymentsStarGiftAuctionAcquiredGifts {}
_ bin .BareDecoder = &PaymentsStarGiftAuctionAcquiredGifts {}
)
func (s *PaymentsStarGiftAuctionAcquiredGifts ) Zero () bool {
if s == nil {
return true
}
if !(s .Gifts == nil ) {
return false
}
if !(s .Users == nil ) {
return false
}
if !(s .Chats == nil ) {
return false
}
return true
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) String () string {
if s == nil {
return "PaymentsStarGiftAuctionAcquiredGifts(nil)"
}
type Alias PaymentsStarGiftAuctionAcquiredGifts
return fmt .Sprintf ("PaymentsStarGiftAuctionAcquiredGifts%+v" , Alias (*s ))
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) FillFrom (from interface {
GetGifts () (value []StarGiftAuctionAcquiredGift )
GetUsers () (value []UserClass )
GetChats () (value []ChatClass )
}) {
s .Gifts = from .GetGifts ()
s .Users = from .GetUsers ()
s .Chats = from .GetChats ()
}
func (*PaymentsStarGiftAuctionAcquiredGifts ) TypeID () uint32 {
return PaymentsStarGiftAuctionAcquiredGiftsTypeID
}
func (*PaymentsStarGiftAuctionAcquiredGifts ) TypeName () string {
return "payments.starGiftAuctionAcquiredGifts"
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.starGiftAuctionAcquiredGifts" ,
ID : PaymentsStarGiftAuctionAcquiredGiftsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Gifts" ,
SchemaName : "gifts" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
{
Name : "Chats" ,
SchemaName : "chats" ,
},
}
return typ
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftAuctionAcquiredGifts#7d5bd1f0 as nil" )
}
b .PutID (PaymentsStarGiftAuctionAcquiredGiftsTypeID )
return s .EncodeBare (b )
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftAuctionAcquiredGifts#7d5bd1f0 as nil" )
}
b .PutVectorHeader (len (s .Gifts ))
for idx , v := range s .Gifts {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: field gifts 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.starGiftAuctionAcquiredGifts#7d5bd1f0: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: 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.starGiftAuctionAcquiredGifts#7d5bd1f0: field chats element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: field chats element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0 to nil" )
}
if err := b .ConsumeID (PaymentsStarGiftAuctionAcquiredGiftsTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: field gifts: %w" , err )
}
if headerLen > 0 {
s .Gifts = make ([]StarGiftAuctionAcquiredGift , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value StarGiftAuctionAcquiredGift
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: field gifts: %w" , err )
}
s .Gifts = append (s .Gifts , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: 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.starGiftAuctionAcquiredGifts#7d5bd1f0: field users: %w" , err )
}
s .Users = append (s .Users , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftAuctionAcquiredGifts#7d5bd1f0: 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.starGiftAuctionAcquiredGifts#7d5bd1f0: field chats: %w" , err )
}
s .Chats = append (s .Chats , value )
}
}
return nil
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) GetGifts () (value []StarGiftAuctionAcquiredGift ) {
if s == nil {
return
}
return s .Gifts
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) GetUsers () (value []UserClass ) {
if s == nil {
return
}
return s .Users
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) GetChats () (value []ChatClass ) {
if s == nil {
return
}
return s .Chats
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) MapUsers () (value UserClassArray ) {
return UserClassArray (s .Users )
}
func (s *PaymentsStarGiftAuctionAcquiredGifts ) MapChats () (value ChatClassArray ) {
return ChatClassArray (s .Chats )
}
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 .