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 PaymentsStarGiftCollectionsNotModified struct {
}
const PaymentsStarGiftCollectionsNotModifiedTypeID = 0xa0ba4f17
func (s PaymentsStarGiftCollectionsNotModified ) construct () PaymentsStarGiftCollectionsClass {
return &s
}
var (
_ bin .Encoder = &PaymentsStarGiftCollectionsNotModified {}
_ bin .Decoder = &PaymentsStarGiftCollectionsNotModified {}
_ bin .BareEncoder = &PaymentsStarGiftCollectionsNotModified {}
_ bin .BareDecoder = &PaymentsStarGiftCollectionsNotModified {}
_ PaymentsStarGiftCollectionsClass = &PaymentsStarGiftCollectionsNotModified {}
)
func (s *PaymentsStarGiftCollectionsNotModified ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *PaymentsStarGiftCollectionsNotModified ) String () string {
if s == nil {
return "PaymentsStarGiftCollectionsNotModified(nil)"
}
type Alias PaymentsStarGiftCollectionsNotModified
return fmt .Sprintf ("PaymentsStarGiftCollectionsNotModified%+v" , Alias (*s ))
}
func (*PaymentsStarGiftCollectionsNotModified ) TypeID () uint32 {
return PaymentsStarGiftCollectionsNotModifiedTypeID
}
func (*PaymentsStarGiftCollectionsNotModified ) TypeName () string {
return "payments.starGiftCollectionsNotModified"
}
func (s *PaymentsStarGiftCollectionsNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.starGiftCollectionsNotModified" ,
ID : PaymentsStarGiftCollectionsNotModifiedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *PaymentsStarGiftCollectionsNotModified ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftCollectionsNotModified#a0ba4f17 as nil" )
}
b .PutID (PaymentsStarGiftCollectionsNotModifiedTypeID )
return s .EncodeBare (b )
}
func (s *PaymentsStarGiftCollectionsNotModified ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftCollectionsNotModified#a0ba4f17 as nil" )
}
return nil
}
func (s *PaymentsStarGiftCollectionsNotModified ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftCollectionsNotModified#a0ba4f17 to nil" )
}
if err := b .ConsumeID (PaymentsStarGiftCollectionsNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftCollectionsNotModified#a0ba4f17: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PaymentsStarGiftCollectionsNotModified ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftCollectionsNotModified#a0ba4f17 to nil" )
}
return nil
}
type PaymentsStarGiftCollections struct {
Collections []StarGiftCollection
}
const PaymentsStarGiftCollectionsTypeID = 0x8a2932f3
func (s PaymentsStarGiftCollections ) construct () PaymentsStarGiftCollectionsClass { return &s }
var (
_ bin .Encoder = &PaymentsStarGiftCollections {}
_ bin .Decoder = &PaymentsStarGiftCollections {}
_ bin .BareEncoder = &PaymentsStarGiftCollections {}
_ bin .BareDecoder = &PaymentsStarGiftCollections {}
_ PaymentsStarGiftCollectionsClass = &PaymentsStarGiftCollections {}
)
func (s *PaymentsStarGiftCollections ) Zero () bool {
if s == nil {
return true
}
if !(s .Collections == nil ) {
return false
}
return true
}
func (s *PaymentsStarGiftCollections ) String () string {
if s == nil {
return "PaymentsStarGiftCollections(nil)"
}
type Alias PaymentsStarGiftCollections
return fmt .Sprintf ("PaymentsStarGiftCollections%+v" , Alias (*s ))
}
func (s *PaymentsStarGiftCollections ) FillFrom (from interface {
GetCollections () (value []StarGiftCollection )
}) {
s .Collections = from .GetCollections ()
}
func (*PaymentsStarGiftCollections ) TypeID () uint32 {
return PaymentsStarGiftCollectionsTypeID
}
func (*PaymentsStarGiftCollections ) TypeName () string {
return "payments.starGiftCollections"
}
func (s *PaymentsStarGiftCollections ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.starGiftCollections" ,
ID : PaymentsStarGiftCollectionsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Collections" ,
SchemaName : "collections" ,
},
}
return typ
}
func (s *PaymentsStarGiftCollections ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftCollections#8a2932f3 as nil" )
}
b .PutID (PaymentsStarGiftCollectionsTypeID )
return s .EncodeBare (b )
}
func (s *PaymentsStarGiftCollections ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode payments.starGiftCollections#8a2932f3 as nil" )
}
b .PutVectorHeader (len (s .Collections ))
for idx , v := range s .Collections {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.starGiftCollections#8a2932f3: field collections element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *PaymentsStarGiftCollections ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftCollections#8a2932f3 to nil" )
}
if err := b .ConsumeID (PaymentsStarGiftCollectionsTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftCollections#8a2932f3: %w" , err )
}
return s .DecodeBare (b )
}
func (s *PaymentsStarGiftCollections ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode payments.starGiftCollections#8a2932f3 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode payments.starGiftCollections#8a2932f3: field collections: %w" , err )
}
if headerLen > 0 {
s .Collections = make ([]StarGiftCollection , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value StarGiftCollection
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.starGiftCollections#8a2932f3: field collections: %w" , err )
}
s .Collections = append (s .Collections , value )
}
}
return nil
}
func (s *PaymentsStarGiftCollections ) GetCollections () (value []StarGiftCollection ) {
if s == nil {
return
}
return s .Collections
}
const PaymentsStarGiftCollectionsClassName = "payments.StarGiftCollections"
type PaymentsStarGiftCollectionsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PaymentsStarGiftCollectionsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*PaymentsStarGiftCollections , bool )
}
func (s *PaymentsStarGiftCollectionsNotModified ) AsModified () (*PaymentsStarGiftCollections , bool ) {
return nil , false
}
func (s *PaymentsStarGiftCollections ) AsModified () (*PaymentsStarGiftCollections , bool ) {
return s , true
}
func DecodePaymentsStarGiftCollections (buf *bin .Buffer ) (PaymentsStarGiftCollectionsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PaymentsStarGiftCollectionsNotModifiedTypeID :
v := PaymentsStarGiftCollectionsNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PaymentsStarGiftCollectionsClass: %w" , err )
}
return &v , nil
case PaymentsStarGiftCollectionsTypeID :
v := PaymentsStarGiftCollections {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PaymentsStarGiftCollectionsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PaymentsStarGiftCollectionsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PaymentsStarGiftCollectionsBox struct {
StarGiftCollections PaymentsStarGiftCollectionsClass
}
func (b *PaymentsStarGiftCollectionsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PaymentsStarGiftCollectionsBox to nil" )
}
v , err := DecodePaymentsStarGiftCollections (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .StarGiftCollections = v
return nil
}
func (b *PaymentsStarGiftCollectionsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .StarGiftCollections == nil {
return fmt .Errorf ("unable to encode PaymentsStarGiftCollectionsClass as nil" )
}
return b .StarGiftCollections .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 .