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 UploadGetCDNFileRequest struct {
FileToken []byte
Offset int64
Limit int
}
const UploadGetCDNFileRequestTypeID = 0x395f69da
var (
_ bin .Encoder = &UploadGetCDNFileRequest {}
_ bin .Decoder = &UploadGetCDNFileRequest {}
_ bin .BareEncoder = &UploadGetCDNFileRequest {}
_ bin .BareDecoder = &UploadGetCDNFileRequest {}
)
func (g *UploadGetCDNFileRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .FileToken == nil ) {
return false
}
if !(g .Offset == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *UploadGetCDNFileRequest ) String () string {
if g == nil {
return "UploadGetCDNFileRequest(nil)"
}
type Alias UploadGetCDNFileRequest
return fmt .Sprintf ("UploadGetCDNFileRequest%+v" , Alias (*g ))
}
func (g *UploadGetCDNFileRequest ) FillFrom (from interface {
GetFileToken () (value []byte )
GetOffset () (value int64 )
GetLimit () (value int )
}) {
g .FileToken = from .GetFileToken ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*UploadGetCDNFileRequest ) TypeID () uint32 {
return UploadGetCDNFileRequestTypeID
}
func (*UploadGetCDNFileRequest ) TypeName () string {
return "upload.getCdnFile"
}
func (g *UploadGetCDNFileRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "upload.getCdnFile" ,
ID : UploadGetCDNFileRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FileToken" ,
SchemaName : "file_token" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *UploadGetCDNFileRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode upload.getCdnFile#395f69da as nil" )
}
b .PutID (UploadGetCDNFileRequestTypeID )
return g .EncodeBare (b )
}
func (g *UploadGetCDNFileRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode upload.getCdnFile#395f69da as nil" )
}
b .PutBytes (g .FileToken )
b .PutLong (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *UploadGetCDNFileRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode upload.getCdnFile#395f69da to nil" )
}
if err := b .ConsumeID (UploadGetCDNFileRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode upload.getCdnFile#395f69da: %w" , err )
}
return g .DecodeBare (b )
}
func (g *UploadGetCDNFileRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode upload.getCdnFile#395f69da to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode upload.getCdnFile#395f69da: field file_token: %w" , err )
}
g .FileToken = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode upload.getCdnFile#395f69da: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode upload.getCdnFile#395f69da: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *UploadGetCDNFileRequest ) GetFileToken () (value []byte ) {
if g == nil {
return
}
return g .FileToken
}
func (g *UploadGetCDNFileRequest ) GetOffset () (value int64 ) {
if g == nil {
return
}
return g .Offset
}
func (g *UploadGetCDNFileRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) UploadGetCDNFile (ctx context .Context , request *UploadGetCDNFileRequest ) (UploadCDNFileClass , error ) {
var result UploadCDNFileBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .CdnFile , 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 .