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 MessagesGetScheduledHistoryRequest struct {
Peer InputPeerClass
Hash int64
}
const MessagesGetScheduledHistoryRequestTypeID = 0xf516760b
var (
_ bin .Encoder = &MessagesGetScheduledHistoryRequest {}
_ bin .Decoder = &MessagesGetScheduledHistoryRequest {}
_ bin .BareEncoder = &MessagesGetScheduledHistoryRequest {}
_ bin .BareDecoder = &MessagesGetScheduledHistoryRequest {}
)
func (g *MessagesGetScheduledHistoryRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Peer == nil ) {
return false
}
if !(g .Hash == 0 ) {
return false
}
return true
}
func (g *MessagesGetScheduledHistoryRequest ) String () string {
if g == nil {
return "MessagesGetScheduledHistoryRequest(nil)"
}
type Alias MessagesGetScheduledHistoryRequest
return fmt .Sprintf ("MessagesGetScheduledHistoryRequest%+v" , Alias (*g ))
}
func (g *MessagesGetScheduledHistoryRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetHash () (value int64 )
}) {
g .Peer = from .GetPeer ()
g .Hash = from .GetHash ()
}
func (*MessagesGetScheduledHistoryRequest ) TypeID () uint32 {
return MessagesGetScheduledHistoryRequestTypeID
}
func (*MessagesGetScheduledHistoryRequest ) TypeName () string {
return "messages.getScheduledHistory"
}
func (g *MessagesGetScheduledHistoryRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getScheduledHistory" ,
ID : MessagesGetScheduledHistoryRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (g *MessagesGetScheduledHistoryRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getScheduledHistory#f516760b as nil" )
}
b .PutID (MessagesGetScheduledHistoryRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetScheduledHistoryRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getScheduledHistory#f516760b as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode messages.getScheduledHistory#f516760b: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getScheduledHistory#f516760b: field peer: %w" , err )
}
b .PutLong (g .Hash )
return nil
}
func (g *MessagesGetScheduledHistoryRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getScheduledHistory#f516760b to nil" )
}
if err := b .ConsumeID (MessagesGetScheduledHistoryRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getScheduledHistory#f516760b: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetScheduledHistoryRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getScheduledHistory#f516760b to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getScheduledHistory#f516760b: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getScheduledHistory#f516760b: field hash: %w" , err )
}
g .Hash = value
}
return nil
}
func (g *MessagesGetScheduledHistoryRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *MessagesGetScheduledHistoryRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
func (c *Client ) MessagesGetScheduledHistory (ctx context .Context , request *MessagesGetScheduledHistoryRequest ) (MessagesMessagesClass , error ) {
var result MessagesMessagesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Messages , 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 .