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 MessagesSetChatAvailableReactionsRequest struct {
Peer InputPeerClass
AvailableReactions ChatReactionsClass
}
const MessagesSetChatAvailableReactionsRequestTypeID = 0xfeb16771
var (
_ bin .Encoder = &MessagesSetChatAvailableReactionsRequest {}
_ bin .Decoder = &MessagesSetChatAvailableReactionsRequest {}
_ bin .BareEncoder = &MessagesSetChatAvailableReactionsRequest {}
_ bin .BareDecoder = &MessagesSetChatAvailableReactionsRequest {}
)
func (s *MessagesSetChatAvailableReactionsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Peer == nil ) {
return false
}
if !(s .AvailableReactions == nil ) {
return false
}
return true
}
func (s *MessagesSetChatAvailableReactionsRequest ) String () string {
if s == nil {
return "MessagesSetChatAvailableReactionsRequest(nil)"
}
type Alias MessagesSetChatAvailableReactionsRequest
return fmt .Sprintf ("MessagesSetChatAvailableReactionsRequest%+v" , Alias (*s ))
}
func (s *MessagesSetChatAvailableReactionsRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetAvailableReactions () (value ChatReactionsClass )
}) {
s .Peer = from .GetPeer ()
s .AvailableReactions = from .GetAvailableReactions ()
}
func (*MessagesSetChatAvailableReactionsRequest ) TypeID () uint32 {
return MessagesSetChatAvailableReactionsRequestTypeID
}
func (*MessagesSetChatAvailableReactionsRequest ) TypeName () string {
return "messages.setChatAvailableReactions"
}
func (s *MessagesSetChatAvailableReactionsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.setChatAvailableReactions" ,
ID : MessagesSetChatAvailableReactionsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "AvailableReactions" ,
SchemaName : "available_reactions" ,
},
}
return typ
}
func (s *MessagesSetChatAvailableReactionsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setChatAvailableReactions#feb16771 as nil" )
}
b .PutID (MessagesSetChatAvailableReactionsRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSetChatAvailableReactionsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setChatAvailableReactions#feb16771 as nil" )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.setChatAvailableReactions#feb16771: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.setChatAvailableReactions#feb16771: field peer: %w" , err )
}
if s .AvailableReactions == nil {
return fmt .Errorf ("unable to encode messages.setChatAvailableReactions#feb16771: field available_reactions is nil" )
}
if err := s .AvailableReactions .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.setChatAvailableReactions#feb16771: field available_reactions: %w" , err )
}
return nil
}
func (s *MessagesSetChatAvailableReactionsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setChatAvailableReactions#feb16771 to nil" )
}
if err := b .ConsumeID (MessagesSetChatAvailableReactionsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.setChatAvailableReactions#feb16771: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSetChatAvailableReactionsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setChatAvailableReactions#feb16771 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.setChatAvailableReactions#feb16771: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := DecodeChatReactions (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.setChatAvailableReactions#feb16771: field available_reactions: %w" , err )
}
s .AvailableReactions = value
}
return nil
}
func (s *MessagesSetChatAvailableReactionsRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesSetChatAvailableReactionsRequest ) GetAvailableReactions () (value ChatReactionsClass ) {
if s == nil {
return
}
return s .AvailableReactions
}
func (c *Client ) MessagesSetChatAvailableReactions (ctx context .Context , request *MessagesSetChatAvailableReactionsRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .