7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
248 lines
6.6 KiB
Go
248 lines
6.6 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tdapi
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// StoryStatistics represents TL type `storyStatistics#46448b6b`.
|
|
type StoryStatistics struct {
|
|
// A graph containing number of story views and shares
|
|
StoryInteractionGraph StatisticalGraphClass
|
|
// A graph containing number of story reactions
|
|
StoryReactionGraph StatisticalGraphClass
|
|
}
|
|
|
|
// StoryStatisticsTypeID is TL type id of StoryStatistics.
|
|
const StoryStatisticsTypeID = 0x46448b6b
|
|
|
|
// Ensuring interfaces in compile-time for StoryStatistics.
|
|
var (
|
|
_ bin.Encoder = &StoryStatistics{}
|
|
_ bin.Decoder = &StoryStatistics{}
|
|
_ bin.BareEncoder = &StoryStatistics{}
|
|
_ bin.BareDecoder = &StoryStatistics{}
|
|
)
|
|
|
|
func (s *StoryStatistics) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.StoryInteractionGraph == nil) {
|
|
return false
|
|
}
|
|
if !(s.StoryReactionGraph == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StoryStatistics) String() string {
|
|
if s == nil {
|
|
return "StoryStatistics(nil)"
|
|
}
|
|
type Alias StoryStatistics
|
|
return fmt.Sprintf("StoryStatistics%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StoryStatistics) TypeID() uint32 {
|
|
return StoryStatisticsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StoryStatistics) TypeName() string {
|
|
return "storyStatistics"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StoryStatistics) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "storyStatistics",
|
|
ID: StoryStatisticsTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "StoryInteractionGraph",
|
|
SchemaName: "story_interaction_graph",
|
|
},
|
|
{
|
|
Name: "StoryReactionGraph",
|
|
SchemaName: "story_reaction_graph",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StoryStatistics) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode storyStatistics#46448b6b as nil")
|
|
}
|
|
b.PutID(StoryStatisticsTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StoryStatistics) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode storyStatistics#46448b6b as nil")
|
|
}
|
|
if s.StoryInteractionGraph == nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph is nil")
|
|
}
|
|
if err := s.StoryInteractionGraph.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph: %w", err)
|
|
}
|
|
if s.StoryReactionGraph == nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph is nil")
|
|
}
|
|
if err := s.StoryReactionGraph.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StoryStatistics) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode storyStatistics#46448b6b to nil")
|
|
}
|
|
if err := b.ConsumeID(StoryStatisticsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode storyStatistics#46448b6b: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StoryStatistics) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode storyStatistics#46448b6b to nil")
|
|
}
|
|
{
|
|
value, err := DecodeStatisticalGraph(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_interaction_graph: %w", err)
|
|
}
|
|
s.StoryInteractionGraph = value
|
|
}
|
|
{
|
|
value, err := DecodeStatisticalGraph(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_reaction_graph: %w", err)
|
|
}
|
|
s.StoryReactionGraph = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *StoryStatistics) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode storyStatistics#46448b6b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("storyStatistics")
|
|
b.Comma()
|
|
b.FieldStart("story_interaction_graph")
|
|
if s.StoryInteractionGraph == nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph is nil")
|
|
}
|
|
if err := s.StoryInteractionGraph.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("story_reaction_graph")
|
|
if s.StoryReactionGraph == nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph is nil")
|
|
}
|
|
if err := s.StoryReactionGraph.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *StoryStatistics) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode storyStatistics#46448b6b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("storyStatistics"); err != nil {
|
|
return fmt.Errorf("unable to decode storyStatistics#46448b6b: %w", err)
|
|
}
|
|
case "story_interaction_graph":
|
|
value, err := DecodeTDLibJSONStatisticalGraph(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_interaction_graph: %w", err)
|
|
}
|
|
s.StoryInteractionGraph = value
|
|
case "story_reaction_graph":
|
|
value, err := DecodeTDLibJSONStatisticalGraph(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_reaction_graph: %w", err)
|
|
}
|
|
s.StoryReactionGraph = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetStoryInteractionGraph returns value of StoryInteractionGraph field.
|
|
func (s *StoryStatistics) GetStoryInteractionGraph() (value StatisticalGraphClass) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.StoryInteractionGraph
|
|
}
|
|
|
|
// GetStoryReactionGraph returns value of StoryReactionGraph field.
|
|
func (s *StoryStatistics) GetStoryReactionGraph() (value StatisticalGraphClass) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.StoryReactionGraph
|
|
}
|