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 ShareThemeBackdropOption struct {
BackdropID int
Name string
CenterColor int
EdgeColor int
PatternColor int
TextColor int
}
const ShareThemeBackdropOptionTypeID = 0x45c1d652
var (
_ bin .Encoder = &ShareThemeBackdropOption {}
_ bin .Decoder = &ShareThemeBackdropOption {}
_ bin .BareEncoder = &ShareThemeBackdropOption {}
_ bin .BareDecoder = &ShareThemeBackdropOption {}
)
func (s *ShareThemeBackdropOption ) Zero () bool {
if s == nil {
return true
}
if !(s .BackdropID == 0 ) {
return false
}
if !(s .Name == "" ) {
return false
}
if !(s .CenterColor == 0 ) {
return false
}
if !(s .EdgeColor == 0 ) {
return false
}
if !(s .PatternColor == 0 ) {
return false
}
if !(s .TextColor == 0 ) {
return false
}
return true
}
func (s *ShareThemeBackdropOption ) String () string {
if s == nil {
return "ShareThemeBackdropOption(nil)"
}
type Alias ShareThemeBackdropOption
return fmt .Sprintf ("ShareThemeBackdropOption%+v" , Alias (*s ))
}
func (s *ShareThemeBackdropOption ) FillFrom (from interface {
GetBackdropID () (value int )
GetName () (value string )
GetCenterColor () (value int )
GetEdgeColor () (value int )
GetPatternColor () (value int )
GetTextColor () (value int )
}) {
s .BackdropID = from .GetBackdropID ()
s .Name = from .GetName ()
s .CenterColor = from .GetCenterColor ()
s .EdgeColor = from .GetEdgeColor ()
s .PatternColor = from .GetPatternColor ()
s .TextColor = from .GetTextColor ()
}
func (*ShareThemeBackdropOption ) TypeID () uint32 {
return ShareThemeBackdropOptionTypeID
}
func (*ShareThemeBackdropOption ) TypeName () string {
return "shareThemeBackdropOption"
}
func (s *ShareThemeBackdropOption ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "shareThemeBackdropOption" ,
ID : ShareThemeBackdropOptionTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BackdropID" ,
SchemaName : "backdrop_id" ,
},
{
Name : "Name" ,
SchemaName : "name" ,
},
{
Name : "CenterColor" ,
SchemaName : "center_color" ,
},
{
Name : "EdgeColor" ,
SchemaName : "edge_color" ,
},
{
Name : "PatternColor" ,
SchemaName : "pattern_color" ,
},
{
Name : "TextColor" ,
SchemaName : "text_color" ,
},
}
return typ
}
func (s *ShareThemeBackdropOption ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode shareThemeBackdropOption#45c1d652 as nil" )
}
b .PutID (ShareThemeBackdropOptionTypeID )
return s .EncodeBare (b )
}
func (s *ShareThemeBackdropOption ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode shareThemeBackdropOption#45c1d652 as nil" )
}
b .PutInt (s .BackdropID )
b .PutString (s .Name )
b .PutInt (s .CenterColor )
b .PutInt (s .EdgeColor )
b .PutInt (s .PatternColor )
b .PutInt (s .TextColor )
return nil
}
func (s *ShareThemeBackdropOption ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode shareThemeBackdropOption#45c1d652 to nil" )
}
if err := b .ConsumeID (ShareThemeBackdropOptionTypeID ); err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ShareThemeBackdropOption ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode shareThemeBackdropOption#45c1d652 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: field backdrop_id: %w" , err )
}
s .BackdropID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: field name: %w" , err )
}
s .Name = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: field center_color: %w" , err )
}
s .CenterColor = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: field edge_color: %w" , err )
}
s .EdgeColor = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: field pattern_color: %w" , err )
}
s .PatternColor = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropOption#45c1d652: field text_color: %w" , err )
}
s .TextColor = value
}
return nil
}
func (s *ShareThemeBackdropOption ) GetBackdropID () (value int ) {
if s == nil {
return
}
return s .BackdropID
}
func (s *ShareThemeBackdropOption ) GetName () (value string ) {
if s == nil {
return
}
return s .Name
}
func (s *ShareThemeBackdropOption ) GetCenterColor () (value int ) {
if s == nil {
return
}
return s .CenterColor
}
func (s *ShareThemeBackdropOption ) GetEdgeColor () (value int ) {
if s == nil {
return
}
return s .EdgeColor
}
func (s *ShareThemeBackdropOption ) GetPatternColor () (value int ) {
if s == nil {
return
}
return s .PatternColor
}
func (s *ShareThemeBackdropOption ) GetTextColor () (value int ) {
if s == nil {
return
}
return s .TextColor
}
The pages are generated with Golds v0.8.7 . (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 .