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 MessagesUploadEncryptedFileRequest struct {
Peer InputEncryptedChat
File InputEncryptedFileClass
}
const MessagesUploadEncryptedFileRequestTypeID = 0x5057c497
var (
_ bin .Encoder = &MessagesUploadEncryptedFileRequest {}
_ bin .Decoder = &MessagesUploadEncryptedFileRequest {}
_ bin .BareEncoder = &MessagesUploadEncryptedFileRequest {}
_ bin .BareDecoder = &MessagesUploadEncryptedFileRequest {}
)
func (u *MessagesUploadEncryptedFileRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Peer .Zero ()) {
return false
}
if !(u .File == nil ) {
return false
}
return true
}
func (u *MessagesUploadEncryptedFileRequest ) String () string {
if u == nil {
return "MessagesUploadEncryptedFileRequest(nil)"
}
type Alias MessagesUploadEncryptedFileRequest
return fmt .Sprintf ("MessagesUploadEncryptedFileRequest%+v" , Alias (*u ))
}
func (u *MessagesUploadEncryptedFileRequest ) FillFrom (from interface {
GetPeer () (value InputEncryptedChat )
GetFile () (value InputEncryptedFileClass )
}) {
u .Peer = from .GetPeer ()
u .File = from .GetFile ()
}
func (*MessagesUploadEncryptedFileRequest ) TypeID () uint32 {
return MessagesUploadEncryptedFileRequestTypeID
}
func (*MessagesUploadEncryptedFileRequest ) TypeName () string {
return "messages.uploadEncryptedFile"
}
func (u *MessagesUploadEncryptedFileRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.uploadEncryptedFile" ,
ID : MessagesUploadEncryptedFileRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "File" ,
SchemaName : "file" ,
},
}
return typ
}
func (u *MessagesUploadEncryptedFileRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode messages.uploadEncryptedFile#5057c497 as nil" )
}
b .PutID (MessagesUploadEncryptedFileRequestTypeID )
return u .EncodeBare (b )
}
func (u *MessagesUploadEncryptedFileRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode messages.uploadEncryptedFile#5057c497 as nil" )
}
if err := u .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.uploadEncryptedFile#5057c497: field peer: %w" , err )
}
if u .File == nil {
return fmt .Errorf ("unable to encode messages.uploadEncryptedFile#5057c497: field file is nil" )
}
if err := u .File .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.uploadEncryptedFile#5057c497: field file: %w" , err )
}
return nil
}
func (u *MessagesUploadEncryptedFileRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode messages.uploadEncryptedFile#5057c497 to nil" )
}
if err := b .ConsumeID (MessagesUploadEncryptedFileRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.uploadEncryptedFile#5057c497: %w" , err )
}
return u .DecodeBare (b )
}
func (u *MessagesUploadEncryptedFileRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode messages.uploadEncryptedFile#5057c497 to nil" )
}
{
if err := u .Peer .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.uploadEncryptedFile#5057c497: field peer: %w" , err )
}
}
{
value , err := DecodeInputEncryptedFile (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.uploadEncryptedFile#5057c497: field file: %w" , err )
}
u .File = value
}
return nil
}
func (u *MessagesUploadEncryptedFileRequest ) GetPeer () (value InputEncryptedChat ) {
if u == nil {
return
}
return u .Peer
}
func (u *MessagesUploadEncryptedFileRequest ) GetFile () (value InputEncryptedFileClass ) {
if u == nil {
return
}
return u .File
}
func (u *MessagesUploadEncryptedFileRequest ) GetFileAsNotEmpty () (NotEmptyInputEncryptedFile , bool ) {
return u .File .AsNotEmpty ()
}
func (c *Client ) MessagesUploadEncryptedFile (ctx context .Context , request *MessagesUploadEncryptedFileRequest ) (EncryptedFileClass , error ) {
var result EncryptedFileBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .EncryptedFile , nil
}
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 .