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
238 lines
5.7 KiB
Go
238 lines
5.7 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{}
|
|
)
|
|
|
|
// StoryRepostInfo represents TL type `storyRepostInfo#ff7fa440`.
|
|
type StoryRepostInfo struct {
|
|
// Origin of the story that was reposted
|
|
Origin StoryOriginClass
|
|
// True, if story content was modified during reposting; otherwise, story wasn't modified
|
|
IsContentModified bool
|
|
}
|
|
|
|
// StoryRepostInfoTypeID is TL type id of StoryRepostInfo.
|
|
const StoryRepostInfoTypeID = 0xff7fa440
|
|
|
|
// Ensuring interfaces in compile-time for StoryRepostInfo.
|
|
var (
|
|
_ bin.Encoder = &StoryRepostInfo{}
|
|
_ bin.Decoder = &StoryRepostInfo{}
|
|
_ bin.BareEncoder = &StoryRepostInfo{}
|
|
_ bin.BareDecoder = &StoryRepostInfo{}
|
|
)
|
|
|
|
func (s *StoryRepostInfo) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.Origin == nil) {
|
|
return false
|
|
}
|
|
if !(s.IsContentModified == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StoryRepostInfo) String() string {
|
|
if s == nil {
|
|
return "StoryRepostInfo(nil)"
|
|
}
|
|
type Alias StoryRepostInfo
|
|
return fmt.Sprintf("StoryRepostInfo%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StoryRepostInfo) TypeID() uint32 {
|
|
return StoryRepostInfoTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StoryRepostInfo) TypeName() string {
|
|
return "storyRepostInfo"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StoryRepostInfo) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "storyRepostInfo",
|
|
ID: StoryRepostInfoTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Origin",
|
|
SchemaName: "origin",
|
|
},
|
|
{
|
|
Name: "IsContentModified",
|
|
SchemaName: "is_content_modified",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StoryRepostInfo) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil")
|
|
}
|
|
b.PutID(StoryRepostInfoTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StoryRepostInfo) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil")
|
|
}
|
|
if s.Origin == nil {
|
|
return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin is nil")
|
|
}
|
|
if err := s.Origin.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin: %w", err)
|
|
}
|
|
b.PutBool(s.IsContentModified)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StoryRepostInfo) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil")
|
|
}
|
|
if err := b.ConsumeID(StoryRepostInfoTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StoryRepostInfo) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeStoryOrigin(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field origin: %w", err)
|
|
}
|
|
s.Origin = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field is_content_modified: %w", err)
|
|
}
|
|
s.IsContentModified = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *StoryRepostInfo) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("storyRepostInfo")
|
|
b.Comma()
|
|
b.FieldStart("origin")
|
|
if s.Origin == nil {
|
|
return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin is nil")
|
|
}
|
|
if err := s.Origin.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("is_content_modified")
|
|
b.PutBool(s.IsContentModified)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *StoryRepostInfo) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("storyRepostInfo"); err != nil {
|
|
return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: %w", err)
|
|
}
|
|
case "origin":
|
|
value, err := DecodeTDLibJSONStoryOrigin(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field origin: %w", err)
|
|
}
|
|
s.Origin = value
|
|
case "is_content_modified":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field is_content_modified: %w", err)
|
|
}
|
|
s.IsContentModified = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetOrigin returns value of Origin field.
|
|
func (s *StoryRepostInfo) GetOrigin() (value StoryOriginClass) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.Origin
|
|
}
|
|
|
|
// GetIsContentModified returns value of IsContentModified field.
|
|
func (s *StoryRepostInfo) GetIsContentModified() (value bool) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.IsContentModified
|
|
}
|