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 MessagePeerReaction struct {
Flags bin .Fields
Big bool
Unread bool
My bool
PeerID PeerClass
Date int
Reaction ReactionClass
}
const MessagePeerReactionTypeID = 0x8c79b63c
var (
_ bin .Encoder = &MessagePeerReaction {}
_ bin .Decoder = &MessagePeerReaction {}
_ bin .BareEncoder = &MessagePeerReaction {}
_ bin .BareDecoder = &MessagePeerReaction {}
)
func (m *MessagePeerReaction ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .Big == false ) {
return false
}
if !(m .Unread == false ) {
return false
}
if !(m .My == false ) {
return false
}
if !(m .PeerID == nil ) {
return false
}
if !(m .Date == 0 ) {
return false
}
if !(m .Reaction == nil ) {
return false
}
return true
}
func (m *MessagePeerReaction ) String () string {
if m == nil {
return "MessagePeerReaction(nil)"
}
type Alias MessagePeerReaction
return fmt .Sprintf ("MessagePeerReaction%+v" , Alias (*m ))
}
func (m *MessagePeerReaction ) FillFrom (from interface {
GetBig () (value bool )
GetUnread () (value bool )
GetMy () (value bool )
GetPeerID () (value PeerClass )
GetDate () (value int )
GetReaction () (value ReactionClass )
}) {
m .Big = from .GetBig ()
m .Unread = from .GetUnread ()
m .My = from .GetMy ()
m .PeerID = from .GetPeerID ()
m .Date = from .GetDate ()
m .Reaction = from .GetReaction ()
}
func (*MessagePeerReaction ) TypeID () uint32 {
return MessagePeerReactionTypeID
}
func (*MessagePeerReaction ) TypeName () string {
return "messagePeerReaction"
}
func (m *MessagePeerReaction ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messagePeerReaction" ,
ID : MessagePeerReactionTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Big" ,
SchemaName : "big" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "Unread" ,
SchemaName : "unread" ,
Null : !m .Flags .Has (1 ),
},
{
Name : "My" ,
SchemaName : "my" ,
Null : !m .Flags .Has (2 ),
},
{
Name : "PeerID" ,
SchemaName : "peer_id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "Reaction" ,
SchemaName : "reaction" ,
},
}
return typ
}
func (m *MessagePeerReaction ) SetFlags () {
if !(m .Big == false ) {
m .Flags .Set (0 )
}
if !(m .Unread == false ) {
m .Flags .Set (1 )
}
if !(m .My == false ) {
m .Flags .Set (2 )
}
}
func (m *MessagePeerReaction ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messagePeerReaction#8c79b63c as nil" )
}
b .PutID (MessagePeerReactionTypeID )
return m .EncodeBare (b )
}
func (m *MessagePeerReaction ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messagePeerReaction#8c79b63c as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messagePeerReaction#8c79b63c: field flags: %w" , err )
}
if m .PeerID == nil {
return fmt .Errorf ("unable to encode messagePeerReaction#8c79b63c: field peer_id is nil" )
}
if err := m .PeerID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messagePeerReaction#8c79b63c: field peer_id: %w" , err )
}
b .PutInt (m .Date )
if m .Reaction == nil {
return fmt .Errorf ("unable to encode messagePeerReaction#8c79b63c: field reaction is nil" )
}
if err := m .Reaction .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messagePeerReaction#8c79b63c: field reaction: %w" , err )
}
return nil
}
func (m *MessagePeerReaction ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messagePeerReaction#8c79b63c to nil" )
}
if err := b .ConsumeID (MessagePeerReactionTypeID ); err != nil {
return fmt .Errorf ("unable to decode messagePeerReaction#8c79b63c: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessagePeerReaction ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messagePeerReaction#8c79b63c to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messagePeerReaction#8c79b63c: field flags: %w" , err )
}
}
m .Big = m .Flags .Has (0 )
m .Unread = m .Flags .Has (1 )
m .My = m .Flags .Has (2 )
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messagePeerReaction#8c79b63c: field peer_id: %w" , err )
}
m .PeerID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messagePeerReaction#8c79b63c: field date: %w" , err )
}
m .Date = value
}
{
value , err := DecodeReaction (b )
if err != nil {
return fmt .Errorf ("unable to decode messagePeerReaction#8c79b63c: field reaction: %w" , err )
}
m .Reaction = value
}
return nil
}
func (m *MessagePeerReaction ) SetBig (value bool ) {
if value {
m .Flags .Set (0 )
m .Big = true
} else {
m .Flags .Unset (0 )
m .Big = false
}
}
func (m *MessagePeerReaction ) GetBig () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (0 )
}
func (m *MessagePeerReaction ) SetUnread (value bool ) {
if value {
m .Flags .Set (1 )
m .Unread = true
} else {
m .Flags .Unset (1 )
m .Unread = false
}
}
func (m *MessagePeerReaction ) GetUnread () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (1 )
}
func (m *MessagePeerReaction ) SetMy (value bool ) {
if value {
m .Flags .Set (2 )
m .My = true
} else {
m .Flags .Unset (2 )
m .My = false
}
}
func (m *MessagePeerReaction ) GetMy () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (2 )
}
func (m *MessagePeerReaction ) GetPeerID () (value PeerClass ) {
if m == nil {
return
}
return m .PeerID
}
func (m *MessagePeerReaction ) GetDate () (value int ) {
if m == nil {
return
}
return m .Date
}
func (m *MessagePeerReaction ) GetReaction () (value ReactionClass ) {
if m == nil {
return
}
return m .Reaction
}
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 .