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 InputEncryptedFileEmpty struct {
}
const InputEncryptedFileEmptyTypeID = 0x1837c364
func (i InputEncryptedFileEmpty ) construct () InputEncryptedFileClass { return &i }
var (
_ bin .Encoder = &InputEncryptedFileEmpty {}
_ bin .Decoder = &InputEncryptedFileEmpty {}
_ bin .BareEncoder = &InputEncryptedFileEmpty {}
_ bin .BareDecoder = &InputEncryptedFileEmpty {}
_ InputEncryptedFileClass = &InputEncryptedFileEmpty {}
)
func (i *InputEncryptedFileEmpty ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputEncryptedFileEmpty ) String () string {
if i == nil {
return "InputEncryptedFileEmpty(nil)"
}
type Alias InputEncryptedFileEmpty
return fmt .Sprintf ("InputEncryptedFileEmpty%+v" , Alias (*i ))
}
func (*InputEncryptedFileEmpty ) TypeID () uint32 {
return InputEncryptedFileEmptyTypeID
}
func (*InputEncryptedFileEmpty ) TypeName () string {
return "inputEncryptedFileEmpty"
}
func (i *InputEncryptedFileEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputEncryptedFileEmpty" ,
ID : InputEncryptedFileEmptyTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputEncryptedFileEmpty ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFileEmpty#1837c364 as nil" )
}
b .PutID (InputEncryptedFileEmptyTypeID )
return i .EncodeBare (b )
}
func (i *InputEncryptedFileEmpty ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFileEmpty#1837c364 as nil" )
}
return nil
}
func (i *InputEncryptedFileEmpty ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFileEmpty#1837c364 to nil" )
}
if err := b .ConsumeID (InputEncryptedFileEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileEmpty#1837c364: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputEncryptedFileEmpty ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFileEmpty#1837c364 to nil" )
}
return nil
}
type InputEncryptedFileUploaded struct {
ID int64
Parts int
MD5Checksum string
KeyFingerprint int
}
const InputEncryptedFileUploadedTypeID = 0x64bd0306
func (i InputEncryptedFileUploaded ) construct () InputEncryptedFileClass { return &i }
var (
_ bin .Encoder = &InputEncryptedFileUploaded {}
_ bin .Decoder = &InputEncryptedFileUploaded {}
_ bin .BareEncoder = &InputEncryptedFileUploaded {}
_ bin .BareDecoder = &InputEncryptedFileUploaded {}
_ InputEncryptedFileClass = &InputEncryptedFileUploaded {}
)
func (i *InputEncryptedFileUploaded ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == 0 ) {
return false
}
if !(i .Parts == 0 ) {
return false
}
if !(i .MD5Checksum == "" ) {
return false
}
if !(i .KeyFingerprint == 0 ) {
return false
}
return true
}
func (i *InputEncryptedFileUploaded ) String () string {
if i == nil {
return "InputEncryptedFileUploaded(nil)"
}
type Alias InputEncryptedFileUploaded
return fmt .Sprintf ("InputEncryptedFileUploaded%+v" , Alias (*i ))
}
func (i *InputEncryptedFileUploaded ) FillFrom (from interface {
GetID () (value int64 )
GetParts () (value int )
GetMD5Checksum () (value string )
GetKeyFingerprint () (value int )
}) {
i .ID = from .GetID ()
i .Parts = from .GetParts ()
i .MD5Checksum = from .GetMD5Checksum ()
i .KeyFingerprint = from .GetKeyFingerprint ()
}
func (*InputEncryptedFileUploaded ) TypeID () uint32 {
return InputEncryptedFileUploadedTypeID
}
func (*InputEncryptedFileUploaded ) TypeName () string {
return "inputEncryptedFileUploaded"
}
func (i *InputEncryptedFileUploaded ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputEncryptedFileUploaded" ,
ID : InputEncryptedFileUploadedTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Parts" ,
SchemaName : "parts" ,
},
{
Name : "MD5Checksum" ,
SchemaName : "md5_checksum" ,
},
{
Name : "KeyFingerprint" ,
SchemaName : "key_fingerprint" ,
},
}
return typ
}
func (i *InputEncryptedFileUploaded ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFileUploaded#64bd0306 as nil" )
}
b .PutID (InputEncryptedFileUploadedTypeID )
return i .EncodeBare (b )
}
func (i *InputEncryptedFileUploaded ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFileUploaded#64bd0306 as nil" )
}
b .PutLong (i .ID )
b .PutInt (i .Parts )
b .PutString (i .MD5Checksum )
b .PutInt (i .KeyFingerprint )
return nil
}
func (i *InputEncryptedFileUploaded ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFileUploaded#64bd0306 to nil" )
}
if err := b .ConsumeID (InputEncryptedFileUploadedTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileUploaded#64bd0306: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputEncryptedFileUploaded ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFileUploaded#64bd0306 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileUploaded#64bd0306: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileUploaded#64bd0306: field parts: %w" , err )
}
i .Parts = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileUploaded#64bd0306: field md5_checksum: %w" , err )
}
i .MD5Checksum = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileUploaded#64bd0306: field key_fingerprint: %w" , err )
}
i .KeyFingerprint = value
}
return nil
}
func (i *InputEncryptedFileUploaded ) GetID () (value int64 ) {
if i == nil {
return
}
return i .ID
}
func (i *InputEncryptedFileUploaded ) GetParts () (value int ) {
if i == nil {
return
}
return i .Parts
}
func (i *InputEncryptedFileUploaded ) GetMD5Checksum () (value string ) {
if i == nil {
return
}
return i .MD5Checksum
}
func (i *InputEncryptedFileUploaded ) GetKeyFingerprint () (value int ) {
if i == nil {
return
}
return i .KeyFingerprint
}
type InputEncryptedFile struct {
ID int64
AccessHash int64
}
const InputEncryptedFileTypeID = 0x5a17b5e5
func (i InputEncryptedFile ) construct () InputEncryptedFileClass { return &i }
var (
_ bin .Encoder = &InputEncryptedFile {}
_ bin .Decoder = &InputEncryptedFile {}
_ bin .BareEncoder = &InputEncryptedFile {}
_ bin .BareDecoder = &InputEncryptedFile {}
_ InputEncryptedFileClass = &InputEncryptedFile {}
)
func (i *InputEncryptedFile ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == 0 ) {
return false
}
if !(i .AccessHash == 0 ) {
return false
}
return true
}
func (i *InputEncryptedFile ) String () string {
if i == nil {
return "InputEncryptedFile(nil)"
}
type Alias InputEncryptedFile
return fmt .Sprintf ("InputEncryptedFile%+v" , Alias (*i ))
}
func (i *InputEncryptedFile ) FillFrom (from interface {
GetID () (value int64 )
GetAccessHash () (value int64 )
}) {
i .ID = from .GetID ()
i .AccessHash = from .GetAccessHash ()
}
func (*InputEncryptedFile ) TypeID () uint32 {
return InputEncryptedFileTypeID
}
func (*InputEncryptedFile ) TypeName () string {
return "inputEncryptedFile"
}
func (i *InputEncryptedFile ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputEncryptedFile" ,
ID : InputEncryptedFileTypeID ,
}
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 *InputEncryptedFile ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFile#5a17b5e5 as nil" )
}
b .PutID (InputEncryptedFileTypeID )
return i .EncodeBare (b )
}
func (i *InputEncryptedFile ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFile#5a17b5e5 as nil" )
}
b .PutLong (i .ID )
b .PutLong (i .AccessHash )
return nil
}
func (i *InputEncryptedFile ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFile#5a17b5e5 to nil" )
}
if err := b .ConsumeID (InputEncryptedFileTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFile#5a17b5e5: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputEncryptedFile ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFile#5a17b5e5 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFile#5a17b5e5: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFile#5a17b5e5: field access_hash: %w" , err )
}
i .AccessHash = value
}
return nil
}
func (i *InputEncryptedFile ) GetID () (value int64 ) {
if i == nil {
return
}
return i .ID
}
func (i *InputEncryptedFile ) GetAccessHash () (value int64 ) {
if i == nil {
return
}
return i .AccessHash
}
type InputEncryptedFileBigUploaded struct {
ID int64
Parts int
KeyFingerprint int
}
const InputEncryptedFileBigUploadedTypeID = 0x2dc173c8
func (i InputEncryptedFileBigUploaded ) construct () InputEncryptedFileClass { return &i }
var (
_ bin .Encoder = &InputEncryptedFileBigUploaded {}
_ bin .Decoder = &InputEncryptedFileBigUploaded {}
_ bin .BareEncoder = &InputEncryptedFileBigUploaded {}
_ bin .BareDecoder = &InputEncryptedFileBigUploaded {}
_ InputEncryptedFileClass = &InputEncryptedFileBigUploaded {}
)
func (i *InputEncryptedFileBigUploaded ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == 0 ) {
return false
}
if !(i .Parts == 0 ) {
return false
}
if !(i .KeyFingerprint == 0 ) {
return false
}
return true
}
func (i *InputEncryptedFileBigUploaded ) String () string {
if i == nil {
return "InputEncryptedFileBigUploaded(nil)"
}
type Alias InputEncryptedFileBigUploaded
return fmt .Sprintf ("InputEncryptedFileBigUploaded%+v" , Alias (*i ))
}
func (i *InputEncryptedFileBigUploaded ) FillFrom (from interface {
GetID () (value int64 )
GetParts () (value int )
GetKeyFingerprint () (value int )
}) {
i .ID = from .GetID ()
i .Parts = from .GetParts ()
i .KeyFingerprint = from .GetKeyFingerprint ()
}
func (*InputEncryptedFileBigUploaded ) TypeID () uint32 {
return InputEncryptedFileBigUploadedTypeID
}
func (*InputEncryptedFileBigUploaded ) TypeName () string {
return "inputEncryptedFileBigUploaded"
}
func (i *InputEncryptedFileBigUploaded ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputEncryptedFileBigUploaded" ,
ID : InputEncryptedFileBigUploadedTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Parts" ,
SchemaName : "parts" ,
},
{
Name : "KeyFingerprint" ,
SchemaName : "key_fingerprint" ,
},
}
return typ
}
func (i *InputEncryptedFileBigUploaded ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFileBigUploaded#2dc173c8 as nil" )
}
b .PutID (InputEncryptedFileBigUploadedTypeID )
return i .EncodeBare (b )
}
func (i *InputEncryptedFileBigUploaded ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputEncryptedFileBigUploaded#2dc173c8 as nil" )
}
b .PutLong (i .ID )
b .PutInt (i .Parts )
b .PutInt (i .KeyFingerprint )
return nil
}
func (i *InputEncryptedFileBigUploaded ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFileBigUploaded#2dc173c8 to nil" )
}
if err := b .ConsumeID (InputEncryptedFileBigUploadedTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileBigUploaded#2dc173c8: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputEncryptedFileBigUploaded ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputEncryptedFileBigUploaded#2dc173c8 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileBigUploaded#2dc173c8: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileBigUploaded#2dc173c8: field parts: %w" , err )
}
i .Parts = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputEncryptedFileBigUploaded#2dc173c8: field key_fingerprint: %w" , err )
}
i .KeyFingerprint = value
}
return nil
}
func (i *InputEncryptedFileBigUploaded ) GetID () (value int64 ) {
if i == nil {
return
}
return i .ID
}
func (i *InputEncryptedFileBigUploaded ) GetParts () (value int ) {
if i == nil {
return
}
return i .Parts
}
func (i *InputEncryptedFileBigUploaded ) GetKeyFingerprint () (value int ) {
if i == nil {
return
}
return i .KeyFingerprint
}
const InputEncryptedFileClassName = "InputEncryptedFile"
type InputEncryptedFileClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputEncryptedFileClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsNotEmpty () (NotEmptyInputEncryptedFile , bool )
}
func (i *InputEncryptedFile ) AsInputEncryptedFileLocation () *InputEncryptedFileLocation {
value := new (InputEncryptedFileLocation )
value .ID = i .GetID ()
value .AccessHash = i .GetAccessHash ()
return value
}
type NotEmptyInputEncryptedFile interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputEncryptedFileClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value int64 )
}
func (i *InputEncryptedFileEmpty ) AsNotEmpty () (NotEmptyInputEncryptedFile , bool ) {
value , ok := (InputEncryptedFileClass (i )).(NotEmptyInputEncryptedFile )
return value , ok
}
func (i *InputEncryptedFileUploaded ) AsNotEmpty () (NotEmptyInputEncryptedFile , bool ) {
value , ok := (InputEncryptedFileClass (i )).(NotEmptyInputEncryptedFile )
return value , ok
}
func (i *InputEncryptedFile ) AsNotEmpty () (NotEmptyInputEncryptedFile , bool ) {
value , ok := (InputEncryptedFileClass (i )).(NotEmptyInputEncryptedFile )
return value , ok
}
func (i *InputEncryptedFileBigUploaded ) AsNotEmpty () (NotEmptyInputEncryptedFile , bool ) {
value , ok := (InputEncryptedFileClass (i )).(NotEmptyInputEncryptedFile )
return value , ok
}
func DecodeInputEncryptedFile (buf *bin .Buffer ) (InputEncryptedFileClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputEncryptedFileEmptyTypeID :
v := InputEncryptedFileEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputEncryptedFileClass: %w" , err )
}
return &v , nil
case InputEncryptedFileUploadedTypeID :
v := InputEncryptedFileUploaded {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputEncryptedFileClass: %w" , err )
}
return &v , nil
case InputEncryptedFileTypeID :
v := InputEncryptedFile {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputEncryptedFileClass: %w" , err )
}
return &v , nil
case InputEncryptedFileBigUploadedTypeID :
v := InputEncryptedFileBigUploaded {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputEncryptedFileClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputEncryptedFileClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputEncryptedFileBox struct {
InputEncryptedFile InputEncryptedFileClass
}
func (b *InputEncryptedFileBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputEncryptedFileBox to nil" )
}
v , err := DecodeInputEncryptedFile (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputEncryptedFile = v
return nil
}
func (b *InputEncryptedFileBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputEncryptedFile == nil {
return fmt .Errorf ("unable to encode InputEncryptedFileClass as nil" )
}
return b .InputEncryptedFile .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 .