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 InputChatThemeEmpty struct {
}
const InputChatThemeEmptyTypeID = 0x83268483
func (i InputChatThemeEmpty ) construct () InputChatThemeClass { return &i }
var (
_ bin .Encoder = &InputChatThemeEmpty {}
_ bin .Decoder = &InputChatThemeEmpty {}
_ bin .BareEncoder = &InputChatThemeEmpty {}
_ bin .BareDecoder = &InputChatThemeEmpty {}
_ InputChatThemeClass = &InputChatThemeEmpty {}
)
func (i *InputChatThemeEmpty ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputChatThemeEmpty ) String () string {
if i == nil {
return "InputChatThemeEmpty(nil)"
}
type Alias InputChatThemeEmpty
return fmt .Sprintf ("InputChatThemeEmpty%+v" , Alias (*i ))
}
func (*InputChatThemeEmpty ) TypeID () uint32 {
return InputChatThemeEmptyTypeID
}
func (*InputChatThemeEmpty ) TypeName () string {
return "inputChatThemeEmpty"
}
func (i *InputChatThemeEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputChatThemeEmpty" ,
ID : InputChatThemeEmptyTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputChatThemeEmpty ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputChatThemeEmpty#83268483 as nil" )
}
b .PutID (InputChatThemeEmptyTypeID )
return i .EncodeBare (b )
}
func (i *InputChatThemeEmpty ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputChatThemeEmpty#83268483 as nil" )
}
return nil
}
func (i *InputChatThemeEmpty ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputChatThemeEmpty#83268483 to nil" )
}
if err := b .ConsumeID (InputChatThemeEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputChatThemeEmpty#83268483: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputChatThemeEmpty ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputChatThemeEmpty#83268483 to nil" )
}
return nil
}
type InputChatTheme struct {
Emoticon string
}
const InputChatThemeTypeID = 0xc93de95c
func (i InputChatTheme ) construct () InputChatThemeClass { return &i }
var (
_ bin .Encoder = &InputChatTheme {}
_ bin .Decoder = &InputChatTheme {}
_ bin .BareEncoder = &InputChatTheme {}
_ bin .BareDecoder = &InputChatTheme {}
_ InputChatThemeClass = &InputChatTheme {}
)
func (i *InputChatTheme ) Zero () bool {
if i == nil {
return true
}
if !(i .Emoticon == "" ) {
return false
}
return true
}
func (i *InputChatTheme ) String () string {
if i == nil {
return "InputChatTheme(nil)"
}
type Alias InputChatTheme
return fmt .Sprintf ("InputChatTheme%+v" , Alias (*i ))
}
func (i *InputChatTheme ) FillFrom (from interface {
GetEmoticon () (value string )
}) {
i .Emoticon = from .GetEmoticon ()
}
func (*InputChatTheme ) TypeID () uint32 {
return InputChatThemeTypeID
}
func (*InputChatTheme ) TypeName () string {
return "inputChatTheme"
}
func (i *InputChatTheme ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputChatTheme" ,
ID : InputChatThemeTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Emoticon" ,
SchemaName : "emoticon" ,
},
}
return typ
}
func (i *InputChatTheme ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputChatTheme#c93de95c as nil" )
}
b .PutID (InputChatThemeTypeID )
return i .EncodeBare (b )
}
func (i *InputChatTheme ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputChatTheme#c93de95c as nil" )
}
b .PutString (i .Emoticon )
return nil
}
func (i *InputChatTheme ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputChatTheme#c93de95c to nil" )
}
if err := b .ConsumeID (InputChatThemeTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputChatTheme#c93de95c: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputChatTheme ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputChatTheme#c93de95c to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputChatTheme#c93de95c: field emoticon: %w" , err )
}
i .Emoticon = value
}
return nil
}
func (i *InputChatTheme ) GetEmoticon () (value string ) {
if i == nil {
return
}
return i .Emoticon
}
type InputChatThemeUniqueGift struct {
Slug string
}
const InputChatThemeUniqueGiftTypeID = 0x87e5dfe4
func (i InputChatThemeUniqueGift ) construct () InputChatThemeClass { return &i }
var (
_ bin .Encoder = &InputChatThemeUniqueGift {}
_ bin .Decoder = &InputChatThemeUniqueGift {}
_ bin .BareEncoder = &InputChatThemeUniqueGift {}
_ bin .BareDecoder = &InputChatThemeUniqueGift {}
_ InputChatThemeClass = &InputChatThemeUniqueGift {}
)
func (i *InputChatThemeUniqueGift ) Zero () bool {
if i == nil {
return true
}
if !(i .Slug == "" ) {
return false
}
return true
}
func (i *InputChatThemeUniqueGift ) String () string {
if i == nil {
return "InputChatThemeUniqueGift(nil)"
}
type Alias InputChatThemeUniqueGift
return fmt .Sprintf ("InputChatThemeUniqueGift%+v" , Alias (*i ))
}
func (i *InputChatThemeUniqueGift ) FillFrom (from interface {
GetSlug () (value string )
}) {
i .Slug = from .GetSlug ()
}
func (*InputChatThemeUniqueGift ) TypeID () uint32 {
return InputChatThemeUniqueGiftTypeID
}
func (*InputChatThemeUniqueGift ) TypeName () string {
return "inputChatThemeUniqueGift"
}
func (i *InputChatThemeUniqueGift ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputChatThemeUniqueGift" ,
ID : InputChatThemeUniqueGiftTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (i *InputChatThemeUniqueGift ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputChatThemeUniqueGift#87e5dfe4 as nil" )
}
b .PutID (InputChatThemeUniqueGiftTypeID )
return i .EncodeBare (b )
}
func (i *InputChatThemeUniqueGift ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputChatThemeUniqueGift#87e5dfe4 as nil" )
}
b .PutString (i .Slug )
return nil
}
func (i *InputChatThemeUniqueGift ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputChatThemeUniqueGift#87e5dfe4 to nil" )
}
if err := b .ConsumeID (InputChatThemeUniqueGiftTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputChatThemeUniqueGift#87e5dfe4: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputChatThemeUniqueGift ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputChatThemeUniqueGift#87e5dfe4 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputChatThemeUniqueGift#87e5dfe4: field slug: %w" , err )
}
i .Slug = value
}
return nil
}
func (i *InputChatThemeUniqueGift ) GetSlug () (value string ) {
if i == nil {
return
}
return i .Slug
}
const InputChatThemeClassName = "InputChatTheme"
type InputChatThemeClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputChatThemeClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputChatTheme (buf *bin .Buffer ) (InputChatThemeClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputChatThemeEmptyTypeID :
v := InputChatThemeEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputChatThemeClass: %w" , err )
}
return &v , nil
case InputChatThemeTypeID :
v := InputChatTheme {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputChatThemeClass: %w" , err )
}
return &v , nil
case InputChatThemeUniqueGiftTypeID :
v := InputChatThemeUniqueGift {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputChatThemeClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputChatThemeClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputChatThemeBox struct {
InputChatTheme InputChatThemeClass
}
func (b *InputChatThemeBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputChatThemeBox to nil" )
}
v , err := DecodeInputChatTheme (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputChatTheme = v
return nil
}
func (b *InputChatThemeBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputChatTheme == nil {
return fmt .Errorf ("unable to encode InputChatThemeClass as nil" )
}
return b .InputChatTheme .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 .