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