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 MessagesSendBotRequestedPeerRequest struct {
Peer InputPeerClass
MsgID int
ButtonID int
RequestedPeers []InputPeerClass
}
const MessagesSendBotRequestedPeerRequestTypeID = 0x91b2d060
var (
_ bin .Encoder = &MessagesSendBotRequestedPeerRequest {}
_ bin .Decoder = &MessagesSendBotRequestedPeerRequest {}
_ bin .BareEncoder = &MessagesSendBotRequestedPeerRequest {}
_ bin .BareDecoder = &MessagesSendBotRequestedPeerRequest {}
)
func (s *MessagesSendBotRequestedPeerRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer == nil ) {
return false
}
if !(s .MsgID == 0 ) {
return false
}
if !(s .ButtonID == 0 ) {
return false
}
if !(s .RequestedPeers == nil ) {
return false
}
return true
}
func (s *MessagesSendBotRequestedPeerRequest ) String () string {
if s == nil {
return "MessagesSendBotRequestedPeerRequest(nil)"
}
type Alias MessagesSendBotRequestedPeerRequest
return fmt .Sprintf ("MessagesSendBotRequestedPeerRequest%+v" , Alias (*s ))
}
func (s *MessagesSendBotRequestedPeerRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetMsgID () (value int )
GetButtonID () (value int )
GetRequestedPeers () (value []InputPeerClass )
}) {
s .Peer = from .GetPeer ()
s .MsgID = from .GetMsgID ()
s .ButtonID = from .GetButtonID ()
s .RequestedPeers = from .GetRequestedPeers ()
}
func (*MessagesSendBotRequestedPeerRequest ) TypeID () uint32 {
return MessagesSendBotRequestedPeerRequestTypeID
}
func (*MessagesSendBotRequestedPeerRequest ) TypeName () string {
return "messages.sendBotRequestedPeer"
}
func (s *MessagesSendBotRequestedPeerRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.sendBotRequestedPeer" ,
ID : MessagesSendBotRequestedPeerRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
{
Name : "ButtonID" ,
SchemaName : "button_id" ,
},
{
Name : "RequestedPeers" ,
SchemaName : "requested_peers" ,
},
}
return typ
}
func (s *MessagesSendBotRequestedPeerRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendBotRequestedPeer#91b2d060 as nil" )
}
b .PutID (MessagesSendBotRequestedPeerRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSendBotRequestedPeerRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendBotRequestedPeer#91b2d060 as nil" )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.sendBotRequestedPeer#91b2d060: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendBotRequestedPeer#91b2d060: field peer: %w" , err )
}
b .PutInt (s .MsgID )
b .PutInt (s .ButtonID )
b .PutVectorHeader (len (s .RequestedPeers ))
for idx , v := range s .RequestedPeers {
if v == nil {
return fmt .Errorf ("unable to encode messages.sendBotRequestedPeer#91b2d060: field requested_peers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendBotRequestedPeer#91b2d060: field requested_peers element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *MessagesSendBotRequestedPeerRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendBotRequestedPeer#91b2d060 to nil" )
}
if err := b .ConsumeID (MessagesSendBotRequestedPeerRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.sendBotRequestedPeer#91b2d060: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSendBotRequestedPeerRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendBotRequestedPeer#91b2d060 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendBotRequestedPeer#91b2d060: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendBotRequestedPeer#91b2d060: field msg_id: %w" , err )
}
s .MsgID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendBotRequestedPeer#91b2d060: field button_id: %w" , err )
}
s .ButtonID = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendBotRequestedPeer#91b2d060: field requested_peers: %w" , err )
}
if headerLen > 0 {
s .RequestedPeers = make ([]InputPeerClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendBotRequestedPeer#91b2d060: field requested_peers: %w" , err )
}
s .RequestedPeers = append (s .RequestedPeers , value )
}
}
return nil
}
func (s *MessagesSendBotRequestedPeerRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesSendBotRequestedPeerRequest ) GetMsgID () (value int ) {
if s == nil {
return
}
return s .MsgID
}
func (s *MessagesSendBotRequestedPeerRequest ) GetButtonID () (value int ) {
if s == nil {
return
}
return s .ButtonID
}
func (s *MessagesSendBotRequestedPeerRequest ) GetRequestedPeers () (value []InputPeerClass ) {
if s == nil {
return
}
return s .RequestedPeers
}
func (s *MessagesSendBotRequestedPeerRequest ) MapRequestedPeers () (value InputPeerClassArray ) {
return InputPeerClassArray (s .RequestedPeers )
}
func (c *Client ) MessagesSendBotRequestedPeer (ctx context .Context , request *MessagesSendBotRequestedPeerRequest ) (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 .