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 AccountSavedRingtone struct {
}
const AccountSavedRingtoneTypeID = 0xb7263f6d
func (s AccountSavedRingtone ) construct () AccountSavedRingtoneClass { return &s }
var (
_ bin .Encoder = &AccountSavedRingtone {}
_ bin .Decoder = &AccountSavedRingtone {}
_ bin .BareEncoder = &AccountSavedRingtone {}
_ bin .BareDecoder = &AccountSavedRingtone {}
_ AccountSavedRingtoneClass = &AccountSavedRingtone {}
)
func (s *AccountSavedRingtone ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *AccountSavedRingtone ) String () string {
if s == nil {
return "AccountSavedRingtone(nil)"
}
type Alias AccountSavedRingtone
return fmt .Sprintf ("AccountSavedRingtone%+v" , Alias (*s ))
}
func (*AccountSavedRingtone ) TypeID () uint32 {
return AccountSavedRingtoneTypeID
}
func (*AccountSavedRingtone ) TypeName () string {
return "account.savedRingtone"
}
func (s *AccountSavedRingtone ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.savedRingtone" ,
ID : AccountSavedRingtoneTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *AccountSavedRingtone ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.savedRingtone#b7263f6d as nil" )
}
b .PutID (AccountSavedRingtoneTypeID )
return s .EncodeBare (b )
}
func (s *AccountSavedRingtone ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.savedRingtone#b7263f6d as nil" )
}
return nil
}
func (s *AccountSavedRingtone ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.savedRingtone#b7263f6d to nil" )
}
if err := b .ConsumeID (AccountSavedRingtoneTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.savedRingtone#b7263f6d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSavedRingtone ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.savedRingtone#b7263f6d to nil" )
}
return nil
}
type AccountSavedRingtoneConverted struct {
Document DocumentClass
}
const AccountSavedRingtoneConvertedTypeID = 0x1f307eb7
func (s AccountSavedRingtoneConverted ) construct () AccountSavedRingtoneClass { return &s }
var (
_ bin .Encoder = &AccountSavedRingtoneConverted {}
_ bin .Decoder = &AccountSavedRingtoneConverted {}
_ bin .BareEncoder = &AccountSavedRingtoneConverted {}
_ bin .BareDecoder = &AccountSavedRingtoneConverted {}
_ AccountSavedRingtoneClass = &AccountSavedRingtoneConverted {}
)
func (s *AccountSavedRingtoneConverted ) Zero () bool {
if s == nil {
return true
}
if !(s .Document == nil ) {
return false
}
return true
}
func (s *AccountSavedRingtoneConverted ) String () string {
if s == nil {
return "AccountSavedRingtoneConverted(nil)"
}
type Alias AccountSavedRingtoneConverted
return fmt .Sprintf ("AccountSavedRingtoneConverted%+v" , Alias (*s ))
}
func (s *AccountSavedRingtoneConverted ) FillFrom (from interface {
GetDocument () (value DocumentClass )
}) {
s .Document = from .GetDocument ()
}
func (*AccountSavedRingtoneConverted ) TypeID () uint32 {
return AccountSavedRingtoneConvertedTypeID
}
func (*AccountSavedRingtoneConverted ) TypeName () string {
return "account.savedRingtoneConverted"
}
func (s *AccountSavedRingtoneConverted ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.savedRingtoneConverted" ,
ID : AccountSavedRingtoneConvertedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Document" ,
SchemaName : "document" ,
},
}
return typ
}
func (s *AccountSavedRingtoneConverted ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.savedRingtoneConverted#1f307eb7 as nil" )
}
b .PutID (AccountSavedRingtoneConvertedTypeID )
return s .EncodeBare (b )
}
func (s *AccountSavedRingtoneConverted ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode account.savedRingtoneConverted#1f307eb7 as nil" )
}
if s .Document == nil {
return fmt .Errorf ("unable to encode account.savedRingtoneConverted#1f307eb7: field document is nil" )
}
if err := s .Document .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.savedRingtoneConverted#1f307eb7: field document: %w" , err )
}
return nil
}
func (s *AccountSavedRingtoneConverted ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.savedRingtoneConverted#1f307eb7 to nil" )
}
if err := b .ConsumeID (AccountSavedRingtoneConvertedTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.savedRingtoneConverted#1f307eb7: %w" , err )
}
return s .DecodeBare (b )
}
func (s *AccountSavedRingtoneConverted ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode account.savedRingtoneConverted#1f307eb7 to nil" )
}
{
value , err := DecodeDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode account.savedRingtoneConverted#1f307eb7: field document: %w" , err )
}
s .Document = value
}
return nil
}
func (s *AccountSavedRingtoneConverted ) GetDocument () (value DocumentClass ) {
if s == nil {
return
}
return s .Document
}
const AccountSavedRingtoneClassName = "account.SavedRingtone"
type AccountSavedRingtoneClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () AccountSavedRingtoneClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeAccountSavedRingtone (buf *bin .Buffer ) (AccountSavedRingtoneClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case AccountSavedRingtoneTypeID :
v := AccountSavedRingtone {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountSavedRingtoneClass: %w" , err )
}
return &v , nil
case AccountSavedRingtoneConvertedTypeID :
v := AccountSavedRingtoneConverted {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountSavedRingtoneClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode AccountSavedRingtoneClass: %w" , bin .NewUnexpectedID (id ))
}
}
type AccountSavedRingtoneBox struct {
SavedRingtone AccountSavedRingtoneClass
}
func (b *AccountSavedRingtoneBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode AccountSavedRingtoneBox to nil" )
}
v , err := DecodeAccountSavedRingtone (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .SavedRingtone = v
return nil
}
func (b *AccountSavedRingtoneBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .SavedRingtone == nil {
return fmt .Errorf ("unable to encode AccountSavedRingtoneClass as nil" )
}
return b .SavedRingtone .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 .