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 BotsSendCustomRequestRequest struct {
CustomMethod string
Params DataJSON
}
const BotsSendCustomRequestRequestTypeID = 0xaa2769ed
var (
_ bin .Encoder = &BotsSendCustomRequestRequest {}
_ bin .Decoder = &BotsSendCustomRequestRequest {}
_ bin .BareEncoder = &BotsSendCustomRequestRequest {}
_ bin .BareDecoder = &BotsSendCustomRequestRequest {}
)
func (s *BotsSendCustomRequestRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .CustomMethod == "" ) {
return false
}
if !(s .Params .Zero ()) {
return false
}
return true
}
func (s *BotsSendCustomRequestRequest ) String () string {
if s == nil {
return "BotsSendCustomRequestRequest(nil)"
}
type Alias BotsSendCustomRequestRequest
return fmt .Sprintf ("BotsSendCustomRequestRequest%+v" , Alias (*s ))
}
func (s *BotsSendCustomRequestRequest ) FillFrom (from interface {
GetCustomMethod () (value string )
GetParams () (value DataJSON )
}) {
s .CustomMethod = from .GetCustomMethod ()
s .Params = from .GetParams ()
}
func (*BotsSendCustomRequestRequest ) TypeID () uint32 {
return BotsSendCustomRequestRequestTypeID
}
func (*BotsSendCustomRequestRequest ) TypeName () string {
return "bots.sendCustomRequest"
}
func (s *BotsSendCustomRequestRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.sendCustomRequest" ,
ID : BotsSendCustomRequestRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "CustomMethod" ,
SchemaName : "custom_method" ,
},
{
Name : "Params" ,
SchemaName : "params" ,
},
}
return typ
}
func (s *BotsSendCustomRequestRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.sendCustomRequest#aa2769ed as nil" )
}
b .PutID (BotsSendCustomRequestRequestTypeID )
return s .EncodeBare (b )
}
func (s *BotsSendCustomRequestRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.sendCustomRequest#aa2769ed as nil" )
}
b .PutString (s .CustomMethod )
if err := s .Params .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.sendCustomRequest#aa2769ed: field params: %w" , err )
}
return nil
}
func (s *BotsSendCustomRequestRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.sendCustomRequest#aa2769ed to nil" )
}
if err := b .ConsumeID (BotsSendCustomRequestRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.sendCustomRequest#aa2769ed: %w" , err )
}
return s .DecodeBare (b )
}
func (s *BotsSendCustomRequestRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.sendCustomRequest#aa2769ed to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.sendCustomRequest#aa2769ed: field custom_method: %w" , err )
}
s .CustomMethod = value
}
{
if err := s .Params .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode bots.sendCustomRequest#aa2769ed: field params: %w" , err )
}
}
return nil
}
func (s *BotsSendCustomRequestRequest ) GetCustomMethod () (value string ) {
if s == nil {
return
}
return s .CustomMethod
}
func (s *BotsSendCustomRequestRequest ) GetParams () (value DataJSON ) {
if s == nil {
return
}
return s .Params
}
func (c *Client ) BotsSendCustomRequest (ctx context .Context , request *BotsSendCustomRequestRequest ) (*DataJSON , error ) {
var result DataJSON
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 .