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 MessagesSendScheduledMessagesRequest struct {
Peer InputPeerClass
ID []int
}
const MessagesSendScheduledMessagesRequestTypeID = 0xbd38850a
var (
_ bin .Encoder = &MessagesSendScheduledMessagesRequest {}
_ bin .Decoder = &MessagesSendScheduledMessagesRequest {}
_ bin .BareEncoder = &MessagesSendScheduledMessagesRequest {}
_ bin .BareDecoder = &MessagesSendScheduledMessagesRequest {}
)
func (s *MessagesSendScheduledMessagesRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer == nil ) {
return false
}
if !(s .ID == nil ) {
return false
}
return true
}
func (s *MessagesSendScheduledMessagesRequest ) String () string {
if s == nil {
return "MessagesSendScheduledMessagesRequest(nil)"
}
type Alias MessagesSendScheduledMessagesRequest
return fmt .Sprintf ("MessagesSendScheduledMessagesRequest%+v" , Alias (*s ))
}
func (s *MessagesSendScheduledMessagesRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetID () (value []int )
}) {
s .Peer = from .GetPeer ()
s .ID = from .GetID ()
}
func (*MessagesSendScheduledMessagesRequest ) TypeID () uint32 {
return MessagesSendScheduledMessagesRequestTypeID
}
func (*MessagesSendScheduledMessagesRequest ) TypeName () string {
return "messages.sendScheduledMessages"
}
func (s *MessagesSendScheduledMessagesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.sendScheduledMessages" ,
ID : MessagesSendScheduledMessagesRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (s *MessagesSendScheduledMessagesRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendScheduledMessages#bd38850a as nil" )
}
b .PutID (MessagesSendScheduledMessagesRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSendScheduledMessagesRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendScheduledMessages#bd38850a as nil" )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.sendScheduledMessages#bd38850a: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendScheduledMessages#bd38850a: field peer: %w" , err )
}
b .PutVectorHeader (len (s .ID ))
for _ , v := range s .ID {
b .PutInt (v )
}
return nil
}
func (s *MessagesSendScheduledMessagesRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendScheduledMessages#bd38850a to nil" )
}
if err := b .ConsumeID (MessagesSendScheduledMessagesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.sendScheduledMessages#bd38850a: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSendScheduledMessagesRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendScheduledMessages#bd38850a to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendScheduledMessages#bd38850a: field peer: %w" , err )
}
s .Peer = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendScheduledMessages#bd38850a: field id: %w" , err )
}
if headerLen > 0 {
s .ID = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendScheduledMessages#bd38850a: field id: %w" , err )
}
s .ID = append (s .ID , value )
}
}
return nil
}
func (s *MessagesSendScheduledMessagesRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesSendScheduledMessagesRequest ) GetID () (value []int ) {
if s == nil {
return
}
return s .ID
}
func (c *Client ) MessagesSendScheduledMessages (ctx context .Context , request *MessagesSendScheduledMessagesRequest ) (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 .