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 UploadReuploadCDNFileRequest struct {
FileToken []byte
RequestToken []byte
}
const UploadReuploadCDNFileRequestTypeID = 0x9b2754a8
var (
_ bin .Encoder = &UploadReuploadCDNFileRequest {}
_ bin .Decoder = &UploadReuploadCDNFileRequest {}
_ bin .BareEncoder = &UploadReuploadCDNFileRequest {}
_ bin .BareDecoder = &UploadReuploadCDNFileRequest {}
)
func (r *UploadReuploadCDNFileRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .FileToken == nil ) {
return false
}
if !(r .RequestToken == nil ) {
return false
}
return true
}
func (r *UploadReuploadCDNFileRequest ) String () string {
if r == nil {
return "UploadReuploadCDNFileRequest(nil)"
}
type Alias UploadReuploadCDNFileRequest
return fmt .Sprintf ("UploadReuploadCDNFileRequest%+v" , Alias (*r ))
}
func (r *UploadReuploadCDNFileRequest ) FillFrom (from interface {
GetFileToken () (value []byte )
GetRequestToken () (value []byte )
}) {
r .FileToken = from .GetFileToken ()
r .RequestToken = from .GetRequestToken ()
}
func (*UploadReuploadCDNFileRequest ) TypeID () uint32 {
return UploadReuploadCDNFileRequestTypeID
}
func (*UploadReuploadCDNFileRequest ) TypeName () string {
return "upload.reuploadCdnFile"
}
func (r *UploadReuploadCDNFileRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "upload.reuploadCdnFile" ,
ID : UploadReuploadCDNFileRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FileToken" ,
SchemaName : "file_token" ,
},
{
Name : "RequestToken" ,
SchemaName : "request_token" ,
},
}
return typ
}
func (r *UploadReuploadCDNFileRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode upload.reuploadCdnFile#9b2754a8 as nil" )
}
b .PutID (UploadReuploadCDNFileRequestTypeID )
return r .EncodeBare (b )
}
func (r *UploadReuploadCDNFileRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode upload.reuploadCdnFile#9b2754a8 as nil" )
}
b .PutBytes (r .FileToken )
b .PutBytes (r .RequestToken )
return nil
}
func (r *UploadReuploadCDNFileRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode upload.reuploadCdnFile#9b2754a8 to nil" )
}
if err := b .ConsumeID (UploadReuploadCDNFileRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode upload.reuploadCdnFile#9b2754a8: %w" , err )
}
return r .DecodeBare (b )
}
func (r *UploadReuploadCDNFileRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode upload.reuploadCdnFile#9b2754a8 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode upload.reuploadCdnFile#9b2754a8: field file_token: %w" , err )
}
r .FileToken = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode upload.reuploadCdnFile#9b2754a8: field request_token: %w" , err )
}
r .RequestToken = value
}
return nil
}
func (r *UploadReuploadCDNFileRequest ) GetFileToken () (value []byte ) {
if r == nil {
return
}
return r .FileToken
}
func (r *UploadReuploadCDNFileRequest ) GetRequestToken () (value []byte ) {
if r == nil {
return
}
return r .RequestToken
}
func (c *Client ) UploadReuploadCDNFile (ctx context .Context , request *UploadReuploadCDNFileRequest ) ([]FileHash , error ) {
var result FileHashVector
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []FileHash (result .Elems ), 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 .