7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
215 lines
5.3 KiB
Go
215 lines
5.3 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// MessagesGetTopReactionsRequest represents TL type `messages.getTopReactions#bb8125ba`.
|
|
// Got popular message reactions¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/reactions
|
|
//
|
|
// See https://core.telegram.org/method/messages.getTopReactions for reference.
|
|
type MessagesGetTopReactionsRequest struct {
|
|
// Maximum number of results to return, see pagination¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/offsets
|
|
Limit int
|
|
// Hash used for caching, for more info click here¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/offsets#hash-generation
|
|
Hash int64
|
|
}
|
|
|
|
// MessagesGetTopReactionsRequestTypeID is TL type id of MessagesGetTopReactionsRequest.
|
|
const MessagesGetTopReactionsRequestTypeID = 0xbb8125ba
|
|
|
|
// Ensuring interfaces in compile-time for MessagesGetTopReactionsRequest.
|
|
var (
|
|
_ bin.Encoder = &MessagesGetTopReactionsRequest{}
|
|
_ bin.Decoder = &MessagesGetTopReactionsRequest{}
|
|
_ bin.BareEncoder = &MessagesGetTopReactionsRequest{}
|
|
_ bin.BareDecoder = &MessagesGetTopReactionsRequest{}
|
|
)
|
|
|
|
func (g *MessagesGetTopReactionsRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
if !(g.Limit == 0) {
|
|
return false
|
|
}
|
|
if !(g.Hash == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *MessagesGetTopReactionsRequest) String() string {
|
|
if g == nil {
|
|
return "MessagesGetTopReactionsRequest(nil)"
|
|
}
|
|
type Alias MessagesGetTopReactionsRequest
|
|
return fmt.Sprintf("MessagesGetTopReactionsRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// FillFrom fills MessagesGetTopReactionsRequest from given interface.
|
|
func (g *MessagesGetTopReactionsRequest) FillFrom(from interface {
|
|
GetLimit() (value int)
|
|
GetHash() (value int64)
|
|
}) {
|
|
g.Limit = from.GetLimit()
|
|
g.Hash = from.GetHash()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MessagesGetTopReactionsRequest) TypeID() uint32 {
|
|
return MessagesGetTopReactionsRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MessagesGetTopReactionsRequest) TypeName() string {
|
|
return "messages.getTopReactions"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *MessagesGetTopReactionsRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "messages.getTopReactions",
|
|
ID: MessagesGetTopReactionsRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Limit",
|
|
SchemaName: "limit",
|
|
},
|
|
{
|
|
Name: "Hash",
|
|
SchemaName: "hash",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *MessagesGetTopReactionsRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode messages.getTopReactions#bb8125ba as nil")
|
|
}
|
|
b.PutID(MessagesGetTopReactionsRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *MessagesGetTopReactionsRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode messages.getTopReactions#bb8125ba as nil")
|
|
}
|
|
b.PutInt(g.Limit)
|
|
b.PutLong(g.Hash)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *MessagesGetTopReactionsRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode messages.getTopReactions#bb8125ba to nil")
|
|
}
|
|
if err := b.ConsumeID(MessagesGetTopReactionsRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode messages.getTopReactions#bb8125ba: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *MessagesGetTopReactionsRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode messages.getTopReactions#bb8125ba to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode messages.getTopReactions#bb8125ba: field limit: %w", err)
|
|
}
|
|
g.Limit = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode messages.getTopReactions#bb8125ba: field hash: %w", err)
|
|
}
|
|
g.Hash = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetLimit returns value of Limit field.
|
|
func (g *MessagesGetTopReactionsRequest) GetLimit() (value int) {
|
|
if g == nil {
|
|
return
|
|
}
|
|
return g.Limit
|
|
}
|
|
|
|
// GetHash returns value of Hash field.
|
|
func (g *MessagesGetTopReactionsRequest) GetHash() (value int64) {
|
|
if g == nil {
|
|
return
|
|
}
|
|
return g.Hash
|
|
}
|
|
|
|
// MessagesGetTopReactions invokes method messages.getTopReactions#bb8125ba returning error if any.
|
|
// Got popular message reactions¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/reactions
|
|
//
|
|
// See https://core.telegram.org/method/messages.getTopReactions for reference.
|
|
func (c *Client) MessagesGetTopReactions(ctx context.Context, request *MessagesGetTopReactionsRequest) (MessagesReactionsClass, error) {
|
|
var result MessagesReactionsBox
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return result.Reactions, nil
|
|
}
|