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 MessagesReceivedMessagesRequest struct {
MaxID int
}
const MessagesReceivedMessagesRequestTypeID = 0x5a954c0
var (
_ bin .Encoder = &MessagesReceivedMessagesRequest {}
_ bin .Decoder = &MessagesReceivedMessagesRequest {}
_ bin .BareEncoder = &MessagesReceivedMessagesRequest {}
_ bin .BareDecoder = &MessagesReceivedMessagesRequest {}
)
func (r *MessagesReceivedMessagesRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .MaxID == 0 ) {
return false
}
return true
}
func (r *MessagesReceivedMessagesRequest ) String () string {
if r == nil {
return "MessagesReceivedMessagesRequest(nil)"
}
type Alias MessagesReceivedMessagesRequest
return fmt .Sprintf ("MessagesReceivedMessagesRequest%+v" , Alias (*r ))
}
func (r *MessagesReceivedMessagesRequest ) FillFrom (from interface {
GetMaxID () (value int )
}) {
r .MaxID = from .GetMaxID ()
}
func (*MessagesReceivedMessagesRequest ) TypeID () uint32 {
return MessagesReceivedMessagesRequestTypeID
}
func (*MessagesReceivedMessagesRequest ) TypeName () string {
return "messages.receivedMessages"
}
func (r *MessagesReceivedMessagesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.receivedMessages" ,
ID : MessagesReceivedMessagesRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MaxID" ,
SchemaName : "max_id" ,
},
}
return typ
}
func (r *MessagesReceivedMessagesRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.receivedMessages#5a954c0 as nil" )
}
b .PutID (MessagesReceivedMessagesRequestTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReceivedMessagesRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.receivedMessages#5a954c0 as nil" )
}
b .PutInt (r .MaxID )
return nil
}
func (r *MessagesReceivedMessagesRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.receivedMessages#5a954c0 to nil" )
}
if err := b .ConsumeID (MessagesReceivedMessagesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.receivedMessages#5a954c0: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReceivedMessagesRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.receivedMessages#5a954c0 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.receivedMessages#5a954c0: field max_id: %w" , err )
}
r .MaxID = value
}
return nil
}
func (r *MessagesReceivedMessagesRequest ) GetMaxID () (value int ) {
if r == nil {
return
}
return r .MaxID
}
func (c *Client ) MessagesReceivedMessages (ctx context .Context , maxid int ) ([]ReceivedNotifyMessage , error ) {
var result ReceivedNotifyMessageVector
request := &MessagesReceivedMessagesRequest {
MaxID : maxid ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []ReceivedNotifyMessage (result .Elems ), 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 .