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 MessagesReportReactionRequest struct {
Peer InputPeerClass
ID int
ReactionPeer InputPeerClass
}
const MessagesReportReactionRequestTypeID = 0x3f64c076
var (
_ bin .Encoder = &MessagesReportReactionRequest {}
_ bin .Decoder = &MessagesReportReactionRequest {}
_ bin .BareEncoder = &MessagesReportReactionRequest {}
_ bin .BareDecoder = &MessagesReportReactionRequest {}
)
func (r *MessagesReportReactionRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Peer == nil ) {
return false
}
if !(r .ID == 0 ) {
return false
}
if !(r .ReactionPeer == nil ) {
return false
}
return true
}
func (r *MessagesReportReactionRequest ) String () string {
if r == nil {
return "MessagesReportReactionRequest(nil)"
}
type Alias MessagesReportReactionRequest
return fmt .Sprintf ("MessagesReportReactionRequest%+v" , Alias (*r ))
}
func (r *MessagesReportReactionRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetID () (value int )
GetReactionPeer () (value InputPeerClass )
}) {
r .Peer = from .GetPeer ()
r .ID = from .GetID ()
r .ReactionPeer = from .GetReactionPeer ()
}
func (*MessagesReportReactionRequest ) TypeID () uint32 {
return MessagesReportReactionRequestTypeID
}
func (*MessagesReportReactionRequest ) TypeName () string {
return "messages.reportReaction"
}
func (r *MessagesReportReactionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.reportReaction" ,
ID : MessagesReportReactionRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "ReactionPeer" ,
SchemaName : "reaction_peer" ,
},
}
return typ
}
func (r *MessagesReportReactionRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reportReaction#3f64c076 as nil" )
}
b .PutID (MessagesReportReactionRequestTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReportReactionRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reportReaction#3f64c076 as nil" )
}
if r .Peer == nil {
return fmt .Errorf ("unable to encode messages.reportReaction#3f64c076: field peer is nil" )
}
if err := r .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.reportReaction#3f64c076: field peer: %w" , err )
}
b .PutInt (r .ID )
if r .ReactionPeer == nil {
return fmt .Errorf ("unable to encode messages.reportReaction#3f64c076: field reaction_peer is nil" )
}
if err := r .ReactionPeer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.reportReaction#3f64c076: field reaction_peer: %w" , err )
}
return nil
}
func (r *MessagesReportReactionRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reportReaction#3f64c076 to nil" )
}
if err := b .ConsumeID (MessagesReportReactionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.reportReaction#3f64c076: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReportReactionRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reportReaction#3f64c076 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.reportReaction#3f64c076: field peer: %w" , err )
}
r .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.reportReaction#3f64c076: field id: %w" , err )
}
r .ID = value
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.reportReaction#3f64c076: field reaction_peer: %w" , err )
}
r .ReactionPeer = value
}
return nil
}
func (r *MessagesReportReactionRequest ) GetPeer () (value InputPeerClass ) {
if r == nil {
return
}
return r .Peer
}
func (r *MessagesReportReactionRequest ) GetID () (value int ) {
if r == nil {
return
}
return r .ID
}
func (r *MessagesReportReactionRequest ) GetReactionPeer () (value InputPeerClass ) {
if r == nil {
return
}
return r .ReactionPeer
}
func (c *Client ) MessagesReportReaction (ctx context .Context , request *MessagesReportReactionRequest ) (bool , error ) {
var result BoolBox
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 .