package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type MediaAreaVenue struct {
Coordinates MediaAreaCoordinates
Geo GeoPointClass
Title string
Address string
Provider string
VenueID string
VenueType string
}
const MediaAreaVenueTypeID = 0xbe82db9c
func (m MediaAreaVenue ) construct () MediaAreaClass { return &m }
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
}
func (m *MediaAreaVenue ) String () string {
if m == nil {
return "MediaAreaVenue(nil)"
}
type Alias MediaAreaVenue
return fmt .Sprintf ("MediaAreaVenue%+v" , Alias (*m ))
}
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 ()
}
func (*MediaAreaVenue ) TypeID () uint32 {
return MediaAreaVenueTypeID
}
func (*MediaAreaVenue ) TypeName () string {
return "mediaAreaVenue"
}
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
}
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 )
}
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
}
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 )
}
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
}
func (m *MediaAreaVenue ) GetCoordinates () (value MediaAreaCoordinates ) {
if m == nil {
return
}
return m .Coordinates
}
func (m *MediaAreaVenue ) GetGeo () (value GeoPointClass ) {
if m == nil {
return
}
return m .Geo
}
func (m *MediaAreaVenue ) GetTitle () (value string ) {
if m == nil {
return
}
return m .Title
}
func (m *MediaAreaVenue ) GetAddress () (value string ) {
if m == nil {
return
}
return m .Address
}
func (m *MediaAreaVenue ) GetProvider () (value string ) {
if m == nil {
return
}
return m .Provider
}
func (m *MediaAreaVenue ) GetVenueID () (value string ) {
if m == nil {
return
}
return m .VenueID
}
func (m *MediaAreaVenue ) GetVenueType () (value string ) {
if m == nil {
return
}
return m .VenueType
}
type InputMediaAreaVenue struct {
Coordinates MediaAreaCoordinates
QueryID int64
ResultID string
}
const InputMediaAreaVenueTypeID = 0xb282217f
func (i InputMediaAreaVenue ) construct () MediaAreaClass { return &i }
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
}
func (i *InputMediaAreaVenue ) String () string {
if i == nil {
return "InputMediaAreaVenue(nil)"
}
type Alias InputMediaAreaVenue
return fmt .Sprintf ("InputMediaAreaVenue%+v" , Alias (*i ))
}
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 ()
}
func (*InputMediaAreaVenue ) TypeID () uint32 {
return InputMediaAreaVenueTypeID
}
func (*InputMediaAreaVenue ) TypeName () string {
return "inputMediaAreaVenue"
}
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
}
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 )
}
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
}
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 )
}
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
}
func (i *InputMediaAreaVenue ) GetCoordinates () (value MediaAreaCoordinates ) {
if i == nil {
return
}
return i .Coordinates
}
func (i *InputMediaAreaVenue ) GetQueryID () (value int64 ) {
if i == nil {
return
}
return i .QueryID
}
func (i *InputMediaAreaVenue ) GetResultID () (value string ) {
if i == nil {
return
}
return i .ResultID
}
type MediaAreaGeoPoint struct {
Coordinates MediaAreaCoordinates
Geo GeoPointClass
}
const MediaAreaGeoPointTypeID = 0xdf8b3b22
func (m MediaAreaGeoPoint ) construct () MediaAreaClass { return &m }
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 .Coordinates .Zero ()) {
return false
}
if !(m .Geo == nil ) {
return false
}
return true
}
func (m *MediaAreaGeoPoint ) String () string {
if m == nil {
return "MediaAreaGeoPoint(nil)"
}
type Alias MediaAreaGeoPoint
return fmt .Sprintf ("MediaAreaGeoPoint%+v" , Alias (*m ))
}
func (m *MediaAreaGeoPoint ) FillFrom (from interface {
GetCoordinates () (value MediaAreaCoordinates )
GetGeo () (value GeoPointClass )
}) {
m .Coordinates = from .GetCoordinates ()
m .Geo = from .GetGeo ()
}
func (*MediaAreaGeoPoint ) TypeID () uint32 {
return MediaAreaGeoPointTypeID
}
func (*MediaAreaGeoPoint ) TypeName () string {
return "mediaAreaGeoPoint"
}
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" ,
},
}
return typ
}
func (m *MediaAreaGeoPoint ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode mediaAreaGeoPoint#df8b3b22 as nil" )
}
b .PutID (MediaAreaGeoPointTypeID )
return m .EncodeBare (b )
}
func (m *MediaAreaGeoPoint ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode mediaAreaGeoPoint#df8b3b22 as nil" )
}
if err := m .Coordinates .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode mediaAreaGeoPoint#df8b3b22: field coordinates: %w" , err )
}
if m .Geo == nil {
return fmt .Errorf ("unable to encode mediaAreaGeoPoint#df8b3b22: field geo is nil" )
}
if err := m .Geo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode mediaAreaGeoPoint#df8b3b22: field geo: %w" , err )
}
return nil
}
func (m *MediaAreaGeoPoint ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode mediaAreaGeoPoint#df8b3b22 to nil" )
}
if err := b .ConsumeID (MediaAreaGeoPointTypeID ); err != nil {
return fmt .Errorf ("unable to decode mediaAreaGeoPoint#df8b3b22: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MediaAreaGeoPoint ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode mediaAreaGeoPoint#df8b3b22 to nil" )
}
{
if err := m .Coordinates .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode mediaAreaGeoPoint#df8b3b22: field coordinates: %w" , err )
}
}
{
value , err := DecodeGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode mediaAreaGeoPoint#df8b3b22: field geo: %w" , err )
}
m .Geo = value
}
return nil
}
func (m *MediaAreaGeoPoint ) GetCoordinates () (value MediaAreaCoordinates ) {
if m == nil {
return
}
return m .Coordinates
}
func (m *MediaAreaGeoPoint ) GetGeo () (value GeoPointClass ) {
if m == nil {
return
}
return m .Geo
}
type MediaAreaSuggestedReaction struct {
Flags bin .Fields
Dark bool
Flipped bool
Coordinates MediaAreaCoordinates
Reaction ReactionClass
}
const MediaAreaSuggestedReactionTypeID = 0x14455871
func (m MediaAreaSuggestedReaction ) construct () MediaAreaClass { return &m }
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
}
func (m *MediaAreaSuggestedReaction ) String () string {
if m == nil {
return "MediaAreaSuggestedReaction(nil)"
}
type Alias MediaAreaSuggestedReaction
return fmt .Sprintf ("MediaAreaSuggestedReaction%+v" , Alias (*m ))
}
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 ()
}
func (*MediaAreaSuggestedReaction ) TypeID () uint32 {
return MediaAreaSuggestedReactionTypeID
}
func (*MediaAreaSuggestedReaction ) TypeName () string {
return "mediaAreaSuggestedReaction"
}
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
}
func (m *MediaAreaSuggestedReaction ) SetFlags () {
if !(m .Dark == false ) {
m .Flags .Set (0 )
}
if !(m .Flipped == false ) {
m .Flags .Set (1 )
}
}
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 )
}
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
}
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 )
}
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
}
func (m *MediaAreaSuggestedReaction ) SetDark (value bool ) {
if value {
m .Flags .Set (0 )
m .Dark = true
} else {
m .Flags .Unset (0 )
m .Dark = false
}
}
func (m *MediaAreaSuggestedReaction ) GetDark () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (0 )
}
func (m *MediaAreaSuggestedReaction ) SetFlipped (value bool ) {
if value {
m .Flags .Set (1 )
m .Flipped = true
} else {
m .Flags .Unset (1 )
m .Flipped = false
}
}
func (m *MediaAreaSuggestedReaction ) GetFlipped () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (1 )
}
func (m *MediaAreaSuggestedReaction ) GetCoordinates () (value MediaAreaCoordinates ) {
if m == nil {
return
}
return m .Coordinates
}
func (m *MediaAreaSuggestedReaction ) GetReaction () (value ReactionClass ) {
if m == nil {
return
}
return m .Reaction
}
type MediaAreaChannelPost struct {
Coordinates MediaAreaCoordinates
ChannelID int64
MsgID int
}
const MediaAreaChannelPostTypeID = 0x770416af
func (m MediaAreaChannelPost ) construct () MediaAreaClass { return &m }
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
}
func (m *MediaAreaChannelPost ) String () string {
if m == nil {
return "MediaAreaChannelPost(nil)"
}
type Alias MediaAreaChannelPost
return fmt .Sprintf ("MediaAreaChannelPost%+v" , Alias (*m ))
}
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 ()
}
func (*MediaAreaChannelPost ) TypeID () uint32 {
return MediaAreaChannelPostTypeID
}
func (*MediaAreaChannelPost ) TypeName () string {
return "mediaAreaChannelPost"
}
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
}
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 )
}
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
}
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 )
}
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
}
func (m *MediaAreaChannelPost ) GetCoordinates () (value MediaAreaCoordinates ) {
if m == nil {
return
}
return m .Coordinates
}
func (m *MediaAreaChannelPost ) GetChannelID () (value int64 ) {
if m == nil {
return
}
return m .ChannelID
}
func (m *MediaAreaChannelPost ) GetMsgID () (value int ) {
if m == nil {
return
}
return m .MsgID
}
type InputMediaAreaChannelPost struct {
Coordinates MediaAreaCoordinates
Channel InputChannelClass
MsgID int
}
const InputMediaAreaChannelPostTypeID = 0x2271f2bf
func (i InputMediaAreaChannelPost ) construct () MediaAreaClass { return &i }
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
}
func (i *InputMediaAreaChannelPost ) String () string {
if i == nil {
return "InputMediaAreaChannelPost(nil)"
}
type Alias InputMediaAreaChannelPost
return fmt .Sprintf ("InputMediaAreaChannelPost%+v" , Alias (*i ))
}
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 ()
}
func (*InputMediaAreaChannelPost ) TypeID () uint32 {
return InputMediaAreaChannelPostTypeID
}
func (*InputMediaAreaChannelPost ) TypeName () string {
return "inputMediaAreaChannelPost"
}
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
}
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 )
}
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
}
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 )
}
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
}
func (i *InputMediaAreaChannelPost ) GetCoordinates () (value MediaAreaCoordinates ) {
if i == nil {
return
}
return i .Coordinates
}
func (i *InputMediaAreaChannelPost ) GetChannel () (value InputChannelClass ) {
if i == nil {
return
}
return i .Channel
}
func (i *InputMediaAreaChannelPost ) GetMsgID () (value int ) {
if i == nil {
return
}
return i .MsgID
}
const MediaAreaClassName = "MediaArea"
type MediaAreaClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MediaAreaClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetCoordinates () (value MediaAreaCoordinates )
}
func DecodeMediaArea (buf *bin .Buffer ) (MediaAreaClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MediaAreaVenueTypeID :
v := MediaAreaVenue {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MediaAreaClass: %w" , err )
}
return &v , nil
case InputMediaAreaVenueTypeID :
v := InputMediaAreaVenue {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MediaAreaClass: %w" , err )
}
return &v , nil
case MediaAreaGeoPointTypeID :
v := MediaAreaGeoPoint {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MediaAreaClass: %w" , err )
}
return &v , nil
case MediaAreaSuggestedReactionTypeID :
v := MediaAreaSuggestedReaction {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MediaAreaClass: %w" , err )
}
return &v , nil
case MediaAreaChannelPostTypeID :
v := MediaAreaChannelPost {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MediaAreaClass: %w" , err )
}
return &v , nil
case InputMediaAreaChannelPostTypeID :
v := InputMediaAreaChannelPost {}
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 ))
}
}
type MediaAreaBox struct {
MediaArea MediaAreaClass
}
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
}
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 )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .