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 InputMediaEmpty struct {
}
const InputMediaEmptyTypeID = 0x9664f57f
func (i InputMediaEmpty ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaEmpty {}
_ bin .Decoder = &InputMediaEmpty {}
_ bin .BareEncoder = &InputMediaEmpty {}
_ bin .BareDecoder = &InputMediaEmpty {}
_ InputMediaClass = &InputMediaEmpty {}
)
func (i *InputMediaEmpty ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputMediaEmpty ) String () string {
if i == nil {
return "InputMediaEmpty(nil)"
}
type Alias InputMediaEmpty
return fmt .Sprintf ("InputMediaEmpty%+v" , Alias (*i ))
}
func (*InputMediaEmpty ) TypeID () uint32 {
return InputMediaEmptyTypeID
}
func (*InputMediaEmpty ) TypeName () string {
return "inputMediaEmpty"
}
func (i *InputMediaEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaEmpty" ,
ID : InputMediaEmptyTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputMediaEmpty ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaEmpty#9664f57f as nil" )
}
b .PutID (InputMediaEmptyTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaEmpty ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaEmpty#9664f57f as nil" )
}
return nil
}
func (i *InputMediaEmpty ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaEmpty#9664f57f to nil" )
}
if err := b .ConsumeID (InputMediaEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaEmpty#9664f57f: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaEmpty ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaEmpty#9664f57f to nil" )
}
return nil
}
type InputMediaUploadedPhoto struct {
Flags bin .Fields
Spoiler bool
File InputFileClass
Stickers []InputDocumentClass
TTLSeconds int
}
const InputMediaUploadedPhotoTypeID = 0x1e287d04
func (i InputMediaUploadedPhoto ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaUploadedPhoto {}
_ bin .Decoder = &InputMediaUploadedPhoto {}
_ bin .BareEncoder = &InputMediaUploadedPhoto {}
_ bin .BareDecoder = &InputMediaUploadedPhoto {}
_ InputMediaClass = &InputMediaUploadedPhoto {}
)
func (i *InputMediaUploadedPhoto ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Spoiler == false ) {
return false
}
if !(i .File == nil ) {
return false
}
if !(i .Stickers == nil ) {
return false
}
if !(i .TTLSeconds == 0 ) {
return false
}
return true
}
func (i *InputMediaUploadedPhoto ) String () string {
if i == nil {
return "InputMediaUploadedPhoto(nil)"
}
type Alias InputMediaUploadedPhoto
return fmt .Sprintf ("InputMediaUploadedPhoto%+v" , Alias (*i ))
}
func (i *InputMediaUploadedPhoto ) FillFrom (from interface {
GetSpoiler () (value bool )
GetFile () (value InputFileClass )
GetStickers () (value []InputDocumentClass , ok bool )
GetTTLSeconds () (value int , ok bool )
}) {
i .Spoiler = from .GetSpoiler ()
i .File = from .GetFile ()
if val , ok := from .GetStickers (); ok {
i .Stickers = val
}
if val , ok := from .GetTTLSeconds (); ok {
i .TTLSeconds = val
}
}
func (*InputMediaUploadedPhoto ) TypeID () uint32 {
return InputMediaUploadedPhotoTypeID
}
func (*InputMediaUploadedPhoto ) TypeName () string {
return "inputMediaUploadedPhoto"
}
func (i *InputMediaUploadedPhoto ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaUploadedPhoto" ,
ID : InputMediaUploadedPhotoTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "File" ,
SchemaName : "file" ,
},
{
Name : "Stickers" ,
SchemaName : "stickers" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !i .Flags .Has (1 ),
},
}
return typ
}
func (i *InputMediaUploadedPhoto ) SetFlags () {
if !(i .Spoiler == false ) {
i .Flags .Set (2 )
}
if !(i .Stickers == nil ) {
i .Flags .Set (0 )
}
if !(i .TTLSeconds == 0 ) {
i .Flags .Set (1 )
}
}
func (i *InputMediaUploadedPhoto ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaUploadedPhoto#1e287d04 as nil" )
}
b .PutID (InputMediaUploadedPhotoTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaUploadedPhoto ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaUploadedPhoto#1e287d04 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedPhoto#1e287d04: field flags: %w" , err )
}
if i .File == nil {
return fmt .Errorf ("unable to encode inputMediaUploadedPhoto#1e287d04: field file is nil" )
}
if err := i .File .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedPhoto#1e287d04: field file: %w" , err )
}
if i .Flags .Has (0 ) {
b .PutVectorHeader (len (i .Stickers ))
for idx , v := range i .Stickers {
if v == nil {
return fmt .Errorf ("unable to encode inputMediaUploadedPhoto#1e287d04: field stickers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedPhoto#1e287d04: field stickers element with index %d: %w" , idx , err )
}
}
}
if i .Flags .Has (1 ) {
b .PutInt (i .TTLSeconds )
}
return nil
}
func (i *InputMediaUploadedPhoto ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaUploadedPhoto#1e287d04 to nil" )
}
if err := b .ConsumeID (InputMediaUploadedPhotoTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedPhoto#1e287d04: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaUploadedPhoto ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaUploadedPhoto#1e287d04 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedPhoto#1e287d04: field flags: %w" , err )
}
}
i .Spoiler = i .Flags .Has (2 )
{
value , err := DecodeInputFile (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedPhoto#1e287d04: field file: %w" , err )
}
i .File = value
}
if i .Flags .Has (0 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedPhoto#1e287d04: field stickers: %w" , err )
}
if headerLen > 0 {
i .Stickers = make ([]InputDocumentClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedPhoto#1e287d04: field stickers: %w" , err )
}
i .Stickers = append (i .Stickers , value )
}
}
if i .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedPhoto#1e287d04: field ttl_seconds: %w" , err )
}
i .TTLSeconds = value
}
return nil
}
func (i *InputMediaUploadedPhoto ) SetSpoiler (value bool ) {
if value {
i .Flags .Set (2 )
i .Spoiler = true
} else {
i .Flags .Unset (2 )
i .Spoiler = false
}
}
func (i *InputMediaUploadedPhoto ) GetSpoiler () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (2 )
}
func (i *InputMediaUploadedPhoto ) GetFile () (value InputFileClass ) {
if i == nil {
return
}
return i .File
}
func (i *InputMediaUploadedPhoto ) SetStickers (value []InputDocumentClass ) {
i .Flags .Set (0 )
i .Stickers = value
}
func (i *InputMediaUploadedPhoto ) GetStickers () (value []InputDocumentClass , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .Stickers , true
}
func (i *InputMediaUploadedPhoto ) SetTTLSeconds (value int ) {
i .Flags .Set (1 )
i .TTLSeconds = value
}
func (i *InputMediaUploadedPhoto ) GetTTLSeconds () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .TTLSeconds , true
}
func (i *InputMediaUploadedPhoto ) MapStickers () (value InputDocumentClassArray , ok bool ) {
if !i .Flags .Has (0 ) {
return value , false
}
return InputDocumentClassArray (i .Stickers ), true
}
type InputMediaPhoto struct {
Flags bin .Fields
Spoiler bool
ID InputPhotoClass
TTLSeconds int
}
const InputMediaPhotoTypeID = 0xb3ba0635
func (i InputMediaPhoto ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaPhoto {}
_ bin .Decoder = &InputMediaPhoto {}
_ bin .BareEncoder = &InputMediaPhoto {}
_ bin .BareDecoder = &InputMediaPhoto {}
_ InputMediaClass = &InputMediaPhoto {}
)
func (i *InputMediaPhoto ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Spoiler == false ) {
return false
}
if !(i .ID == nil ) {
return false
}
if !(i .TTLSeconds == 0 ) {
return false
}
return true
}
func (i *InputMediaPhoto ) String () string {
if i == nil {
return "InputMediaPhoto(nil)"
}
type Alias InputMediaPhoto
return fmt .Sprintf ("InputMediaPhoto%+v" , Alias (*i ))
}
func (i *InputMediaPhoto ) FillFrom (from interface {
GetSpoiler () (value bool )
GetID () (value InputPhotoClass )
GetTTLSeconds () (value int , ok bool )
}) {
i .Spoiler = from .GetSpoiler ()
i .ID = from .GetID ()
if val , ok := from .GetTTLSeconds (); ok {
i .TTLSeconds = val
}
}
func (*InputMediaPhoto ) TypeID () uint32 {
return InputMediaPhotoTypeID
}
func (*InputMediaPhoto ) TypeName () string {
return "inputMediaPhoto"
}
func (i *InputMediaPhoto ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaPhoto" ,
ID : InputMediaPhotoTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !i .Flags .Has (0 ),
},
}
return typ
}
func (i *InputMediaPhoto ) SetFlags () {
if !(i .Spoiler == false ) {
i .Flags .Set (1 )
}
if !(i .TTLSeconds == 0 ) {
i .Flags .Set (0 )
}
}
func (i *InputMediaPhoto ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaPhoto#b3ba0635 as nil" )
}
b .PutID (InputMediaPhotoTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaPhoto ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaPhoto#b3ba0635 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaPhoto#b3ba0635: field flags: %w" , err )
}
if i .ID == nil {
return fmt .Errorf ("unable to encode inputMediaPhoto#b3ba0635: field id is nil" )
}
if err := i .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaPhoto#b3ba0635: field id: %w" , err )
}
if i .Flags .Has (0 ) {
b .PutInt (i .TTLSeconds )
}
return nil
}
func (i *InputMediaPhoto ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaPhoto#b3ba0635 to nil" )
}
if err := b .ConsumeID (InputMediaPhotoTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPhoto#b3ba0635: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaPhoto ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaPhoto#b3ba0635 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPhoto#b3ba0635: field flags: %w" , err )
}
}
i .Spoiler = i .Flags .Has (1 )
{
value , err := DecodeInputPhoto (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPhoto#b3ba0635: field id: %w" , err )
}
i .ID = value
}
if i .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPhoto#b3ba0635: field ttl_seconds: %w" , err )
}
i .TTLSeconds = value
}
return nil
}
func (i *InputMediaPhoto ) SetSpoiler (value bool ) {
if value {
i .Flags .Set (1 )
i .Spoiler = true
} else {
i .Flags .Unset (1 )
i .Spoiler = false
}
}
func (i *InputMediaPhoto ) GetSpoiler () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (1 )
}
func (i *InputMediaPhoto ) GetID () (value InputPhotoClass ) {
if i == nil {
return
}
return i .ID
}
func (i *InputMediaPhoto ) SetTTLSeconds (value int ) {
i .Flags .Set (0 )
i .TTLSeconds = value
}
func (i *InputMediaPhoto ) GetTTLSeconds () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .TTLSeconds , true
}
type InputMediaGeoPoint struct {
GeoPoint InputGeoPointClass
}
const InputMediaGeoPointTypeID = 0xf9c44144
func (i InputMediaGeoPoint ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaGeoPoint {}
_ bin .Decoder = &InputMediaGeoPoint {}
_ bin .BareEncoder = &InputMediaGeoPoint {}
_ bin .BareDecoder = &InputMediaGeoPoint {}
_ InputMediaClass = &InputMediaGeoPoint {}
)
func (i *InputMediaGeoPoint ) Zero () bool {
if i == nil {
return true
}
if !(i .GeoPoint == nil ) {
return false
}
return true
}
func (i *InputMediaGeoPoint ) String () string {
if i == nil {
return "InputMediaGeoPoint(nil)"
}
type Alias InputMediaGeoPoint
return fmt .Sprintf ("InputMediaGeoPoint%+v" , Alias (*i ))
}
func (i *InputMediaGeoPoint ) FillFrom (from interface {
GetGeoPoint () (value InputGeoPointClass )
}) {
i .GeoPoint = from .GetGeoPoint ()
}
func (*InputMediaGeoPoint ) TypeID () uint32 {
return InputMediaGeoPointTypeID
}
func (*InputMediaGeoPoint ) TypeName () string {
return "inputMediaGeoPoint"
}
func (i *InputMediaGeoPoint ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaGeoPoint" ,
ID : InputMediaGeoPointTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "GeoPoint" ,
SchemaName : "geo_point" ,
},
}
return typ
}
func (i *InputMediaGeoPoint ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaGeoPoint#f9c44144 as nil" )
}
b .PutID (InputMediaGeoPointTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaGeoPoint ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaGeoPoint#f9c44144 as nil" )
}
if i .GeoPoint == nil {
return fmt .Errorf ("unable to encode inputMediaGeoPoint#f9c44144: field geo_point is nil" )
}
if err := i .GeoPoint .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaGeoPoint#f9c44144: field geo_point: %w" , err )
}
return nil
}
func (i *InputMediaGeoPoint ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaGeoPoint#f9c44144 to nil" )
}
if err := b .ConsumeID (InputMediaGeoPointTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoPoint#f9c44144: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaGeoPoint ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaGeoPoint#f9c44144 to nil" )
}
{
value , err := DecodeInputGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoPoint#f9c44144: field geo_point: %w" , err )
}
i .GeoPoint = value
}
return nil
}
func (i *InputMediaGeoPoint ) GetGeoPoint () (value InputGeoPointClass ) {
if i == nil {
return
}
return i .GeoPoint
}
type InputMediaContact struct {
PhoneNumber string
FirstName string
LastName string
Vcard string
}
const InputMediaContactTypeID = 0xf8ab7dfb
func (i InputMediaContact ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaContact {}
_ bin .Decoder = &InputMediaContact {}
_ bin .BareEncoder = &InputMediaContact {}
_ bin .BareDecoder = &InputMediaContact {}
_ InputMediaClass = &InputMediaContact {}
)
func (i *InputMediaContact ) Zero () bool {
if i == nil {
return true
}
if !(i .PhoneNumber == "" ) {
return false
}
if !(i .FirstName == "" ) {
return false
}
if !(i .LastName == "" ) {
return false
}
if !(i .Vcard == "" ) {
return false
}
return true
}
func (i *InputMediaContact ) String () string {
if i == nil {
return "InputMediaContact(nil)"
}
type Alias InputMediaContact
return fmt .Sprintf ("InputMediaContact%+v" , Alias (*i ))
}
func (i *InputMediaContact ) FillFrom (from interface {
GetPhoneNumber () (value string )
GetFirstName () (value string )
GetLastName () (value string )
GetVcard () (value string )
}) {
i .PhoneNumber = from .GetPhoneNumber ()
i .FirstName = from .GetFirstName ()
i .LastName = from .GetLastName ()
i .Vcard = from .GetVcard ()
}
func (*InputMediaContact ) TypeID () uint32 {
return InputMediaContactTypeID
}
func (*InputMediaContact ) TypeName () string {
return "inputMediaContact"
}
func (i *InputMediaContact ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaContact" ,
ID : InputMediaContactTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PhoneNumber" ,
SchemaName : "phone_number" ,
},
{
Name : "FirstName" ,
SchemaName : "first_name" ,
},
{
Name : "LastName" ,
SchemaName : "last_name" ,
},
{
Name : "Vcard" ,
SchemaName : "vcard" ,
},
}
return typ
}
func (i *InputMediaContact ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaContact#f8ab7dfb as nil" )
}
b .PutID (InputMediaContactTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaContact ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaContact#f8ab7dfb as nil" )
}
b .PutString (i .PhoneNumber )
b .PutString (i .FirstName )
b .PutString (i .LastName )
b .PutString (i .Vcard )
return nil
}
func (i *InputMediaContact ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaContact#f8ab7dfb to nil" )
}
if err := b .ConsumeID (InputMediaContactTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaContact#f8ab7dfb: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaContact ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaContact#f8ab7dfb to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaContact#f8ab7dfb: field phone_number: %w" , err )
}
i .PhoneNumber = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaContact#f8ab7dfb: field first_name: %w" , err )
}
i .FirstName = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaContact#f8ab7dfb: field last_name: %w" , err )
}
i .LastName = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaContact#f8ab7dfb: field vcard: %w" , err )
}
i .Vcard = value
}
return nil
}
func (i *InputMediaContact ) GetPhoneNumber () (value string ) {
if i == nil {
return
}
return i .PhoneNumber
}
func (i *InputMediaContact ) GetFirstName () (value string ) {
if i == nil {
return
}
return i .FirstName
}
func (i *InputMediaContact ) GetLastName () (value string ) {
if i == nil {
return
}
return i .LastName
}
func (i *InputMediaContact ) GetVcard () (value string ) {
if i == nil {
return
}
return i .Vcard
}
type InputMediaUploadedDocument struct {
Flags bin .Fields
NosoundVideo bool
ForceFile bool
Spoiler bool
File InputFileClass
Thumb InputFileClass
MimeType string
Attributes []DocumentAttributeClass
Stickers []InputDocumentClass
TTLSeconds int
}
const InputMediaUploadedDocumentTypeID = 0x5b38c6c1
func (i InputMediaUploadedDocument ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaUploadedDocument {}
_ bin .Decoder = &InputMediaUploadedDocument {}
_ bin .BareEncoder = &InputMediaUploadedDocument {}
_ bin .BareDecoder = &InputMediaUploadedDocument {}
_ InputMediaClass = &InputMediaUploadedDocument {}
)
func (i *InputMediaUploadedDocument ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .NosoundVideo == false ) {
return false
}
if !(i .ForceFile == false ) {
return false
}
if !(i .Spoiler == false ) {
return false
}
if !(i .File == nil ) {
return false
}
if !(i .Thumb == nil ) {
return false
}
if !(i .MimeType == "" ) {
return false
}
if !(i .Attributes == nil ) {
return false
}
if !(i .Stickers == nil ) {
return false
}
if !(i .TTLSeconds == 0 ) {
return false
}
return true
}
func (i *InputMediaUploadedDocument ) String () string {
if i == nil {
return "InputMediaUploadedDocument(nil)"
}
type Alias InputMediaUploadedDocument
return fmt .Sprintf ("InputMediaUploadedDocument%+v" , Alias (*i ))
}
func (i *InputMediaUploadedDocument ) FillFrom (from interface {
GetNosoundVideo () (value bool )
GetForceFile () (value bool )
GetSpoiler () (value bool )
GetFile () (value InputFileClass )
GetThumb () (value InputFileClass , ok bool )
GetMimeType () (value string )
GetAttributes () (value []DocumentAttributeClass )
GetStickers () (value []InputDocumentClass , ok bool )
GetTTLSeconds () (value int , ok bool )
}) {
i .NosoundVideo = from .GetNosoundVideo ()
i .ForceFile = from .GetForceFile ()
i .Spoiler = from .GetSpoiler ()
i .File = from .GetFile ()
if val , ok := from .GetThumb (); ok {
i .Thumb = val
}
i .MimeType = from .GetMimeType ()
i .Attributes = from .GetAttributes ()
if val , ok := from .GetStickers (); ok {
i .Stickers = val
}
if val , ok := from .GetTTLSeconds (); ok {
i .TTLSeconds = val
}
}
func (*InputMediaUploadedDocument ) TypeID () uint32 {
return InputMediaUploadedDocumentTypeID
}
func (*InputMediaUploadedDocument ) TypeName () string {
return "inputMediaUploadedDocument"
}
func (i *InputMediaUploadedDocument ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaUploadedDocument" ,
ID : InputMediaUploadedDocumentTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "NosoundVideo" ,
SchemaName : "nosound_video" ,
Null : !i .Flags .Has (3 ),
},
{
Name : "ForceFile" ,
SchemaName : "force_file" ,
Null : !i .Flags .Has (4 ),
},
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !i .Flags .Has (5 ),
},
{
Name : "File" ,
SchemaName : "file" ,
},
{
Name : "Thumb" ,
SchemaName : "thumb" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "MimeType" ,
SchemaName : "mime_type" ,
},
{
Name : "Attributes" ,
SchemaName : "attributes" ,
},
{
Name : "Stickers" ,
SchemaName : "stickers" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !i .Flags .Has (1 ),
},
}
return typ
}
func (i *InputMediaUploadedDocument ) SetFlags () {
if !(i .NosoundVideo == false ) {
i .Flags .Set (3 )
}
if !(i .ForceFile == false ) {
i .Flags .Set (4 )
}
if !(i .Spoiler == false ) {
i .Flags .Set (5 )
}
if !(i .Thumb == nil ) {
i .Flags .Set (2 )
}
if !(i .Stickers == nil ) {
i .Flags .Set (0 )
}
if !(i .TTLSeconds == 0 ) {
i .Flags .Set (1 )
}
}
func (i *InputMediaUploadedDocument ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaUploadedDocument#5b38c6c1 as nil" )
}
b .PutID (InputMediaUploadedDocumentTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaUploadedDocument ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaUploadedDocument#5b38c6c1 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field flags: %w" , err )
}
if i .File == nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field file is nil" )
}
if err := i .File .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field file: %w" , err )
}
if i .Flags .Has (2 ) {
if i .Thumb == nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field thumb is nil" )
}
if err := i .Thumb .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field thumb: %w" , err )
}
}
b .PutString (i .MimeType )
b .PutVectorHeader (len (i .Attributes ))
for idx , v := range i .Attributes {
if v == nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field attributes element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field attributes element with index %d: %w" , idx , err )
}
}
if i .Flags .Has (0 ) {
b .PutVectorHeader (len (i .Stickers ))
for idx , v := range i .Stickers {
if v == nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field stickers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaUploadedDocument#5b38c6c1: field stickers element with index %d: %w" , idx , err )
}
}
}
if i .Flags .Has (1 ) {
b .PutInt (i .TTLSeconds )
}
return nil
}
func (i *InputMediaUploadedDocument ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaUploadedDocument#5b38c6c1 to nil" )
}
if err := b .ConsumeID (InputMediaUploadedDocumentTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaUploadedDocument ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaUploadedDocument#5b38c6c1 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field flags: %w" , err )
}
}
i .NosoundVideo = i .Flags .Has (3 )
i .ForceFile = i .Flags .Has (4 )
i .Spoiler = i .Flags .Has (5 )
{
value , err := DecodeInputFile (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field file: %w" , err )
}
i .File = value
}
if i .Flags .Has (2 ) {
value , err := DecodeInputFile (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field thumb: %w" , err )
}
i .Thumb = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field mime_type: %w" , err )
}
i .MimeType = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field attributes: %w" , err )
}
if headerLen > 0 {
i .Attributes = make ([]DocumentAttributeClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeDocumentAttribute (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field attributes: %w" , err )
}
i .Attributes = append (i .Attributes , value )
}
}
if i .Flags .Has (0 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field stickers: %w" , err )
}
if headerLen > 0 {
i .Stickers = make ([]InputDocumentClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field stickers: %w" , err )
}
i .Stickers = append (i .Stickers , value )
}
}
if i .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaUploadedDocument#5b38c6c1: field ttl_seconds: %w" , err )
}
i .TTLSeconds = value
}
return nil
}
func (i *InputMediaUploadedDocument ) SetNosoundVideo (value bool ) {
if value {
i .Flags .Set (3 )
i .NosoundVideo = true
} else {
i .Flags .Unset (3 )
i .NosoundVideo = false
}
}
func (i *InputMediaUploadedDocument ) GetNosoundVideo () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (3 )
}
func (i *InputMediaUploadedDocument ) SetForceFile (value bool ) {
if value {
i .Flags .Set (4 )
i .ForceFile = true
} else {
i .Flags .Unset (4 )
i .ForceFile = false
}
}
func (i *InputMediaUploadedDocument ) GetForceFile () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (4 )
}
func (i *InputMediaUploadedDocument ) SetSpoiler (value bool ) {
if value {
i .Flags .Set (5 )
i .Spoiler = true
} else {
i .Flags .Unset (5 )
i .Spoiler = false
}
}
func (i *InputMediaUploadedDocument ) GetSpoiler () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (5 )
}
func (i *InputMediaUploadedDocument ) GetFile () (value InputFileClass ) {
if i == nil {
return
}
return i .File
}
func (i *InputMediaUploadedDocument ) SetThumb (value InputFileClass ) {
i .Flags .Set (2 )
i .Thumb = value
}
func (i *InputMediaUploadedDocument ) GetThumb () (value InputFileClass , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (2 ) {
return value , false
}
return i .Thumb , true
}
func (i *InputMediaUploadedDocument ) GetMimeType () (value string ) {
if i == nil {
return
}
return i .MimeType
}
func (i *InputMediaUploadedDocument ) GetAttributes () (value []DocumentAttributeClass ) {
if i == nil {
return
}
return i .Attributes
}
func (i *InputMediaUploadedDocument ) SetStickers (value []InputDocumentClass ) {
i .Flags .Set (0 )
i .Stickers = value
}
func (i *InputMediaUploadedDocument ) GetStickers () (value []InputDocumentClass , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .Stickers , true
}
func (i *InputMediaUploadedDocument ) SetTTLSeconds (value int ) {
i .Flags .Set (1 )
i .TTLSeconds = value
}
func (i *InputMediaUploadedDocument ) GetTTLSeconds () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .TTLSeconds , true
}
func (i *InputMediaUploadedDocument ) MapAttributes () (value DocumentAttributeClassArray ) {
return DocumentAttributeClassArray (i .Attributes )
}
func (i *InputMediaUploadedDocument ) MapStickers () (value InputDocumentClassArray , ok bool ) {
if !i .Flags .Has (0 ) {
return value , false
}
return InputDocumentClassArray (i .Stickers ), true
}
type InputMediaDocument struct {
Flags bin .Fields
Spoiler bool
ID InputDocumentClass
TTLSeconds int
Query string
}
const InputMediaDocumentTypeID = 0x33473058
func (i InputMediaDocument ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaDocument {}
_ bin .Decoder = &InputMediaDocument {}
_ bin .BareEncoder = &InputMediaDocument {}
_ bin .BareDecoder = &InputMediaDocument {}
_ InputMediaClass = &InputMediaDocument {}
)
func (i *InputMediaDocument ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Spoiler == false ) {
return false
}
if !(i .ID == nil ) {
return false
}
if !(i .TTLSeconds == 0 ) {
return false
}
if !(i .Query == "" ) {
return false
}
return true
}
func (i *InputMediaDocument ) String () string {
if i == nil {
return "InputMediaDocument(nil)"
}
type Alias InputMediaDocument
return fmt .Sprintf ("InputMediaDocument%+v" , Alias (*i ))
}
func (i *InputMediaDocument ) FillFrom (from interface {
GetSpoiler () (value bool )
GetID () (value InputDocumentClass )
GetTTLSeconds () (value int , ok bool )
GetQuery () (value string , ok bool )
}) {
i .Spoiler = from .GetSpoiler ()
i .ID = from .GetID ()
if val , ok := from .GetTTLSeconds (); ok {
i .TTLSeconds = val
}
if val , ok := from .GetQuery (); ok {
i .Query = val
}
}
func (*InputMediaDocument ) TypeID () uint32 {
return InputMediaDocumentTypeID
}
func (*InputMediaDocument ) TypeName () string {
return "inputMediaDocument"
}
func (i *InputMediaDocument ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaDocument" ,
ID : InputMediaDocumentTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "Query" ,
SchemaName : "query" ,
Null : !i .Flags .Has (1 ),
},
}
return typ
}
func (i *InputMediaDocument ) SetFlags () {
if !(i .Spoiler == false ) {
i .Flags .Set (2 )
}
if !(i .TTLSeconds == 0 ) {
i .Flags .Set (0 )
}
if !(i .Query == "" ) {
i .Flags .Set (1 )
}
}
func (i *InputMediaDocument ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaDocument#33473058 as nil" )
}
b .PutID (InputMediaDocumentTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaDocument ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaDocument#33473058 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaDocument#33473058: field flags: %w" , err )
}
if i .ID == nil {
return fmt .Errorf ("unable to encode inputMediaDocument#33473058: field id is nil" )
}
if err := i .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaDocument#33473058: field id: %w" , err )
}
if i .Flags .Has (0 ) {
b .PutInt (i .TTLSeconds )
}
if i .Flags .Has (1 ) {
b .PutString (i .Query )
}
return nil
}
func (i *InputMediaDocument ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaDocument#33473058 to nil" )
}
if err := b .ConsumeID (InputMediaDocumentTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaDocument#33473058: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaDocument ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaDocument#33473058 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaDocument#33473058: field flags: %w" , err )
}
}
i .Spoiler = i .Flags .Has (2 )
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaDocument#33473058: field id: %w" , err )
}
i .ID = value
}
if i .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaDocument#33473058: field ttl_seconds: %w" , err )
}
i .TTLSeconds = value
}
if i .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaDocument#33473058: field query: %w" , err )
}
i .Query = value
}
return nil
}
func (i *InputMediaDocument ) SetSpoiler (value bool ) {
if value {
i .Flags .Set (2 )
i .Spoiler = true
} else {
i .Flags .Unset (2 )
i .Spoiler = false
}
}
func (i *InputMediaDocument ) GetSpoiler () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (2 )
}
func (i *InputMediaDocument ) GetID () (value InputDocumentClass ) {
if i == nil {
return
}
return i .ID
}
func (i *InputMediaDocument ) SetTTLSeconds (value int ) {
i .Flags .Set (0 )
i .TTLSeconds = value
}
func (i *InputMediaDocument ) GetTTLSeconds () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .TTLSeconds , true
}
func (i *InputMediaDocument ) SetQuery (value string ) {
i .Flags .Set (1 )
i .Query = value
}
func (i *InputMediaDocument ) GetQuery () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .Query , true
}
type InputMediaVenue struct {
GeoPoint InputGeoPointClass
Title string
Address string
Provider string
VenueID string
VenueType string
}
const InputMediaVenueTypeID = 0xc13d1c11
func (i InputMediaVenue ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaVenue {}
_ bin .Decoder = &InputMediaVenue {}
_ bin .BareEncoder = &InputMediaVenue {}
_ bin .BareDecoder = &InputMediaVenue {}
_ InputMediaClass = &InputMediaVenue {}
)
func (i *InputMediaVenue ) Zero () bool {
if i == nil {
return true
}
if !(i .GeoPoint == nil ) {
return false
}
if !(i .Title == "" ) {
return false
}
if !(i .Address == "" ) {
return false
}
if !(i .Provider == "" ) {
return false
}
if !(i .VenueID == "" ) {
return false
}
if !(i .VenueType == "" ) {
return false
}
return true
}
func (i *InputMediaVenue ) String () string {
if i == nil {
return "InputMediaVenue(nil)"
}
type Alias InputMediaVenue
return fmt .Sprintf ("InputMediaVenue%+v" , Alias (*i ))
}
func (i *InputMediaVenue ) FillFrom (from interface {
GetGeoPoint () (value InputGeoPointClass )
GetTitle () (value string )
GetAddress () (value string )
GetProvider () (value string )
GetVenueID () (value string )
GetVenueType () (value string )
}) {
i .GeoPoint = from .GetGeoPoint ()
i .Title = from .GetTitle ()
i .Address = from .GetAddress ()
i .Provider = from .GetProvider ()
i .VenueID = from .GetVenueID ()
i .VenueType = from .GetVenueType ()
}
func (*InputMediaVenue ) TypeID () uint32 {
return InputMediaVenueTypeID
}
func (*InputMediaVenue ) TypeName () string {
return "inputMediaVenue"
}
func (i *InputMediaVenue ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaVenue" ,
ID : InputMediaVenueTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "GeoPoint" ,
SchemaName : "geo_point" ,
},
{
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 (i *InputMediaVenue ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaVenue#c13d1c11 as nil" )
}
b .PutID (InputMediaVenueTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaVenue ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaVenue#c13d1c11 as nil" )
}
if i .GeoPoint == nil {
return fmt .Errorf ("unable to encode inputMediaVenue#c13d1c11: field geo_point is nil" )
}
if err := i .GeoPoint .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaVenue#c13d1c11: field geo_point: %w" , err )
}
b .PutString (i .Title )
b .PutString (i .Address )
b .PutString (i .Provider )
b .PutString (i .VenueID )
b .PutString (i .VenueType )
return nil
}
func (i *InputMediaVenue ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaVenue#c13d1c11 to nil" )
}
if err := b .ConsumeID (InputMediaVenueTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaVenue ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaVenue#c13d1c11 to nil" )
}
{
value , err := DecodeInputGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: field geo_point: %w" , err )
}
i .GeoPoint = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: field title: %w" , err )
}
i .Title = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: field address: %w" , err )
}
i .Address = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: field provider: %w" , err )
}
i .Provider = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: field venue_id: %w" , err )
}
i .VenueID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaVenue#c13d1c11: field venue_type: %w" , err )
}
i .VenueType = value
}
return nil
}
func (i *InputMediaVenue ) GetGeoPoint () (value InputGeoPointClass ) {
if i == nil {
return
}
return i .GeoPoint
}
func (i *InputMediaVenue ) GetTitle () (value string ) {
if i == nil {
return
}
return i .Title
}
func (i *InputMediaVenue ) GetAddress () (value string ) {
if i == nil {
return
}
return i .Address
}
func (i *InputMediaVenue ) GetProvider () (value string ) {
if i == nil {
return
}
return i .Provider
}
func (i *InputMediaVenue ) GetVenueID () (value string ) {
if i == nil {
return
}
return i .VenueID
}
func (i *InputMediaVenue ) GetVenueType () (value string ) {
if i == nil {
return
}
return i .VenueType
}
type InputMediaPhotoExternal struct {
Flags bin .Fields
Spoiler bool
URL string
TTLSeconds int
}
const InputMediaPhotoExternalTypeID = 0xe5bbfe1a
func (i InputMediaPhotoExternal ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaPhotoExternal {}
_ bin .Decoder = &InputMediaPhotoExternal {}
_ bin .BareEncoder = &InputMediaPhotoExternal {}
_ bin .BareDecoder = &InputMediaPhotoExternal {}
_ InputMediaClass = &InputMediaPhotoExternal {}
)
func (i *InputMediaPhotoExternal ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Spoiler == false ) {
return false
}
if !(i .URL == "" ) {
return false
}
if !(i .TTLSeconds == 0 ) {
return false
}
return true
}
func (i *InputMediaPhotoExternal ) String () string {
if i == nil {
return "InputMediaPhotoExternal(nil)"
}
type Alias InputMediaPhotoExternal
return fmt .Sprintf ("InputMediaPhotoExternal%+v" , Alias (*i ))
}
func (i *InputMediaPhotoExternal ) FillFrom (from interface {
GetSpoiler () (value bool )
GetURL () (value string )
GetTTLSeconds () (value int , ok bool )
}) {
i .Spoiler = from .GetSpoiler ()
i .URL = from .GetURL ()
if val , ok := from .GetTTLSeconds (); ok {
i .TTLSeconds = val
}
}
func (*InputMediaPhotoExternal ) TypeID () uint32 {
return InputMediaPhotoExternalTypeID
}
func (*InputMediaPhotoExternal ) TypeName () string {
return "inputMediaPhotoExternal"
}
func (i *InputMediaPhotoExternal ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaPhotoExternal" ,
ID : InputMediaPhotoExternalTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !i .Flags .Has (0 ),
},
}
return typ
}
func (i *InputMediaPhotoExternal ) SetFlags () {
if !(i .Spoiler == false ) {
i .Flags .Set (1 )
}
if !(i .TTLSeconds == 0 ) {
i .Flags .Set (0 )
}
}
func (i *InputMediaPhotoExternal ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaPhotoExternal#e5bbfe1a as nil" )
}
b .PutID (InputMediaPhotoExternalTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaPhotoExternal ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaPhotoExternal#e5bbfe1a as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaPhotoExternal#e5bbfe1a: field flags: %w" , err )
}
b .PutString (i .URL )
if i .Flags .Has (0 ) {
b .PutInt (i .TTLSeconds )
}
return nil
}
func (i *InputMediaPhotoExternal ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaPhotoExternal#e5bbfe1a to nil" )
}
if err := b .ConsumeID (InputMediaPhotoExternalTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPhotoExternal#e5bbfe1a: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaPhotoExternal ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaPhotoExternal#e5bbfe1a to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPhotoExternal#e5bbfe1a: field flags: %w" , err )
}
}
i .Spoiler = i .Flags .Has (1 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPhotoExternal#e5bbfe1a: field url: %w" , err )
}
i .URL = value
}
if i .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPhotoExternal#e5bbfe1a: field ttl_seconds: %w" , err )
}
i .TTLSeconds = value
}
return nil
}
func (i *InputMediaPhotoExternal ) SetSpoiler (value bool ) {
if value {
i .Flags .Set (1 )
i .Spoiler = true
} else {
i .Flags .Unset (1 )
i .Spoiler = false
}
}
func (i *InputMediaPhotoExternal ) GetSpoiler () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (1 )
}
func (i *InputMediaPhotoExternal ) GetURL () (value string ) {
if i == nil {
return
}
return i .URL
}
func (i *InputMediaPhotoExternal ) SetTTLSeconds (value int ) {
i .Flags .Set (0 )
i .TTLSeconds = value
}
func (i *InputMediaPhotoExternal ) GetTTLSeconds () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .TTLSeconds , true
}
type InputMediaDocumentExternal struct {
Flags bin .Fields
Spoiler bool
URL string
TTLSeconds int
}
const InputMediaDocumentExternalTypeID = 0xfb52dc99
func (i InputMediaDocumentExternal ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaDocumentExternal {}
_ bin .Decoder = &InputMediaDocumentExternal {}
_ bin .BareEncoder = &InputMediaDocumentExternal {}
_ bin .BareDecoder = &InputMediaDocumentExternal {}
_ InputMediaClass = &InputMediaDocumentExternal {}
)
func (i *InputMediaDocumentExternal ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Spoiler == false ) {
return false
}
if !(i .URL == "" ) {
return false
}
if !(i .TTLSeconds == 0 ) {
return false
}
return true
}
func (i *InputMediaDocumentExternal ) String () string {
if i == nil {
return "InputMediaDocumentExternal(nil)"
}
type Alias InputMediaDocumentExternal
return fmt .Sprintf ("InputMediaDocumentExternal%+v" , Alias (*i ))
}
func (i *InputMediaDocumentExternal ) FillFrom (from interface {
GetSpoiler () (value bool )
GetURL () (value string )
GetTTLSeconds () (value int , ok bool )
}) {
i .Spoiler = from .GetSpoiler ()
i .URL = from .GetURL ()
if val , ok := from .GetTTLSeconds (); ok {
i .TTLSeconds = val
}
}
func (*InputMediaDocumentExternal ) TypeID () uint32 {
return InputMediaDocumentExternalTypeID
}
func (*InputMediaDocumentExternal ) TypeName () string {
return "inputMediaDocumentExternal"
}
func (i *InputMediaDocumentExternal ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaDocumentExternal" ,
ID : InputMediaDocumentExternalTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !i .Flags .Has (0 ),
},
}
return typ
}
func (i *InputMediaDocumentExternal ) SetFlags () {
if !(i .Spoiler == false ) {
i .Flags .Set (1 )
}
if !(i .TTLSeconds == 0 ) {
i .Flags .Set (0 )
}
}
func (i *InputMediaDocumentExternal ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaDocumentExternal#fb52dc99 as nil" )
}
b .PutID (InputMediaDocumentExternalTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaDocumentExternal ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaDocumentExternal#fb52dc99 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaDocumentExternal#fb52dc99: field flags: %w" , err )
}
b .PutString (i .URL )
if i .Flags .Has (0 ) {
b .PutInt (i .TTLSeconds )
}
return nil
}
func (i *InputMediaDocumentExternal ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaDocumentExternal#fb52dc99 to nil" )
}
if err := b .ConsumeID (InputMediaDocumentExternalTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaDocumentExternal#fb52dc99: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaDocumentExternal ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaDocumentExternal#fb52dc99 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaDocumentExternal#fb52dc99: field flags: %w" , err )
}
}
i .Spoiler = i .Flags .Has (1 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaDocumentExternal#fb52dc99: field url: %w" , err )
}
i .URL = value
}
if i .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaDocumentExternal#fb52dc99: field ttl_seconds: %w" , err )
}
i .TTLSeconds = value
}
return nil
}
func (i *InputMediaDocumentExternal ) SetSpoiler (value bool ) {
if value {
i .Flags .Set (1 )
i .Spoiler = true
} else {
i .Flags .Unset (1 )
i .Spoiler = false
}
}
func (i *InputMediaDocumentExternal ) GetSpoiler () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (1 )
}
func (i *InputMediaDocumentExternal ) GetURL () (value string ) {
if i == nil {
return
}
return i .URL
}
func (i *InputMediaDocumentExternal ) SetTTLSeconds (value int ) {
i .Flags .Set (0 )
i .TTLSeconds = value
}
func (i *InputMediaDocumentExternal ) GetTTLSeconds () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .TTLSeconds , true
}
type InputMediaGame struct {
ID InputGameClass
}
const InputMediaGameTypeID = 0xd33f43f3
func (i InputMediaGame ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaGame {}
_ bin .Decoder = &InputMediaGame {}
_ bin .BareEncoder = &InputMediaGame {}
_ bin .BareDecoder = &InputMediaGame {}
_ InputMediaClass = &InputMediaGame {}
)
func (i *InputMediaGame ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == nil ) {
return false
}
return true
}
func (i *InputMediaGame ) String () string {
if i == nil {
return "InputMediaGame(nil)"
}
type Alias InputMediaGame
return fmt .Sprintf ("InputMediaGame%+v" , Alias (*i ))
}
func (i *InputMediaGame ) FillFrom (from interface {
GetID () (value InputGameClass )
}) {
i .ID = from .GetID ()
}
func (*InputMediaGame ) TypeID () uint32 {
return InputMediaGameTypeID
}
func (*InputMediaGame ) TypeName () string {
return "inputMediaGame"
}
func (i *InputMediaGame ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaGame" ,
ID : InputMediaGameTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (i *InputMediaGame ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaGame#d33f43f3 as nil" )
}
b .PutID (InputMediaGameTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaGame ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaGame#d33f43f3 as nil" )
}
if i .ID == nil {
return fmt .Errorf ("unable to encode inputMediaGame#d33f43f3: field id is nil" )
}
if err := i .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaGame#d33f43f3: field id: %w" , err )
}
return nil
}
func (i *InputMediaGame ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaGame#d33f43f3 to nil" )
}
if err := b .ConsumeID (InputMediaGameTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaGame#d33f43f3: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaGame ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaGame#d33f43f3 to nil" )
}
{
value , err := DecodeInputGame (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaGame#d33f43f3: field id: %w" , err )
}
i .ID = value
}
return nil
}
func (i *InputMediaGame ) GetID () (value InputGameClass ) {
if i == nil {
return
}
return i .ID
}
type InputMediaInvoice struct {
Flags bin .Fields
Title string
Description string
Photo InputWebDocument
Invoice Invoice
Payload []byte
Provider string
ProviderData DataJSON
StartParam string
ExtendedMedia InputMediaClass
}
const InputMediaInvoiceTypeID = 0x8eb5a6d5
func (i InputMediaInvoice ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaInvoice {}
_ bin .Decoder = &InputMediaInvoice {}
_ bin .BareEncoder = &InputMediaInvoice {}
_ bin .BareDecoder = &InputMediaInvoice {}
_ InputMediaClass = &InputMediaInvoice {}
)
func (i *InputMediaInvoice ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Title == "" ) {
return false
}
if !(i .Description == "" ) {
return false
}
if !(i .Photo .Zero ()) {
return false
}
if !(i .Invoice .Zero ()) {
return false
}
if !(i .Payload == nil ) {
return false
}
if !(i .Provider == "" ) {
return false
}
if !(i .ProviderData .Zero ()) {
return false
}
if !(i .StartParam == "" ) {
return false
}
if !(i .ExtendedMedia == nil ) {
return false
}
return true
}
func (i *InputMediaInvoice ) String () string {
if i == nil {
return "InputMediaInvoice(nil)"
}
type Alias InputMediaInvoice
return fmt .Sprintf ("InputMediaInvoice%+v" , Alias (*i ))
}
func (i *InputMediaInvoice ) FillFrom (from interface {
GetTitle () (value string )
GetDescription () (value string )
GetPhoto () (value InputWebDocument , ok bool )
GetInvoice () (value Invoice )
GetPayload () (value []byte )
GetProvider () (value string )
GetProviderData () (value DataJSON )
GetStartParam () (value string , ok bool )
GetExtendedMedia () (value InputMediaClass , ok bool )
}) {
i .Title = from .GetTitle ()
i .Description = from .GetDescription ()
if val , ok := from .GetPhoto (); ok {
i .Photo = val
}
i .Invoice = from .GetInvoice ()
i .Payload = from .GetPayload ()
i .Provider = from .GetProvider ()
i .ProviderData = from .GetProviderData ()
if val , ok := from .GetStartParam (); ok {
i .StartParam = val
}
if val , ok := from .GetExtendedMedia (); ok {
i .ExtendedMedia = val
}
}
func (*InputMediaInvoice ) TypeID () uint32 {
return InputMediaInvoiceTypeID
}
func (*InputMediaInvoice ) TypeName () string {
return "inputMediaInvoice"
}
func (i *InputMediaInvoice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaInvoice" ,
ID : InputMediaInvoiceTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Description" ,
SchemaName : "description" ,
},
{
Name : "Photo" ,
SchemaName : "photo" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "Invoice" ,
SchemaName : "invoice" ,
},
{
Name : "Payload" ,
SchemaName : "payload" ,
},
{
Name : "Provider" ,
SchemaName : "provider" ,
},
{
Name : "ProviderData" ,
SchemaName : "provider_data" ,
},
{
Name : "StartParam" ,
SchemaName : "start_param" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "ExtendedMedia" ,
SchemaName : "extended_media" ,
Null : !i .Flags .Has (2 ),
},
}
return typ
}
func (i *InputMediaInvoice ) SetFlags () {
if !(i .Photo .Zero ()) {
i .Flags .Set (0 )
}
if !(i .StartParam == "" ) {
i .Flags .Set (1 )
}
if !(i .ExtendedMedia == nil ) {
i .Flags .Set (2 )
}
}
func (i *InputMediaInvoice ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaInvoice#8eb5a6d5 as nil" )
}
b .PutID (InputMediaInvoiceTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaInvoice ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaInvoice#8eb5a6d5 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaInvoice#8eb5a6d5: field flags: %w" , err )
}
b .PutString (i .Title )
b .PutString (i .Description )
if i .Flags .Has (0 ) {
if err := i .Photo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaInvoice#8eb5a6d5: field photo: %w" , err )
}
}
if err := i .Invoice .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaInvoice#8eb5a6d5: field invoice: %w" , err )
}
b .PutBytes (i .Payload )
b .PutString (i .Provider )
if err := i .ProviderData .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaInvoice#8eb5a6d5: field provider_data: %w" , err )
}
if i .Flags .Has (1 ) {
b .PutString (i .StartParam )
}
if i .Flags .Has (2 ) {
if i .ExtendedMedia == nil {
return fmt .Errorf ("unable to encode inputMediaInvoice#8eb5a6d5: field extended_media is nil" )
}
if err := i .ExtendedMedia .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaInvoice#8eb5a6d5: field extended_media: %w" , err )
}
}
return nil
}
func (i *InputMediaInvoice ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaInvoice#8eb5a6d5 to nil" )
}
if err := b .ConsumeID (InputMediaInvoiceTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaInvoice ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaInvoice#8eb5a6d5 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field title: %w" , err )
}
i .Title = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field description: %w" , err )
}
i .Description = value
}
if i .Flags .Has (0 ) {
if err := i .Photo .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field photo: %w" , err )
}
}
{
if err := i .Invoice .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field invoice: %w" , err )
}
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field payload: %w" , err )
}
i .Payload = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field provider: %w" , err )
}
i .Provider = value
}
{
if err := i .ProviderData .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field provider_data: %w" , err )
}
}
if i .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field start_param: %w" , err )
}
i .StartParam = value
}
if i .Flags .Has (2 ) {
value , err := DecodeInputMedia (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaInvoice#8eb5a6d5: field extended_media: %w" , err )
}
i .ExtendedMedia = value
}
return nil
}
func (i *InputMediaInvoice ) GetTitle () (value string ) {
if i == nil {
return
}
return i .Title
}
func (i *InputMediaInvoice ) GetDescription () (value string ) {
if i == nil {
return
}
return i .Description
}
func (i *InputMediaInvoice ) SetPhoto (value InputWebDocument ) {
i .Flags .Set (0 )
i .Photo = value
}
func (i *InputMediaInvoice ) GetPhoto () (value InputWebDocument , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .Photo , true
}
func (i *InputMediaInvoice ) GetInvoice () (value Invoice ) {
if i == nil {
return
}
return i .Invoice
}
func (i *InputMediaInvoice ) GetPayload () (value []byte ) {
if i == nil {
return
}
return i .Payload
}
func (i *InputMediaInvoice ) GetProvider () (value string ) {
if i == nil {
return
}
return i .Provider
}
func (i *InputMediaInvoice ) GetProviderData () (value DataJSON ) {
if i == nil {
return
}
return i .ProviderData
}
func (i *InputMediaInvoice ) SetStartParam (value string ) {
i .Flags .Set (1 )
i .StartParam = value
}
func (i *InputMediaInvoice ) GetStartParam () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .StartParam , true
}
func (i *InputMediaInvoice ) SetExtendedMedia (value InputMediaClass ) {
i .Flags .Set (2 )
i .ExtendedMedia = value
}
func (i *InputMediaInvoice ) GetExtendedMedia () (value InputMediaClass , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (2 ) {
return value , false
}
return i .ExtendedMedia , true
}
type InputMediaGeoLive struct {
Flags bin .Fields
Stopped bool
GeoPoint InputGeoPointClass
Heading int
Period int
ProximityNotificationRadius int
}
const InputMediaGeoLiveTypeID = 0x971fa843
func (i InputMediaGeoLive ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaGeoLive {}
_ bin .Decoder = &InputMediaGeoLive {}
_ bin .BareEncoder = &InputMediaGeoLive {}
_ bin .BareDecoder = &InputMediaGeoLive {}
_ InputMediaClass = &InputMediaGeoLive {}
)
func (i *InputMediaGeoLive ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Stopped == false ) {
return false
}
if !(i .GeoPoint == nil ) {
return false
}
if !(i .Heading == 0 ) {
return false
}
if !(i .Period == 0 ) {
return false
}
if !(i .ProximityNotificationRadius == 0 ) {
return false
}
return true
}
func (i *InputMediaGeoLive ) String () string {
if i == nil {
return "InputMediaGeoLive(nil)"
}
type Alias InputMediaGeoLive
return fmt .Sprintf ("InputMediaGeoLive%+v" , Alias (*i ))
}
func (i *InputMediaGeoLive ) FillFrom (from interface {
GetStopped () (value bool )
GetGeoPoint () (value InputGeoPointClass )
GetHeading () (value int , ok bool )
GetPeriod () (value int , ok bool )
GetProximityNotificationRadius () (value int , ok bool )
}) {
i .Stopped = from .GetStopped ()
i .GeoPoint = from .GetGeoPoint ()
if val , ok := from .GetHeading (); ok {
i .Heading = val
}
if val , ok := from .GetPeriod (); ok {
i .Period = val
}
if val , ok := from .GetProximityNotificationRadius (); ok {
i .ProximityNotificationRadius = val
}
}
func (*InputMediaGeoLive ) TypeID () uint32 {
return InputMediaGeoLiveTypeID
}
func (*InputMediaGeoLive ) TypeName () string {
return "inputMediaGeoLive"
}
func (i *InputMediaGeoLive ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaGeoLive" ,
ID : InputMediaGeoLiveTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stopped" ,
SchemaName : "stopped" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "GeoPoint" ,
SchemaName : "geo_point" ,
},
{
Name : "Heading" ,
SchemaName : "heading" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "Period" ,
SchemaName : "period" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "ProximityNotificationRadius" ,
SchemaName : "proximity_notification_radius" ,
Null : !i .Flags .Has (3 ),
},
}
return typ
}
func (i *InputMediaGeoLive ) SetFlags () {
if !(i .Stopped == false ) {
i .Flags .Set (0 )
}
if !(i .Heading == 0 ) {
i .Flags .Set (2 )
}
if !(i .Period == 0 ) {
i .Flags .Set (1 )
}
if !(i .ProximityNotificationRadius == 0 ) {
i .Flags .Set (3 )
}
}
func (i *InputMediaGeoLive ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaGeoLive#971fa843 as nil" )
}
b .PutID (InputMediaGeoLiveTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaGeoLive ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaGeoLive#971fa843 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaGeoLive#971fa843: field flags: %w" , err )
}
if i .GeoPoint == nil {
return fmt .Errorf ("unable to encode inputMediaGeoLive#971fa843: field geo_point is nil" )
}
if err := i .GeoPoint .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaGeoLive#971fa843: field geo_point: %w" , err )
}
if i .Flags .Has (2 ) {
b .PutInt (i .Heading )
}
if i .Flags .Has (1 ) {
b .PutInt (i .Period )
}
if i .Flags .Has (3 ) {
b .PutInt (i .ProximityNotificationRadius )
}
return nil
}
func (i *InputMediaGeoLive ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaGeoLive#971fa843 to nil" )
}
if err := b .ConsumeID (InputMediaGeoLiveTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoLive#971fa843: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaGeoLive ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaGeoLive#971fa843 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoLive#971fa843: field flags: %w" , err )
}
}
i .Stopped = i .Flags .Has (0 )
{
value , err := DecodeInputGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoLive#971fa843: field geo_point: %w" , err )
}
i .GeoPoint = value
}
if i .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoLive#971fa843: field heading: %w" , err )
}
i .Heading = value
}
if i .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoLive#971fa843: field period: %w" , err )
}
i .Period = value
}
if i .Flags .Has (3 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaGeoLive#971fa843: field proximity_notification_radius: %w" , err )
}
i .ProximityNotificationRadius = value
}
return nil
}
func (i *InputMediaGeoLive ) SetStopped (value bool ) {
if value {
i .Flags .Set (0 )
i .Stopped = true
} else {
i .Flags .Unset (0 )
i .Stopped = false
}
}
func (i *InputMediaGeoLive ) GetStopped () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (0 )
}
func (i *InputMediaGeoLive ) GetGeoPoint () (value InputGeoPointClass ) {
if i == nil {
return
}
return i .GeoPoint
}
func (i *InputMediaGeoLive ) SetHeading (value int ) {
i .Flags .Set (2 )
i .Heading = value
}
func (i *InputMediaGeoLive ) GetHeading () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (2 ) {
return value , false
}
return i .Heading , true
}
func (i *InputMediaGeoLive ) SetPeriod (value int ) {
i .Flags .Set (1 )
i .Period = value
}
func (i *InputMediaGeoLive ) GetPeriod () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .Period , true
}
func (i *InputMediaGeoLive ) SetProximityNotificationRadius (value int ) {
i .Flags .Set (3 )
i .ProximityNotificationRadius = value
}
func (i *InputMediaGeoLive ) GetProximityNotificationRadius () (value int , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (3 ) {
return value , false
}
return i .ProximityNotificationRadius , true
}
type InputMediaPoll struct {
Flags bin .Fields
Poll Poll
CorrectAnswers [][]byte
Solution string
SolutionEntities []MessageEntityClass
}
const InputMediaPollTypeID = 0xf94e5f1
func (i InputMediaPoll ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaPoll {}
_ bin .Decoder = &InputMediaPoll {}
_ bin .BareEncoder = &InputMediaPoll {}
_ bin .BareDecoder = &InputMediaPoll {}
_ InputMediaClass = &InputMediaPoll {}
)
func (i *InputMediaPoll ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .Poll .Zero ()) {
return false
}
if !(i .CorrectAnswers == nil ) {
return false
}
if !(i .Solution == "" ) {
return false
}
if !(i .SolutionEntities == nil ) {
return false
}
return true
}
func (i *InputMediaPoll ) String () string {
if i == nil {
return "InputMediaPoll(nil)"
}
type Alias InputMediaPoll
return fmt .Sprintf ("InputMediaPoll%+v" , Alias (*i ))
}
func (i *InputMediaPoll ) FillFrom (from interface {
GetPoll () (value Poll )
GetCorrectAnswers () (value [][]byte , ok bool )
GetSolution () (value string , ok bool )
GetSolutionEntities () (value []MessageEntityClass , ok bool )
}) {
i .Poll = from .GetPoll ()
if val , ok := from .GetCorrectAnswers (); ok {
i .CorrectAnswers = val
}
if val , ok := from .GetSolution (); ok {
i .Solution = val
}
if val , ok := from .GetSolutionEntities (); ok {
i .SolutionEntities = val
}
}
func (*InputMediaPoll ) TypeID () uint32 {
return InputMediaPollTypeID
}
func (*InputMediaPoll ) TypeName () string {
return "inputMediaPoll"
}
func (i *InputMediaPoll ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaPoll" ,
ID : InputMediaPollTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Poll" ,
SchemaName : "poll" ,
},
{
Name : "CorrectAnswers" ,
SchemaName : "correct_answers" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "Solution" ,
SchemaName : "solution" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "SolutionEntities" ,
SchemaName : "solution_entities" ,
Null : !i .Flags .Has (1 ),
},
}
return typ
}
func (i *InputMediaPoll ) SetFlags () {
if !(i .CorrectAnswers == nil ) {
i .Flags .Set (0 )
}
if !(i .Solution == "" ) {
i .Flags .Set (1 )
}
if !(i .SolutionEntities == nil ) {
i .Flags .Set (1 )
}
}
func (i *InputMediaPoll ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaPoll#f94e5f1 as nil" )
}
b .PutID (InputMediaPollTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaPoll ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaPoll#f94e5f1 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaPoll#f94e5f1: field flags: %w" , err )
}
if err := i .Poll .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaPoll#f94e5f1: field poll: %w" , err )
}
if i .Flags .Has (0 ) {
b .PutVectorHeader (len (i .CorrectAnswers ))
for _ , v := range i .CorrectAnswers {
b .PutBytes (v )
}
}
if i .Flags .Has (1 ) {
b .PutString (i .Solution )
}
if i .Flags .Has (1 ) {
b .PutVectorHeader (len (i .SolutionEntities ))
for idx , v := range i .SolutionEntities {
if v == nil {
return fmt .Errorf ("unable to encode inputMediaPoll#f94e5f1: field solution_entities element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaPoll#f94e5f1: field solution_entities element with index %d: %w" , idx , err )
}
}
}
return nil
}
func (i *InputMediaPoll ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaPoll#f94e5f1 to nil" )
}
if err := b .ConsumeID (InputMediaPollTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaPoll ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaPoll#f94e5f1 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field flags: %w" , err )
}
}
{
if err := i .Poll .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field poll: %w" , err )
}
}
if i .Flags .Has (0 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field correct_answers: %w" , err )
}
if headerLen > 0 {
i .CorrectAnswers = make ([][]byte , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field correct_answers: %w" , err )
}
i .CorrectAnswers = append (i .CorrectAnswers , value )
}
}
if i .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field solution: %w" , err )
}
i .Solution = value
}
if i .Flags .Has (1 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field solution_entities: %w" , err )
}
if headerLen > 0 {
i .SolutionEntities = make ([]MessageEntityClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessageEntity (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaPoll#f94e5f1: field solution_entities: %w" , err )
}
i .SolutionEntities = append (i .SolutionEntities , value )
}
}
return nil
}
func (i *InputMediaPoll ) GetPoll () (value Poll ) {
if i == nil {
return
}
return i .Poll
}
func (i *InputMediaPoll ) SetCorrectAnswers (value [][]byte ) {
i .Flags .Set (0 )
i .CorrectAnswers = value
}
func (i *InputMediaPoll ) GetCorrectAnswers () (value [][]byte , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (0 ) {
return value , false
}
return i .CorrectAnswers , true
}
func (i *InputMediaPoll ) SetSolution (value string ) {
i .Flags .Set (1 )
i .Solution = value
}
func (i *InputMediaPoll ) GetSolution () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .Solution , true
}
func (i *InputMediaPoll ) SetSolutionEntities (value []MessageEntityClass ) {
i .Flags .Set (1 )
i .SolutionEntities = value
}
func (i *InputMediaPoll ) GetSolutionEntities () (value []MessageEntityClass , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .SolutionEntities , true
}
func (i *InputMediaPoll ) MapSolutionEntities () (value MessageEntityClassArray , ok bool ) {
if !i .Flags .Has (1 ) {
return value , false
}
return MessageEntityClassArray (i .SolutionEntities ), true
}
type InputMediaDice struct {
Emoticon string
}
const InputMediaDiceTypeID = 0xe66fbf7b
func (i InputMediaDice ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaDice {}
_ bin .Decoder = &InputMediaDice {}
_ bin .BareEncoder = &InputMediaDice {}
_ bin .BareDecoder = &InputMediaDice {}
_ InputMediaClass = &InputMediaDice {}
)
func (i *InputMediaDice ) Zero () bool {
if i == nil {
return true
}
if !(i .Emoticon == "" ) {
return false
}
return true
}
func (i *InputMediaDice ) String () string {
if i == nil {
return "InputMediaDice(nil)"
}
type Alias InputMediaDice
return fmt .Sprintf ("InputMediaDice%+v" , Alias (*i ))
}
func (i *InputMediaDice ) FillFrom (from interface {
GetEmoticon () (value string )
}) {
i .Emoticon = from .GetEmoticon ()
}
func (*InputMediaDice ) TypeID () uint32 {
return InputMediaDiceTypeID
}
func (*InputMediaDice ) TypeName () string {
return "inputMediaDice"
}
func (i *InputMediaDice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaDice" ,
ID : InputMediaDiceTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Emoticon" ,
SchemaName : "emoticon" ,
},
}
return typ
}
func (i *InputMediaDice ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaDice#e66fbf7b as nil" )
}
b .PutID (InputMediaDiceTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaDice ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaDice#e66fbf7b as nil" )
}
b .PutString (i .Emoticon )
return nil
}
func (i *InputMediaDice ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaDice#e66fbf7b to nil" )
}
if err := b .ConsumeID (InputMediaDiceTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaDice#e66fbf7b: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaDice ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaDice#e66fbf7b to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaDice#e66fbf7b: field emoticon: %w" , err )
}
i .Emoticon = value
}
return nil
}
func (i *InputMediaDice ) GetEmoticon () (value string ) {
if i == nil {
return
}
return i .Emoticon
}
type InputMediaStory struct {
Peer InputPeerClass
ID int
}
const InputMediaStoryTypeID = 0x89fdd778
func (i InputMediaStory ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaStory {}
_ bin .Decoder = &InputMediaStory {}
_ bin .BareEncoder = &InputMediaStory {}
_ bin .BareDecoder = &InputMediaStory {}
_ InputMediaClass = &InputMediaStory {}
)
func (i *InputMediaStory ) Zero () bool {
if i == nil {
return true
}
if !(i .Peer == nil ) {
return false
}
if !(i .ID == 0 ) {
return false
}
return true
}
func (i *InputMediaStory ) String () string {
if i == nil {
return "InputMediaStory(nil)"
}
type Alias InputMediaStory
return fmt .Sprintf ("InputMediaStory%+v" , Alias (*i ))
}
func (i *InputMediaStory ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetID () (value int )
}) {
i .Peer = from .GetPeer ()
i .ID = from .GetID ()
}
func (*InputMediaStory ) TypeID () uint32 {
return InputMediaStoryTypeID
}
func (*InputMediaStory ) TypeName () string {
return "inputMediaStory"
}
func (i *InputMediaStory ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaStory" ,
ID : InputMediaStoryTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (i *InputMediaStory ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaStory#89fdd778 as nil" )
}
b .PutID (InputMediaStoryTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaStory ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaStory#89fdd778 as nil" )
}
if i .Peer == nil {
return fmt .Errorf ("unable to encode inputMediaStory#89fdd778: field peer is nil" )
}
if err := i .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaStory#89fdd778: field peer: %w" , err )
}
b .PutInt (i .ID )
return nil
}
func (i *InputMediaStory ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaStory#89fdd778 to nil" )
}
if err := b .ConsumeID (InputMediaStoryTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaStory#89fdd778: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaStory ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaStory#89fdd778 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode inputMediaStory#89fdd778: field peer: %w" , err )
}
i .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaStory#89fdd778: field id: %w" , err )
}
i .ID = value
}
return nil
}
func (i *InputMediaStory ) GetPeer () (value InputPeerClass ) {
if i == nil {
return
}
return i .Peer
}
func (i *InputMediaStory ) GetID () (value int ) {
if i == nil {
return
}
return i .ID
}
type InputMediaWebPage struct {
Flags bin .Fields
ForceLargeMedia bool
ForceSmallMedia bool
Optional bool
URL string
}
const InputMediaWebPageTypeID = 0xc21b8849
func (i InputMediaWebPage ) construct () InputMediaClass { return &i }
var (
_ bin .Encoder = &InputMediaWebPage {}
_ bin .Decoder = &InputMediaWebPage {}
_ bin .BareEncoder = &InputMediaWebPage {}
_ bin .BareDecoder = &InputMediaWebPage {}
_ InputMediaClass = &InputMediaWebPage {}
)
func (i *InputMediaWebPage ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .ForceLargeMedia == false ) {
return false
}
if !(i .ForceSmallMedia == false ) {
return false
}
if !(i .Optional == false ) {
return false
}
if !(i .URL == "" ) {
return false
}
return true
}
func (i *InputMediaWebPage ) String () string {
if i == nil {
return "InputMediaWebPage(nil)"
}
type Alias InputMediaWebPage
return fmt .Sprintf ("InputMediaWebPage%+v" , Alias (*i ))
}
func (i *InputMediaWebPage ) FillFrom (from interface {
GetForceLargeMedia () (value bool )
GetForceSmallMedia () (value bool )
GetOptional () (value bool )
GetURL () (value string )
}) {
i .ForceLargeMedia = from .GetForceLargeMedia ()
i .ForceSmallMedia = from .GetForceSmallMedia ()
i .Optional = from .GetOptional ()
i .URL = from .GetURL ()
}
func (*InputMediaWebPage ) TypeID () uint32 {
return InputMediaWebPageTypeID
}
func (*InputMediaWebPage ) TypeName () string {
return "inputMediaWebPage"
}
func (i *InputMediaWebPage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputMediaWebPage" ,
ID : InputMediaWebPageTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ForceLargeMedia" ,
SchemaName : "force_large_media" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "ForceSmallMedia" ,
SchemaName : "force_small_media" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "Optional" ,
SchemaName : "optional" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (i *InputMediaWebPage ) SetFlags () {
if !(i .ForceLargeMedia == false ) {
i .Flags .Set (0 )
}
if !(i .ForceSmallMedia == false ) {
i .Flags .Set (1 )
}
if !(i .Optional == false ) {
i .Flags .Set (2 )
}
}
func (i *InputMediaWebPage ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaWebPage#c21b8849 as nil" )
}
b .PutID (InputMediaWebPageTypeID )
return i .EncodeBare (b )
}
func (i *InputMediaWebPage ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputMediaWebPage#c21b8849 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputMediaWebPage#c21b8849: field flags: %w" , err )
}
b .PutString (i .URL )
return nil
}
func (i *InputMediaWebPage ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaWebPage#c21b8849 to nil" )
}
if err := b .ConsumeID (InputMediaWebPageTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputMediaWebPage#c21b8849: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputMediaWebPage ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputMediaWebPage#c21b8849 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputMediaWebPage#c21b8849: field flags: %w" , err )
}
}
i .ForceLargeMedia = i .Flags .Has (0 )
i .ForceSmallMedia = i .Flags .Has (1 )
i .Optional = i .Flags .Has (2 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputMediaWebPage#c21b8849: field url: %w" , err )
}
i .URL = value
}
return nil
}
func (i *InputMediaWebPage ) SetForceLargeMedia (value bool ) {
if value {
i .Flags .Set (0 )
i .ForceLargeMedia = true
} else {
i .Flags .Unset (0 )
i .ForceLargeMedia = false
}
}
func (i *InputMediaWebPage ) GetForceLargeMedia () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (0 )
}
func (i *InputMediaWebPage ) SetForceSmallMedia (value bool ) {
if value {
i .Flags .Set (1 )
i .ForceSmallMedia = true
} else {
i .Flags .Unset (1 )
i .ForceSmallMedia = false
}
}
func (i *InputMediaWebPage ) GetForceSmallMedia () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (1 )
}
func (i *InputMediaWebPage ) SetOptional (value bool ) {
if value {
i .Flags .Set (2 )
i .Optional = true
} else {
i .Flags .Unset (2 )
i .Optional = false
}
}
func (i *InputMediaWebPage ) GetOptional () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (2 )
}
func (i *InputMediaWebPage ) GetURL () (value string ) {
if i == nil {
return
}
return i .URL
}
const InputMediaClassName = "InputMedia"
type InputMediaClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputMediaClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputMedia (buf *bin .Buffer ) (InputMediaClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputMediaEmptyTypeID :
v := InputMediaEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaUploadedPhotoTypeID :
v := InputMediaUploadedPhoto {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaPhotoTypeID :
v := InputMediaPhoto {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaGeoPointTypeID :
v := InputMediaGeoPoint {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaContactTypeID :
v := InputMediaContact {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaUploadedDocumentTypeID :
v := InputMediaUploadedDocument {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaDocumentTypeID :
v := InputMediaDocument {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaVenueTypeID :
v := InputMediaVenue {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaPhotoExternalTypeID :
v := InputMediaPhotoExternal {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaDocumentExternalTypeID :
v := InputMediaDocumentExternal {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaGameTypeID :
v := InputMediaGame {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaInvoiceTypeID :
v := InputMediaInvoice {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaGeoLiveTypeID :
v := InputMediaGeoLive {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaPollTypeID :
v := InputMediaPoll {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaDiceTypeID :
v := InputMediaDice {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaStoryTypeID :
v := InputMediaStory {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
case InputMediaWebPageTypeID :
v := InputMediaWebPage {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputMediaClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputMediaBox struct {
InputMedia InputMediaClass
}
func (b *InputMediaBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputMediaBox to nil" )
}
v , err := DecodeInputMedia (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputMedia = v
return nil
}
func (b *InputMediaBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputMedia == nil {
return fmt .Errorf ("unable to encode InputMediaClass as nil" )
}
return b .InputMedia .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 .