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 MessagesReadReactionsRequest struct {
Flags bin .Fields
Peer InputPeerClass
TopMsgID int
}
const MessagesReadReactionsRequestTypeID = 0x54aa7f8e
var (
_ bin .Encoder = &MessagesReadReactionsRequest {}
_ bin .Decoder = &MessagesReadReactionsRequest {}
_ bin .BareEncoder = &MessagesReadReactionsRequest {}
_ bin .BareDecoder = &MessagesReadReactionsRequest {}
)
func (r *MessagesReadReactionsRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Flags .Zero ()) {
return false
}
if !(r .Peer == nil ) {
return false
}
if !(r .TopMsgID == 0 ) {
return false
}
return true
}
func (r *MessagesReadReactionsRequest ) String () string {
if r == nil {
return "MessagesReadReactionsRequest(nil)"
}
type Alias MessagesReadReactionsRequest
return fmt .Sprintf ("MessagesReadReactionsRequest%+v" , Alias (*r ))
}
func (r *MessagesReadReactionsRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetTopMsgID () (value int , ok bool )
}) {
r .Peer = from .GetPeer ()
if val , ok := from .GetTopMsgID (); ok {
r .TopMsgID = val
}
}
func (*MessagesReadReactionsRequest ) TypeID () uint32 {
return MessagesReadReactionsRequestTypeID
}
func (*MessagesReadReactionsRequest ) TypeName () string {
return "messages.readReactions"
}
func (r *MessagesReadReactionsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.readReactions" ,
ID : MessagesReadReactionsRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "TopMsgID" ,
SchemaName : "top_msg_id" ,
Null : !r .Flags .Has (0 ),
},
}
return typ
}
func (r *MessagesReadReactionsRequest ) SetFlags () {
if !(r .TopMsgID == 0 ) {
r .Flags .Set (0 )
}
}
func (r *MessagesReadReactionsRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.readReactions#54aa7f8e as nil" )
}
b .PutID (MessagesReadReactionsRequestTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReadReactionsRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.readReactions#54aa7f8e as nil" )
}
r .SetFlags ()
if err := r .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.readReactions#54aa7f8e: field flags: %w" , err )
}
if r .Peer == nil {
return fmt .Errorf ("unable to encode messages.readReactions#54aa7f8e: field peer is nil" )
}
if err := r .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.readReactions#54aa7f8e: field peer: %w" , err )
}
if r .Flags .Has (0 ) {
b .PutInt (r .TopMsgID )
}
return nil
}
func (r *MessagesReadReactionsRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.readReactions#54aa7f8e to nil" )
}
if err := b .ConsumeID (MessagesReadReactionsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.readReactions#54aa7f8e: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReadReactionsRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.readReactions#54aa7f8e to nil" )
}
{
if err := r .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.readReactions#54aa7f8e: field flags: %w" , err )
}
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.readReactions#54aa7f8e: field peer: %w" , err )
}
r .Peer = value
}
if r .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.readReactions#54aa7f8e: field top_msg_id: %w" , err )
}
r .TopMsgID = value
}
return nil
}
func (r *MessagesReadReactionsRequest ) GetPeer () (value InputPeerClass ) {
if r == nil {
return
}
return r .Peer
}
func (r *MessagesReadReactionsRequest ) SetTopMsgID (value int ) {
r .Flags .Set (0 )
r .TopMsgID = value
}
func (r *MessagesReadReactionsRequest ) GetTopMsgID () (value int , ok bool ) {
if r == nil {
return
}
if !r .Flags .Has (0 ) {
return value , false
}
return r .TopMsgID , true
}
func (c *Client ) MessagesReadReactions (ctx context .Context , request *MessagesReadReactionsRequest ) (*MessagesAffectedHistory , error ) {
var result MessagesAffectedHistory
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .