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 StarGiftAttributeRarity struct {
Permille int
}
const StarGiftAttributeRarityTypeID = 0x36437737
func (s StarGiftAttributeRarity ) construct () StarGiftAttributeRarityClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeRarity {}
_ bin .Decoder = &StarGiftAttributeRarity {}
_ bin .BareEncoder = &StarGiftAttributeRarity {}
_ bin .BareDecoder = &StarGiftAttributeRarity {}
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarity {}
)
func (s *StarGiftAttributeRarity ) Zero () bool {
if s == nil {
return true
}
if !(s .Permille == 0 ) {
return false
}
return true
}
func (s *StarGiftAttributeRarity ) String () string {
if s == nil {
return "StarGiftAttributeRarity(nil)"
}
type Alias StarGiftAttributeRarity
return fmt .Sprintf ("StarGiftAttributeRarity%+v" , Alias (*s ))
}
func (s *StarGiftAttributeRarity ) FillFrom (from interface {
GetPermille () (value int )
}) {
s .Permille = from .GetPermille ()
}
func (*StarGiftAttributeRarity ) TypeID () uint32 {
return StarGiftAttributeRarityTypeID
}
func (*StarGiftAttributeRarity ) TypeName () string {
return "starGiftAttributeRarity"
}
func (s *StarGiftAttributeRarity ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeRarity" ,
ID : StarGiftAttributeRarityTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Permille" ,
SchemaName : "permille" ,
},
}
return typ
}
func (s *StarGiftAttributeRarity ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarity#36437737 as nil" )
}
b .PutID (StarGiftAttributeRarityTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeRarity ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarity#36437737 as nil" )
}
b .PutInt (s .Permille )
return nil
}
func (s *StarGiftAttributeRarity ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarity#36437737 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeRarityTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeRarity#36437737: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeRarity ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarity#36437737 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeRarity#36437737: field permille: %w" , err )
}
s .Permille = value
}
return nil
}
func (s *StarGiftAttributeRarity ) GetPermille () (value int ) {
if s == nil {
return
}
return s .Permille
}
type StarGiftAttributeRarityUncommon struct {
}
const StarGiftAttributeRarityUncommonTypeID = 0xdbce6389
func (s StarGiftAttributeRarityUncommon ) construct () StarGiftAttributeRarityClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeRarityUncommon {}
_ bin .Decoder = &StarGiftAttributeRarityUncommon {}
_ bin .BareEncoder = &StarGiftAttributeRarityUncommon {}
_ bin .BareDecoder = &StarGiftAttributeRarityUncommon {}
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityUncommon {}
)
func (s *StarGiftAttributeRarityUncommon ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *StarGiftAttributeRarityUncommon ) String () string {
if s == nil {
return "StarGiftAttributeRarityUncommon(nil)"
}
type Alias StarGiftAttributeRarityUncommon
return fmt .Sprintf ("StarGiftAttributeRarityUncommon%+v" , Alias (*s ))
}
func (*StarGiftAttributeRarityUncommon ) TypeID () uint32 {
return StarGiftAttributeRarityUncommonTypeID
}
func (*StarGiftAttributeRarityUncommon ) TypeName () string {
return "starGiftAttributeRarityUncommon"
}
func (s *StarGiftAttributeRarityUncommon ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeRarityUncommon" ,
ID : StarGiftAttributeRarityUncommonTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *StarGiftAttributeRarityUncommon ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil" )
}
b .PutID (StarGiftAttributeRarityUncommonTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeRarityUncommon ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil" )
}
return nil
}
func (s *StarGiftAttributeRarityUncommon ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeRarityUncommonTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeRarityUncommon#dbce6389: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeRarityUncommon ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil" )
}
return nil
}
type StarGiftAttributeRarityRare struct {
}
const StarGiftAttributeRarityRareTypeID = 0xf08d516b
func (s StarGiftAttributeRarityRare ) construct () StarGiftAttributeRarityClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeRarityRare {}
_ bin .Decoder = &StarGiftAttributeRarityRare {}
_ bin .BareEncoder = &StarGiftAttributeRarityRare {}
_ bin .BareDecoder = &StarGiftAttributeRarityRare {}
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityRare {}
)
func (s *StarGiftAttributeRarityRare ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *StarGiftAttributeRarityRare ) String () string {
if s == nil {
return "StarGiftAttributeRarityRare(nil)"
}
type Alias StarGiftAttributeRarityRare
return fmt .Sprintf ("StarGiftAttributeRarityRare%+v" , Alias (*s ))
}
func (*StarGiftAttributeRarityRare ) TypeID () uint32 {
return StarGiftAttributeRarityRareTypeID
}
func (*StarGiftAttributeRarityRare ) TypeName () string {
return "starGiftAttributeRarityRare"
}
func (s *StarGiftAttributeRarityRare ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeRarityRare" ,
ID : StarGiftAttributeRarityRareTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *StarGiftAttributeRarityRare ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityRare#f08d516b as nil" )
}
b .PutID (StarGiftAttributeRarityRareTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeRarityRare ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityRare#f08d516b as nil" )
}
return nil
}
func (s *StarGiftAttributeRarityRare ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityRare#f08d516b to nil" )
}
if err := b .ConsumeID (StarGiftAttributeRarityRareTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeRarityRare#f08d516b: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeRarityRare ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityRare#f08d516b to nil" )
}
return nil
}
type StarGiftAttributeRarityEpic struct {
}
const StarGiftAttributeRarityEpicTypeID = 0x78fbf3a8
func (s StarGiftAttributeRarityEpic ) construct () StarGiftAttributeRarityClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeRarityEpic {}
_ bin .Decoder = &StarGiftAttributeRarityEpic {}
_ bin .BareEncoder = &StarGiftAttributeRarityEpic {}
_ bin .BareDecoder = &StarGiftAttributeRarityEpic {}
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityEpic {}
)
func (s *StarGiftAttributeRarityEpic ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *StarGiftAttributeRarityEpic ) String () string {
if s == nil {
return "StarGiftAttributeRarityEpic(nil)"
}
type Alias StarGiftAttributeRarityEpic
return fmt .Sprintf ("StarGiftAttributeRarityEpic%+v" , Alias (*s ))
}
func (*StarGiftAttributeRarityEpic ) TypeID () uint32 {
return StarGiftAttributeRarityEpicTypeID
}
func (*StarGiftAttributeRarityEpic ) TypeName () string {
return "starGiftAttributeRarityEpic"
}
func (s *StarGiftAttributeRarityEpic ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeRarityEpic" ,
ID : StarGiftAttributeRarityEpicTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *StarGiftAttributeRarityEpic ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil" )
}
b .PutID (StarGiftAttributeRarityEpicTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeRarityEpic ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil" )
}
return nil
}
func (s *StarGiftAttributeRarityEpic ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeRarityEpicTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeRarityEpic#78fbf3a8: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeRarityEpic ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil" )
}
return nil
}
type StarGiftAttributeRarityLegendary struct {
}
const StarGiftAttributeRarityLegendaryTypeID = 0xcef7e7a8
func (s StarGiftAttributeRarityLegendary ) construct () StarGiftAttributeRarityClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeRarityLegendary {}
_ bin .Decoder = &StarGiftAttributeRarityLegendary {}
_ bin .BareEncoder = &StarGiftAttributeRarityLegendary {}
_ bin .BareDecoder = &StarGiftAttributeRarityLegendary {}
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityLegendary {}
)
func (s *StarGiftAttributeRarityLegendary ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *StarGiftAttributeRarityLegendary ) String () string {
if s == nil {
return "StarGiftAttributeRarityLegendary(nil)"
}
type Alias StarGiftAttributeRarityLegendary
return fmt .Sprintf ("StarGiftAttributeRarityLegendary%+v" , Alias (*s ))
}
func (*StarGiftAttributeRarityLegendary ) TypeID () uint32 {
return StarGiftAttributeRarityLegendaryTypeID
}
func (*StarGiftAttributeRarityLegendary ) TypeName () string {
return "starGiftAttributeRarityLegendary"
}
func (s *StarGiftAttributeRarityLegendary ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeRarityLegendary" ,
ID : StarGiftAttributeRarityLegendaryTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *StarGiftAttributeRarityLegendary ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil" )
}
b .PutID (StarGiftAttributeRarityLegendaryTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeRarityLegendary ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil" )
}
return nil
}
func (s *StarGiftAttributeRarityLegendary ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeRarityLegendaryTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeRarityLegendary#cef7e7a8: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeRarityLegendary ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil" )
}
return nil
}
const StarGiftAttributeRarityClassName = "StarGiftAttributeRarity"
type StarGiftAttributeRarityClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () StarGiftAttributeRarityClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeStarGiftAttributeRarity (buf *bin .Buffer ) (StarGiftAttributeRarityClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case StarGiftAttributeRarityTypeID :
v := StarGiftAttributeRarity {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeRarityClass: %w" , err )
}
return &v , nil
case StarGiftAttributeRarityUncommonTypeID :
v := StarGiftAttributeRarityUncommon {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeRarityClass: %w" , err )
}
return &v , nil
case StarGiftAttributeRarityRareTypeID :
v := StarGiftAttributeRarityRare {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeRarityClass: %w" , err )
}
return &v , nil
case StarGiftAttributeRarityEpicTypeID :
v := StarGiftAttributeRarityEpic {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeRarityClass: %w" , err )
}
return &v , nil
case StarGiftAttributeRarityLegendaryTypeID :
v := StarGiftAttributeRarityLegendary {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeRarityClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode StarGiftAttributeRarityClass: %w" , bin .NewUnexpectedID (id ))
}
}
type StarGiftAttributeRarityBox struct {
StarGiftAttributeRarity StarGiftAttributeRarityClass
}
func (b *StarGiftAttributeRarityBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode StarGiftAttributeRarityBox to nil" )
}
v , err := DecodeStarGiftAttributeRarity (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .StarGiftAttributeRarity = v
return nil
}
func (b *StarGiftAttributeRarityBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .StarGiftAttributeRarity == nil {
return fmt .Errorf ("unable to encode StarGiftAttributeRarityClass as nil" )
}
return b .StarGiftAttributeRarity .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 .