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