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 InputWallPaper struct {
ID int64
AccessHash int64
}
const InputWallPaperTypeID = 0xe630b979
func (i InputWallPaper ) construct () InputWallPaperClass { return &i }
var (
_ bin .Encoder = &InputWallPaper {}
_ bin .Decoder = &InputWallPaper {}
_ bin .BareEncoder = &InputWallPaper {}
_ bin .BareDecoder = &InputWallPaper {}
_ InputWallPaperClass = &InputWallPaper {}
)
func (i *InputWallPaper ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == 0 ) {
return false
}
if !(i .AccessHash == 0 ) {
return false
}
return true
}
func (i *InputWallPaper ) String () string {
if i == nil {
return "InputWallPaper(nil)"
}
type Alias InputWallPaper
return fmt .Sprintf ("InputWallPaper%+v" , Alias (*i ))
}
func (i *InputWallPaper ) FillFrom (from interface {
GetID () (value int64 )
GetAccessHash () (value int64 )
}) {
i .ID = from .GetID ()
i .AccessHash = from .GetAccessHash ()
}
func (*InputWallPaper ) TypeID () uint32 {
return InputWallPaperTypeID
}
func (*InputWallPaper ) TypeName () string {
return "inputWallPaper"
}
func (i *InputWallPaper ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputWallPaper" ,
ID : InputWallPaperTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
}
return typ
}
func (i *InputWallPaper ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputWallPaper#e630b979 as nil" )
}
b .PutID (InputWallPaperTypeID )
return i .EncodeBare (b )
}
func (i *InputWallPaper ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputWallPaper#e630b979 as nil" )
}
b .PutLong (i .ID )
b .PutLong (i .AccessHash )
return nil
}
func (i *InputWallPaper ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputWallPaper#e630b979 to nil" )
}
if err := b .ConsumeID (InputWallPaperTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputWallPaper#e630b979: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputWallPaper ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputWallPaper#e630b979 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputWallPaper#e630b979: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputWallPaper#e630b979: field access_hash: %w" , err )
}
i .AccessHash = value
}
return nil
}
func (i *InputWallPaper ) GetID () (value int64 ) {
if i == nil {
return
}
return i .ID
}
func (i *InputWallPaper ) GetAccessHash () (value int64 ) {
if i == nil {
return
}
return i .AccessHash
}
type InputWallPaperSlug struct {
Slug string
}
const InputWallPaperSlugTypeID = 0x72091c80
func (i InputWallPaperSlug ) construct () InputWallPaperClass { return &i }
var (
_ bin .Encoder = &InputWallPaperSlug {}
_ bin .Decoder = &InputWallPaperSlug {}
_ bin .BareEncoder = &InputWallPaperSlug {}
_ bin .BareDecoder = &InputWallPaperSlug {}
_ InputWallPaperClass = &InputWallPaperSlug {}
)
func (i *InputWallPaperSlug ) Zero () bool {
if i == nil {
return true
}
if !(i .Slug == "" ) {
return false
}
return true
}
func (i *InputWallPaperSlug ) String () string {
if i == nil {
return "InputWallPaperSlug(nil)"
}
type Alias InputWallPaperSlug
return fmt .Sprintf ("InputWallPaperSlug%+v" , Alias (*i ))
}
func (i *InputWallPaperSlug ) FillFrom (from interface {
GetSlug () (value string )
}) {
i .Slug = from .GetSlug ()
}
func (*InputWallPaperSlug ) TypeID () uint32 {
return InputWallPaperSlugTypeID
}
func (*InputWallPaperSlug ) TypeName () string {
return "inputWallPaperSlug"
}
func (i *InputWallPaperSlug ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputWallPaperSlug" ,
ID : InputWallPaperSlugTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Slug" ,
SchemaName : "slug" ,
},
}
return typ
}
func (i *InputWallPaperSlug ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputWallPaperSlug#72091c80 as nil" )
}
b .PutID (InputWallPaperSlugTypeID )
return i .EncodeBare (b )
}
func (i *InputWallPaperSlug ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputWallPaperSlug#72091c80 as nil" )
}
b .PutString (i .Slug )
return nil
}
func (i *InputWallPaperSlug ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputWallPaperSlug#72091c80 to nil" )
}
if err := b .ConsumeID (InputWallPaperSlugTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputWallPaperSlug#72091c80: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputWallPaperSlug ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputWallPaperSlug#72091c80 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputWallPaperSlug#72091c80: field slug: %w" , err )
}
i .Slug = value
}
return nil
}
func (i *InputWallPaperSlug ) GetSlug () (value string ) {
if i == nil {
return
}
return i .Slug
}
type InputWallPaperNoFile struct {
ID int64
}
const InputWallPaperNoFileTypeID = 0x967a462e
func (i InputWallPaperNoFile ) construct () InputWallPaperClass { return &i }
var (
_ bin .Encoder = &InputWallPaperNoFile {}
_ bin .Decoder = &InputWallPaperNoFile {}
_ bin .BareEncoder = &InputWallPaperNoFile {}
_ bin .BareDecoder = &InputWallPaperNoFile {}
_ InputWallPaperClass = &InputWallPaperNoFile {}
)
func (i *InputWallPaperNoFile ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == 0 ) {
return false
}
return true
}
func (i *InputWallPaperNoFile ) String () string {
if i == nil {
return "InputWallPaperNoFile(nil)"
}
type Alias InputWallPaperNoFile
return fmt .Sprintf ("InputWallPaperNoFile%+v" , Alias (*i ))
}
func (i *InputWallPaperNoFile ) FillFrom (from interface {
GetID () (value int64 )
}) {
i .ID = from .GetID ()
}
func (*InputWallPaperNoFile ) TypeID () uint32 {
return InputWallPaperNoFileTypeID
}
func (*InputWallPaperNoFile ) TypeName () string {
return "inputWallPaperNoFile"
}
func (i *InputWallPaperNoFile ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputWallPaperNoFile" ,
ID : InputWallPaperNoFileTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (i *InputWallPaperNoFile ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputWallPaperNoFile#967a462e as nil" )
}
b .PutID (InputWallPaperNoFileTypeID )
return i .EncodeBare (b )
}
func (i *InputWallPaperNoFile ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputWallPaperNoFile#967a462e as nil" )
}
b .PutLong (i .ID )
return nil
}
func (i *InputWallPaperNoFile ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputWallPaperNoFile#967a462e to nil" )
}
if err := b .ConsumeID (InputWallPaperNoFileTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputWallPaperNoFile#967a462e: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputWallPaperNoFile ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputWallPaperNoFile#967a462e to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputWallPaperNoFile#967a462e: field id: %w" , err )
}
i .ID = value
}
return nil
}
func (i *InputWallPaperNoFile ) GetID () (value int64 ) {
if i == nil {
return
}
return i .ID
}
const InputWallPaperClassName = "InputWallPaper"
type InputWallPaperClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputWallPaperClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputWallPaper (buf *bin .Buffer ) (InputWallPaperClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputWallPaperTypeID :
v := InputWallPaper {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputWallPaperClass: %w" , err )
}
return &v , nil
case InputWallPaperSlugTypeID :
v := InputWallPaperSlug {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputWallPaperClass: %w" , err )
}
return &v , nil
case InputWallPaperNoFileTypeID :
v := InputWallPaperNoFile {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputWallPaperClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputWallPaperClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputWallPaperBox struct {
InputWallPaper InputWallPaperClass
}
func (b *InputWallPaperBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputWallPaperBox to nil" )
}
v , err := DecodeInputWallPaper (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputWallPaper = v
return nil
}
func (b *InputWallPaperBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputWallPaper == nil {
return fmt .Errorf ("unable to encode InputWallPaperClass as nil" )
}
return b .InputWallPaper .Encode (buf )
}
The pages are generated with Golds v0.6.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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .