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.6 KiB
Go
238 lines
5.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{}
|
|
)
|
|
|
|
// InputStoryArea represents TL type `inputStoryArea#752ae7f`.
|
|
type InputStoryArea struct {
|
|
// Position of the area
|
|
Position StoryAreaPosition
|
|
// Type of the area
|
|
Type InputStoryAreaTypeClass
|
|
}
|
|
|
|
// InputStoryAreaTypeID is TL type id of InputStoryArea.
|
|
const InputStoryAreaTypeID = 0x752ae7f
|
|
|
|
// Ensuring interfaces in compile-time for InputStoryArea.
|
|
var (
|
|
_ bin.Encoder = &InputStoryArea{}
|
|
_ bin.Decoder = &InputStoryArea{}
|
|
_ bin.BareEncoder = &InputStoryArea{}
|
|
_ bin.BareDecoder = &InputStoryArea{}
|
|
)
|
|
|
|
func (i *InputStoryArea) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Position.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Type == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputStoryArea) String() string {
|
|
if i == nil {
|
|
return "InputStoryArea(nil)"
|
|
}
|
|
type Alias InputStoryArea
|
|
return fmt.Sprintf("InputStoryArea%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputStoryArea) TypeID() uint32 {
|
|
return InputStoryAreaTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputStoryArea) TypeName() string {
|
|
return "inputStoryArea"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputStoryArea) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputStoryArea",
|
|
ID: InputStoryAreaTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Position",
|
|
SchemaName: "position",
|
|
},
|
|
{
|
|
Name: "Type",
|
|
SchemaName: "type",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputStoryArea) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStoryArea#752ae7f as nil")
|
|
}
|
|
b.PutID(InputStoryAreaTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputStoryArea) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStoryArea#752ae7f as nil")
|
|
}
|
|
if err := i.Position.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field position: %w", err)
|
|
}
|
|
if i.Type == nil {
|
|
return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type is nil")
|
|
}
|
|
if err := i.Type.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputStoryArea) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStoryArea#752ae7f to nil")
|
|
}
|
|
if err := b.ConsumeID(InputStoryAreaTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputStoryArea#752ae7f: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputStoryArea) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStoryArea#752ae7f to nil")
|
|
}
|
|
{
|
|
if err := i.Position.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field position: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeInputStoryAreaType(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field type: %w", err)
|
|
}
|
|
i.Type = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputStoryArea) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputStoryArea#752ae7f as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputStoryArea")
|
|
b.Comma()
|
|
b.FieldStart("position")
|
|
if err := i.Position.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field position: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("type")
|
|
if i.Type == nil {
|
|
return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type is nil")
|
|
}
|
|
if err := i.Type.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputStoryArea) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputStoryArea#752ae7f to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputStoryArea"); err != nil {
|
|
return fmt.Errorf("unable to decode inputStoryArea#752ae7f: %w", err)
|
|
}
|
|
case "position":
|
|
if err := i.Position.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field position: %w", err)
|
|
}
|
|
case "type":
|
|
value, err := DecodeTDLibJSONInputStoryAreaType(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field type: %w", err)
|
|
}
|
|
i.Type = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetPosition returns value of Position field.
|
|
func (i *InputStoryArea) GetPosition() (value StoryAreaPosition) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Position
|
|
}
|
|
|
|
// GetType returns value of Type field.
|
|
func (i *InputStoryArea) GetType() (value InputStoryAreaTypeClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Type
|
|
}
|