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 UploadGetFileHashesRequest struct {
Location InputFileLocationClass
Offset int64
}
const UploadGetFileHashesRequestTypeID = 0x9156982a
var (
_ bin .Encoder = &UploadGetFileHashesRequest {}
_ bin .Decoder = &UploadGetFileHashesRequest {}
_ bin .BareEncoder = &UploadGetFileHashesRequest {}
_ bin .BareDecoder = &UploadGetFileHashesRequest {}
)
func (g *UploadGetFileHashesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Location == nil ) {
return false
}
if !(g .Offset == 0 ) {
return false
}
return true
}
func (g *UploadGetFileHashesRequest ) String () string {
if g == nil {
return "UploadGetFileHashesRequest(nil)"
}
type Alias UploadGetFileHashesRequest
return fmt .Sprintf ("UploadGetFileHashesRequest%+v" , Alias (*g ))
}
func (g *UploadGetFileHashesRequest ) FillFrom (from interface {
GetLocation () (value InputFileLocationClass )
GetOffset () (value int64 )
}) {
g .Location = from .GetLocation ()
g .Offset = from .GetOffset ()
}
func (*UploadGetFileHashesRequest ) TypeID () uint32 {
return UploadGetFileHashesRequestTypeID
}
func (*UploadGetFileHashesRequest ) TypeName () string {
return "upload.getFileHashes"
}
func (g *UploadGetFileHashesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "upload.getFileHashes" ,
ID : UploadGetFileHashesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Location" ,
SchemaName : "location" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
}
return typ
}
func (g *UploadGetFileHashesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode upload.getFileHashes#9156982a as nil" )
}
b .PutID (UploadGetFileHashesRequestTypeID )
return g .EncodeBare (b )
}
func (g *UploadGetFileHashesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode upload.getFileHashes#9156982a as nil" )
}
if g .Location == nil {
return fmt .Errorf ("unable to encode upload.getFileHashes#9156982a: field location is nil" )
}
if err := g .Location .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode upload.getFileHashes#9156982a: field location: %w" , err )
}
b .PutLong (g .Offset )
return nil
}
func (g *UploadGetFileHashesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode upload.getFileHashes#9156982a to nil" )
}
if err := b .ConsumeID (UploadGetFileHashesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode upload.getFileHashes#9156982a: %w" , err )
}
return g .DecodeBare (b )
}
func (g *UploadGetFileHashesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode upload.getFileHashes#9156982a to nil" )
}
{
value , err := DecodeInputFileLocation (b )
if err != nil {
return fmt .Errorf ("unable to decode upload.getFileHashes#9156982a: field location: %w" , err )
}
g .Location = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode upload.getFileHashes#9156982a: field offset: %w" , err )
}
g .Offset = value
}
return nil
}
func (g *UploadGetFileHashesRequest ) GetLocation () (value InputFileLocationClass ) {
if g == nil {
return
}
return g .Location
}
func (g *UploadGetFileHashesRequest ) GetOffset () (value int64 ) {
if g == nil {
return
}
return g .Offset
}
func (c *Client ) UploadGetFileHashes (ctx context .Context , request *UploadGetFileHashesRequest ) ([]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 .