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 BotsGetRequestedWebViewButtonRequest struct {
Bot InputUserClass
WebappReqID string
}
const BotsGetRequestedWebViewButtonRequestTypeID = 0xbf25b7f3
var (
_ bin .Encoder = &BotsGetRequestedWebViewButtonRequest {}
_ bin .Decoder = &BotsGetRequestedWebViewButtonRequest {}
_ bin .BareEncoder = &BotsGetRequestedWebViewButtonRequest {}
_ bin .BareDecoder = &BotsGetRequestedWebViewButtonRequest {}
)
func (g *BotsGetRequestedWebViewButtonRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Bot == nil ) {
return false
}
if !(g .WebappReqID == "" ) {
return false
}
return true
}
func (g *BotsGetRequestedWebViewButtonRequest ) String () string {
if g == nil {
return "BotsGetRequestedWebViewButtonRequest(nil)"
}
type Alias BotsGetRequestedWebViewButtonRequest
return fmt .Sprintf ("BotsGetRequestedWebViewButtonRequest%+v" , Alias (*g ))
}
func (g *BotsGetRequestedWebViewButtonRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
GetWebappReqID () (value string )
}) {
g .Bot = from .GetBot ()
g .WebappReqID = from .GetWebappReqID ()
}
func (*BotsGetRequestedWebViewButtonRequest ) TypeID () uint32 {
return BotsGetRequestedWebViewButtonRequestTypeID
}
func (*BotsGetRequestedWebViewButtonRequest ) TypeName () string {
return "bots.getRequestedWebViewButton"
}
func (g *BotsGetRequestedWebViewButtonRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.getRequestedWebViewButton" ,
ID : BotsGetRequestedWebViewButtonRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "WebappReqID" ,
SchemaName : "webapp_req_id" ,
},
}
return typ
}
func (g *BotsGetRequestedWebViewButtonRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode bots.getRequestedWebViewButton#bf25b7f3 as nil" )
}
b .PutID (BotsGetRequestedWebViewButtonRequestTypeID )
return g .EncodeBare (b )
}
func (g *BotsGetRequestedWebViewButtonRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode bots.getRequestedWebViewButton#bf25b7f3 as nil" )
}
if g .Bot == nil {
return fmt .Errorf ("unable to encode bots.getRequestedWebViewButton#bf25b7f3: field bot is nil" )
}
if err := g .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.getRequestedWebViewButton#bf25b7f3: field bot: %w" , err )
}
b .PutString (g .WebappReqID )
return nil
}
func (g *BotsGetRequestedWebViewButtonRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode bots.getRequestedWebViewButton#bf25b7f3 to nil" )
}
if err := b .ConsumeID (BotsGetRequestedWebViewButtonRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.getRequestedWebViewButton#bf25b7f3: %w" , err )
}
return g .DecodeBare (b )
}
func (g *BotsGetRequestedWebViewButtonRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode bots.getRequestedWebViewButton#bf25b7f3 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.getRequestedWebViewButton#bf25b7f3: field bot: %w" , err )
}
g .Bot = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.getRequestedWebViewButton#bf25b7f3: field webapp_req_id: %w" , err )
}
g .WebappReqID = value
}
return nil
}
func (g *BotsGetRequestedWebViewButtonRequest ) GetBot () (value InputUserClass ) {
if g == nil {
return
}
return g .Bot
}
func (g *BotsGetRequestedWebViewButtonRequest ) GetWebappReqID () (value string ) {
if g == nil {
return
}
return g .WebappReqID
}
func (c *Client ) BotsGetRequestedWebViewButton (ctx context .Context , request *BotsGetRequestedWebViewButtonRequest ) (KeyboardButtonClass , error ) {
var result KeyboardButtonBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .KeyboardButton , 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 .