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 StorageFileUnknown struct {
}
const StorageFileUnknownTypeID = 0xaa963b05
func (f StorageFileUnknown ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileUnknown {}
_ bin .Decoder = &StorageFileUnknown {}
_ bin .BareEncoder = &StorageFileUnknown {}
_ bin .BareDecoder = &StorageFileUnknown {}
_ StorageFileTypeClass = &StorageFileUnknown {}
)
func (f *StorageFileUnknown ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileUnknown ) String () string {
if f == nil {
return "StorageFileUnknown(nil)"
}
type Alias StorageFileUnknown
return fmt .Sprintf ("StorageFileUnknown%+v" , Alias (*f ))
}
func (*StorageFileUnknown ) TypeID () uint32 {
return StorageFileUnknownTypeID
}
func (*StorageFileUnknown ) TypeName () string {
return "storage.fileUnknown"
}
func (f *StorageFileUnknown ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileUnknown" ,
ID : StorageFileUnknownTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileUnknown ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileUnknown#aa963b05 as nil" )
}
b .PutID (StorageFileUnknownTypeID )
return f .EncodeBare (b )
}
func (f *StorageFileUnknown ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileUnknown#aa963b05 as nil" )
}
return nil
}
func (f *StorageFileUnknown ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileUnknown#aa963b05 to nil" )
}
if err := b .ConsumeID (StorageFileUnknownTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileUnknown#aa963b05: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileUnknown ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileUnknown#aa963b05 to nil" )
}
return nil
}
type StorageFilePartial struct {
}
const StorageFilePartialTypeID = 0x40bc6f52
func (f StorageFilePartial ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFilePartial {}
_ bin .Decoder = &StorageFilePartial {}
_ bin .BareEncoder = &StorageFilePartial {}
_ bin .BareDecoder = &StorageFilePartial {}
_ StorageFileTypeClass = &StorageFilePartial {}
)
func (f *StorageFilePartial ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFilePartial ) String () string {
if f == nil {
return "StorageFilePartial(nil)"
}
type Alias StorageFilePartial
return fmt .Sprintf ("StorageFilePartial%+v" , Alias (*f ))
}
func (*StorageFilePartial ) TypeID () uint32 {
return StorageFilePartialTypeID
}
func (*StorageFilePartial ) TypeName () string {
return "storage.filePartial"
}
func (f *StorageFilePartial ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.filePartial" ,
ID : StorageFilePartialTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFilePartial ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.filePartial#40bc6f52 as nil" )
}
b .PutID (StorageFilePartialTypeID )
return f .EncodeBare (b )
}
func (f *StorageFilePartial ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.filePartial#40bc6f52 as nil" )
}
return nil
}
func (f *StorageFilePartial ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.filePartial#40bc6f52 to nil" )
}
if err := b .ConsumeID (StorageFilePartialTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.filePartial#40bc6f52: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFilePartial ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.filePartial#40bc6f52 to nil" )
}
return nil
}
type StorageFileJpeg struct {
}
const StorageFileJpegTypeID = 0x7efe0e
func (f StorageFileJpeg ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileJpeg {}
_ bin .Decoder = &StorageFileJpeg {}
_ bin .BareEncoder = &StorageFileJpeg {}
_ bin .BareDecoder = &StorageFileJpeg {}
_ StorageFileTypeClass = &StorageFileJpeg {}
)
func (f *StorageFileJpeg ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileJpeg ) String () string {
if f == nil {
return "StorageFileJpeg(nil)"
}
type Alias StorageFileJpeg
return fmt .Sprintf ("StorageFileJpeg%+v" , Alias (*f ))
}
func (*StorageFileJpeg ) TypeID () uint32 {
return StorageFileJpegTypeID
}
func (*StorageFileJpeg ) TypeName () string {
return "storage.fileJpeg"
}
func (f *StorageFileJpeg ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileJpeg" ,
ID : StorageFileJpegTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileJpeg ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileJpeg#7efe0e as nil" )
}
b .PutID (StorageFileJpegTypeID )
return f .EncodeBare (b )
}
func (f *StorageFileJpeg ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileJpeg#7efe0e as nil" )
}
return nil
}
func (f *StorageFileJpeg ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileJpeg#7efe0e to nil" )
}
if err := b .ConsumeID (StorageFileJpegTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileJpeg#7efe0e: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileJpeg ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileJpeg#7efe0e to nil" )
}
return nil
}
type StorageFileGif struct {
}
const StorageFileGifTypeID = 0xcae1aadf
func (f StorageFileGif ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileGif {}
_ bin .Decoder = &StorageFileGif {}
_ bin .BareEncoder = &StorageFileGif {}
_ bin .BareDecoder = &StorageFileGif {}
_ StorageFileTypeClass = &StorageFileGif {}
)
func (f *StorageFileGif ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileGif ) String () string {
if f == nil {
return "StorageFileGif(nil)"
}
type Alias StorageFileGif
return fmt .Sprintf ("StorageFileGif%+v" , Alias (*f ))
}
func (*StorageFileGif ) TypeID () uint32 {
return StorageFileGifTypeID
}
func (*StorageFileGif ) TypeName () string {
return "storage.fileGif"
}
func (f *StorageFileGif ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileGif" ,
ID : StorageFileGifTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileGif ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileGif#cae1aadf as nil" )
}
b .PutID (StorageFileGifTypeID )
return f .EncodeBare (b )
}
func (f *StorageFileGif ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileGif#cae1aadf as nil" )
}
return nil
}
func (f *StorageFileGif ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileGif#cae1aadf to nil" )
}
if err := b .ConsumeID (StorageFileGifTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileGif#cae1aadf: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileGif ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileGif#cae1aadf to nil" )
}
return nil
}
type StorageFilePng struct {
}
const StorageFilePngTypeID = 0xa4f63c0
func (f StorageFilePng ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFilePng {}
_ bin .Decoder = &StorageFilePng {}
_ bin .BareEncoder = &StorageFilePng {}
_ bin .BareDecoder = &StorageFilePng {}
_ StorageFileTypeClass = &StorageFilePng {}
)
func (f *StorageFilePng ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFilePng ) String () string {
if f == nil {
return "StorageFilePng(nil)"
}
type Alias StorageFilePng
return fmt .Sprintf ("StorageFilePng%+v" , Alias (*f ))
}
func (*StorageFilePng ) TypeID () uint32 {
return StorageFilePngTypeID
}
func (*StorageFilePng ) TypeName () string {
return "storage.filePng"
}
func (f *StorageFilePng ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.filePng" ,
ID : StorageFilePngTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFilePng ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.filePng#a4f63c0 as nil" )
}
b .PutID (StorageFilePngTypeID )
return f .EncodeBare (b )
}
func (f *StorageFilePng ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.filePng#a4f63c0 as nil" )
}
return nil
}
func (f *StorageFilePng ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.filePng#a4f63c0 to nil" )
}
if err := b .ConsumeID (StorageFilePngTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.filePng#a4f63c0: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFilePng ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.filePng#a4f63c0 to nil" )
}
return nil
}
type StorageFilePdf struct {
}
const StorageFilePdfTypeID = 0xae1e508d
func (f StorageFilePdf ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFilePdf {}
_ bin .Decoder = &StorageFilePdf {}
_ bin .BareEncoder = &StorageFilePdf {}
_ bin .BareDecoder = &StorageFilePdf {}
_ StorageFileTypeClass = &StorageFilePdf {}
)
func (f *StorageFilePdf ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFilePdf ) String () string {
if f == nil {
return "StorageFilePdf(nil)"
}
type Alias StorageFilePdf
return fmt .Sprintf ("StorageFilePdf%+v" , Alias (*f ))
}
func (*StorageFilePdf ) TypeID () uint32 {
return StorageFilePdfTypeID
}
func (*StorageFilePdf ) TypeName () string {
return "storage.filePdf"
}
func (f *StorageFilePdf ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.filePdf" ,
ID : StorageFilePdfTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFilePdf ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.filePdf#ae1e508d as nil" )
}
b .PutID (StorageFilePdfTypeID )
return f .EncodeBare (b )
}
func (f *StorageFilePdf ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.filePdf#ae1e508d as nil" )
}
return nil
}
func (f *StorageFilePdf ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.filePdf#ae1e508d to nil" )
}
if err := b .ConsumeID (StorageFilePdfTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.filePdf#ae1e508d: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFilePdf ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.filePdf#ae1e508d to nil" )
}
return nil
}
type StorageFileMp3 struct {
}
const StorageFileMp3TypeID = 0x528a0677
func (f StorageFileMp3 ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileMp3 {}
_ bin .Decoder = &StorageFileMp3 {}
_ bin .BareEncoder = &StorageFileMp3 {}
_ bin .BareDecoder = &StorageFileMp3 {}
_ StorageFileTypeClass = &StorageFileMp3 {}
)
func (f *StorageFileMp3 ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileMp3 ) String () string {
if f == nil {
return "StorageFileMp3(nil)"
}
type Alias StorageFileMp3
return fmt .Sprintf ("StorageFileMp3%+v" , Alias (*f ))
}
func (*StorageFileMp3 ) TypeID () uint32 {
return StorageFileMp3TypeID
}
func (*StorageFileMp3 ) TypeName () string {
return "storage.fileMp3"
}
func (f *StorageFileMp3 ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileMp3" ,
ID : StorageFileMp3TypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileMp3 ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileMp3#528a0677 as nil" )
}
b .PutID (StorageFileMp3TypeID )
return f .EncodeBare (b )
}
func (f *StorageFileMp3 ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileMp3#528a0677 as nil" )
}
return nil
}
func (f *StorageFileMp3 ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileMp3#528a0677 to nil" )
}
if err := b .ConsumeID (StorageFileMp3TypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileMp3#528a0677: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileMp3 ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileMp3#528a0677 to nil" )
}
return nil
}
type StorageFileMov struct {
}
const StorageFileMovTypeID = 0x4b09ebbc
func (f StorageFileMov ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileMov {}
_ bin .Decoder = &StorageFileMov {}
_ bin .BareEncoder = &StorageFileMov {}
_ bin .BareDecoder = &StorageFileMov {}
_ StorageFileTypeClass = &StorageFileMov {}
)
func (f *StorageFileMov ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileMov ) String () string {
if f == nil {
return "StorageFileMov(nil)"
}
type Alias StorageFileMov
return fmt .Sprintf ("StorageFileMov%+v" , Alias (*f ))
}
func (*StorageFileMov ) TypeID () uint32 {
return StorageFileMovTypeID
}
func (*StorageFileMov ) TypeName () string {
return "storage.fileMov"
}
func (f *StorageFileMov ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileMov" ,
ID : StorageFileMovTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileMov ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileMov#4b09ebbc as nil" )
}
b .PutID (StorageFileMovTypeID )
return f .EncodeBare (b )
}
func (f *StorageFileMov ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileMov#4b09ebbc as nil" )
}
return nil
}
func (f *StorageFileMov ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileMov#4b09ebbc to nil" )
}
if err := b .ConsumeID (StorageFileMovTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileMov#4b09ebbc: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileMov ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileMov#4b09ebbc to nil" )
}
return nil
}
type StorageFileMp4 struct {
}
const StorageFileMp4TypeID = 0xb3cea0e4
func (f StorageFileMp4 ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileMp4 {}
_ bin .Decoder = &StorageFileMp4 {}
_ bin .BareEncoder = &StorageFileMp4 {}
_ bin .BareDecoder = &StorageFileMp4 {}
_ StorageFileTypeClass = &StorageFileMp4 {}
)
func (f *StorageFileMp4 ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileMp4 ) String () string {
if f == nil {
return "StorageFileMp4(nil)"
}
type Alias StorageFileMp4
return fmt .Sprintf ("StorageFileMp4%+v" , Alias (*f ))
}
func (*StorageFileMp4 ) TypeID () uint32 {
return StorageFileMp4TypeID
}
func (*StorageFileMp4 ) TypeName () string {
return "storage.fileMp4"
}
func (f *StorageFileMp4 ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileMp4" ,
ID : StorageFileMp4TypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileMp4 ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileMp4#b3cea0e4 as nil" )
}
b .PutID (StorageFileMp4TypeID )
return f .EncodeBare (b )
}
func (f *StorageFileMp4 ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileMp4#b3cea0e4 as nil" )
}
return nil
}
func (f *StorageFileMp4 ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileMp4#b3cea0e4 to nil" )
}
if err := b .ConsumeID (StorageFileMp4TypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileMp4#b3cea0e4: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileMp4 ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileMp4#b3cea0e4 to nil" )
}
return nil
}
type StorageFileWebp struct {
}
const StorageFileWebpTypeID = 0x1081464c
func (f StorageFileWebp ) construct () StorageFileTypeClass { return &f }
var (
_ bin .Encoder = &StorageFileWebp {}
_ bin .Decoder = &StorageFileWebp {}
_ bin .BareEncoder = &StorageFileWebp {}
_ bin .BareDecoder = &StorageFileWebp {}
_ StorageFileTypeClass = &StorageFileWebp {}
)
func (f *StorageFileWebp ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *StorageFileWebp ) String () string {
if f == nil {
return "StorageFileWebp(nil)"
}
type Alias StorageFileWebp
return fmt .Sprintf ("StorageFileWebp%+v" , Alias (*f ))
}
func (*StorageFileWebp ) TypeID () uint32 {
return StorageFileWebpTypeID
}
func (*StorageFileWebp ) TypeName () string {
return "storage.fileWebp"
}
func (f *StorageFileWebp ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "storage.fileWebp" ,
ID : StorageFileWebpTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *StorageFileWebp ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileWebp#1081464c as nil" )
}
b .PutID (StorageFileWebpTypeID )
return f .EncodeBare (b )
}
func (f *StorageFileWebp ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode storage.fileWebp#1081464c as nil" )
}
return nil
}
func (f *StorageFileWebp ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileWebp#1081464c to nil" )
}
if err := b .ConsumeID (StorageFileWebpTypeID ); err != nil {
return fmt .Errorf ("unable to decode storage.fileWebp#1081464c: %w" , err )
}
return f .DecodeBare (b )
}
func (f *StorageFileWebp ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode storage.fileWebp#1081464c to nil" )
}
return nil
}
const StorageFileTypeClassName = "storage.FileType"
type StorageFileTypeClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () StorageFileTypeClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeStorageFileType (buf *bin .Buffer ) (StorageFileTypeClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case StorageFileUnknownTypeID :
v := StorageFileUnknown {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFilePartialTypeID :
v := StorageFilePartial {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFileJpegTypeID :
v := StorageFileJpeg {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFileGifTypeID :
v := StorageFileGif {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFilePngTypeID :
v := StorageFilePng {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFilePdfTypeID :
v := StorageFilePdf {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFileMp3TypeID :
v := StorageFileMp3 {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFileMovTypeID :
v := StorageFileMov {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFileMp4TypeID :
v := StorageFileMp4 {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
case StorageFileWebpTypeID :
v := StorageFileWebp {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode StorageFileTypeClass: %w" , bin .NewUnexpectedID (id ))
}
}
type StorageFileTypeBox struct {
FileType StorageFileTypeClass
}
func (b *StorageFileTypeBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode StorageFileTypeBox to nil" )
}
v , err := DecodeStorageFileType (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .FileType = v
return nil
}
func (b *StorageFileTypeBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .FileType == nil {
return fmt .Errorf ("unable to encode StorageFileTypeClass as nil" )
}
return b .FileType .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 .