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 StatsMessageStats struct {
ViewsGraph StatsGraphClass
ReactionsByEmotionGraph StatsGraphClass
}
const StatsMessageStatsTypeID = 0x7fe91c14
var (
_ bin .Encoder = &StatsMessageStats {}
_ bin .Decoder = &StatsMessageStats {}
_ bin .BareEncoder = &StatsMessageStats {}
_ bin .BareDecoder = &StatsMessageStats {}
)
func (m *StatsMessageStats ) Zero () bool {
if m == nil {
return true
}
if !(m .ViewsGraph == nil ) {
return false
}
if !(m .ReactionsByEmotionGraph == nil ) {
return false
}
return true
}
func (m *StatsMessageStats ) String () string {
if m == nil {
return "StatsMessageStats(nil)"
}
type Alias StatsMessageStats
return fmt .Sprintf ("StatsMessageStats%+v" , Alias (*m ))
}
func (m *StatsMessageStats ) FillFrom (from interface {
GetViewsGraph () (value StatsGraphClass )
GetReactionsByEmotionGraph () (value StatsGraphClass )
}) {
m .ViewsGraph = from .GetViewsGraph ()
m .ReactionsByEmotionGraph = from .GetReactionsByEmotionGraph ()
}
func (*StatsMessageStats ) TypeID () uint32 {
return StatsMessageStatsTypeID
}
func (*StatsMessageStats ) TypeName () string {
return "stats.messageStats"
}
func (m *StatsMessageStats ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stats.messageStats" ,
ID : StatsMessageStatsTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ViewsGraph" ,
SchemaName : "views_graph" ,
},
{
Name : "ReactionsByEmotionGraph" ,
SchemaName : "reactions_by_emotion_graph" ,
},
}
return typ
}
func (m *StatsMessageStats ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode stats.messageStats#7fe91c14 as nil" )
}
b .PutID (StatsMessageStatsTypeID )
return m .EncodeBare (b )
}
func (m *StatsMessageStats ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode stats.messageStats#7fe91c14 as nil" )
}
if m .ViewsGraph == nil {
return fmt .Errorf ("unable to encode stats.messageStats#7fe91c14: field views_graph is nil" )
}
if err := m .ViewsGraph .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.messageStats#7fe91c14: field views_graph: %w" , err )
}
if m .ReactionsByEmotionGraph == nil {
return fmt .Errorf ("unable to encode stats.messageStats#7fe91c14: field reactions_by_emotion_graph is nil" )
}
if err := m .ReactionsByEmotionGraph .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stats.messageStats#7fe91c14: field reactions_by_emotion_graph: %w" , err )
}
return nil
}
func (m *StatsMessageStats ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode stats.messageStats#7fe91c14 to nil" )
}
if err := b .ConsumeID (StatsMessageStatsTypeID ); err != nil {
return fmt .Errorf ("unable to decode stats.messageStats#7fe91c14: %w" , err )
}
return m .DecodeBare (b )
}
func (m *StatsMessageStats ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode stats.messageStats#7fe91c14 to nil" )
}
{
value , err := DecodeStatsGraph (b )
if err != nil {
return fmt .Errorf ("unable to decode stats.messageStats#7fe91c14: field views_graph: %w" , err )
}
m .ViewsGraph = value
}
{
value , err := DecodeStatsGraph (b )
if err != nil {
return fmt .Errorf ("unable to decode stats.messageStats#7fe91c14: field reactions_by_emotion_graph: %w" , err )
}
m .ReactionsByEmotionGraph = value
}
return nil
}
func (m *StatsMessageStats ) GetViewsGraph () (value StatsGraphClass ) {
if m == nil {
return
}
return m .ViewsGraph
}
func (m *StatsMessageStats ) GetReactionsByEmotionGraph () (value StatsGraphClass ) {
if m == nil {
return
}
return m .ReactionsByEmotionGraph
}
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 .