7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
3233 lines
84 KiB
Go
3233 lines
84 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tdapi
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// InlineQueryResultArticle represents TL type `inlineQueryResultArticle#1016d01a`.
|
|
type InlineQueryResultArticle struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// URL of the result, if it exists
|
|
URL string
|
|
// Title of the result
|
|
Title string
|
|
// Represents a link to an article or web page
|
|
Description string
|
|
// Result thumbnail in JPEG format; may be null
|
|
Thumbnail Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultArticleTypeID is TL type id of InlineQueryResultArticle.
|
|
const InlineQueryResultArticleTypeID = 0x1016d01a
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultArticle) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultArticle.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultArticle{}
|
|
_ bin.Decoder = &InlineQueryResultArticle{}
|
|
_ bin.BareEncoder = &InlineQueryResultArticle{}
|
|
_ bin.BareDecoder = &InlineQueryResultArticle{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultArticle{}
|
|
)
|
|
|
|
func (i *InlineQueryResultArticle) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.URL == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
if !(i.Thumbnail.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultArticle) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultArticle(nil)"
|
|
}
|
|
type Alias InlineQueryResultArticle
|
|
return fmt.Sprintf("InlineQueryResultArticle%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultArticle) TypeID() uint32 {
|
|
return InlineQueryResultArticleTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultArticle) TypeName() string {
|
|
return "inlineQueryResultArticle"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultArticle) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultArticle",
|
|
ID: InlineQueryResultArticleTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "URL",
|
|
SchemaName: "url",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
{
|
|
Name: "Thumbnail",
|
|
SchemaName: "thumbnail",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultArticle) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil")
|
|
}
|
|
b.PutID(InlineQueryResultArticleTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultArticle) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.URL)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
if err := i.Thumbnail.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultArticle) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultArticleTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultArticle) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field url: %w", err)
|
|
}
|
|
i.URL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
{
|
|
if err := i.Thumbnail.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultArticle")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("url")
|
|
b.PutString(i.URL)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail")
|
|
if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultArticle) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultArticle"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field url: %w", err)
|
|
}
|
|
i.URL = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
case "thumbnail":
|
|
if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultArticle) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetURL returns value of URL field.
|
|
func (i *InlineQueryResultArticle) GetURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.URL
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultArticle) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InlineQueryResultArticle) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// GetThumbnail returns value of Thumbnail field.
|
|
func (i *InlineQueryResultArticle) GetThumbnail() (value Thumbnail) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultContact represents TL type `inlineQueryResultContact#f5278212`.
|
|
type InlineQueryResultContact struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// A user contact
|
|
Contact Contact
|
|
// Result thumbnail in JPEG format; may be null
|
|
Thumbnail Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultContactTypeID is TL type id of InlineQueryResultContact.
|
|
const InlineQueryResultContactTypeID = 0xf5278212
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultContact) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultContact.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultContact{}
|
|
_ bin.Decoder = &InlineQueryResultContact{}
|
|
_ bin.BareEncoder = &InlineQueryResultContact{}
|
|
_ bin.BareDecoder = &InlineQueryResultContact{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultContact{}
|
|
)
|
|
|
|
func (i *InlineQueryResultContact) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Contact.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Thumbnail.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultContact) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultContact(nil)"
|
|
}
|
|
type Alias InlineQueryResultContact
|
|
return fmt.Sprintf("InlineQueryResultContact%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultContact) TypeID() uint32 {
|
|
return InlineQueryResultContactTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultContact) TypeName() string {
|
|
return "inlineQueryResultContact"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultContact) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultContact",
|
|
ID: InlineQueryResultContactTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Contact",
|
|
SchemaName: "contact",
|
|
},
|
|
{
|
|
Name: "Thumbnail",
|
|
SchemaName: "thumbnail",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultContact) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultContact#f5278212 as nil")
|
|
}
|
|
b.PutID(InlineQueryResultContactTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultContact) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultContact#f5278212 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Contact.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field contact: %w", err)
|
|
}
|
|
if err := i.Thumbnail.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field thumbnail: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultContact) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultContact#f5278212 to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultContactTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultContact) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultContact#f5278212 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Contact.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field contact: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := i.Thumbnail.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field thumbnail: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultContact) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultContact#f5278212 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultContact")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("contact")
|
|
if err := i.Contact.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field contact: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("thumbnail")
|
|
if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field thumbnail: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultContact) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultContact#f5278212 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultContact"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "contact":
|
|
if err := i.Contact.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field contact: %w", err)
|
|
}
|
|
case "thumbnail":
|
|
if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field thumbnail: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultContact) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetContact returns value of Contact field.
|
|
func (i *InlineQueryResultContact) GetContact() (value Contact) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Contact
|
|
}
|
|
|
|
// GetThumbnail returns value of Thumbnail field.
|
|
func (i *InlineQueryResultContact) GetThumbnail() (value Thumbnail) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultLocation represents TL type `inlineQueryResultLocation#1bc6ab10`.
|
|
type InlineQueryResultLocation struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Location result
|
|
Location Location
|
|
// Title of the result
|
|
Title string
|
|
// Result thumbnail in JPEG format; may be null
|
|
Thumbnail Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultLocationTypeID is TL type id of InlineQueryResultLocation.
|
|
const InlineQueryResultLocationTypeID = 0x1bc6ab10
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultLocation) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultLocation.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultLocation{}
|
|
_ bin.Decoder = &InlineQueryResultLocation{}
|
|
_ bin.BareEncoder = &InlineQueryResultLocation{}
|
|
_ bin.BareDecoder = &InlineQueryResultLocation{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultLocation{}
|
|
)
|
|
|
|
func (i *InlineQueryResultLocation) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Location.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Thumbnail.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultLocation) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultLocation(nil)"
|
|
}
|
|
type Alias InlineQueryResultLocation
|
|
return fmt.Sprintf("InlineQueryResultLocation%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultLocation) TypeID() uint32 {
|
|
return InlineQueryResultLocationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultLocation) TypeName() string {
|
|
return "inlineQueryResultLocation"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultLocation) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultLocation",
|
|
ID: InlineQueryResultLocationTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Location",
|
|
SchemaName: "location",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Thumbnail",
|
|
SchemaName: "thumbnail",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultLocation) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultLocation#1bc6ab10 as nil")
|
|
}
|
|
b.PutID(InlineQueryResultLocationTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultLocation) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultLocation#1bc6ab10 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Location.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field location: %w", err)
|
|
}
|
|
b.PutString(i.Title)
|
|
if err := i.Thumbnail.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultLocation) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultLocation#1bc6ab10 to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultLocationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultLocation) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultLocation#1bc6ab10 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Location.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field location: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
if err := i.Thumbnail.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultLocation) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultLocation#1bc6ab10 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultLocation")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("location")
|
|
if err := i.Location.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field location: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail")
|
|
if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultLocation) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultLocation#1bc6ab10 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultLocation"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "location":
|
|
if err := i.Location.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field location: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "thumbnail":
|
|
if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultLocation) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetLocation returns value of Location field.
|
|
func (i *InlineQueryResultLocation) GetLocation() (value Location) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Location
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultLocation) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetThumbnail returns value of Thumbnail field.
|
|
func (i *InlineQueryResultLocation) GetThumbnail() (value Thumbnail) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultVenue represents TL type `inlineQueryResultVenue#4c5b105e`.
|
|
type InlineQueryResultVenue struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Venue result
|
|
Venue Venue
|
|
// Result thumbnail in JPEG format; may be null
|
|
Thumbnail Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultVenueTypeID is TL type id of InlineQueryResultVenue.
|
|
const InlineQueryResultVenueTypeID = 0x4c5b105e
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultVenue) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultVenue.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultVenue{}
|
|
_ bin.Decoder = &InlineQueryResultVenue{}
|
|
_ bin.BareEncoder = &InlineQueryResultVenue{}
|
|
_ bin.BareDecoder = &InlineQueryResultVenue{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultVenue{}
|
|
)
|
|
|
|
func (i *InlineQueryResultVenue) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Venue.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Thumbnail.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultVenue) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultVenue(nil)"
|
|
}
|
|
type Alias InlineQueryResultVenue
|
|
return fmt.Sprintf("InlineQueryResultVenue%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultVenue) TypeID() uint32 {
|
|
return InlineQueryResultVenueTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultVenue) TypeName() string {
|
|
return "inlineQueryResultVenue"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultVenue) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultVenue",
|
|
ID: InlineQueryResultVenueTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Venue",
|
|
SchemaName: "venue",
|
|
},
|
|
{
|
|
Name: "Thumbnail",
|
|
SchemaName: "thumbnail",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultVenue) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVenue#4c5b105e as nil")
|
|
}
|
|
b.PutID(InlineQueryResultVenueTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultVenue) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVenue#4c5b105e as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Venue.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field venue: %w", err)
|
|
}
|
|
if err := i.Thumbnail.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultVenue) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVenue#4c5b105e to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultVenueTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultVenue) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVenue#4c5b105e to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Venue.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field venue: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := i.Thumbnail.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultVenue) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVenue#4c5b105e as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultVenue")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("venue")
|
|
if err := i.Venue.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field venue: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("thumbnail")
|
|
if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultVenue) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVenue#4c5b105e to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultVenue"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "venue":
|
|
if err := i.Venue.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field venue: %w", err)
|
|
}
|
|
case "thumbnail":
|
|
if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultVenue) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetVenue returns value of Venue field.
|
|
func (i *InlineQueryResultVenue) GetVenue() (value Venue) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Venue
|
|
}
|
|
|
|
// GetThumbnail returns value of Thumbnail field.
|
|
func (i *InlineQueryResultVenue) GetThumbnail() (value Thumbnail) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Thumbnail
|
|
}
|
|
|
|
// InlineQueryResultGame represents TL type `inlineQueryResultGame#65bd7c7b`.
|
|
type InlineQueryResultGame struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Game result
|
|
Game Game
|
|
}
|
|
|
|
// InlineQueryResultGameTypeID is TL type id of InlineQueryResultGame.
|
|
const InlineQueryResultGameTypeID = 0x65bd7c7b
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultGame) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultGame.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultGame{}
|
|
_ bin.Decoder = &InlineQueryResultGame{}
|
|
_ bin.BareEncoder = &InlineQueryResultGame{}
|
|
_ bin.BareDecoder = &InlineQueryResultGame{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultGame{}
|
|
)
|
|
|
|
func (i *InlineQueryResultGame) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Game.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultGame) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultGame(nil)"
|
|
}
|
|
type Alias InlineQueryResultGame
|
|
return fmt.Sprintf("InlineQueryResultGame%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultGame) TypeID() uint32 {
|
|
return InlineQueryResultGameTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultGame) TypeName() string {
|
|
return "inlineQueryResultGame"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultGame) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultGame",
|
|
ID: InlineQueryResultGameTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Game",
|
|
SchemaName: "game",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultGame) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultGame#65bd7c7b as nil")
|
|
}
|
|
b.PutID(InlineQueryResultGameTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultGame) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultGame#65bd7c7b as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Game.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultGame#65bd7c7b: field game: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultGame) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultGame#65bd7c7b to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultGameTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultGame) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultGame#65bd7c7b to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Game.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field game: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultGame) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultGame#65bd7c7b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultGame")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("game")
|
|
if err := i.Game.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultGame#65bd7c7b: field game: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultGame) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultGame#65bd7c7b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultGame"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "game":
|
|
if err := i.Game.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field game: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultGame) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetGame returns value of Game field.
|
|
func (i *InlineQueryResultGame) GetGame() (value Game) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Game
|
|
}
|
|
|
|
// InlineQueryResultAnimation represents TL type `inlineQueryResultAnimation#77cded0b`.
|
|
type InlineQueryResultAnimation struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Animation file
|
|
Animation Animation
|
|
// Animation title
|
|
Title string
|
|
}
|
|
|
|
// InlineQueryResultAnimationTypeID is TL type id of InlineQueryResultAnimation.
|
|
const InlineQueryResultAnimationTypeID = 0x77cded0b
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultAnimation) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultAnimation.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultAnimation{}
|
|
_ bin.Decoder = &InlineQueryResultAnimation{}
|
|
_ bin.BareEncoder = &InlineQueryResultAnimation{}
|
|
_ bin.BareDecoder = &InlineQueryResultAnimation{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultAnimation{}
|
|
)
|
|
|
|
func (i *InlineQueryResultAnimation) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Animation.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultAnimation) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultAnimation(nil)"
|
|
}
|
|
type Alias InlineQueryResultAnimation
|
|
return fmt.Sprintf("InlineQueryResultAnimation%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultAnimation) TypeID() uint32 {
|
|
return InlineQueryResultAnimationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultAnimation) TypeName() string {
|
|
return "inlineQueryResultAnimation"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultAnimation) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultAnimation",
|
|
ID: InlineQueryResultAnimationTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Animation",
|
|
SchemaName: "animation",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultAnimation) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultAnimation#77cded0b as nil")
|
|
}
|
|
b.PutID(InlineQueryResultAnimationTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultAnimation) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultAnimation#77cded0b as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Animation.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultAnimation#77cded0b: field animation: %w", err)
|
|
}
|
|
b.PutString(i.Title)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultAnimation) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultAnimation#77cded0b to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultAnimationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultAnimation) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultAnimation#77cded0b to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Animation.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field animation: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultAnimation) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultAnimation#77cded0b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultAnimation")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("animation")
|
|
if err := i.Animation.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultAnimation#77cded0b: field animation: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultAnimation) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultAnimation#77cded0b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultAnimation"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "animation":
|
|
if err := i.Animation.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field animation: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultAnimation) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetAnimation returns value of Animation field.
|
|
func (i *InlineQueryResultAnimation) GetAnimation() (value Animation) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Animation
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultAnimation) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// InlineQueryResultAudio represents TL type `inlineQueryResultAudio#3239d2f8`.
|
|
type InlineQueryResultAudio struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Audio file
|
|
Audio Audio
|
|
}
|
|
|
|
// InlineQueryResultAudioTypeID is TL type id of InlineQueryResultAudio.
|
|
const InlineQueryResultAudioTypeID = 0x3239d2f8
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultAudio) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultAudio.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultAudio{}
|
|
_ bin.Decoder = &InlineQueryResultAudio{}
|
|
_ bin.BareEncoder = &InlineQueryResultAudio{}
|
|
_ bin.BareDecoder = &InlineQueryResultAudio{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultAudio{}
|
|
)
|
|
|
|
func (i *InlineQueryResultAudio) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Audio.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultAudio) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultAudio(nil)"
|
|
}
|
|
type Alias InlineQueryResultAudio
|
|
return fmt.Sprintf("InlineQueryResultAudio%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultAudio) TypeID() uint32 {
|
|
return InlineQueryResultAudioTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultAudio) TypeName() string {
|
|
return "inlineQueryResultAudio"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultAudio) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultAudio",
|
|
ID: InlineQueryResultAudioTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Audio",
|
|
SchemaName: "audio",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultAudio) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultAudio#3239d2f8 as nil")
|
|
}
|
|
b.PutID(InlineQueryResultAudioTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultAudio) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultAudio#3239d2f8 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Audio.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultAudio#3239d2f8: field audio: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultAudio) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultAudio#3239d2f8 to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultAudioTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultAudio) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultAudio#3239d2f8 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Audio.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field audio: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultAudio) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultAudio#3239d2f8 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultAudio")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("audio")
|
|
if err := i.Audio.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultAudio#3239d2f8: field audio: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultAudio) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultAudio#3239d2f8 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultAudio"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "audio":
|
|
if err := i.Audio.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field audio: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultAudio) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetAudio returns value of Audio field.
|
|
func (i *InlineQueryResultAudio) GetAudio() (value Audio) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Audio
|
|
}
|
|
|
|
// InlineQueryResultDocument represents TL type `inlineQueryResultDocument#a71d0c45`.
|
|
type InlineQueryResultDocument struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Document
|
|
Document Document
|
|
// Document title
|
|
Title string
|
|
// Represents a document
|
|
Description string
|
|
}
|
|
|
|
// InlineQueryResultDocumentTypeID is TL type id of InlineQueryResultDocument.
|
|
const InlineQueryResultDocumentTypeID = 0xa71d0c45
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultDocument) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultDocument.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultDocument{}
|
|
_ bin.Decoder = &InlineQueryResultDocument{}
|
|
_ bin.BareEncoder = &InlineQueryResultDocument{}
|
|
_ bin.BareDecoder = &InlineQueryResultDocument{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultDocument{}
|
|
)
|
|
|
|
func (i *InlineQueryResultDocument) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Document.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultDocument) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultDocument(nil)"
|
|
}
|
|
type Alias InlineQueryResultDocument
|
|
return fmt.Sprintf("InlineQueryResultDocument%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultDocument) TypeID() uint32 {
|
|
return InlineQueryResultDocumentTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultDocument) TypeName() string {
|
|
return "inlineQueryResultDocument"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultDocument) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultDocument",
|
|
ID: InlineQueryResultDocumentTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Document",
|
|
SchemaName: "document",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultDocument) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultDocument#a71d0c45 as nil")
|
|
}
|
|
b.PutID(InlineQueryResultDocumentTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultDocument) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultDocument#a71d0c45 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Document.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultDocument#a71d0c45: field document: %w", err)
|
|
}
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultDocument) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultDocument#a71d0c45 to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultDocumentTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultDocument) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultDocument#a71d0c45 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Document.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field document: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultDocument) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultDocument#a71d0c45 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultDocument")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("document")
|
|
if err := i.Document.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultDocument#a71d0c45: field document: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultDocument) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultDocument#a71d0c45 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultDocument"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "document":
|
|
if err := i.Document.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field document: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultDocument) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetDocument returns value of Document field.
|
|
func (i *InlineQueryResultDocument) GetDocument() (value Document) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Document
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultDocument) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InlineQueryResultDocument) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// InlineQueryResultPhoto represents TL type `inlineQueryResultPhoto#6e2b1dd0`.
|
|
type InlineQueryResultPhoto struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Photo
|
|
Photo Photo
|
|
// Title of the result, if known
|
|
Title string
|
|
// Represents a photo
|
|
Description string
|
|
}
|
|
|
|
// InlineQueryResultPhotoTypeID is TL type id of InlineQueryResultPhoto.
|
|
const InlineQueryResultPhotoTypeID = 0x6e2b1dd0
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultPhoto) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultPhoto.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultPhoto{}
|
|
_ bin.Decoder = &InlineQueryResultPhoto{}
|
|
_ bin.BareEncoder = &InlineQueryResultPhoto{}
|
|
_ bin.BareDecoder = &InlineQueryResultPhoto{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultPhoto{}
|
|
)
|
|
|
|
func (i *InlineQueryResultPhoto) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Photo.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultPhoto) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultPhoto(nil)"
|
|
}
|
|
type Alias InlineQueryResultPhoto
|
|
return fmt.Sprintf("InlineQueryResultPhoto%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultPhoto) TypeID() uint32 {
|
|
return InlineQueryResultPhotoTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultPhoto) TypeName() string {
|
|
return "inlineQueryResultPhoto"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultPhoto) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultPhoto",
|
|
ID: InlineQueryResultPhotoTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Photo",
|
|
SchemaName: "photo",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultPhoto) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultPhoto#6e2b1dd0 as nil")
|
|
}
|
|
b.PutID(InlineQueryResultPhotoTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultPhoto) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultPhoto#6e2b1dd0 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Photo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err)
|
|
}
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultPhoto) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultPhoto#6e2b1dd0 to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultPhotoTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultPhoto) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultPhoto#6e2b1dd0 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Photo.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultPhoto) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultPhoto#6e2b1dd0 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultPhoto")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("photo")
|
|
if err := i.Photo.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultPhoto) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultPhoto#6e2b1dd0 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultPhoto"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "photo":
|
|
if err := i.Photo.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultPhoto) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetPhoto returns value of Photo field.
|
|
func (i *InlineQueryResultPhoto) GetPhoto() (value Photo) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Photo
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultPhoto) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InlineQueryResultPhoto) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// InlineQueryResultSticker represents TL type `inlineQueryResultSticker#91d6560b`.
|
|
type InlineQueryResultSticker struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Sticker
|
|
Sticker Sticker
|
|
}
|
|
|
|
// InlineQueryResultStickerTypeID is TL type id of InlineQueryResultSticker.
|
|
const InlineQueryResultStickerTypeID = 0x91d6560b
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultSticker) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultSticker.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultSticker{}
|
|
_ bin.Decoder = &InlineQueryResultSticker{}
|
|
_ bin.BareEncoder = &InlineQueryResultSticker{}
|
|
_ bin.BareDecoder = &InlineQueryResultSticker{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultSticker{}
|
|
)
|
|
|
|
func (i *InlineQueryResultSticker) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Sticker.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultSticker) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultSticker(nil)"
|
|
}
|
|
type Alias InlineQueryResultSticker
|
|
return fmt.Sprintf("InlineQueryResultSticker%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultSticker) TypeID() uint32 {
|
|
return InlineQueryResultStickerTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultSticker) TypeName() string {
|
|
return "inlineQueryResultSticker"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultSticker) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultSticker",
|
|
ID: InlineQueryResultStickerTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Sticker",
|
|
SchemaName: "sticker",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultSticker) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultSticker#91d6560b as nil")
|
|
}
|
|
b.PutID(InlineQueryResultStickerTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultSticker) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultSticker#91d6560b as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Sticker.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultSticker#91d6560b: field sticker: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultSticker) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultSticker#91d6560b to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultStickerTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultSticker) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultSticker#91d6560b to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Sticker.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field sticker: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultSticker) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultSticker#91d6560b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultSticker")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("sticker")
|
|
if err := i.Sticker.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultSticker#91d6560b: field sticker: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultSticker) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultSticker#91d6560b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultSticker"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "sticker":
|
|
if err := i.Sticker.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field sticker: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultSticker) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetSticker returns value of Sticker field.
|
|
func (i *InlineQueryResultSticker) GetSticker() (value Sticker) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Sticker
|
|
}
|
|
|
|
// InlineQueryResultVideo represents TL type `inlineQueryResultVideo#ae2742e5`.
|
|
type InlineQueryResultVideo struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Video
|
|
Video Video
|
|
// Title of the video
|
|
Title string
|
|
// Represents a video
|
|
Description string
|
|
}
|
|
|
|
// InlineQueryResultVideoTypeID is TL type id of InlineQueryResultVideo.
|
|
const InlineQueryResultVideoTypeID = 0xae2742e5
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultVideo) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultVideo.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultVideo{}
|
|
_ bin.Decoder = &InlineQueryResultVideo{}
|
|
_ bin.BareEncoder = &InlineQueryResultVideo{}
|
|
_ bin.BareDecoder = &InlineQueryResultVideo{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultVideo{}
|
|
)
|
|
|
|
func (i *InlineQueryResultVideo) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Video.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultVideo) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultVideo(nil)"
|
|
}
|
|
type Alias InlineQueryResultVideo
|
|
return fmt.Sprintf("InlineQueryResultVideo%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultVideo) TypeID() uint32 {
|
|
return InlineQueryResultVideoTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultVideo) TypeName() string {
|
|
return "inlineQueryResultVideo"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultVideo) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultVideo",
|
|
ID: InlineQueryResultVideoTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Video",
|
|
SchemaName: "video",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultVideo) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVideo#ae2742e5 as nil")
|
|
}
|
|
b.PutID(InlineQueryResultVideoTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultVideo) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVideo#ae2742e5 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Video.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVideo#ae2742e5: field video: %w", err)
|
|
}
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultVideo) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVideo#ae2742e5 to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultVideoTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultVideo) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVideo#ae2742e5 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Video.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field video: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultVideo) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVideo#ae2742e5 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultVideo")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("video")
|
|
if err := i.Video.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVideo#ae2742e5: field video: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultVideo) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVideo#ae2742e5 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultVideo"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "video":
|
|
if err := i.Video.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field video: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultVideo) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetVideo returns value of Video field.
|
|
func (i *InlineQueryResultVideo) GetVideo() (value Video) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Video
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultVideo) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InlineQueryResultVideo) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// InlineQueryResultVoiceNote represents TL type `inlineQueryResultVoiceNote#8ee8142f`.
|
|
type InlineQueryResultVoiceNote struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Voice note
|
|
VoiceNote VoiceNote
|
|
// Title of the voice note
|
|
Title string
|
|
}
|
|
|
|
// InlineQueryResultVoiceNoteTypeID is TL type id of InlineQueryResultVoiceNote.
|
|
const InlineQueryResultVoiceNoteTypeID = 0x8ee8142f
|
|
|
|
// construct implements constructor of InlineQueryResultClass.
|
|
func (i InlineQueryResultVoiceNote) construct() InlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InlineQueryResultVoiceNote.
|
|
var (
|
|
_ bin.Encoder = &InlineQueryResultVoiceNote{}
|
|
_ bin.Decoder = &InlineQueryResultVoiceNote{}
|
|
_ bin.BareEncoder = &InlineQueryResultVoiceNote{}
|
|
_ bin.BareDecoder = &InlineQueryResultVoiceNote{}
|
|
|
|
_ InlineQueryResultClass = &InlineQueryResultVoiceNote{}
|
|
)
|
|
|
|
func (i *InlineQueryResultVoiceNote) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.VoiceNote.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InlineQueryResultVoiceNote) String() string {
|
|
if i == nil {
|
|
return "InlineQueryResultVoiceNote(nil)"
|
|
}
|
|
type Alias InlineQueryResultVoiceNote
|
|
return fmt.Sprintf("InlineQueryResultVoiceNote%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InlineQueryResultVoiceNote) TypeID() uint32 {
|
|
return InlineQueryResultVoiceNoteTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InlineQueryResultVoiceNote) TypeName() string {
|
|
return "inlineQueryResultVoiceNote"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InlineQueryResultVoiceNote) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inlineQueryResultVoiceNote",
|
|
ID: InlineQueryResultVoiceNoteTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "VoiceNote",
|
|
SchemaName: "voice_note",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InlineQueryResultVoiceNote) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVoiceNote#8ee8142f as nil")
|
|
}
|
|
b.PutID(InlineQueryResultVoiceNoteTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InlineQueryResultVoiceNote) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVoiceNote#8ee8142f as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.VoiceNote.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err)
|
|
}
|
|
b.PutString(i.Title)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InlineQueryResultVoiceNote) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVoiceNote#8ee8142f to nil")
|
|
}
|
|
if err := b.ConsumeID(InlineQueryResultVoiceNoteTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InlineQueryResultVoiceNote) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVoiceNote#8ee8142f to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.VoiceNote.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InlineQueryResultVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inlineQueryResultVoiceNote#8ee8142f as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inlineQueryResultVoiceNote")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("voice_note")
|
|
if err := i.VoiceNote.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InlineQueryResultVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inlineQueryResultVoiceNote#8ee8142f to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inlineQueryResultVoiceNote"); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "voice_note":
|
|
if err := i.VoiceNote.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InlineQueryResultVoiceNote) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetVoiceNote returns value of VoiceNote field.
|
|
func (i *InlineQueryResultVoiceNote) GetVoiceNote() (value VoiceNote) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VoiceNote
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InlineQueryResultVoiceNote) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// InlineQueryResultClassName is schema name of InlineQueryResultClass.
|
|
const InlineQueryResultClassName = "InlineQueryResult"
|
|
|
|
// InlineQueryResultClass represents InlineQueryResult generic type.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tdapi.DecodeInlineQueryResult(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tdapi.InlineQueryResultArticle: // inlineQueryResultArticle#1016d01a
|
|
// case *tdapi.InlineQueryResultContact: // inlineQueryResultContact#f5278212
|
|
// case *tdapi.InlineQueryResultLocation: // inlineQueryResultLocation#1bc6ab10
|
|
// case *tdapi.InlineQueryResultVenue: // inlineQueryResultVenue#4c5b105e
|
|
// case *tdapi.InlineQueryResultGame: // inlineQueryResultGame#65bd7c7b
|
|
// case *tdapi.InlineQueryResultAnimation: // inlineQueryResultAnimation#77cded0b
|
|
// case *tdapi.InlineQueryResultAudio: // inlineQueryResultAudio#3239d2f8
|
|
// case *tdapi.InlineQueryResultDocument: // inlineQueryResultDocument#a71d0c45
|
|
// case *tdapi.InlineQueryResultPhoto: // inlineQueryResultPhoto#6e2b1dd0
|
|
// case *tdapi.InlineQueryResultSticker: // inlineQueryResultSticker#91d6560b
|
|
// case *tdapi.InlineQueryResultVideo: // inlineQueryResultVideo#ae2742e5
|
|
// case *tdapi.InlineQueryResultVoiceNote: // inlineQueryResultVoiceNote#8ee8142f
|
|
// default: panic(v)
|
|
// }
|
|
type InlineQueryResultClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() InlineQueryResultClass
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
TypeID() uint32
|
|
// TypeName returns name of type in TL schema.
|
|
TypeName() string
|
|
// String implements fmt.Stringer.
|
|
String() string
|
|
// Zero returns true if current object has a zero value.
|
|
Zero() bool
|
|
|
|
EncodeTDLibJSON(b tdjson.Encoder) error
|
|
DecodeTDLibJSON(b tdjson.Decoder) error
|
|
|
|
// Unique identifier of the query result
|
|
GetID() (value string)
|
|
}
|
|
|
|
// DecodeInlineQueryResult implements binary de-serialization for InlineQueryResultClass.
|
|
func DecodeInlineQueryResult(buf *bin.Buffer) (InlineQueryResultClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case InlineQueryResultArticleTypeID:
|
|
// Decoding inlineQueryResultArticle#1016d01a.
|
|
v := InlineQueryResultArticle{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultContactTypeID:
|
|
// Decoding inlineQueryResultContact#f5278212.
|
|
v := InlineQueryResultContact{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultLocationTypeID:
|
|
// Decoding inlineQueryResultLocation#1bc6ab10.
|
|
v := InlineQueryResultLocation{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultVenueTypeID:
|
|
// Decoding inlineQueryResultVenue#4c5b105e.
|
|
v := InlineQueryResultVenue{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultGameTypeID:
|
|
// Decoding inlineQueryResultGame#65bd7c7b.
|
|
v := InlineQueryResultGame{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultAnimationTypeID:
|
|
// Decoding inlineQueryResultAnimation#77cded0b.
|
|
v := InlineQueryResultAnimation{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultAudioTypeID:
|
|
// Decoding inlineQueryResultAudio#3239d2f8.
|
|
v := InlineQueryResultAudio{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultDocumentTypeID:
|
|
// Decoding inlineQueryResultDocument#a71d0c45.
|
|
v := InlineQueryResultDocument{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultPhotoTypeID:
|
|
// Decoding inlineQueryResultPhoto#6e2b1dd0.
|
|
v := InlineQueryResultPhoto{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultStickerTypeID:
|
|
// Decoding inlineQueryResultSticker#91d6560b.
|
|
v := InlineQueryResultSticker{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultVideoTypeID:
|
|
// Decoding inlineQueryResultVideo#ae2742e5.
|
|
v := InlineQueryResultVideo{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InlineQueryResultVoiceNoteTypeID:
|
|
// Decoding inlineQueryResultVoiceNote#8ee8142f.
|
|
v := InlineQueryResultVoiceNote{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// DecodeTDLibJSONInlineQueryResult implements binary de-serialization for InlineQueryResultClass.
|
|
func DecodeTDLibJSONInlineQueryResult(buf tdjson.Decoder) (InlineQueryResultClass, error) {
|
|
id, err := buf.FindTypeID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case "inlineQueryResultArticle":
|
|
// Decoding inlineQueryResultArticle#1016d01a.
|
|
v := InlineQueryResultArticle{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultContact":
|
|
// Decoding inlineQueryResultContact#f5278212.
|
|
v := InlineQueryResultContact{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultLocation":
|
|
// Decoding inlineQueryResultLocation#1bc6ab10.
|
|
v := InlineQueryResultLocation{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultVenue":
|
|
// Decoding inlineQueryResultVenue#4c5b105e.
|
|
v := InlineQueryResultVenue{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultGame":
|
|
// Decoding inlineQueryResultGame#65bd7c7b.
|
|
v := InlineQueryResultGame{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultAnimation":
|
|
// Decoding inlineQueryResultAnimation#77cded0b.
|
|
v := InlineQueryResultAnimation{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultAudio":
|
|
// Decoding inlineQueryResultAudio#3239d2f8.
|
|
v := InlineQueryResultAudio{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultDocument":
|
|
// Decoding inlineQueryResultDocument#a71d0c45.
|
|
v := InlineQueryResultDocument{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultPhoto":
|
|
// Decoding inlineQueryResultPhoto#6e2b1dd0.
|
|
v := InlineQueryResultPhoto{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultSticker":
|
|
// Decoding inlineQueryResultSticker#91d6560b.
|
|
v := InlineQueryResultSticker{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultVideo":
|
|
// Decoding inlineQueryResultVideo#ae2742e5.
|
|
v := InlineQueryResultVideo{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inlineQueryResultVoiceNote":
|
|
// Decoding inlineQueryResultVoiceNote#8ee8142f.
|
|
v := InlineQueryResultVoiceNote{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", tdjson.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// InlineQueryResult boxes the InlineQueryResultClass providing a helper.
|
|
type InlineQueryResultBox struct {
|
|
InlineQueryResult InlineQueryResultClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for InlineQueryResultBox.
|
|
func (b *InlineQueryResultBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InlineQueryResultBox to nil")
|
|
}
|
|
v, err := DecodeInlineQueryResult(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InlineQueryResult = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for InlineQueryResultBox.
|
|
func (b *InlineQueryResultBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.InlineQueryResult == nil {
|
|
return fmt.Errorf("unable to encode InlineQueryResultClass as nil")
|
|
}
|
|
return b.InlineQueryResult.Encode(buf)
|
|
}
|
|
|
|
// DecodeTDLibJSON implements bin.Decoder for InlineQueryResultBox.
|
|
func (b *InlineQueryResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InlineQueryResultBox to nil")
|
|
}
|
|
v, err := DecodeTDLibJSONInlineQueryResult(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InlineQueryResult = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements bin.Encode for InlineQueryResultBox.
|
|
func (b *InlineQueryResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil || b.InlineQueryResult == nil {
|
|
return fmt.Errorf("unable to encode InlineQueryResultClass as nil")
|
|
}
|
|
return b.InlineQueryResult.EncodeTDLibJSON(buf)
|
|
}
|