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 StarGiftUpgradePrice struct {
Date int
UpgradeStars int64
}
const StarGiftUpgradePriceTypeID = 0x99ea331d
var (
_ bin .Encoder = &StarGiftUpgradePrice {}
_ bin .Decoder = &StarGiftUpgradePrice {}
_ bin .BareEncoder = &StarGiftUpgradePrice {}
_ bin .BareDecoder = &StarGiftUpgradePrice {}
)
func (s *StarGiftUpgradePrice ) Zero () bool {
if s == nil {
return true
}
if !(s .Date == 0 ) {
return false
}
if !(s .UpgradeStars == 0 ) {
return false
}
return true
}
func (s *StarGiftUpgradePrice ) String () string {
if s == nil {
return "StarGiftUpgradePrice(nil)"
}
type Alias StarGiftUpgradePrice
return fmt .Sprintf ("StarGiftUpgradePrice%+v" , Alias (*s ))
}
func (s *StarGiftUpgradePrice ) FillFrom (from interface {
GetDate () (value int )
GetUpgradeStars () (value int64 )
}) {
s .Date = from .GetDate ()
s .UpgradeStars = from .GetUpgradeStars ()
}
func (*StarGiftUpgradePrice ) TypeID () uint32 {
return StarGiftUpgradePriceTypeID
}
func (*StarGiftUpgradePrice ) TypeName () string {
return "starGiftUpgradePrice"
}
func (s *StarGiftUpgradePrice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftUpgradePrice" ,
ID : StarGiftUpgradePriceTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "UpgradeStars" ,
SchemaName : "upgrade_stars" ,
},
}
return typ
}
func (s *StarGiftUpgradePrice ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftUpgradePrice#99ea331d as nil" )
}
b .PutID (StarGiftUpgradePriceTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftUpgradePrice ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftUpgradePrice#99ea331d as nil" )
}
b .PutInt (s .Date )
b .PutLong (s .UpgradeStars )
return nil
}
func (s *StarGiftUpgradePrice ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftUpgradePrice#99ea331d to nil" )
}
if err := b .ConsumeID (StarGiftUpgradePriceTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftUpgradePrice#99ea331d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftUpgradePrice ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftUpgradePrice#99ea331d to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftUpgradePrice#99ea331d: field date: %w" , err )
}
s .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftUpgradePrice#99ea331d: field upgrade_stars: %w" , err )
}
s .UpgradeStars = value
}
return nil
}
func (s *StarGiftUpgradePrice ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *StarGiftUpgradePrice ) GetUpgradeStars () (value int64 ) {
if s == nil {
return
}
return s .UpgradeStars
}
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 .