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 MessagesSetDefaultReactionRequest struct {
Reaction ReactionClass
}
const MessagesSetDefaultReactionRequestTypeID = 0x4f47a016
var (
_ bin .Encoder = &MessagesSetDefaultReactionRequest {}
_ bin .Decoder = &MessagesSetDefaultReactionRequest {}
_ bin .BareEncoder = &MessagesSetDefaultReactionRequest {}
_ bin .BareDecoder = &MessagesSetDefaultReactionRequest {}
)
func (s *MessagesSetDefaultReactionRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Reaction == nil ) {
return false
}
return true
}
func (s *MessagesSetDefaultReactionRequest ) String () string {
if s == nil {
return "MessagesSetDefaultReactionRequest(nil)"
}
type Alias MessagesSetDefaultReactionRequest
return fmt .Sprintf ("MessagesSetDefaultReactionRequest%+v" , Alias (*s ))
}
func (s *MessagesSetDefaultReactionRequest ) FillFrom (from interface {
GetReaction () (value ReactionClass )
}) {
s .Reaction = from .GetReaction ()
}
func (*MessagesSetDefaultReactionRequest ) TypeID () uint32 {
return MessagesSetDefaultReactionRequestTypeID
}
func (*MessagesSetDefaultReactionRequest ) TypeName () string {
return "messages.setDefaultReaction"
}
func (s *MessagesSetDefaultReactionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.setDefaultReaction" ,
ID : MessagesSetDefaultReactionRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Reaction" ,
SchemaName : "reaction" ,
},
}
return typ
}
func (s *MessagesSetDefaultReactionRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setDefaultReaction#4f47a016 as nil" )
}
b .PutID (MessagesSetDefaultReactionRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSetDefaultReactionRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setDefaultReaction#4f47a016 as nil" )
}
if s .Reaction == nil {
return fmt .Errorf ("unable to encode messages.setDefaultReaction#4f47a016: field reaction is nil" )
}
if err := s .Reaction .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.setDefaultReaction#4f47a016: field reaction: %w" , err )
}
return nil
}
func (s *MessagesSetDefaultReactionRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setDefaultReaction#4f47a016 to nil" )
}
if err := b .ConsumeID (MessagesSetDefaultReactionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.setDefaultReaction#4f47a016: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSetDefaultReactionRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setDefaultReaction#4f47a016 to nil" )
}
{
value , err := DecodeReaction (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.setDefaultReaction#4f47a016: field reaction: %w" , err )
}
s .Reaction = value
}
return nil
}
func (s *MessagesSetDefaultReactionRequest ) GetReaction () (value ReactionClass ) {
if s == nil {
return
}
return s .Reaction
}
func (c *Client ) MessagesSetDefaultReaction (ctx context .Context , reaction ReactionClass ) (bool , error ) {
var result BoolBox
request := &MessagesSetDefaultReactionRequest {
Reaction : reaction ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .