move gotd fork into repo. (#111)
- 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
This commit is contained in:
@@ -0,0 +1,363 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// StoryAreaPosition represents TL type `storyAreaPosition#a49fec6c`.
|
||||
type StoryAreaPosition struct {
|
||||
// The abscissa of the rectangle's center, as a percentage of the media width
|
||||
XPercentage float64
|
||||
// The ordinate of the rectangle's center, as a percentage of the media height
|
||||
YPercentage float64
|
||||
// The width of the rectangle, as a percentage of the media width
|
||||
WidthPercentage float64
|
||||
// The height of the rectangle, as a percentage of the media height
|
||||
HeightPercentage float64
|
||||
// Clockwise rotation angle of the rectangle, in degrees; 0-360
|
||||
RotationAngle float64
|
||||
// The radius of the rectangle corner rounding, as a percentage of the media width
|
||||
CornerRadiusPercentage float64
|
||||
}
|
||||
|
||||
// StoryAreaPositionTypeID is TL type id of StoryAreaPosition.
|
||||
const StoryAreaPositionTypeID = 0xa49fec6c
|
||||
|
||||
// Ensuring interfaces in compile-time for StoryAreaPosition.
|
||||
var (
|
||||
_ bin.Encoder = &StoryAreaPosition{}
|
||||
_ bin.Decoder = &StoryAreaPosition{}
|
||||
_ bin.BareEncoder = &StoryAreaPosition{}
|
||||
_ bin.BareDecoder = &StoryAreaPosition{}
|
||||
)
|
||||
|
||||
func (s *StoryAreaPosition) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.XPercentage == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.YPercentage == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.WidthPercentage == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.HeightPercentage == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.RotationAngle == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.CornerRadiusPercentage == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *StoryAreaPosition) String() string {
|
||||
if s == nil {
|
||||
return "StoryAreaPosition(nil)"
|
||||
}
|
||||
type Alias StoryAreaPosition
|
||||
return fmt.Sprintf("StoryAreaPosition%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*StoryAreaPosition) TypeID() uint32 {
|
||||
return StoryAreaPositionTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*StoryAreaPosition) TypeName() string {
|
||||
return "storyAreaPosition"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *StoryAreaPosition) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "storyAreaPosition",
|
||||
ID: StoryAreaPositionTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "XPercentage",
|
||||
SchemaName: "x_percentage",
|
||||
},
|
||||
{
|
||||
Name: "YPercentage",
|
||||
SchemaName: "y_percentage",
|
||||
},
|
||||
{
|
||||
Name: "WidthPercentage",
|
||||
SchemaName: "width_percentage",
|
||||
},
|
||||
{
|
||||
Name: "HeightPercentage",
|
||||
SchemaName: "height_percentage",
|
||||
},
|
||||
{
|
||||
Name: "RotationAngle",
|
||||
SchemaName: "rotation_angle",
|
||||
},
|
||||
{
|
||||
Name: "CornerRadiusPercentage",
|
||||
SchemaName: "corner_radius_percentage",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *StoryAreaPosition) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode storyAreaPosition#a49fec6c as nil")
|
||||
}
|
||||
b.PutID(StoryAreaPositionTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *StoryAreaPosition) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode storyAreaPosition#a49fec6c as nil")
|
||||
}
|
||||
b.PutDouble(s.XPercentage)
|
||||
b.PutDouble(s.YPercentage)
|
||||
b.PutDouble(s.WidthPercentage)
|
||||
b.PutDouble(s.HeightPercentage)
|
||||
b.PutDouble(s.RotationAngle)
|
||||
b.PutDouble(s.CornerRadiusPercentage)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *StoryAreaPosition) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode storyAreaPosition#a49fec6c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StoryAreaPositionTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *StoryAreaPosition) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode storyAreaPosition#a49fec6c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field x_percentage: %w", err)
|
||||
}
|
||||
s.XPercentage = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field y_percentage: %w", err)
|
||||
}
|
||||
s.YPercentage = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field width_percentage: %w", err)
|
||||
}
|
||||
s.WidthPercentage = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field height_percentage: %w", err)
|
||||
}
|
||||
s.HeightPercentage = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field rotation_angle: %w", err)
|
||||
}
|
||||
s.RotationAngle = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field corner_radius_percentage: %w", err)
|
||||
}
|
||||
s.CornerRadiusPercentage = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (s *StoryAreaPosition) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode storyAreaPosition#a49fec6c as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("storyAreaPosition")
|
||||
b.Comma()
|
||||
b.FieldStart("x_percentage")
|
||||
b.PutDouble(s.XPercentage)
|
||||
b.Comma()
|
||||
b.FieldStart("y_percentage")
|
||||
b.PutDouble(s.YPercentage)
|
||||
b.Comma()
|
||||
b.FieldStart("width_percentage")
|
||||
b.PutDouble(s.WidthPercentage)
|
||||
b.Comma()
|
||||
b.FieldStart("height_percentage")
|
||||
b.PutDouble(s.HeightPercentage)
|
||||
b.Comma()
|
||||
b.FieldStart("rotation_angle")
|
||||
b.PutDouble(s.RotationAngle)
|
||||
b.Comma()
|
||||
b.FieldStart("corner_radius_percentage")
|
||||
b.PutDouble(s.CornerRadiusPercentage)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (s *StoryAreaPosition) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode storyAreaPosition#a49fec6c to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("storyAreaPosition"); err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: %w", err)
|
||||
}
|
||||
case "x_percentage":
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field x_percentage: %w", err)
|
||||
}
|
||||
s.XPercentage = value
|
||||
case "y_percentage":
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field y_percentage: %w", err)
|
||||
}
|
||||
s.YPercentage = value
|
||||
case "width_percentage":
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field width_percentage: %w", err)
|
||||
}
|
||||
s.WidthPercentage = value
|
||||
case "height_percentage":
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field height_percentage: %w", err)
|
||||
}
|
||||
s.HeightPercentage = value
|
||||
case "rotation_angle":
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field rotation_angle: %w", err)
|
||||
}
|
||||
s.RotationAngle = value
|
||||
case "corner_radius_percentage":
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field corner_radius_percentage: %w", err)
|
||||
}
|
||||
s.CornerRadiusPercentage = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetXPercentage returns value of XPercentage field.
|
||||
func (s *StoryAreaPosition) GetXPercentage() (value float64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.XPercentage
|
||||
}
|
||||
|
||||
// GetYPercentage returns value of YPercentage field.
|
||||
func (s *StoryAreaPosition) GetYPercentage() (value float64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.YPercentage
|
||||
}
|
||||
|
||||
// GetWidthPercentage returns value of WidthPercentage field.
|
||||
func (s *StoryAreaPosition) GetWidthPercentage() (value float64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.WidthPercentage
|
||||
}
|
||||
|
||||
// GetHeightPercentage returns value of HeightPercentage field.
|
||||
func (s *StoryAreaPosition) GetHeightPercentage() (value float64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.HeightPercentage
|
||||
}
|
||||
|
||||
// GetRotationAngle returns value of RotationAngle field.
|
||||
func (s *StoryAreaPosition) GetRotationAngle() (value float64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.RotationAngle
|
||||
}
|
||||
|
||||
// GetCornerRadiusPercentage returns value of CornerRadiusPercentage field.
|
||||
func (s *StoryAreaPosition) GetCornerRadiusPercentage() (value float64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.CornerRadiusPercentage
|
||||
}
|
||||
Reference in New Issue
Block a user