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 MessagesSendWebViewDataRequest struct {
Bot InputUserClass
RandomID int64
ButtonText string
Data string
}
const MessagesSendWebViewDataRequestTypeID = 0xdc0242c8
var (
_ bin .Encoder = &MessagesSendWebViewDataRequest {}
_ bin .Decoder = &MessagesSendWebViewDataRequest {}
_ bin .BareEncoder = &MessagesSendWebViewDataRequest {}
_ bin .BareDecoder = &MessagesSendWebViewDataRequest {}
)
func (s *MessagesSendWebViewDataRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Bot == nil ) {
return false
}
if !(s .RandomID == 0 ) {
return false
}
if !(s .ButtonText == "" ) {
return false
}
if !(s .Data == "" ) {
return false
}
return true
}
func (s *MessagesSendWebViewDataRequest ) String () string {
if s == nil {
return "MessagesSendWebViewDataRequest(nil)"
}
type Alias MessagesSendWebViewDataRequest
return fmt .Sprintf ("MessagesSendWebViewDataRequest%+v" , Alias (*s ))
}
func (s *MessagesSendWebViewDataRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
GetRandomID () (value int64 )
GetButtonText () (value string )
GetData () (value string )
}) {
s .Bot = from .GetBot ()
s .RandomID = from .GetRandomID ()
s .ButtonText = from .GetButtonText ()
s .Data = from .GetData ()
}
func (*MessagesSendWebViewDataRequest ) TypeID () uint32 {
return MessagesSendWebViewDataRequestTypeID
}
func (*MessagesSendWebViewDataRequest ) TypeName () string {
return "messages.sendWebViewData"
}
func (s *MessagesSendWebViewDataRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.sendWebViewData" ,
ID : MessagesSendWebViewDataRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "RandomID" ,
SchemaName : "random_id" ,
},
{
Name : "ButtonText" ,
SchemaName : "button_text" ,
},
{
Name : "Data" ,
SchemaName : "data" ,
},
}
return typ
}
func (s *MessagesSendWebViewDataRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendWebViewData#dc0242c8 as nil" )
}
b .PutID (MessagesSendWebViewDataRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSendWebViewDataRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendWebViewData#dc0242c8 as nil" )
}
if s .Bot == nil {
return fmt .Errorf ("unable to encode messages.sendWebViewData#dc0242c8: field bot is nil" )
}
if err := s .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendWebViewData#dc0242c8: field bot: %w" , err )
}
b .PutLong (s .RandomID )
b .PutString (s .ButtonText )
b .PutString (s .Data )
return nil
}
func (s *MessagesSendWebViewDataRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendWebViewData#dc0242c8 to nil" )
}
if err := b .ConsumeID (MessagesSendWebViewDataRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.sendWebViewData#dc0242c8: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSendWebViewDataRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendWebViewData#dc0242c8 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendWebViewData#dc0242c8: field bot: %w" , err )
}
s .Bot = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendWebViewData#dc0242c8: field random_id: %w" , err )
}
s .RandomID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendWebViewData#dc0242c8: field button_text: %w" , err )
}
s .ButtonText = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendWebViewData#dc0242c8: field data: %w" , err )
}
s .Data = value
}
return nil
}
func (s *MessagesSendWebViewDataRequest ) GetBot () (value InputUserClass ) {
if s == nil {
return
}
return s .Bot
}
func (s *MessagesSendWebViewDataRequest ) GetRandomID () (value int64 ) {
if s == nil {
return
}
return s .RandomID
}
func (s *MessagesSendWebViewDataRequest ) GetButtonText () (value string ) {
if s == nil {
return
}
return s .ButtonText
}
func (s *MessagesSendWebViewDataRequest ) GetData () (value string ) {
if s == nil {
return
}
return s .Data
}
func (c *Client ) MessagesSendWebViewData (ctx context .Context , request *MessagesSendWebViewDataRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .