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 StarGiftBackground struct {
CenterColor int
EdgeColor int
TextColor int
}
const StarGiftBackgroundTypeID = 0xaff56398
var (
_ bin .Encoder = &StarGiftBackground {}
_ bin .Decoder = &StarGiftBackground {}
_ bin .BareEncoder = &StarGiftBackground {}
_ bin .BareDecoder = &StarGiftBackground {}
)
func (s *StarGiftBackground ) Zero () bool {
if s == nil {
return true
}
if !(s .CenterColor == 0 ) {
return false
}
if !(s .EdgeColor == 0 ) {
return false
}
if !(s .TextColor == 0 ) {
return false
}
return true
}
func (s *StarGiftBackground ) String () string {
if s == nil {
return "StarGiftBackground(nil)"
}
type Alias StarGiftBackground
return fmt .Sprintf ("StarGiftBackground%+v" , Alias (*s ))
}
func (s *StarGiftBackground ) FillFrom (from interface {
GetCenterColor () (value int )
GetEdgeColor () (value int )
GetTextColor () (value int )
}) {
s .CenterColor = from .GetCenterColor ()
s .EdgeColor = from .GetEdgeColor ()
s .TextColor = from .GetTextColor ()
}
func (*StarGiftBackground ) TypeID () uint32 {
return StarGiftBackgroundTypeID
}
func (*StarGiftBackground ) TypeName () string {
return "starGiftBackground"
}
func (s *StarGiftBackground ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "starGiftBackground" ,
ID : StarGiftBackgroundTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "CenterColor" ,
SchemaName : "center_color" ,
},
{
Name : "EdgeColor" ,
SchemaName : "edge_color" ,
},
{
Name : "TextColor" ,
SchemaName : "text_color" ,
},
}
return typ
}
func (s *StarGiftBackground ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftBackground#aff56398 as nil" )
}
b .PutID (StarGiftBackgroundTypeID )
return s .EncodeBare (b )
}
func (s *StarGiftBackground ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode starGiftBackground#aff56398 as nil" )
}
b .PutInt (s .CenterColor )
b .PutInt (s .EdgeColor )
b .PutInt (s .TextColor )
return nil
}
func (s *StarGiftBackground ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftBackground#aff56398 to nil" )
}
if err := b .ConsumeID (StarGiftBackgroundTypeID ); err != nil {
return fmt .Errorf ("unable to decode starGiftBackground#aff56398: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StarGiftBackground ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode starGiftBackground#aff56398 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftBackground#aff56398: field center_color: %w" , err )
}
s .CenterColor = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftBackground#aff56398: field edge_color: %w" , err )
}
s .EdgeColor = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode starGiftBackground#aff56398: field text_color: %w" , err )
}
s .TextColor = value
}
return nil
}
func (s *StarGiftBackground ) GetCenterColor () (value int ) {
if s == nil {
return
}
return s .CenterColor
}
func (s *StarGiftBackground ) GetEdgeColor () (value int ) {
if s == nil {
return
}
return s .EdgeColor
}
func (s *StarGiftBackground ) GetTextColor () (value int ) {
if s == nil {
return
}
return s .TextColor
}
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 .