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 BotsCheckDownloadFileParamsRequest struct {
Bot InputUserClass
FileName string
URL string
}
const BotsCheckDownloadFileParamsRequestTypeID = 0x50077589
var (
_ bin .Encoder = &BotsCheckDownloadFileParamsRequest {}
_ bin .Decoder = &BotsCheckDownloadFileParamsRequest {}
_ bin .BareEncoder = &BotsCheckDownloadFileParamsRequest {}
_ bin .BareDecoder = &BotsCheckDownloadFileParamsRequest {}
)
func (c *BotsCheckDownloadFileParamsRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Bot == nil ) {
return false
}
if !(c .FileName == "" ) {
return false
}
if !(c .URL == "" ) {
return false
}
return true
}
func (c *BotsCheckDownloadFileParamsRequest ) String () string {
if c == nil {
return "BotsCheckDownloadFileParamsRequest(nil)"
}
type Alias BotsCheckDownloadFileParamsRequest
return fmt .Sprintf ("BotsCheckDownloadFileParamsRequest%+v" , Alias (*c ))
}
func (c *BotsCheckDownloadFileParamsRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
GetFileName () (value string )
GetURL () (value string )
}) {
c .Bot = from .GetBot ()
c .FileName = from .GetFileName ()
c .URL = from .GetURL ()
}
func (*BotsCheckDownloadFileParamsRequest ) TypeID () uint32 {
return BotsCheckDownloadFileParamsRequestTypeID
}
func (*BotsCheckDownloadFileParamsRequest ) TypeName () string {
return "bots.checkDownloadFileParams"
}
func (c *BotsCheckDownloadFileParamsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.checkDownloadFileParams" ,
ID : BotsCheckDownloadFileParamsRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "FileName" ,
SchemaName : "file_name" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (c *BotsCheckDownloadFileParamsRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode bots.checkDownloadFileParams#50077589 as nil" )
}
b .PutID (BotsCheckDownloadFileParamsRequestTypeID )
return c .EncodeBare (b )
}
func (c *BotsCheckDownloadFileParamsRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode bots.checkDownloadFileParams#50077589 as nil" )
}
if c .Bot == nil {
return fmt .Errorf ("unable to encode bots.checkDownloadFileParams#50077589: field bot is nil" )
}
if err := c .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.checkDownloadFileParams#50077589: field bot: %w" , err )
}
b .PutString (c .FileName )
b .PutString (c .URL )
return nil
}
func (c *BotsCheckDownloadFileParamsRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode bots.checkDownloadFileParams#50077589 to nil" )
}
if err := b .ConsumeID (BotsCheckDownloadFileParamsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.checkDownloadFileParams#50077589: %w" , err )
}
return c .DecodeBare (b )
}
func (c *BotsCheckDownloadFileParamsRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode bots.checkDownloadFileParams#50077589 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.checkDownloadFileParams#50077589: field bot: %w" , err )
}
c .Bot = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.checkDownloadFileParams#50077589: field file_name: %w" , err )
}
c .FileName = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.checkDownloadFileParams#50077589: field url: %w" , err )
}
c .URL = value
}
return nil
}
func (c *BotsCheckDownloadFileParamsRequest ) GetBot () (value InputUserClass ) {
if c == nil {
return
}
return c .Bot
}
func (c *BotsCheckDownloadFileParamsRequest ) GetFileName () (value string ) {
if c == nil {
return
}
return c .FileName
}
func (c *BotsCheckDownloadFileParamsRequest ) GetURL () (value string ) {
if c == nil {
return
}
return c .URL
}
func (c *Client ) BotsCheckDownloadFileParams (ctx context .Context , request *BotsCheckDownloadFileParamsRequest ) (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.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .