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 UploadGetWebFileRequest struct {
Location InputWebFileLocationClass
Offset int
Limit int
}
const UploadGetWebFileRequestTypeID = 0x24e6818d
var (
_ bin .Encoder = &UploadGetWebFileRequest {}
_ bin .Decoder = &UploadGetWebFileRequest {}
_ bin .BareEncoder = &UploadGetWebFileRequest {}
_ bin .BareDecoder = &UploadGetWebFileRequest {}
)
func (g *UploadGetWebFileRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Location == nil ) {
return false
}
if !(g .Offset == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *UploadGetWebFileRequest ) String () string {
if g == nil {
return "UploadGetWebFileRequest(nil)"
}
type Alias UploadGetWebFileRequest
return fmt .Sprintf ("UploadGetWebFileRequest%+v" , Alias (*g ))
}
func (g *UploadGetWebFileRequest ) FillFrom (from interface {
GetLocation () (value InputWebFileLocationClass )
GetOffset () (value int )
GetLimit () (value int )
}) {
g .Location = from .GetLocation ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*UploadGetWebFileRequest ) TypeID () uint32 {
return UploadGetWebFileRequestTypeID
}
func (*UploadGetWebFileRequest ) TypeName () string {
return "upload.getWebFile"
}
func (g *UploadGetWebFileRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "upload.getWebFile" ,
ID : UploadGetWebFileRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Location" ,
SchemaName : "location" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *UploadGetWebFileRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode upload.getWebFile#24e6818d as nil" )
}
b .PutID (UploadGetWebFileRequestTypeID )
return g .EncodeBare (b )
}
func (g *UploadGetWebFileRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode upload.getWebFile#24e6818d as nil" )
}
if g .Location == nil {
return fmt .Errorf ("unable to encode upload.getWebFile#24e6818d: field location is nil" )
}
if err := g .Location .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode upload.getWebFile#24e6818d: field location: %w" , err )
}
b .PutInt (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *UploadGetWebFileRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode upload.getWebFile#24e6818d to nil" )
}
if err := b .ConsumeID (UploadGetWebFileRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode upload.getWebFile#24e6818d: %w" , err )
}
return g .DecodeBare (b )
}
func (g *UploadGetWebFileRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode upload.getWebFile#24e6818d to nil" )
}
{
value , err := DecodeInputWebFileLocation (b )
if err != nil {
return fmt .Errorf ("unable to decode upload.getWebFile#24e6818d: field location: %w" , err )
}
g .Location = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode upload.getWebFile#24e6818d: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode upload.getWebFile#24e6818d: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *UploadGetWebFileRequest ) GetLocation () (value InputWebFileLocationClass ) {
if g == nil {
return
}
return g .Location
}
func (g *UploadGetWebFileRequest ) GetOffset () (value int ) {
if g == nil {
return
}
return g .Offset
}
func (g *UploadGetWebFileRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) UploadGetWebFile (ctx context .Context , request *UploadGetWebFileRequest ) (*UploadWebFile , error ) {
var result UploadWebFile
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .