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 UploadSaveBigFilePartRequest struct {
FileID int64
FilePart int
FileTotalParts int
Bytes []byte
}
const UploadSaveBigFilePartRequestTypeID = 0xde7b673d
var (
_ bin .Encoder = &UploadSaveBigFilePartRequest {}
_ bin .Decoder = &UploadSaveBigFilePartRequest {}
_ bin .BareEncoder = &UploadSaveBigFilePartRequest {}
_ bin .BareDecoder = &UploadSaveBigFilePartRequest {}
)
func (s *UploadSaveBigFilePartRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .FileID == 0 ) {
return false
}
if !(s .FilePart == 0 ) {
return false
}
if !(s .FileTotalParts == 0 ) {
return false
}
if !(s .Bytes == nil ) {
return false
}
return true
}
func (s *UploadSaveBigFilePartRequest ) String () string {
if s == nil {
return "UploadSaveBigFilePartRequest(nil)"
}
type Alias UploadSaveBigFilePartRequest
return fmt .Sprintf ("UploadSaveBigFilePartRequest%+v" , Alias (*s ))
}
func (s *UploadSaveBigFilePartRequest ) FillFrom (from interface {
GetFileID () (value int64 )
GetFilePart () (value int )
GetFileTotalParts () (value int )
GetBytes () (value []byte )
}) {
s .FileID = from .GetFileID ()
s .FilePart = from .GetFilePart ()
s .FileTotalParts = from .GetFileTotalParts ()
s .Bytes = from .GetBytes ()
}
func (*UploadSaveBigFilePartRequest ) TypeID () uint32 {
return UploadSaveBigFilePartRequestTypeID
}
func (*UploadSaveBigFilePartRequest ) TypeName () string {
return "upload.saveBigFilePart"
}
func (s *UploadSaveBigFilePartRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "upload.saveBigFilePart" ,
ID : UploadSaveBigFilePartRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FileID" ,
SchemaName : "file_id" ,
},
{
Name : "FilePart" ,
SchemaName : "file_part" ,
},
{
Name : "FileTotalParts" ,
SchemaName : "file_total_parts" ,
},
{
Name : "Bytes" ,
SchemaName : "bytes" ,
},
}
return typ
}
func (s *UploadSaveBigFilePartRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode upload.saveBigFilePart#de7b673d as nil" )
}
b .PutID (UploadSaveBigFilePartRequestTypeID )
return s .EncodeBare (b )
}
func (s *UploadSaveBigFilePartRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode upload.saveBigFilePart#de7b673d as nil" )
}
b .PutLong (s .FileID )
b .PutInt (s .FilePart )
b .PutInt (s .FileTotalParts )
b .PutBytes (s .Bytes )
return nil
}
func (s *UploadSaveBigFilePartRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode upload.saveBigFilePart#de7b673d to nil" )
}
if err := b .ConsumeID (UploadSaveBigFilePartRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode upload.saveBigFilePart#de7b673d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *UploadSaveBigFilePartRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode upload.saveBigFilePart#de7b673d to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode upload.saveBigFilePart#de7b673d: field file_id: %w" , err )
}
s .FileID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode upload.saveBigFilePart#de7b673d: field file_part: %w" , err )
}
s .FilePart = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode upload.saveBigFilePart#de7b673d: field file_total_parts: %w" , err )
}
s .FileTotalParts = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode upload.saveBigFilePart#de7b673d: field bytes: %w" , err )
}
s .Bytes = value
}
return nil
}
func (s *UploadSaveBigFilePartRequest ) GetFileID () (value int64 ) {
if s == nil {
return
}
return s .FileID
}
func (s *UploadSaveBigFilePartRequest ) GetFilePart () (value int ) {
if s == nil {
return
}
return s .FilePart
}
func (s *UploadSaveBigFilePartRequest ) GetFileTotalParts () (value int ) {
if s == nil {
return
}
return s .FileTotalParts
}
func (s *UploadSaveBigFilePartRequest ) GetBytes () (value []byte ) {
if s == nil {
return
}
return s .Bytes
}
func (c *Client ) UploadSaveBigFilePart (ctx context .Context , request *UploadSaveBigFilePartRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .