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 MessagesGetTopReactionsRequest struct {
Limit int
Hash int64
}
const MessagesGetTopReactionsRequestTypeID = 0xbb8125ba
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
}
func (g *MessagesGetTopReactionsRequest ) String () string {
if g == nil {
return "MessagesGetTopReactionsRequest(nil)"
}
type Alias MessagesGetTopReactionsRequest
return fmt .Sprintf ("MessagesGetTopReactionsRequest%+v" , Alias (*g ))
}
func (g *MessagesGetTopReactionsRequest ) FillFrom (from interface {
GetLimit () (value int )
GetHash () (value int64 )
}) {
g .Limit = from .GetLimit ()
g .Hash = from .GetHash ()
}
func (*MessagesGetTopReactionsRequest ) TypeID () uint32 {
return MessagesGetTopReactionsRequestTypeID
}
func (*MessagesGetTopReactionsRequest ) TypeName () string {
return "messages.getTopReactions"
}
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
}
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 )
}
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
}
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 )
}
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
}
func (g *MessagesGetTopReactionsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *MessagesGetTopReactionsRequest ) GetHash () (value int64 ) {
if g == nil {
return
}
return g .Hash
}
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
}
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 .