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 StarGiftAttributeIDModel struct {
DocumentID int64
}
const StarGiftAttributeIDModelTypeID = 0x48aaae3c
func (s StarGiftAttributeIDModel ) construct () StarGiftAttributeIDClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeIDModel {}
_ bin .Decoder = &StarGiftAttributeIDModel {}
_ bin .BareEncoder = &StarGiftAttributeIDModel {}
_ bin .BareDecoder = &StarGiftAttributeIDModel {}
_ StarGiftAttributeIDClass = &StarGiftAttributeIDModel {}
)
func (s *StarGiftAttributeIDModel ) Zero () bool {
if s == nil {
return true
}
if !(s .DocumentID == 0 ) {
return false
}
return true
}
func (s *StarGiftAttributeIDModel ) String () string {
if s == nil {
return "StarGiftAttributeIDModel(nil)"
}
type Alias StarGiftAttributeIDModel
return fmt .Sprintf ("StarGiftAttributeIDModel%+v" , Alias (*s ))
}
func (s *StarGiftAttributeIDModel ) FillFrom (from interface {
GetDocumentID () (value int64 )
}) {
s .DocumentID = from .GetDocumentID ()
}
func (*StarGiftAttributeIDModel ) TypeID () uint32 {
return StarGiftAttributeIDModelTypeID
}
func (*StarGiftAttributeIDModel ) TypeName () string {
return "starGiftAttributeIdModel"
}
func (s *StarGiftAttributeIDModel ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeIdModel" ,
ID : StarGiftAttributeIDModelTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DocumentID" ,
SchemaName : "document_id" ,
},
}
return typ
}
func (s *StarGiftAttributeIDModel ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeIdModel#48aaae3c as nil" )
}
b .PutID (StarGiftAttributeIDModelTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeIDModel ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeIdModel#48aaae3c as nil" )
}
b .PutLong (s .DocumentID )
return nil
}
func (s *StarGiftAttributeIDModel ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeIdModel#48aaae3c to nil" )
}
if err := b .ConsumeID (StarGiftAttributeIDModelTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeIdModel#48aaae3c: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeIDModel ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeIdModel#48aaae3c to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeIdModel#48aaae3c: field document_id: %w" , err )
}
s .DocumentID = value
}
return nil
}
func (s *StarGiftAttributeIDModel ) GetDocumentID () (value int64 ) {
if s == nil {
return
}
return s .DocumentID
}
type StarGiftAttributeIDPattern struct {
DocumentID int64
}
const StarGiftAttributeIDPatternTypeID = 0x4a162433
func (s StarGiftAttributeIDPattern ) construct () StarGiftAttributeIDClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeIDPattern {}
_ bin .Decoder = &StarGiftAttributeIDPattern {}
_ bin .BareEncoder = &StarGiftAttributeIDPattern {}
_ bin .BareDecoder = &StarGiftAttributeIDPattern {}
_ StarGiftAttributeIDClass = &StarGiftAttributeIDPattern {}
)
func (s *StarGiftAttributeIDPattern ) Zero () bool {
if s == nil {
return true
}
if !(s .DocumentID == 0 ) {
return false
}
return true
}
func (s *StarGiftAttributeIDPattern ) String () string {
if s == nil {
return "StarGiftAttributeIDPattern(nil)"
}
type Alias StarGiftAttributeIDPattern
return fmt .Sprintf ("StarGiftAttributeIDPattern%+v" , Alias (*s ))
}
func (s *StarGiftAttributeIDPattern ) FillFrom (from interface {
GetDocumentID () (value int64 )
}) {
s .DocumentID = from .GetDocumentID ()
}
func (*StarGiftAttributeIDPattern ) TypeID () uint32 {
return StarGiftAttributeIDPatternTypeID
}
func (*StarGiftAttributeIDPattern ) TypeName () string {
return "starGiftAttributeIdPattern"
}
func (s *StarGiftAttributeIDPattern ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeIdPattern" ,
ID : StarGiftAttributeIDPatternTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DocumentID" ,
SchemaName : "document_id" ,
},
}
return typ
}
func (s *StarGiftAttributeIDPattern ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeIdPattern#4a162433 as nil" )
}
b .PutID (StarGiftAttributeIDPatternTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeIDPattern ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeIdPattern#4a162433 as nil" )
}
b .PutLong (s .DocumentID )
return nil
}
func (s *StarGiftAttributeIDPattern ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeIdPattern#4a162433 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeIDPatternTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeIdPattern#4a162433: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeIDPattern ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeIdPattern#4a162433 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeIdPattern#4a162433: field document_id: %w" , err )
}
s .DocumentID = value
}
return nil
}
func (s *StarGiftAttributeIDPattern ) GetDocumentID () (value int64 ) {
if s == nil {
return
}
return s .DocumentID
}
type StarGiftAttributeIDBackdrop struct {
BackdropID int
}
const StarGiftAttributeIDBackdropTypeID = 0x1f01c757
func (s StarGiftAttributeIDBackdrop ) construct () StarGiftAttributeIDClass { return &s }
var (
_ bin .Encoder = &StarGiftAttributeIDBackdrop {}
_ bin .Decoder = &StarGiftAttributeIDBackdrop {}
_ bin .BareEncoder = &StarGiftAttributeIDBackdrop {}
_ bin .BareDecoder = &StarGiftAttributeIDBackdrop {}
_ StarGiftAttributeIDClass = &StarGiftAttributeIDBackdrop {}
)
func (s *StarGiftAttributeIDBackdrop ) Zero () bool {
if s == nil {
return true
}
if !(s .BackdropID == 0 ) {
return false
}
return true
}
func (s *StarGiftAttributeIDBackdrop ) String () string {
if s == nil {
return "StarGiftAttributeIDBackdrop(nil)"
}
type Alias StarGiftAttributeIDBackdrop
return fmt .Sprintf ("StarGiftAttributeIDBackdrop%+v" , Alias (*s ))
}
func (s *StarGiftAttributeIDBackdrop ) FillFrom (from interface {
GetBackdropID () (value int )
}) {
s .BackdropID = from .GetBackdropID ()
}
func (*StarGiftAttributeIDBackdrop ) TypeID () uint32 {
return StarGiftAttributeIDBackdropTypeID
}
func (*StarGiftAttributeIDBackdrop ) TypeName () string {
return "starGiftAttributeIdBackdrop"
}
func (s *StarGiftAttributeIDBackdrop ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeIdBackdrop" ,
ID : StarGiftAttributeIDBackdropTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BackdropID" ,
SchemaName : "backdrop_id" ,
},
}
return typ
}
func (s *StarGiftAttributeIDBackdrop ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeIdBackdrop#1f01c757 as nil" )
}
b .PutID (StarGiftAttributeIDBackdropTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeIDBackdrop ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeIdBackdrop#1f01c757 as nil" )
}
b .PutInt (s .BackdropID )
return nil
}
func (s *StarGiftAttributeIDBackdrop ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeIdBackdrop#1f01c757 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeIDBackdropTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeIdBackdrop#1f01c757: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeIDBackdrop ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeIdBackdrop#1f01c757 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeIdBackdrop#1f01c757: field backdrop_id: %w" , err )
}
s .BackdropID = value
}
return nil
}
func (s *StarGiftAttributeIDBackdrop ) GetBackdropID () (value int ) {
if s == nil {
return
}
return s .BackdropID
}
const StarGiftAttributeIDClassName = "StarGiftAttributeId"
type StarGiftAttributeIDClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () StarGiftAttributeIDClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeStarGiftAttributeID (buf *bin .Buffer ) (StarGiftAttributeIDClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case StarGiftAttributeIDModelTypeID :
v := StarGiftAttributeIDModel {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeIDClass: %w" , err )
}
return &v , nil
case StarGiftAttributeIDPatternTypeID :
v := StarGiftAttributeIDPattern {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeIDClass: %w" , err )
}
return &v , nil
case StarGiftAttributeIDBackdropTypeID :
v := StarGiftAttributeIDBackdrop {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StarGiftAttributeIDClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode StarGiftAttributeIDClass: %w" , bin .NewUnexpectedID (id ))
}
}
type StarGiftAttributeIDBox struct {
StarGiftAttributeId StarGiftAttributeIDClass
}
func (b *StarGiftAttributeIDBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode StarGiftAttributeIDBox to nil" )
}
v , err := DecodeStarGiftAttributeID (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .StarGiftAttributeId = v
return nil
}
func (b *StarGiftAttributeIDBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .StarGiftAttributeId == nil {
return fmt .Errorf ("unable to encode StarGiftAttributeIDClass as nil" )
}
return b .StarGiftAttributeId .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 .