2133 lines
53 KiB
Go
Generated
2133 lines
53 KiB
Go
Generated
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
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{}
|
|
)
|
|
|
|
// MediaAreaVenue represents TL type `mediaAreaVenue#be82db9c`.
|
|
// Represents a location tag attached to a story¹, with additional venue information.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaVenue for reference.
|
|
type MediaAreaVenue struct {
|
|
// The size and location of the media area corresponding to the location sticker on top
|
|
// of the story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// Coordinates of the venue
|
|
Geo GeoPointClass
|
|
// Venue name
|
|
Title string
|
|
// Address
|
|
Address string
|
|
// Venue provider: currently only "foursquare" needs to be supported.
|
|
Provider string
|
|
// Venue ID in the provider's database
|
|
VenueID string
|
|
// Venue type in the provider's database
|
|
VenueType string
|
|
}
|
|
|
|
// MediaAreaVenueTypeID is TL type id of MediaAreaVenue.
|
|
const MediaAreaVenueTypeID = 0xbe82db9c
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaVenue) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaVenue.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaVenue{}
|
|
_ bin.Decoder = &MediaAreaVenue{}
|
|
_ bin.BareEncoder = &MediaAreaVenue{}
|
|
_ bin.BareDecoder = &MediaAreaVenue{}
|
|
|
|
_ MediaAreaClass = &MediaAreaVenue{}
|
|
)
|
|
|
|
func (m *MediaAreaVenue) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Geo == nil) {
|
|
return false
|
|
}
|
|
if !(m.Title == "") {
|
|
return false
|
|
}
|
|
if !(m.Address == "") {
|
|
return false
|
|
}
|
|
if !(m.Provider == "") {
|
|
return false
|
|
}
|
|
if !(m.VenueID == "") {
|
|
return false
|
|
}
|
|
if !(m.VenueType == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaVenue) String() string {
|
|
if m == nil {
|
|
return "MediaAreaVenue(nil)"
|
|
}
|
|
type Alias MediaAreaVenue
|
|
return fmt.Sprintf("MediaAreaVenue%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaVenue from given interface.
|
|
func (m *MediaAreaVenue) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetGeo() (value GeoPointClass)
|
|
GetTitle() (value string)
|
|
GetAddress() (value string)
|
|
GetProvider() (value string)
|
|
GetVenueID() (value string)
|
|
GetVenueType() (value string)
|
|
}) {
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.Geo = from.GetGeo()
|
|
m.Title = from.GetTitle()
|
|
m.Address = from.GetAddress()
|
|
m.Provider = from.GetProvider()
|
|
m.VenueID = from.GetVenueID()
|
|
m.VenueType = from.GetVenueType()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaVenue) TypeID() uint32 {
|
|
return MediaAreaVenueTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaVenue) TypeName() string {
|
|
return "mediaAreaVenue"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaVenue) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaVenue",
|
|
ID: MediaAreaVenueTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "Geo",
|
|
SchemaName: "geo",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Address",
|
|
SchemaName: "address",
|
|
},
|
|
{
|
|
Name: "Provider",
|
|
SchemaName: "provider",
|
|
},
|
|
{
|
|
Name: "VenueID",
|
|
SchemaName: "venue_id",
|
|
},
|
|
{
|
|
Name: "VenueType",
|
|
SchemaName: "venue_type",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaVenue) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaVenue#be82db9c as nil")
|
|
}
|
|
b.PutID(MediaAreaVenueTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaVenue) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaVenue#be82db9c as nil")
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaVenue#be82db9c: field coordinates: %w", err)
|
|
}
|
|
if m.Geo == nil {
|
|
return fmt.Errorf("unable to encode mediaAreaVenue#be82db9c: field geo is nil")
|
|
}
|
|
if err := m.Geo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaVenue#be82db9c: field geo: %w", err)
|
|
}
|
|
b.PutString(m.Title)
|
|
b.PutString(m.Address)
|
|
b.PutString(m.Provider)
|
|
b.PutString(m.VenueID)
|
|
b.PutString(m.VenueType)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaVenue) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaVenue#be82db9c to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaVenueTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaVenue) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaVenue#be82db9c to nil")
|
|
}
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeGeoPoint(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field geo: %w", err)
|
|
}
|
|
m.Geo = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field title: %w", err)
|
|
}
|
|
m.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field address: %w", err)
|
|
}
|
|
m.Address = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field provider: %w", err)
|
|
}
|
|
m.Provider = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field venue_id: %w", err)
|
|
}
|
|
m.VenueID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaVenue#be82db9c: field venue_type: %w", err)
|
|
}
|
|
m.VenueType = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaVenue) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetGeo returns value of Geo field.
|
|
func (m *MediaAreaVenue) GetGeo() (value GeoPointClass) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Geo
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (m *MediaAreaVenue) GetTitle() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Title
|
|
}
|
|
|
|
// GetAddress returns value of Address field.
|
|
func (m *MediaAreaVenue) GetAddress() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Address
|
|
}
|
|
|
|
// GetProvider returns value of Provider field.
|
|
func (m *MediaAreaVenue) GetProvider() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Provider
|
|
}
|
|
|
|
// GetVenueID returns value of VenueID field.
|
|
func (m *MediaAreaVenue) GetVenueID() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.VenueID
|
|
}
|
|
|
|
// GetVenueType returns value of VenueType field.
|
|
func (m *MediaAreaVenue) GetVenueType() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.VenueType
|
|
}
|
|
|
|
// InputMediaAreaVenue represents TL type `inputMediaAreaVenue#b282217f`.
|
|
// Represents a location tag¹ attached to a story², with additional venue information.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories#media-areas
|
|
// 2. https://core.telegram.org/api/stories
|
|
//
|
|
// See https://core.telegram.org/constructor/inputMediaAreaVenue for reference.
|
|
type InputMediaAreaVenue struct {
|
|
// The size and location of the media area corresponding to the location sticker on top
|
|
// of the story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// The query_id from messages.botResults¹, see here »² for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/messages.botResults
|
|
// 2) https://core.telegram.org/api/stories#media-areas
|
|
QueryID int64
|
|
// The id of the chosen result, see here »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stories#media-areas
|
|
ResultID string
|
|
}
|
|
|
|
// InputMediaAreaVenueTypeID is TL type id of InputMediaAreaVenue.
|
|
const InputMediaAreaVenueTypeID = 0xb282217f
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (i InputMediaAreaVenue) construct() MediaAreaClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputMediaAreaVenue.
|
|
var (
|
|
_ bin.Encoder = &InputMediaAreaVenue{}
|
|
_ bin.Decoder = &InputMediaAreaVenue{}
|
|
_ bin.BareEncoder = &InputMediaAreaVenue{}
|
|
_ bin.BareDecoder = &InputMediaAreaVenue{}
|
|
|
|
_ MediaAreaClass = &InputMediaAreaVenue{}
|
|
)
|
|
|
|
func (i *InputMediaAreaVenue) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(i.ResultID == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputMediaAreaVenue) String() string {
|
|
if i == nil {
|
|
return "InputMediaAreaVenue(nil)"
|
|
}
|
|
type Alias InputMediaAreaVenue
|
|
return fmt.Sprintf("InputMediaAreaVenue%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputMediaAreaVenue from given interface.
|
|
func (i *InputMediaAreaVenue) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetQueryID() (value int64)
|
|
GetResultID() (value string)
|
|
}) {
|
|
i.Coordinates = from.GetCoordinates()
|
|
i.QueryID = from.GetQueryID()
|
|
i.ResultID = from.GetResultID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputMediaAreaVenue) TypeID() uint32 {
|
|
return InputMediaAreaVenueTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputMediaAreaVenue) TypeName() string {
|
|
return "inputMediaAreaVenue"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputMediaAreaVenue) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputMediaAreaVenue",
|
|
ID: InputMediaAreaVenueTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "ResultID",
|
|
SchemaName: "result_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputMediaAreaVenue) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputMediaAreaVenue#b282217f as nil")
|
|
}
|
|
b.PutID(InputMediaAreaVenueTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputMediaAreaVenue) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputMediaAreaVenue#b282217f as nil")
|
|
}
|
|
if err := i.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputMediaAreaVenue#b282217f: field coordinates: %w", err)
|
|
}
|
|
b.PutLong(i.QueryID)
|
|
b.PutString(i.ResultID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputMediaAreaVenue) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputMediaAreaVenue#b282217f to nil")
|
|
}
|
|
if err := b.ConsumeID(InputMediaAreaVenueTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaVenue#b282217f: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputMediaAreaVenue) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputMediaAreaVenue#b282217f to nil")
|
|
}
|
|
{
|
|
if err := i.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaVenue#b282217f: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaVenue#b282217f: field query_id: %w", err)
|
|
}
|
|
i.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaVenue#b282217f: field result_id: %w", err)
|
|
}
|
|
i.ResultID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (i *InputMediaAreaVenue) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Coordinates
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (i *InputMediaAreaVenue) GetQueryID() (value int64) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.QueryID
|
|
}
|
|
|
|
// GetResultID returns value of ResultID field.
|
|
func (i *InputMediaAreaVenue) GetResultID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ResultID
|
|
}
|
|
|
|
// MediaAreaGeoPoint represents TL type `mediaAreaGeoPoint#cad5452d`.
|
|
// Represents a geolocation tag attached to a story¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaGeoPoint for reference.
|
|
type MediaAreaGeoPoint struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// The size and position of the media area corresponding to the location sticker on top
|
|
// of the story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// Coordinates of the geolocation tag.
|
|
Geo GeoPointClass
|
|
// Optional textual representation of the address.
|
|
//
|
|
// Use SetAddress and GetAddress helpers.
|
|
Address GeoPointAddress
|
|
}
|
|
|
|
// MediaAreaGeoPointTypeID is TL type id of MediaAreaGeoPoint.
|
|
const MediaAreaGeoPointTypeID = 0xcad5452d
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaGeoPoint) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaGeoPoint.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaGeoPoint{}
|
|
_ bin.Decoder = &MediaAreaGeoPoint{}
|
|
_ bin.BareEncoder = &MediaAreaGeoPoint{}
|
|
_ bin.BareDecoder = &MediaAreaGeoPoint{}
|
|
|
|
_ MediaAreaClass = &MediaAreaGeoPoint{}
|
|
)
|
|
|
|
func (m *MediaAreaGeoPoint) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Geo == nil) {
|
|
return false
|
|
}
|
|
if !(m.Address.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaGeoPoint) String() string {
|
|
if m == nil {
|
|
return "MediaAreaGeoPoint(nil)"
|
|
}
|
|
type Alias MediaAreaGeoPoint
|
|
return fmt.Sprintf("MediaAreaGeoPoint%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaGeoPoint from given interface.
|
|
func (m *MediaAreaGeoPoint) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetGeo() (value GeoPointClass)
|
|
GetAddress() (value GeoPointAddress, ok bool)
|
|
}) {
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.Geo = from.GetGeo()
|
|
if val, ok := from.GetAddress(); ok {
|
|
m.Address = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaGeoPoint) TypeID() uint32 {
|
|
return MediaAreaGeoPointTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaGeoPoint) TypeName() string {
|
|
return "mediaAreaGeoPoint"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaGeoPoint) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaGeoPoint",
|
|
ID: MediaAreaGeoPointTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "Geo",
|
|
SchemaName: "geo",
|
|
},
|
|
{
|
|
Name: "Address",
|
|
SchemaName: "address",
|
|
Null: !m.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (m *MediaAreaGeoPoint) SetFlags() {
|
|
if !(m.Address.Zero()) {
|
|
m.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaGeoPoint) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaGeoPoint#cad5452d as nil")
|
|
}
|
|
b.PutID(MediaAreaGeoPointTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaGeoPoint) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaGeoPoint#cad5452d as nil")
|
|
}
|
|
m.SetFlags()
|
|
if err := m.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field flags: %w", err)
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field coordinates: %w", err)
|
|
}
|
|
if m.Geo == nil {
|
|
return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field geo is nil")
|
|
}
|
|
if err := m.Geo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field geo: %w", err)
|
|
}
|
|
if m.Flags.Has(0) {
|
|
if err := m.Address.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaGeoPoint#cad5452d: field address: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaGeoPoint) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaGeoPoint#cad5452d to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaGeoPointTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaGeoPoint) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaGeoPoint#cad5452d to nil")
|
|
}
|
|
{
|
|
if err := m.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeGeoPoint(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field geo: %w", err)
|
|
}
|
|
m.Geo = value
|
|
}
|
|
if m.Flags.Has(0) {
|
|
if err := m.Address.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaGeoPoint#cad5452d: field address: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaGeoPoint) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetGeo returns value of Geo field.
|
|
func (m *MediaAreaGeoPoint) GetGeo() (value GeoPointClass) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Geo
|
|
}
|
|
|
|
// SetAddress sets value of Address conditional field.
|
|
func (m *MediaAreaGeoPoint) SetAddress(value GeoPointAddress) {
|
|
m.Flags.Set(0)
|
|
m.Address = value
|
|
}
|
|
|
|
// GetAddress returns value of Address conditional field and
|
|
// boolean which is true if field was set.
|
|
func (m *MediaAreaGeoPoint) GetAddress() (value GeoPointAddress, ok bool) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
if !m.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return m.Address, true
|
|
}
|
|
|
|
// MediaAreaSuggestedReaction represents TL type `mediaAreaSuggestedReaction#14455871`.
|
|
// Represents a reaction bubble.
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaSuggestedReaction for reference.
|
|
type MediaAreaSuggestedReaction struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the reaction bubble has a dark background.
|
|
Dark bool
|
|
// Whether the reaction bubble is mirrored (see here »¹ for more info).
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stories#reactions
|
|
Flipped bool
|
|
// The coordinates of the media area corresponding to the reaction button.
|
|
Coordinates MediaAreaCoordinates
|
|
// The reaction that should be sent when this area is clicked.
|
|
Reaction ReactionClass
|
|
}
|
|
|
|
// MediaAreaSuggestedReactionTypeID is TL type id of MediaAreaSuggestedReaction.
|
|
const MediaAreaSuggestedReactionTypeID = 0x14455871
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaSuggestedReaction) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaSuggestedReaction.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaSuggestedReaction{}
|
|
_ bin.Decoder = &MediaAreaSuggestedReaction{}
|
|
_ bin.BareEncoder = &MediaAreaSuggestedReaction{}
|
|
_ bin.BareDecoder = &MediaAreaSuggestedReaction{}
|
|
|
|
_ MediaAreaClass = &MediaAreaSuggestedReaction{}
|
|
)
|
|
|
|
func (m *MediaAreaSuggestedReaction) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Dark == false) {
|
|
return false
|
|
}
|
|
if !(m.Flipped == false) {
|
|
return false
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Reaction == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaSuggestedReaction) String() string {
|
|
if m == nil {
|
|
return "MediaAreaSuggestedReaction(nil)"
|
|
}
|
|
type Alias MediaAreaSuggestedReaction
|
|
return fmt.Sprintf("MediaAreaSuggestedReaction%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaSuggestedReaction from given interface.
|
|
func (m *MediaAreaSuggestedReaction) FillFrom(from interface {
|
|
GetDark() (value bool)
|
|
GetFlipped() (value bool)
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetReaction() (value ReactionClass)
|
|
}) {
|
|
m.Dark = from.GetDark()
|
|
m.Flipped = from.GetFlipped()
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.Reaction = from.GetReaction()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaSuggestedReaction) TypeID() uint32 {
|
|
return MediaAreaSuggestedReactionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaSuggestedReaction) TypeName() string {
|
|
return "mediaAreaSuggestedReaction"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaSuggestedReaction) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaSuggestedReaction",
|
|
ID: MediaAreaSuggestedReactionTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Dark",
|
|
SchemaName: "dark",
|
|
Null: !m.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Flipped",
|
|
SchemaName: "flipped",
|
|
Null: !m.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "Reaction",
|
|
SchemaName: "reaction",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (m *MediaAreaSuggestedReaction) SetFlags() {
|
|
if !(m.Dark == false) {
|
|
m.Flags.Set(0)
|
|
}
|
|
if !(m.Flipped == false) {
|
|
m.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaSuggestedReaction) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaSuggestedReaction#14455871 as nil")
|
|
}
|
|
b.PutID(MediaAreaSuggestedReactionTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaSuggestedReaction) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaSuggestedReaction#14455871 as nil")
|
|
}
|
|
m.SetFlags()
|
|
if err := m.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaSuggestedReaction#14455871: field flags: %w", err)
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaSuggestedReaction#14455871: field coordinates: %w", err)
|
|
}
|
|
if m.Reaction == nil {
|
|
return fmt.Errorf("unable to encode mediaAreaSuggestedReaction#14455871: field reaction is nil")
|
|
}
|
|
if err := m.Reaction.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaSuggestedReaction#14455871: field reaction: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaSuggestedReaction) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaSuggestedReaction#14455871 to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaSuggestedReactionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaSuggestedReaction#14455871: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaSuggestedReaction) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaSuggestedReaction#14455871 to nil")
|
|
}
|
|
{
|
|
if err := m.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaSuggestedReaction#14455871: field flags: %w", err)
|
|
}
|
|
}
|
|
m.Dark = m.Flags.Has(0)
|
|
m.Flipped = m.Flags.Has(1)
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaSuggestedReaction#14455871: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeReaction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaSuggestedReaction#14455871: field reaction: %w", err)
|
|
}
|
|
m.Reaction = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetDark sets value of Dark conditional field.
|
|
func (m *MediaAreaSuggestedReaction) SetDark(value bool) {
|
|
if value {
|
|
m.Flags.Set(0)
|
|
m.Dark = true
|
|
} else {
|
|
m.Flags.Unset(0)
|
|
m.Dark = false
|
|
}
|
|
}
|
|
|
|
// GetDark returns value of Dark conditional field.
|
|
func (m *MediaAreaSuggestedReaction) GetDark() (value bool) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Flags.Has(0)
|
|
}
|
|
|
|
// SetFlipped sets value of Flipped conditional field.
|
|
func (m *MediaAreaSuggestedReaction) SetFlipped(value bool) {
|
|
if value {
|
|
m.Flags.Set(1)
|
|
m.Flipped = true
|
|
} else {
|
|
m.Flags.Unset(1)
|
|
m.Flipped = false
|
|
}
|
|
}
|
|
|
|
// GetFlipped returns value of Flipped conditional field.
|
|
func (m *MediaAreaSuggestedReaction) GetFlipped() (value bool) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Flags.Has(1)
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaSuggestedReaction) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetReaction returns value of Reaction field.
|
|
func (m *MediaAreaSuggestedReaction) GetReaction() (value ReactionClass) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Reaction
|
|
}
|
|
|
|
// MediaAreaChannelPost represents TL type `mediaAreaChannelPost#770416af`.
|
|
// Represents a channel post.
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaChannelPost for reference.
|
|
type MediaAreaChannelPost struct {
|
|
// The size and location of the media area corresponding to the location sticker on top
|
|
// of the story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// The channel that posted the message
|
|
ChannelID int64
|
|
// ID of the channel message
|
|
MsgID int
|
|
}
|
|
|
|
// MediaAreaChannelPostTypeID is TL type id of MediaAreaChannelPost.
|
|
const MediaAreaChannelPostTypeID = 0x770416af
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaChannelPost) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaChannelPost.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaChannelPost{}
|
|
_ bin.Decoder = &MediaAreaChannelPost{}
|
|
_ bin.BareEncoder = &MediaAreaChannelPost{}
|
|
_ bin.BareDecoder = &MediaAreaChannelPost{}
|
|
|
|
_ MediaAreaClass = &MediaAreaChannelPost{}
|
|
)
|
|
|
|
func (m *MediaAreaChannelPost) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(m.MsgID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaChannelPost) String() string {
|
|
if m == nil {
|
|
return "MediaAreaChannelPost(nil)"
|
|
}
|
|
type Alias MediaAreaChannelPost
|
|
return fmt.Sprintf("MediaAreaChannelPost%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaChannelPost from given interface.
|
|
func (m *MediaAreaChannelPost) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetChannelID() (value int64)
|
|
GetMsgID() (value int)
|
|
}) {
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.ChannelID = from.GetChannelID()
|
|
m.MsgID = from.GetMsgID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaChannelPost) TypeID() uint32 {
|
|
return MediaAreaChannelPostTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaChannelPost) TypeName() string {
|
|
return "mediaAreaChannelPost"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaChannelPost) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaChannelPost",
|
|
ID: MediaAreaChannelPostTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaChannelPost) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaChannelPost#770416af as nil")
|
|
}
|
|
b.PutID(MediaAreaChannelPostTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaChannelPost) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaChannelPost#770416af as nil")
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaChannelPost#770416af: field coordinates: %w", err)
|
|
}
|
|
b.PutLong(m.ChannelID)
|
|
b.PutInt(m.MsgID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaChannelPost) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaChannelPost#770416af to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaChannelPostTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaChannelPost) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaChannelPost#770416af to nil")
|
|
}
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: field channel_id: %w", err)
|
|
}
|
|
m.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaChannelPost#770416af: field msg_id: %w", err)
|
|
}
|
|
m.MsgID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaChannelPost) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (m *MediaAreaChannelPost) GetChannelID() (value int64) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.ChannelID
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (m *MediaAreaChannelPost) GetMsgID() (value int) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.MsgID
|
|
}
|
|
|
|
// InputMediaAreaChannelPost represents TL type `inputMediaAreaChannelPost#2271f2bf`.
|
|
// Represents a channel post
|
|
//
|
|
// See https://core.telegram.org/constructor/inputMediaAreaChannelPost for reference.
|
|
type InputMediaAreaChannelPost struct {
|
|
// The size and location of the media area corresponding to the location sticker on top
|
|
// of the story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// The channel that posted the message
|
|
Channel InputChannelClass
|
|
// ID of the channel message
|
|
MsgID int
|
|
}
|
|
|
|
// InputMediaAreaChannelPostTypeID is TL type id of InputMediaAreaChannelPost.
|
|
const InputMediaAreaChannelPostTypeID = 0x2271f2bf
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (i InputMediaAreaChannelPost) construct() MediaAreaClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputMediaAreaChannelPost.
|
|
var (
|
|
_ bin.Encoder = &InputMediaAreaChannelPost{}
|
|
_ bin.Decoder = &InputMediaAreaChannelPost{}
|
|
_ bin.BareEncoder = &InputMediaAreaChannelPost{}
|
|
_ bin.BareDecoder = &InputMediaAreaChannelPost{}
|
|
|
|
_ MediaAreaClass = &InputMediaAreaChannelPost{}
|
|
)
|
|
|
|
func (i *InputMediaAreaChannelPost) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Channel == nil) {
|
|
return false
|
|
}
|
|
if !(i.MsgID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputMediaAreaChannelPost) String() string {
|
|
if i == nil {
|
|
return "InputMediaAreaChannelPost(nil)"
|
|
}
|
|
type Alias InputMediaAreaChannelPost
|
|
return fmt.Sprintf("InputMediaAreaChannelPost%+v", Alias(*i))
|
|
}
|
|
|
|
// FillFrom fills InputMediaAreaChannelPost from given interface.
|
|
func (i *InputMediaAreaChannelPost) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetChannel() (value InputChannelClass)
|
|
GetMsgID() (value int)
|
|
}) {
|
|
i.Coordinates = from.GetCoordinates()
|
|
i.Channel = from.GetChannel()
|
|
i.MsgID = from.GetMsgID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputMediaAreaChannelPost) TypeID() uint32 {
|
|
return InputMediaAreaChannelPostTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputMediaAreaChannelPost) TypeName() string {
|
|
return "inputMediaAreaChannelPost"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputMediaAreaChannelPost) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputMediaAreaChannelPost",
|
|
ID: InputMediaAreaChannelPostTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "Channel",
|
|
SchemaName: "channel",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputMediaAreaChannelPost) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputMediaAreaChannelPost#2271f2bf as nil")
|
|
}
|
|
b.PutID(InputMediaAreaChannelPostTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputMediaAreaChannelPost) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputMediaAreaChannelPost#2271f2bf as nil")
|
|
}
|
|
if err := i.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputMediaAreaChannelPost#2271f2bf: field coordinates: %w", err)
|
|
}
|
|
if i.Channel == nil {
|
|
return fmt.Errorf("unable to encode inputMediaAreaChannelPost#2271f2bf: field channel is nil")
|
|
}
|
|
if err := i.Channel.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputMediaAreaChannelPost#2271f2bf: field channel: %w", err)
|
|
}
|
|
b.PutInt(i.MsgID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputMediaAreaChannelPost) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputMediaAreaChannelPost#2271f2bf to nil")
|
|
}
|
|
if err := b.ConsumeID(InputMediaAreaChannelPostTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputMediaAreaChannelPost) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputMediaAreaChannelPost#2271f2bf to nil")
|
|
}
|
|
{
|
|
if err := i.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeInputChannel(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: field channel: %w", err)
|
|
}
|
|
i.Channel = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputMediaAreaChannelPost#2271f2bf: field msg_id: %w", err)
|
|
}
|
|
i.MsgID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (i *InputMediaAreaChannelPost) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Coordinates
|
|
}
|
|
|
|
// GetChannel returns value of Channel field.
|
|
func (i *InputMediaAreaChannelPost) GetChannel() (value InputChannelClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Channel
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (i *InputMediaAreaChannelPost) GetMsgID() (value int) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.MsgID
|
|
}
|
|
|
|
// MediaAreaURL represents TL type `mediaAreaUrl#37381085`.
|
|
// Represents a URL media area¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories#urls
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaUrl for reference.
|
|
type MediaAreaURL struct {
|
|
// The size and location of the media area corresponding to the URL button on top of the
|
|
// story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// URL to open when clicked.
|
|
URL string
|
|
}
|
|
|
|
// MediaAreaURLTypeID is TL type id of MediaAreaURL.
|
|
const MediaAreaURLTypeID = 0x37381085
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaURL) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaURL.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaURL{}
|
|
_ bin.Decoder = &MediaAreaURL{}
|
|
_ bin.BareEncoder = &MediaAreaURL{}
|
|
_ bin.BareDecoder = &MediaAreaURL{}
|
|
|
|
_ MediaAreaClass = &MediaAreaURL{}
|
|
)
|
|
|
|
func (m *MediaAreaURL) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.URL == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaURL) String() string {
|
|
if m == nil {
|
|
return "MediaAreaURL(nil)"
|
|
}
|
|
type Alias MediaAreaURL
|
|
return fmt.Sprintf("MediaAreaURL%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaURL from given interface.
|
|
func (m *MediaAreaURL) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetURL() (value string)
|
|
}) {
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.URL = from.GetURL()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaURL) TypeID() uint32 {
|
|
return MediaAreaURLTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaURL) TypeName() string {
|
|
return "mediaAreaUrl"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaURL) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaUrl",
|
|
ID: MediaAreaURLTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "URL",
|
|
SchemaName: "url",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaURL) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaUrl#37381085 as nil")
|
|
}
|
|
b.PutID(MediaAreaURLTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaURL) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaUrl#37381085 as nil")
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaUrl#37381085: field coordinates: %w", err)
|
|
}
|
|
b.PutString(m.URL)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaURL) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaUrl#37381085 to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaURLTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaUrl#37381085: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaURL) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaUrl#37381085 to nil")
|
|
}
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaUrl#37381085: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaUrl#37381085: field url: %w", err)
|
|
}
|
|
m.URL = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaURL) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetURL returns value of URL field.
|
|
func (m *MediaAreaURL) GetURL() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.URL
|
|
}
|
|
|
|
// MediaAreaWeather represents TL type `mediaAreaWeather#49a6549c`.
|
|
// Represents a weather widget »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories#weather
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaWeather for reference.
|
|
type MediaAreaWeather struct {
|
|
// The size and location of the media area corresponding to the widget on top of the
|
|
// story media.
|
|
Coordinates MediaAreaCoordinates
|
|
// Weather emoji, should be rendered as an animated emoji¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/animated-emojis
|
|
Emoji string
|
|
// Temperature in degrees Celsius.
|
|
TemperatureC float64
|
|
// ARGB background color.
|
|
Color int
|
|
}
|
|
|
|
// MediaAreaWeatherTypeID is TL type id of MediaAreaWeather.
|
|
const MediaAreaWeatherTypeID = 0x49a6549c
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaWeather) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaWeather.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaWeather{}
|
|
_ bin.Decoder = &MediaAreaWeather{}
|
|
_ bin.BareEncoder = &MediaAreaWeather{}
|
|
_ bin.BareDecoder = &MediaAreaWeather{}
|
|
|
|
_ MediaAreaClass = &MediaAreaWeather{}
|
|
)
|
|
|
|
func (m *MediaAreaWeather) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Emoji == "") {
|
|
return false
|
|
}
|
|
if !(m.TemperatureC == 0) {
|
|
return false
|
|
}
|
|
if !(m.Color == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaWeather) String() string {
|
|
if m == nil {
|
|
return "MediaAreaWeather(nil)"
|
|
}
|
|
type Alias MediaAreaWeather
|
|
return fmt.Sprintf("MediaAreaWeather%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaWeather from given interface.
|
|
func (m *MediaAreaWeather) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetEmoji() (value string)
|
|
GetTemperatureC() (value float64)
|
|
GetColor() (value int)
|
|
}) {
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.Emoji = from.GetEmoji()
|
|
m.TemperatureC = from.GetTemperatureC()
|
|
m.Color = from.GetColor()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaWeather) TypeID() uint32 {
|
|
return MediaAreaWeatherTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaWeather) TypeName() string {
|
|
return "mediaAreaWeather"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaWeather) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaWeather",
|
|
ID: MediaAreaWeatherTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "Emoji",
|
|
SchemaName: "emoji",
|
|
},
|
|
{
|
|
Name: "TemperatureC",
|
|
SchemaName: "temperature_c",
|
|
},
|
|
{
|
|
Name: "Color",
|
|
SchemaName: "color",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaWeather) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaWeather#49a6549c as nil")
|
|
}
|
|
b.PutID(MediaAreaWeatherTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaWeather) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaWeather#49a6549c as nil")
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaWeather#49a6549c: field coordinates: %w", err)
|
|
}
|
|
b.PutString(m.Emoji)
|
|
b.PutDouble(m.TemperatureC)
|
|
b.PutInt(m.Color)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaWeather) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaWeather#49a6549c to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaWeatherTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaWeather) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaWeather#49a6549c to nil")
|
|
}
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field emoji: %w", err)
|
|
}
|
|
m.Emoji = value
|
|
}
|
|
{
|
|
value, err := b.Double()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field temperature_c: %w", err)
|
|
}
|
|
m.TemperatureC = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaWeather#49a6549c: field color: %w", err)
|
|
}
|
|
m.Color = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaWeather) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetEmoji returns value of Emoji field.
|
|
func (m *MediaAreaWeather) GetEmoji() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Emoji
|
|
}
|
|
|
|
// GetTemperatureC returns value of TemperatureC field.
|
|
func (m *MediaAreaWeather) GetTemperatureC() (value float64) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.TemperatureC
|
|
}
|
|
|
|
// GetColor returns value of Color field.
|
|
func (m *MediaAreaWeather) GetColor() (value int) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Color
|
|
}
|
|
|
|
// MediaAreaStarGift represents TL type `mediaAreaStarGift#5787686d`.
|
|
// Represents a collectible gift »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/gifts#collectible-gifts
|
|
//
|
|
// See https://core.telegram.org/constructor/mediaAreaStarGift for reference.
|
|
type MediaAreaStarGift struct {
|
|
// Coordinates of the media area.
|
|
Coordinates MediaAreaCoordinates
|
|
// slug from starGiftUnique¹.slug, that can be resolved as specified here »².
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/starGiftUnique
|
|
// 2) https://core.telegram.org/api/gifts#sharing-and-getting-info-about-a-collectible-gift
|
|
Slug string
|
|
}
|
|
|
|
// MediaAreaStarGiftTypeID is TL type id of MediaAreaStarGift.
|
|
const MediaAreaStarGiftTypeID = 0x5787686d
|
|
|
|
// construct implements constructor of MediaAreaClass.
|
|
func (m MediaAreaStarGift) construct() MediaAreaClass { return &m }
|
|
|
|
// Ensuring interfaces in compile-time for MediaAreaStarGift.
|
|
var (
|
|
_ bin.Encoder = &MediaAreaStarGift{}
|
|
_ bin.Decoder = &MediaAreaStarGift{}
|
|
_ bin.BareEncoder = &MediaAreaStarGift{}
|
|
_ bin.BareDecoder = &MediaAreaStarGift{}
|
|
|
|
_ MediaAreaClass = &MediaAreaStarGift{}
|
|
)
|
|
|
|
func (m *MediaAreaStarGift) Zero() bool {
|
|
if m == nil {
|
|
return true
|
|
}
|
|
if !(m.Coordinates.Zero()) {
|
|
return false
|
|
}
|
|
if !(m.Slug == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (m *MediaAreaStarGift) String() string {
|
|
if m == nil {
|
|
return "MediaAreaStarGift(nil)"
|
|
}
|
|
type Alias MediaAreaStarGift
|
|
return fmt.Sprintf("MediaAreaStarGift%+v", Alias(*m))
|
|
}
|
|
|
|
// FillFrom fills MediaAreaStarGift from given interface.
|
|
func (m *MediaAreaStarGift) FillFrom(from interface {
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
GetSlug() (value string)
|
|
}) {
|
|
m.Coordinates = from.GetCoordinates()
|
|
m.Slug = from.GetSlug()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MediaAreaStarGift) TypeID() uint32 {
|
|
return MediaAreaStarGiftTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MediaAreaStarGift) TypeName() string {
|
|
return "mediaAreaStarGift"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (m *MediaAreaStarGift) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "mediaAreaStarGift",
|
|
ID: MediaAreaStarGiftTypeID,
|
|
}
|
|
if m == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Coordinates",
|
|
SchemaName: "coordinates",
|
|
},
|
|
{
|
|
Name: "Slug",
|
|
SchemaName: "slug",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (m *MediaAreaStarGift) Encode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaStarGift#5787686d as nil")
|
|
}
|
|
b.PutID(MediaAreaStarGiftTypeID)
|
|
return m.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (m *MediaAreaStarGift) EncodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't encode mediaAreaStarGift#5787686d as nil")
|
|
}
|
|
if err := m.Coordinates.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode mediaAreaStarGift#5787686d: field coordinates: %w", err)
|
|
}
|
|
b.PutString(m.Slug)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (m *MediaAreaStarGift) Decode(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaStarGift#5787686d to nil")
|
|
}
|
|
if err := b.ConsumeID(MediaAreaStarGiftTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaStarGift#5787686d: %w", err)
|
|
}
|
|
return m.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (m *MediaAreaStarGift) DecodeBare(b *bin.Buffer) error {
|
|
if m == nil {
|
|
return fmt.Errorf("can't decode mediaAreaStarGift#5787686d to nil")
|
|
}
|
|
{
|
|
if err := m.Coordinates.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaStarGift#5787686d: field coordinates: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode mediaAreaStarGift#5787686d: field slug: %w", err)
|
|
}
|
|
m.Slug = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCoordinates returns value of Coordinates field.
|
|
func (m *MediaAreaStarGift) GetCoordinates() (value MediaAreaCoordinates) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Coordinates
|
|
}
|
|
|
|
// GetSlug returns value of Slug field.
|
|
func (m *MediaAreaStarGift) GetSlug() (value string) {
|
|
if m == nil {
|
|
return
|
|
}
|
|
return m.Slug
|
|
}
|
|
|
|
// MediaAreaClassName is schema name of MediaAreaClass.
|
|
const MediaAreaClassName = "MediaArea"
|
|
|
|
// MediaAreaClass represents MediaArea generic type.
|
|
//
|
|
// See https://core.telegram.org/type/MediaArea for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodeMediaArea(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.MediaAreaVenue: // mediaAreaVenue#be82db9c
|
|
// case *tg.InputMediaAreaVenue: // inputMediaAreaVenue#b282217f
|
|
// case *tg.MediaAreaGeoPoint: // mediaAreaGeoPoint#cad5452d
|
|
// case *tg.MediaAreaSuggestedReaction: // mediaAreaSuggestedReaction#14455871
|
|
// case *tg.MediaAreaChannelPost: // mediaAreaChannelPost#770416af
|
|
// case *tg.InputMediaAreaChannelPost: // inputMediaAreaChannelPost#2271f2bf
|
|
// case *tg.MediaAreaURL: // mediaAreaUrl#37381085
|
|
// case *tg.MediaAreaWeather: // mediaAreaWeather#49a6549c
|
|
// case *tg.MediaAreaStarGift: // mediaAreaStarGift#5787686d
|
|
// default: panic(v)
|
|
// }
|
|
type MediaAreaClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() MediaAreaClass
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
TypeID() uint32
|
|
// TypeName returns name of type in TL schema.
|
|
TypeName() string
|
|
// String implements fmt.Stringer.
|
|
String() string
|
|
// Zero returns true if current object has a zero value.
|
|
Zero() bool
|
|
|
|
// The size and location of the media area corresponding to the location sticker on top
|
|
// of the story media.
|
|
GetCoordinates() (value MediaAreaCoordinates)
|
|
}
|
|
|
|
// DecodeMediaArea implements binary de-serialization for MediaAreaClass.
|
|
func DecodeMediaArea(buf *bin.Buffer) (MediaAreaClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case MediaAreaVenueTypeID:
|
|
// Decoding mediaAreaVenue#be82db9c.
|
|
v := MediaAreaVenue{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputMediaAreaVenueTypeID:
|
|
// Decoding inputMediaAreaVenue#b282217f.
|
|
v := InputMediaAreaVenue{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case MediaAreaGeoPointTypeID:
|
|
// Decoding mediaAreaGeoPoint#cad5452d.
|
|
v := MediaAreaGeoPoint{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case MediaAreaSuggestedReactionTypeID:
|
|
// Decoding mediaAreaSuggestedReaction#14455871.
|
|
v := MediaAreaSuggestedReaction{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case MediaAreaChannelPostTypeID:
|
|
// Decoding mediaAreaChannelPost#770416af.
|
|
v := MediaAreaChannelPost{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputMediaAreaChannelPostTypeID:
|
|
// Decoding inputMediaAreaChannelPost#2271f2bf.
|
|
v := InputMediaAreaChannelPost{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case MediaAreaURLTypeID:
|
|
// Decoding mediaAreaUrl#37381085.
|
|
v := MediaAreaURL{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case MediaAreaWeatherTypeID:
|
|
// Decoding mediaAreaWeather#49a6549c.
|
|
v := MediaAreaWeather{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case MediaAreaStarGiftTypeID:
|
|
// Decoding mediaAreaStarGift#5787686d.
|
|
v := MediaAreaStarGift{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode MediaAreaClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// MediaArea boxes the MediaAreaClass providing a helper.
|
|
type MediaAreaBox struct {
|
|
MediaArea MediaAreaClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for MediaAreaBox.
|
|
func (b *MediaAreaBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode MediaAreaBox to nil")
|
|
}
|
|
v, err := DecodeMediaArea(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.MediaArea = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for MediaAreaBox.
|
|
func (b *MediaAreaBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.MediaArea == nil {
|
|
return fmt.Errorf("unable to encode MediaAreaClass as nil")
|
|
}
|
|
return b.MediaArea.Encode(buf)
|
|
}
|