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