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 StoriesSendReactionRequest struct {
Flags bin .Fields
AddToRecent bool
Peer InputPeerClass
StoryID int
Reaction ReactionClass
}
const StoriesSendReactionRequestTypeID = 0x7fd736b2
var (
_ bin .Encoder = &StoriesSendReactionRequest {}
_ bin .Decoder = &StoriesSendReactionRequest {}
_ bin .BareEncoder = &StoriesSendReactionRequest {}
_ bin .BareDecoder = &StoriesSendReactionRequest {}
)
func (s *StoriesSendReactionRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .AddToRecent == false ) {
return false
}
if !(s .Peer == nil ) {
return false
}
if !(s .StoryID == 0 ) {
return false
}
if !(s .Reaction == nil ) {
return false
}
return true
}
func (s *StoriesSendReactionRequest ) String () string {
if s == nil {
return "StoriesSendReactionRequest(nil)"
}
type Alias StoriesSendReactionRequest
return fmt .Sprintf ("StoriesSendReactionRequest%+v" , Alias (*s ))
}
func (s *StoriesSendReactionRequest ) FillFrom (from interface {
GetAddToRecent () (value bool )
GetPeer () (value InputPeerClass )
GetStoryID () (value int )
GetReaction () (value ReactionClass )
}) {
s .AddToRecent = from .GetAddToRecent ()
s .Peer = from .GetPeer ()
s .StoryID = from .GetStoryID ()
s .Reaction = from .GetReaction ()
}
func (*StoriesSendReactionRequest ) TypeID () uint32 {
return StoriesSendReactionRequestTypeID
}
func (*StoriesSendReactionRequest ) TypeName () string {
return "stories.sendReaction"
}
func (s *StoriesSendReactionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.sendReaction" ,
ID : StoriesSendReactionRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "AddToRecent" ,
SchemaName : "add_to_recent" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "StoryID" ,
SchemaName : "story_id" ,
},
{
Name : "Reaction" ,
SchemaName : "reaction" ,
},
}
return typ
}
func (s *StoriesSendReactionRequest ) SetFlags () {
if !(s .AddToRecent == false ) {
s .Flags .Set (0 )
}
}
func (s *StoriesSendReactionRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stories.sendReaction#7fd736b2 as nil" )
}
b .PutID (StoriesSendReactionRequestTypeID )
return s .EncodeBare (b )
}
func (s *StoriesSendReactionRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode stories.sendReaction#7fd736b2 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.sendReaction#7fd736b2: field flags: %w" , err )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode stories.sendReaction#7fd736b2: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.sendReaction#7fd736b2: field peer: %w" , err )
}
b .PutInt (s .StoryID )
if s .Reaction == nil {
return fmt .Errorf ("unable to encode stories.sendReaction#7fd736b2: field reaction is nil" )
}
if err := s .Reaction .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.sendReaction#7fd736b2: field reaction: %w" , err )
}
return nil
}
func (s *StoriesSendReactionRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stories.sendReaction#7fd736b2 to nil" )
}
if err := b .ConsumeID (StoriesSendReactionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.sendReaction#7fd736b2: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StoriesSendReactionRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode stories.sendReaction#7fd736b2 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stories.sendReaction#7fd736b2: field flags: %w" , err )
}
}
s .AddToRecent = s .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode stories.sendReaction#7fd736b2: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stories.sendReaction#7fd736b2: field story_id: %w" , err )
}
s .StoryID = value
}
{
value , err := DecodeReaction (b )
if err != nil {
return fmt .Errorf ("unable to decode stories.sendReaction#7fd736b2: field reaction: %w" , err )
}
s .Reaction = value
}
return nil
}
func (s *StoriesSendReactionRequest ) SetAddToRecent (value bool ) {
if value {
s .Flags .Set (0 )
s .AddToRecent = true
} else {
s .Flags .Unset (0 )
s .AddToRecent = false
}
}
func (s *StoriesSendReactionRequest ) GetAddToRecent () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (0 )
}
func (s *StoriesSendReactionRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *StoriesSendReactionRequest ) GetStoryID () (value int ) {
if s == nil {
return
}
return s .StoryID
}
func (s *StoriesSendReactionRequest ) GetReaction () (value ReactionClass ) {
if s == nil {
return
}
return s .Reaction
}
func (c *Client ) StoriesSendReaction (ctx context .Context , request *StoriesSendReactionRequest ) (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 .