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 StarGiftAttributeCounter struct {
Attribute StarGiftAttributeIDClass
Count int
}
const StarGiftAttributeCounterTypeID = 0x2eb1b658
var (
_ bin .Encoder = &StarGiftAttributeCounter {}
_ bin .Decoder = &StarGiftAttributeCounter {}
_ bin .BareEncoder = &StarGiftAttributeCounter {}
_ bin .BareDecoder = &StarGiftAttributeCounter {}
)
func (s *StarGiftAttributeCounter ) Zero () bool {
if s == nil {
return true
}
if !(s .Attribute == nil ) {
return false
}
if !(s .Count == 0 ) {
return false
}
return true
}
func (s *StarGiftAttributeCounter ) String () string {
if s == nil {
return "StarGiftAttributeCounter(nil)"
}
type Alias StarGiftAttributeCounter
return fmt .Sprintf ("StarGiftAttributeCounter%+v" , Alias (*s ))
}
func (s *StarGiftAttributeCounter ) FillFrom (from interface {
GetAttribute () (value StarGiftAttributeIDClass )
GetCount () (value int )
}) {
s .Attribute = from .GetAttribute ()
s .Count = from .GetCount ()
}
func (*StarGiftAttributeCounter ) TypeID () uint32 {
return StarGiftAttributeCounterTypeID
}
func (*StarGiftAttributeCounter ) TypeName () string {
return "starGiftAttributeCounter"
}
func (s *StarGiftAttributeCounter ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftAttributeCounter" ,
ID : StarGiftAttributeCounterTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Attribute" ,
SchemaName : "attribute" ,
},
{
Name : "Count" ,
SchemaName : "count" ,
},
}
return typ
}
func (s *StarGiftAttributeCounter ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeCounter#2eb1b658 as nil" )
}
b .PutID (StarGiftAttributeCounterTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftAttributeCounter ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftAttributeCounter#2eb1b658 as nil" )
}
if s .Attribute == nil {
return fmt .Errorf ("unable to encode starGiftAttributeCounter#2eb1b658: field attribute is nil" )
}
if err := s .Attribute .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode starGiftAttributeCounter#2eb1b658: field attribute: %w" , err )
}
b .PutInt (s .Count )
return nil
}
func (s *StarGiftAttributeCounter ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeCounter#2eb1b658 to nil" )
}
if err := b .ConsumeID (StarGiftAttributeCounterTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeCounter#2eb1b658: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftAttributeCounter ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftAttributeCounter#2eb1b658 to nil" )
}
{
value , err := DecodeStarGiftAttributeID (b )
if err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeCounter#2eb1b658: field attribute: %w" , err )
}
s .Attribute = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftAttributeCounter#2eb1b658: field count: %w" , err )
}
s .Count = value
}
return nil
}
func (s *StarGiftAttributeCounter ) GetAttribute () (value StarGiftAttributeIDClass ) {
if s == nil {
return
}
return s .Attribute
}
func (s *StarGiftAttributeCounter ) GetCount () (value int ) {
if s == nil {
return
}
return s .Count
}
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 .