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
5442 lines
153 KiB
Go
5442 lines
153 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{}
|
|
)
|
|
|
|
// InputInlineQueryResultAnimation represents TL type `inputInlineQueryResultAnimation#a7335216`.
|
|
type InputInlineQueryResultAnimation struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Title of the query result
|
|
Title string
|
|
// URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists
|
|
ThumbnailURL string
|
|
// MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg",
|
|
// "image/gif" and "video/mp4"
|
|
ThumbnailMimeType string
|
|
// The URL of the video file (file size must not exceed 1MB)
|
|
VideoURL string
|
|
// MIME type of the video file. Must be one of "image/gif" and "video/mp4"
|
|
VideoMimeType string
|
|
// Duration of the video, in seconds
|
|
VideoDuration int32
|
|
// Width of the video
|
|
VideoWidth int32
|
|
// Height of the video
|
|
VideoHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageAnimation, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultAnimationTypeID is TL type id of InputInlineQueryResultAnimation.
|
|
const InputInlineQueryResultAnimationTypeID = 0xa7335216
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultAnimation) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultAnimation.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultAnimation{}
|
|
_ bin.Decoder = &InputInlineQueryResultAnimation{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultAnimation{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultAnimation{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultAnimation{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultAnimation) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailMimeType == "") {
|
|
return false
|
|
}
|
|
if !(i.VideoURL == "") {
|
|
return false
|
|
}
|
|
if !(i.VideoMimeType == "") {
|
|
return false
|
|
}
|
|
if !(i.VideoDuration == 0) {
|
|
return false
|
|
}
|
|
if !(i.VideoWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.VideoHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultAnimation) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultAnimation(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultAnimation
|
|
return fmt.Sprintf("InputInlineQueryResultAnimation%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultAnimation) TypeID() uint32 {
|
|
return InputInlineQueryResultAnimationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultAnimation) TypeName() string {
|
|
return "inputInlineQueryResultAnimation"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultAnimation) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultAnimation",
|
|
ID: InputInlineQueryResultAnimationTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "ThumbnailMimeType",
|
|
SchemaName: "thumbnail_mime_type",
|
|
},
|
|
{
|
|
Name: "VideoURL",
|
|
SchemaName: "video_url",
|
|
},
|
|
{
|
|
Name: "VideoMimeType",
|
|
SchemaName: "video_mime_type",
|
|
},
|
|
{
|
|
Name: "VideoDuration",
|
|
SchemaName: "video_duration",
|
|
},
|
|
{
|
|
Name: "VideoWidth",
|
|
SchemaName: "video_width",
|
|
},
|
|
{
|
|
Name: "VideoHeight",
|
|
SchemaName: "video_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultAnimation) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultAnimation#a7335216 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultAnimationTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultAnimation) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultAnimation#a7335216 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutString(i.ThumbnailMimeType)
|
|
b.PutString(i.VideoURL)
|
|
b.PutString(i.VideoMimeType)
|
|
b.PutInt32(i.VideoDuration)
|
|
b.PutInt32(i.VideoWidth)
|
|
b.PutInt32(i.VideoHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultAnimation) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultAnimation#a7335216 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultAnimationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultAnimation) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultAnimation#a7335216 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_mime_type: %w", err)
|
|
}
|
|
i.ThumbnailMimeType = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_url: %w", err)
|
|
}
|
|
i.VideoURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_mime_type: %w", err)
|
|
}
|
|
i.VideoMimeType = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_duration: %w", err)
|
|
}
|
|
i.VideoDuration = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_width: %w", err)
|
|
}
|
|
i.VideoWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_height: %w", err)
|
|
}
|
|
i.VideoHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultAnimation) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultAnimation#a7335216 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultAnimation")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_mime_type")
|
|
b.PutString(i.ThumbnailMimeType)
|
|
b.Comma()
|
|
b.FieldStart("video_url")
|
|
b.PutString(i.VideoURL)
|
|
b.Comma()
|
|
b.FieldStart("video_mime_type")
|
|
b.PutString(i.VideoMimeType)
|
|
b.Comma()
|
|
b.FieldStart("video_duration")
|
|
b.PutInt32(i.VideoDuration)
|
|
b.Comma()
|
|
b.FieldStart("video_width")
|
|
b.PutInt32(i.VideoWidth)
|
|
b.Comma()
|
|
b.FieldStart("video_height")
|
|
b.PutInt32(i.VideoHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultAnimation) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultAnimation#a7335216 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultAnimation"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "thumbnail_mime_type":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_mime_type: %w", err)
|
|
}
|
|
i.ThumbnailMimeType = value
|
|
case "video_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_url: %w", err)
|
|
}
|
|
i.VideoURL = value
|
|
case "video_mime_type":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_mime_type: %w", err)
|
|
}
|
|
i.VideoMimeType = value
|
|
case "video_duration":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_duration: %w", err)
|
|
}
|
|
i.VideoDuration = value
|
|
case "video_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_width: %w", err)
|
|
}
|
|
i.VideoWidth = value
|
|
case "video_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_height: %w", err)
|
|
}
|
|
i.VideoHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultAnimation) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultAnimation) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultAnimation) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetThumbnailMimeType returns value of ThumbnailMimeType field.
|
|
func (i *InputInlineQueryResultAnimation) GetThumbnailMimeType() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailMimeType
|
|
}
|
|
|
|
// GetVideoURL returns value of VideoURL field.
|
|
func (i *InputInlineQueryResultAnimation) GetVideoURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoURL
|
|
}
|
|
|
|
// GetVideoMimeType returns value of VideoMimeType field.
|
|
func (i *InputInlineQueryResultAnimation) GetVideoMimeType() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoMimeType
|
|
}
|
|
|
|
// GetVideoDuration returns value of VideoDuration field.
|
|
func (i *InputInlineQueryResultAnimation) GetVideoDuration() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoDuration
|
|
}
|
|
|
|
// GetVideoWidth returns value of VideoWidth field.
|
|
func (i *InputInlineQueryResultAnimation) GetVideoWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoWidth
|
|
}
|
|
|
|
// GetVideoHeight returns value of VideoHeight field.
|
|
func (i *InputInlineQueryResultAnimation) GetVideoHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultAnimation) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultAnimation) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultArticle represents TL type `inputInlineQueryResultArticle#763583bc`.
|
|
type InputInlineQueryResultArticle 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
|
|
// URL of the result thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// Thumbnail width, if known
|
|
ThumbnailWidth int32
|
|
// Thumbnail height, if known
|
|
ThumbnailHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or
|
|
// inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultArticleTypeID is TL type id of InputInlineQueryResultArticle.
|
|
const InputInlineQueryResultArticleTypeID = 0x763583bc
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultArticle) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultArticle.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultArticle{}
|
|
_ bin.Decoder = &InputInlineQueryResultArticle{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultArticle{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultArticle{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultArticle{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultArticle) 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.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultArticle) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultArticle(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultArticle
|
|
return fmt.Sprintf("InputInlineQueryResultArticle%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultArticle) TypeID() uint32 {
|
|
return InputInlineQueryResultArticleTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultArticle) TypeName() string {
|
|
return "inputInlineQueryResultArticle"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultArticle) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultArticle",
|
|
ID: InputInlineQueryResultArticleTypeID,
|
|
}
|
|
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: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "ThumbnailWidth",
|
|
SchemaName: "thumbnail_width",
|
|
},
|
|
{
|
|
Name: "ThumbnailHeight",
|
|
SchemaName: "thumbnail_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultArticle) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultArticleTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultArticle) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.URL)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultArticle) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultArticleTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultArticle) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field url: %w", err)
|
|
}
|
|
i.URL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultArticle")
|
|
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_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_width")
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_height")
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultArticle) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultArticle"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field url: %w", err)
|
|
}
|
|
i.URL = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "thumbnail_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
case "thumbnail_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultArticle) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetURL returns value of URL field.
|
|
func (i *InputInlineQueryResultArticle) GetURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.URL
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultArticle) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InputInlineQueryResultArticle) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultArticle) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetThumbnailWidth returns value of ThumbnailWidth field.
|
|
func (i *InputInlineQueryResultArticle) GetThumbnailWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailWidth
|
|
}
|
|
|
|
// GetThumbnailHeight returns value of ThumbnailHeight field.
|
|
func (i *InputInlineQueryResultArticle) GetThumbnailHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultArticle) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultArticle) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultAudio represents TL type `inputInlineQueryResultAudio#4b1c35d4`.
|
|
type InputInlineQueryResultAudio struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Title of the audio file
|
|
Title string
|
|
// Performer of the audio file
|
|
Performer string
|
|
// The URL of the audio file
|
|
AudioURL string
|
|
// Audio file duration, in seconds
|
|
AudioDuration int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageAudio, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultAudioTypeID is TL type id of InputInlineQueryResultAudio.
|
|
const InputInlineQueryResultAudioTypeID = 0x4b1c35d4
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultAudio) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultAudio.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultAudio{}
|
|
_ bin.Decoder = &InputInlineQueryResultAudio{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultAudio{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultAudio{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultAudio{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultAudio) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Performer == "") {
|
|
return false
|
|
}
|
|
if !(i.AudioURL == "") {
|
|
return false
|
|
}
|
|
if !(i.AudioDuration == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultAudio) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultAudio(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultAudio
|
|
return fmt.Sprintf("InputInlineQueryResultAudio%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultAudio) TypeID() uint32 {
|
|
return InputInlineQueryResultAudioTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultAudio) TypeName() string {
|
|
return "inputInlineQueryResultAudio"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultAudio) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultAudio",
|
|
ID: InputInlineQueryResultAudioTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Performer",
|
|
SchemaName: "performer",
|
|
},
|
|
{
|
|
Name: "AudioURL",
|
|
SchemaName: "audio_url",
|
|
},
|
|
{
|
|
Name: "AudioDuration",
|
|
SchemaName: "audio_duration",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultAudio) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultAudio#4b1c35d4 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultAudioTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultAudio) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultAudio#4b1c35d4 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Performer)
|
|
b.PutString(i.AudioURL)
|
|
b.PutInt32(i.AudioDuration)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultAudio) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultAudio#4b1c35d4 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultAudioTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultAudio) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultAudio#4b1c35d4 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field performer: %w", err)
|
|
}
|
|
i.Performer = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_url: %w", err)
|
|
}
|
|
i.AudioURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_duration: %w", err)
|
|
}
|
|
i.AudioDuration = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultAudio) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultAudio#4b1c35d4 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultAudio")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("performer")
|
|
b.PutString(i.Performer)
|
|
b.Comma()
|
|
b.FieldStart("audio_url")
|
|
b.PutString(i.AudioURL)
|
|
b.Comma()
|
|
b.FieldStart("audio_duration")
|
|
b.PutInt32(i.AudioDuration)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultAudio) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultAudio#4b1c35d4 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultAudio"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "performer":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field performer: %w", err)
|
|
}
|
|
i.Performer = value
|
|
case "audio_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_url: %w", err)
|
|
}
|
|
i.AudioURL = value
|
|
case "audio_duration":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_duration: %w", err)
|
|
}
|
|
i.AudioDuration = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultAudio) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultAudio) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetPerformer returns value of Performer field.
|
|
func (i *InputInlineQueryResultAudio) GetPerformer() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Performer
|
|
}
|
|
|
|
// GetAudioURL returns value of AudioURL field.
|
|
func (i *InputInlineQueryResultAudio) GetAudioURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.AudioURL
|
|
}
|
|
|
|
// GetAudioDuration returns value of AudioDuration field.
|
|
func (i *InputInlineQueryResultAudio) GetAudioDuration() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.AudioDuration
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultAudio) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultAudio) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultContact represents TL type `inputInlineQueryResultContact#6e08b5d2`.
|
|
type InputInlineQueryResultContact struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// User contact
|
|
Contact Contact
|
|
// URL of the result thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// Thumbnail width, if known
|
|
ThumbnailWidth int32
|
|
// Thumbnail height, if known
|
|
ThumbnailHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or
|
|
// inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultContactTypeID is TL type id of InputInlineQueryResultContact.
|
|
const InputInlineQueryResultContactTypeID = 0x6e08b5d2
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultContact) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultContact.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultContact{}
|
|
_ bin.Decoder = &InputInlineQueryResultContact{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultContact{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultContact{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultContact{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultContact) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Contact.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultContact) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultContact(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultContact
|
|
return fmt.Sprintf("InputInlineQueryResultContact%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultContact) TypeID() uint32 {
|
|
return InputInlineQueryResultContactTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultContact) TypeName() string {
|
|
return "inputInlineQueryResultContact"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultContact) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultContact",
|
|
ID: InputInlineQueryResultContactTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Contact",
|
|
SchemaName: "contact",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "ThumbnailWidth",
|
|
SchemaName: "thumbnail_width",
|
|
},
|
|
{
|
|
Name: "ThumbnailHeight",
|
|
SchemaName: "thumbnail_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultContact) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultContact#6e08b5d2 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultContactTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultContact) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultContact#6e08b5d2 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Contact.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err)
|
|
}
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultContact) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultContact#6e08b5d2 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultContactTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultContact) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultContact#6e08b5d2 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Contact.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultContact) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultContact#6e08b5d2 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultContact")
|
|
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 inputInlineQueryResultContact#6e08b5d2: field contact: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_width")
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_height")
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultContact) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultContact#6e08b5d2 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultContact"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "contact":
|
|
if err := i.Contact.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err)
|
|
}
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "thumbnail_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
case "thumbnail_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultContact) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetContact returns value of Contact field.
|
|
func (i *InputInlineQueryResultContact) GetContact() (value Contact) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Contact
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultContact) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetThumbnailWidth returns value of ThumbnailWidth field.
|
|
func (i *InputInlineQueryResultContact) GetThumbnailWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailWidth
|
|
}
|
|
|
|
// GetThumbnailHeight returns value of ThumbnailHeight field.
|
|
func (i *InputInlineQueryResultContact) GetThumbnailHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultContact) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultContact) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultDocument represents TL type `inputInlineQueryResultDocument#227fd0cd`.
|
|
type InputInlineQueryResultDocument struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Title of the resulting file
|
|
Title string
|
|
// Represents a link to a file
|
|
Description string
|
|
// URL of the file
|
|
DocumentURL string
|
|
// MIME type of the file content; only "application/pdf" and "application/zip" are
|
|
// currently allowed
|
|
MimeType string
|
|
// The URL of the file thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// Width of the thumbnail
|
|
ThumbnailWidth int32
|
|
// Height of the thumbnail
|
|
ThumbnailHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageDocument, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultDocumentTypeID is TL type id of InputInlineQueryResultDocument.
|
|
const InputInlineQueryResultDocumentTypeID = 0x227fd0cd
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultDocument) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultDocument.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultDocument{}
|
|
_ bin.Decoder = &InputInlineQueryResultDocument{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultDocument{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultDocument{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultDocument{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultDocument) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
if !(i.DocumentURL == "") {
|
|
return false
|
|
}
|
|
if !(i.MimeType == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultDocument) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultDocument(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultDocument
|
|
return fmt.Sprintf("InputInlineQueryResultDocument%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultDocument) TypeID() uint32 {
|
|
return InputInlineQueryResultDocumentTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultDocument) TypeName() string {
|
|
return "inputInlineQueryResultDocument"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultDocument) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultDocument",
|
|
ID: InputInlineQueryResultDocumentTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
{
|
|
Name: "DocumentURL",
|
|
SchemaName: "document_url",
|
|
},
|
|
{
|
|
Name: "MimeType",
|
|
SchemaName: "mime_type",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "ThumbnailWidth",
|
|
SchemaName: "thumbnail_width",
|
|
},
|
|
{
|
|
Name: "ThumbnailHeight",
|
|
SchemaName: "thumbnail_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultDocument) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultDocument#227fd0cd as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultDocumentTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultDocument) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultDocument#227fd0cd as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
b.PutString(i.DocumentURL)
|
|
b.PutString(i.MimeType)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultDocument) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultDocument#227fd0cd to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultDocumentTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultDocument) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultDocument#227fd0cd to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field document_url: %w", err)
|
|
}
|
|
i.DocumentURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field mime_type: %w", err)
|
|
}
|
|
i.MimeType = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultDocument) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultDocument#227fd0cd as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultDocument")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.FieldStart("document_url")
|
|
b.PutString(i.DocumentURL)
|
|
b.Comma()
|
|
b.FieldStart("mime_type")
|
|
b.PutString(i.MimeType)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_width")
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_height")
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultDocument) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultDocument#227fd0cd to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultDocument"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
case "document_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field document_url: %w", err)
|
|
}
|
|
i.DocumentURL = value
|
|
case "mime_type":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field mime_type: %w", err)
|
|
}
|
|
i.MimeType = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "thumbnail_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
case "thumbnail_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultDocument) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultDocument) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InputInlineQueryResultDocument) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// GetDocumentURL returns value of DocumentURL field.
|
|
func (i *InputInlineQueryResultDocument) GetDocumentURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.DocumentURL
|
|
}
|
|
|
|
// GetMimeType returns value of MimeType field.
|
|
func (i *InputInlineQueryResultDocument) GetMimeType() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.MimeType
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultDocument) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetThumbnailWidth returns value of ThumbnailWidth field.
|
|
func (i *InputInlineQueryResultDocument) GetThumbnailWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailWidth
|
|
}
|
|
|
|
// GetThumbnailHeight returns value of ThumbnailHeight field.
|
|
func (i *InputInlineQueryResultDocument) GetThumbnailHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultDocument) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultDocument) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultGame represents TL type `inputInlineQueryResultGame#39951fd7`.
|
|
type InputInlineQueryResultGame struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Short name of the game
|
|
GameShortName string
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
}
|
|
|
|
// InputInlineQueryResultGameTypeID is TL type id of InputInlineQueryResultGame.
|
|
const InputInlineQueryResultGameTypeID = 0x39951fd7
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultGame) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultGame.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultGame{}
|
|
_ bin.Decoder = &InputInlineQueryResultGame{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultGame{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultGame{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultGame{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultGame) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.GameShortName == "") {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultGame) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultGame(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultGame
|
|
return fmt.Sprintf("InputInlineQueryResultGame%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultGame) TypeID() uint32 {
|
|
return InputInlineQueryResultGameTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultGame) TypeName() string {
|
|
return "inputInlineQueryResultGame"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultGame) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultGame",
|
|
ID: InputInlineQueryResultGameTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "GameShortName",
|
|
SchemaName: "game_short_name",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultGame) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultGame#39951fd7 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultGameTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultGame) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultGame#39951fd7 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.GameShortName)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultGame) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultGame#39951fd7 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultGameTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultGame) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultGame#39951fd7 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field game_short_name: %w", err)
|
|
}
|
|
i.GameShortName = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultGame) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultGame#39951fd7 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultGame")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("game_short_name")
|
|
b.PutString(i.GameShortName)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultGame) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultGame#39951fd7 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultGame"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "game_short_name":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field game_short_name: %w", err)
|
|
}
|
|
i.GameShortName = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultGame) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetGameShortName returns value of GameShortName field.
|
|
func (i *InputInlineQueryResultGame) GetGameShortName() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.GameShortName
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultGame) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// InputInlineQueryResultLocation represents TL type `inputInlineQueryResultLocation#8f7cbe56`.
|
|
type InputInlineQueryResultLocation struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Location result
|
|
Location Location
|
|
// Amount of time relative to the message sent time until the location can be updated, in
|
|
// seconds
|
|
LivePeriod int32
|
|
// Title of the result
|
|
Title string
|
|
// URL of the result thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// Thumbnail width, if known
|
|
ThumbnailWidth int32
|
|
// Thumbnail height, if known
|
|
ThumbnailHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or
|
|
// inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultLocationTypeID is TL type id of InputInlineQueryResultLocation.
|
|
const InputInlineQueryResultLocationTypeID = 0x8f7cbe56
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultLocation) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultLocation.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultLocation{}
|
|
_ bin.Decoder = &InputInlineQueryResultLocation{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultLocation{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultLocation{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultLocation{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultLocation) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Location.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.LivePeriod == 0) {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultLocation) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultLocation(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultLocation
|
|
return fmt.Sprintf("InputInlineQueryResultLocation%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultLocation) TypeID() uint32 {
|
|
return InputInlineQueryResultLocationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultLocation) TypeName() string {
|
|
return "inputInlineQueryResultLocation"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultLocation) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultLocation",
|
|
ID: InputInlineQueryResultLocationTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Location",
|
|
SchemaName: "location",
|
|
},
|
|
{
|
|
Name: "LivePeriod",
|
|
SchemaName: "live_period",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "ThumbnailWidth",
|
|
SchemaName: "thumbnail_width",
|
|
},
|
|
{
|
|
Name: "ThumbnailHeight",
|
|
SchemaName: "thumbnail_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultLocation) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultLocation#8f7cbe56 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultLocationTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultLocation) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultLocation#8f7cbe56 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Location.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err)
|
|
}
|
|
b.PutInt32(i.LivePeriod)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultLocation) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultLocation#8f7cbe56 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultLocationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultLocation) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultLocation#8f7cbe56 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Location.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field live_period: %w", err)
|
|
}
|
|
i.LivePeriod = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultLocation) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultLocation#8f7cbe56 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultLocation")
|
|
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 inputInlineQueryResultLocation#8f7cbe56: field location: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("live_period")
|
|
b.PutInt32(i.LivePeriod)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_width")
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_height")
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultLocation) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultLocation#8f7cbe56 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultLocation"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "location":
|
|
if err := i.Location.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err)
|
|
}
|
|
case "live_period":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field live_period: %w", err)
|
|
}
|
|
i.LivePeriod = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "thumbnail_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
case "thumbnail_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultLocation) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetLocation returns value of Location field.
|
|
func (i *InputInlineQueryResultLocation) GetLocation() (value Location) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Location
|
|
}
|
|
|
|
// GetLivePeriod returns value of LivePeriod field.
|
|
func (i *InputInlineQueryResultLocation) GetLivePeriod() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.LivePeriod
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultLocation) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultLocation) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetThumbnailWidth returns value of ThumbnailWidth field.
|
|
func (i *InputInlineQueryResultLocation) GetThumbnailWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailWidth
|
|
}
|
|
|
|
// GetThumbnailHeight returns value of ThumbnailHeight field.
|
|
func (i *InputInlineQueryResultLocation) GetThumbnailHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultLocation) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultLocation) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultPhoto represents TL type `inputInlineQueryResultPhoto#bd0b361f`.
|
|
type InputInlineQueryResultPhoto struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Title of the result, if known
|
|
Title string
|
|
// Represents link to a JPEG image
|
|
Description string
|
|
// URL of the photo thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// The URL of the JPEG photo (photo size must not exceed 5MB)
|
|
PhotoURL string
|
|
// Width of the photo
|
|
PhotoWidth int32
|
|
// Height of the photo
|
|
PhotoHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessagePhoto, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultPhotoTypeID is TL type id of InputInlineQueryResultPhoto.
|
|
const InputInlineQueryResultPhotoTypeID = 0xbd0b361f
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultPhoto) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultPhoto.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultPhoto{}
|
|
_ bin.Decoder = &InputInlineQueryResultPhoto{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultPhoto{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultPhoto{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultPhoto{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultPhoto) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.PhotoURL == "") {
|
|
return false
|
|
}
|
|
if !(i.PhotoWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.PhotoHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultPhoto) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultPhoto(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultPhoto
|
|
return fmt.Sprintf("InputInlineQueryResultPhoto%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultPhoto) TypeID() uint32 {
|
|
return InputInlineQueryResultPhotoTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultPhoto) TypeName() string {
|
|
return "inputInlineQueryResultPhoto"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultPhoto) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultPhoto",
|
|
ID: InputInlineQueryResultPhotoTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "PhotoURL",
|
|
SchemaName: "photo_url",
|
|
},
|
|
{
|
|
Name: "PhotoWidth",
|
|
SchemaName: "photo_width",
|
|
},
|
|
{
|
|
Name: "PhotoHeight",
|
|
SchemaName: "photo_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultPhoto) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultPhoto#bd0b361f as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultPhotoTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultPhoto) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultPhoto#bd0b361f as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutString(i.PhotoURL)
|
|
b.PutInt32(i.PhotoWidth)
|
|
b.PutInt32(i.PhotoHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultPhoto) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultPhoto#bd0b361f to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultPhotoTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultPhoto) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultPhoto#bd0b361f to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_url: %w", err)
|
|
}
|
|
i.PhotoURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_width: %w", err)
|
|
}
|
|
i.PhotoWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_height: %w", err)
|
|
}
|
|
i.PhotoHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultPhoto) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultPhoto#bd0b361f as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultPhoto")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("photo_url")
|
|
b.PutString(i.PhotoURL)
|
|
b.Comma()
|
|
b.FieldStart("photo_width")
|
|
b.PutInt32(i.PhotoWidth)
|
|
b.Comma()
|
|
b.FieldStart("photo_height")
|
|
b.PutInt32(i.PhotoHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultPhoto) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultPhoto#bd0b361f to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultPhoto"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "photo_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_url: %w", err)
|
|
}
|
|
i.PhotoURL = value
|
|
case "photo_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_width: %w", err)
|
|
}
|
|
i.PhotoWidth = value
|
|
case "photo_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_height: %w", err)
|
|
}
|
|
i.PhotoHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultPhoto) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultPhoto) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InputInlineQueryResultPhoto) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultPhoto) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetPhotoURL returns value of PhotoURL field.
|
|
func (i *InputInlineQueryResultPhoto) GetPhotoURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.PhotoURL
|
|
}
|
|
|
|
// GetPhotoWidth returns value of PhotoWidth field.
|
|
func (i *InputInlineQueryResultPhoto) GetPhotoWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.PhotoWidth
|
|
}
|
|
|
|
// GetPhotoHeight returns value of PhotoHeight field.
|
|
func (i *InputInlineQueryResultPhoto) GetPhotoHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.PhotoHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultPhoto) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultPhoto) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultSticker represents TL type `inputInlineQueryResultSticker#10550459`.
|
|
type InputInlineQueryResultSticker struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// URL of the sticker thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// The URL of the WEBP, TGS, or WEBM sticker (sticker file size must not exceed 5MB)
|
|
StickerURL string
|
|
// Width of the sticker
|
|
StickerWidth int32
|
|
// Height of the sticker
|
|
StickerHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageSticker, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultStickerTypeID is TL type id of InputInlineQueryResultSticker.
|
|
const InputInlineQueryResultStickerTypeID = 0x10550459
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultSticker) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultSticker.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultSticker{}
|
|
_ bin.Decoder = &InputInlineQueryResultSticker{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultSticker{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultSticker{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultSticker{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultSticker) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.StickerURL == "") {
|
|
return false
|
|
}
|
|
if !(i.StickerWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.StickerHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultSticker) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultSticker(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultSticker
|
|
return fmt.Sprintf("InputInlineQueryResultSticker%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultSticker) TypeID() uint32 {
|
|
return InputInlineQueryResultStickerTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultSticker) TypeName() string {
|
|
return "inputInlineQueryResultSticker"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultSticker) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultSticker",
|
|
ID: InputInlineQueryResultStickerTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "StickerURL",
|
|
SchemaName: "sticker_url",
|
|
},
|
|
{
|
|
Name: "StickerWidth",
|
|
SchemaName: "sticker_width",
|
|
},
|
|
{
|
|
Name: "StickerHeight",
|
|
SchemaName: "sticker_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultSticker) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultSticker#10550459 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultStickerTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultSticker) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultSticker#10550459 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutString(i.StickerURL)
|
|
b.PutInt32(i.StickerWidth)
|
|
b.PutInt32(i.StickerHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultSticker) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultSticker#10550459 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultStickerTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultSticker) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultSticker#10550459 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_url: %w", err)
|
|
}
|
|
i.StickerURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_width: %w", err)
|
|
}
|
|
i.StickerWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_height: %w", err)
|
|
}
|
|
i.StickerHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultSticker) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultSticker#10550459 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultSticker")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("sticker_url")
|
|
b.PutString(i.StickerURL)
|
|
b.Comma()
|
|
b.FieldStart("sticker_width")
|
|
b.PutInt32(i.StickerWidth)
|
|
b.Comma()
|
|
b.FieldStart("sticker_height")
|
|
b.PutInt32(i.StickerHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultSticker) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultSticker#10550459 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultSticker"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "sticker_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_url: %w", err)
|
|
}
|
|
i.StickerURL = value
|
|
case "sticker_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_width: %w", err)
|
|
}
|
|
i.StickerWidth = value
|
|
case "sticker_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_height: %w", err)
|
|
}
|
|
i.StickerHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultSticker) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultSticker) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetStickerURL returns value of StickerURL field.
|
|
func (i *InputInlineQueryResultSticker) GetStickerURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.StickerURL
|
|
}
|
|
|
|
// GetStickerWidth returns value of StickerWidth field.
|
|
func (i *InputInlineQueryResultSticker) GetStickerWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.StickerWidth
|
|
}
|
|
|
|
// GetStickerHeight returns value of StickerHeight field.
|
|
func (i *InputInlineQueryResultSticker) GetStickerHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.StickerHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultSticker) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultSticker) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultVenue represents TL type `inputInlineQueryResultVenue#2049c13d`.
|
|
type InputInlineQueryResultVenue struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Venue result
|
|
Venue Venue
|
|
// URL of the result thumbnail, if it exists
|
|
ThumbnailURL string
|
|
// Thumbnail width, if known
|
|
ThumbnailWidth int32
|
|
// Thumbnail height, if known
|
|
ThumbnailHeight int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or
|
|
// inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultVenueTypeID is TL type id of InputInlineQueryResultVenue.
|
|
const InputInlineQueryResultVenueTypeID = 0x2049c13d
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultVenue) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultVenue.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultVenue{}
|
|
_ bin.Decoder = &InputInlineQueryResultVenue{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultVenue{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultVenue{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultVenue{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultVenue) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Venue.Zero()) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultVenue) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultVenue(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultVenue
|
|
return fmt.Sprintf("InputInlineQueryResultVenue%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultVenue) TypeID() uint32 {
|
|
return InputInlineQueryResultVenueTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultVenue) TypeName() string {
|
|
return "inputInlineQueryResultVenue"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultVenue) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultVenue",
|
|
ID: InputInlineQueryResultVenueTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Venue",
|
|
SchemaName: "venue",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "ThumbnailWidth",
|
|
SchemaName: "thumbnail_width",
|
|
},
|
|
{
|
|
Name: "ThumbnailHeight",
|
|
SchemaName: "thumbnail_height",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultVenue) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVenue#2049c13d as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultVenueTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultVenue) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVenue#2049c13d as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
if err := i.Venue.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field venue: %w", err)
|
|
}
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultVenue) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVenue#2049c13d to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultVenueTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultVenue) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVenue#2049c13d to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
if err := i.Venue.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field venue: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultVenue) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVenue#2049c13d as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultVenue")
|
|
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 inputInlineQueryResultVenue#2049c13d: field venue: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_width")
|
|
b.PutInt32(i.ThumbnailWidth)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_height")
|
|
b.PutInt32(i.ThumbnailHeight)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultVenue) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVenue#2049c13d to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultVenue"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "venue":
|
|
if err := i.Venue.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field venue: %w", err)
|
|
}
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "thumbnail_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_width: %w", err)
|
|
}
|
|
i.ThumbnailWidth = value
|
|
case "thumbnail_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_height: %w", err)
|
|
}
|
|
i.ThumbnailHeight = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultVenue) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetVenue returns value of Venue field.
|
|
func (i *InputInlineQueryResultVenue) GetVenue() (value Venue) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Venue
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultVenue) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetThumbnailWidth returns value of ThumbnailWidth field.
|
|
func (i *InputInlineQueryResultVenue) GetThumbnailWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailWidth
|
|
}
|
|
|
|
// GetThumbnailHeight returns value of ThumbnailHeight field.
|
|
func (i *InputInlineQueryResultVenue) GetThumbnailHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailHeight
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultVenue) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultVenue) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultVideo represents TL type `inputInlineQueryResultVideo#66c344e7`.
|
|
type InputInlineQueryResultVideo struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Title of the result
|
|
Title string
|
|
// Represents a link to a page containing an embedded video player or a video file
|
|
Description string
|
|
// The URL of the video thumbnail (JPEG), if it exists
|
|
ThumbnailURL string
|
|
// URL of the embedded video player or video file
|
|
VideoURL string
|
|
// MIME type of the content of the video URL, only "text/html" or "video/mp4" are
|
|
// currently supported
|
|
MimeType string
|
|
// Width of the video
|
|
VideoWidth int32
|
|
// Height of the video
|
|
VideoHeight int32
|
|
// Video duration, in seconds
|
|
VideoDuration int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageVideo, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultVideoTypeID is TL type id of InputInlineQueryResultVideo.
|
|
const InputInlineQueryResultVideoTypeID = 0x66c344e7
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultVideo) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultVideo.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultVideo{}
|
|
_ bin.Decoder = &InputInlineQueryResultVideo{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultVideo{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultVideo{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultVideo{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultVideo) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.Description == "") {
|
|
return false
|
|
}
|
|
if !(i.ThumbnailURL == "") {
|
|
return false
|
|
}
|
|
if !(i.VideoURL == "") {
|
|
return false
|
|
}
|
|
if !(i.MimeType == "") {
|
|
return false
|
|
}
|
|
if !(i.VideoWidth == 0) {
|
|
return false
|
|
}
|
|
if !(i.VideoHeight == 0) {
|
|
return false
|
|
}
|
|
if !(i.VideoDuration == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultVideo) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultVideo(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultVideo
|
|
return fmt.Sprintf("InputInlineQueryResultVideo%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultVideo) TypeID() uint32 {
|
|
return InputInlineQueryResultVideoTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultVideo) TypeName() string {
|
|
return "inputInlineQueryResultVideo"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultVideo) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultVideo",
|
|
ID: InputInlineQueryResultVideoTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Description",
|
|
SchemaName: "description",
|
|
},
|
|
{
|
|
Name: "ThumbnailURL",
|
|
SchemaName: "thumbnail_url",
|
|
},
|
|
{
|
|
Name: "VideoURL",
|
|
SchemaName: "video_url",
|
|
},
|
|
{
|
|
Name: "MimeType",
|
|
SchemaName: "mime_type",
|
|
},
|
|
{
|
|
Name: "VideoWidth",
|
|
SchemaName: "video_width",
|
|
},
|
|
{
|
|
Name: "VideoHeight",
|
|
SchemaName: "video_height",
|
|
},
|
|
{
|
|
Name: "VideoDuration",
|
|
SchemaName: "video_duration",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultVideo) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVideo#66c344e7 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultVideoTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultVideo) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVideo#66c344e7 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.Description)
|
|
b.PutString(i.ThumbnailURL)
|
|
b.PutString(i.VideoURL)
|
|
b.PutString(i.MimeType)
|
|
b.PutInt32(i.VideoWidth)
|
|
b.PutInt32(i.VideoHeight)
|
|
b.PutInt32(i.VideoDuration)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultVideo) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVideo#66c344e7 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultVideoTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultVideo) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVideo#66c344e7 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_url: %w", err)
|
|
}
|
|
i.VideoURL = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field mime_type: %w", err)
|
|
}
|
|
i.MimeType = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_width: %w", err)
|
|
}
|
|
i.VideoWidth = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_height: %w", err)
|
|
}
|
|
i.VideoHeight = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_duration: %w", err)
|
|
}
|
|
i.VideoDuration = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultVideo) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVideo#66c344e7 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultVideo")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("description")
|
|
b.PutString(i.Description)
|
|
b.Comma()
|
|
b.FieldStart("thumbnail_url")
|
|
b.PutString(i.ThumbnailURL)
|
|
b.Comma()
|
|
b.FieldStart("video_url")
|
|
b.PutString(i.VideoURL)
|
|
b.Comma()
|
|
b.FieldStart("mime_type")
|
|
b.PutString(i.MimeType)
|
|
b.Comma()
|
|
b.FieldStart("video_width")
|
|
b.PutInt32(i.VideoWidth)
|
|
b.Comma()
|
|
b.FieldStart("video_height")
|
|
b.PutInt32(i.VideoHeight)
|
|
b.Comma()
|
|
b.FieldStart("video_duration")
|
|
b.PutInt32(i.VideoDuration)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultVideo) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVideo#66c344e7 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultVideo"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "description":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field description: %w", err)
|
|
}
|
|
i.Description = value
|
|
case "thumbnail_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field thumbnail_url: %w", err)
|
|
}
|
|
i.ThumbnailURL = value
|
|
case "video_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_url: %w", err)
|
|
}
|
|
i.VideoURL = value
|
|
case "mime_type":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field mime_type: %w", err)
|
|
}
|
|
i.MimeType = value
|
|
case "video_width":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_width: %w", err)
|
|
}
|
|
i.VideoWidth = value
|
|
case "video_height":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_height: %w", err)
|
|
}
|
|
i.VideoHeight = value
|
|
case "video_duration":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_duration: %w", err)
|
|
}
|
|
i.VideoDuration = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultVideo) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultVideo) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetDescription returns value of Description field.
|
|
func (i *InputInlineQueryResultVideo) GetDescription() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Description
|
|
}
|
|
|
|
// GetThumbnailURL returns value of ThumbnailURL field.
|
|
func (i *InputInlineQueryResultVideo) GetThumbnailURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ThumbnailURL
|
|
}
|
|
|
|
// GetVideoURL returns value of VideoURL field.
|
|
func (i *InputInlineQueryResultVideo) GetVideoURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoURL
|
|
}
|
|
|
|
// GetMimeType returns value of MimeType field.
|
|
func (i *InputInlineQueryResultVideo) GetMimeType() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.MimeType
|
|
}
|
|
|
|
// GetVideoWidth returns value of VideoWidth field.
|
|
func (i *InputInlineQueryResultVideo) GetVideoWidth() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoWidth
|
|
}
|
|
|
|
// GetVideoHeight returns value of VideoHeight field.
|
|
func (i *InputInlineQueryResultVideo) GetVideoHeight() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoHeight
|
|
}
|
|
|
|
// GetVideoDuration returns value of VideoDuration field.
|
|
func (i *InputInlineQueryResultVideo) GetVideoDuration() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VideoDuration
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultVideo) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultVideo) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultVoiceNote represents TL type `inputInlineQueryResultVoiceNote#954da949`.
|
|
type InputInlineQueryResultVoiceNote struct {
|
|
// Unique identifier of the query result
|
|
ID string
|
|
// Title of the voice note
|
|
Title string
|
|
// The URL of the voice note file
|
|
VoiceNoteURL string
|
|
// Duration of the voice note, in seconds
|
|
VoiceNoteDuration int32
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
ReplyMarkup ReplyMarkupClass
|
|
// The content of the message to be sent. Must be one of the following types:
|
|
// inputMessageText, inputMessageVoiceNote, inputMessageInvoice, inputMessageLocation,
|
|
// inputMessageVenue or inputMessageContact
|
|
InputMessageContent InputMessageContentClass
|
|
}
|
|
|
|
// InputInlineQueryResultVoiceNoteTypeID is TL type id of InputInlineQueryResultVoiceNote.
|
|
const InputInlineQueryResultVoiceNoteTypeID = 0x954da949
|
|
|
|
// construct implements constructor of InputInlineQueryResultClass.
|
|
func (i InputInlineQueryResultVoiceNote) construct() InputInlineQueryResultClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputInlineQueryResultVoiceNote.
|
|
var (
|
|
_ bin.Encoder = &InputInlineQueryResultVoiceNote{}
|
|
_ bin.Decoder = &InputInlineQueryResultVoiceNote{}
|
|
_ bin.BareEncoder = &InputInlineQueryResultVoiceNote{}
|
|
_ bin.BareDecoder = &InputInlineQueryResultVoiceNote{}
|
|
|
|
_ InputInlineQueryResultClass = &InputInlineQueryResultVoiceNote{}
|
|
)
|
|
|
|
func (i *InputInlineQueryResultVoiceNote) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.ID == "") {
|
|
return false
|
|
}
|
|
if !(i.Title == "") {
|
|
return false
|
|
}
|
|
if !(i.VoiceNoteURL == "") {
|
|
return false
|
|
}
|
|
if !(i.VoiceNoteDuration == 0) {
|
|
return false
|
|
}
|
|
if !(i.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
if !(i.InputMessageContent == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputInlineQueryResultVoiceNote) String() string {
|
|
if i == nil {
|
|
return "InputInlineQueryResultVoiceNote(nil)"
|
|
}
|
|
type Alias InputInlineQueryResultVoiceNote
|
|
return fmt.Sprintf("InputInlineQueryResultVoiceNote%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputInlineQueryResultVoiceNote) TypeID() uint32 {
|
|
return InputInlineQueryResultVoiceNoteTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputInlineQueryResultVoiceNote) TypeName() string {
|
|
return "inputInlineQueryResultVoiceNote"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputInlineQueryResultVoiceNote) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputInlineQueryResultVoiceNote",
|
|
ID: InputInlineQueryResultVoiceNoteTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "VoiceNoteURL",
|
|
SchemaName: "voice_note_url",
|
|
},
|
|
{
|
|
Name: "VoiceNoteDuration",
|
|
SchemaName: "voice_note_duration",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
{
|
|
Name: "InputMessageContent",
|
|
SchemaName: "input_message_content",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputInlineQueryResultVoiceNote) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVoiceNote#954da949 as nil")
|
|
}
|
|
b.PutID(InputInlineQueryResultVoiceNoteTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputInlineQueryResultVoiceNote) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVoiceNote#954da949 as nil")
|
|
}
|
|
b.PutString(i.ID)
|
|
b.PutString(i.Title)
|
|
b.PutString(i.VoiceNoteURL)
|
|
b.PutInt32(i.VoiceNoteDuration)
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err)
|
|
}
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputInlineQueryResultVoiceNote) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVoiceNote#954da949 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputInlineQueryResultVoiceNoteTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputInlineQueryResultVoiceNote) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVoiceNote#954da949 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_url: %w", err)
|
|
}
|
|
i.VoiceNoteURL = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_duration: %w", err)
|
|
}
|
|
i.VoiceNoteDuration = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
}
|
|
{
|
|
value, err := DecodeInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputInlineQueryResultVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputInlineQueryResultVoiceNote#954da949 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputInlineQueryResultVoiceNote")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutString(i.ID)
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(i.Title)
|
|
b.Comma()
|
|
b.FieldStart("voice_note_url")
|
|
b.PutString(i.VoiceNoteURL)
|
|
b.Comma()
|
|
b.FieldStart("voice_note_duration")
|
|
b.PutInt32(i.VoiceNoteDuration)
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if i.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup is nil")
|
|
}
|
|
if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("input_message_content")
|
|
if i.InputMessageContent == nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content is nil")
|
|
}
|
|
if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputInlineQueryResultVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputInlineQueryResultVoiceNote#954da949 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputInlineQueryResultVoiceNote"); err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field id: %w", err)
|
|
}
|
|
i.ID = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field title: %w", err)
|
|
}
|
|
i.Title = value
|
|
case "voice_note_url":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_url: %w", err)
|
|
}
|
|
i.VoiceNoteURL = value
|
|
case "voice_note_duration":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_duration: %w", err)
|
|
}
|
|
i.VoiceNoteDuration = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err)
|
|
}
|
|
i.ReplyMarkup = value
|
|
case "input_message_content":
|
|
value, err := DecodeTDLibJSONInputMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err)
|
|
}
|
|
i.InputMessageContent = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (i *InputInlineQueryResultVoiceNote) GetID() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ID
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (i *InputInlineQueryResultVoiceNote) GetTitle() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Title
|
|
}
|
|
|
|
// GetVoiceNoteURL returns value of VoiceNoteURL field.
|
|
func (i *InputInlineQueryResultVoiceNote) GetVoiceNoteURL() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VoiceNoteURL
|
|
}
|
|
|
|
// GetVoiceNoteDuration returns value of VoiceNoteDuration field.
|
|
func (i *InputInlineQueryResultVoiceNote) GetVoiceNoteDuration() (value int32) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.VoiceNoteDuration
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (i *InputInlineQueryResultVoiceNote) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.ReplyMarkup
|
|
}
|
|
|
|
// GetInputMessageContent returns value of InputMessageContent field.
|
|
func (i *InputInlineQueryResultVoiceNote) GetInputMessageContent() (value InputMessageContentClass) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InputMessageContent
|
|
}
|
|
|
|
// InputInlineQueryResultClassName is schema name of InputInlineQueryResultClass.
|
|
const InputInlineQueryResultClassName = "InputInlineQueryResult"
|
|
|
|
// InputInlineQueryResultClass represents InputInlineQueryResult generic type.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tdapi.DecodeInputInlineQueryResult(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tdapi.InputInlineQueryResultAnimation: // inputInlineQueryResultAnimation#a7335216
|
|
// case *tdapi.InputInlineQueryResultArticle: // inputInlineQueryResultArticle#763583bc
|
|
// case *tdapi.InputInlineQueryResultAudio: // inputInlineQueryResultAudio#4b1c35d4
|
|
// case *tdapi.InputInlineQueryResultContact: // inputInlineQueryResultContact#6e08b5d2
|
|
// case *tdapi.InputInlineQueryResultDocument: // inputInlineQueryResultDocument#227fd0cd
|
|
// case *tdapi.InputInlineQueryResultGame: // inputInlineQueryResultGame#39951fd7
|
|
// case *tdapi.InputInlineQueryResultLocation: // inputInlineQueryResultLocation#8f7cbe56
|
|
// case *tdapi.InputInlineQueryResultPhoto: // inputInlineQueryResultPhoto#bd0b361f
|
|
// case *tdapi.InputInlineQueryResultSticker: // inputInlineQueryResultSticker#10550459
|
|
// case *tdapi.InputInlineQueryResultVenue: // inputInlineQueryResultVenue#2049c13d
|
|
// case *tdapi.InputInlineQueryResultVideo: // inputInlineQueryResultVideo#66c344e7
|
|
// case *tdapi.InputInlineQueryResultVoiceNote: // inputInlineQueryResultVoiceNote#954da949
|
|
// default: panic(v)
|
|
// }
|
|
type InputInlineQueryResultClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() InputInlineQueryResultClass
|
|
|
|
// 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)
|
|
// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard
|
|
// or null
|
|
GetReplyMarkup() (value ReplyMarkupClass)
|
|
}
|
|
|
|
// DecodeInputInlineQueryResult implements binary de-serialization for InputInlineQueryResultClass.
|
|
func DecodeInputInlineQueryResult(buf *bin.Buffer) (InputInlineQueryResultClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case InputInlineQueryResultAnimationTypeID:
|
|
// Decoding inputInlineQueryResultAnimation#a7335216.
|
|
v := InputInlineQueryResultAnimation{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultArticleTypeID:
|
|
// Decoding inputInlineQueryResultArticle#763583bc.
|
|
v := InputInlineQueryResultArticle{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultAudioTypeID:
|
|
// Decoding inputInlineQueryResultAudio#4b1c35d4.
|
|
v := InputInlineQueryResultAudio{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultContactTypeID:
|
|
// Decoding inputInlineQueryResultContact#6e08b5d2.
|
|
v := InputInlineQueryResultContact{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultDocumentTypeID:
|
|
// Decoding inputInlineQueryResultDocument#227fd0cd.
|
|
v := InputInlineQueryResultDocument{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultGameTypeID:
|
|
// Decoding inputInlineQueryResultGame#39951fd7.
|
|
v := InputInlineQueryResultGame{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultLocationTypeID:
|
|
// Decoding inputInlineQueryResultLocation#8f7cbe56.
|
|
v := InputInlineQueryResultLocation{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultPhotoTypeID:
|
|
// Decoding inputInlineQueryResultPhoto#bd0b361f.
|
|
v := InputInlineQueryResultPhoto{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultStickerTypeID:
|
|
// Decoding inputInlineQueryResultSticker#10550459.
|
|
v := InputInlineQueryResultSticker{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultVenueTypeID:
|
|
// Decoding inputInlineQueryResultVenue#2049c13d.
|
|
v := InputInlineQueryResultVenue{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultVideoTypeID:
|
|
// Decoding inputInlineQueryResultVideo#66c344e7.
|
|
v := InputInlineQueryResultVideo{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputInlineQueryResultVoiceNoteTypeID:
|
|
// Decoding inputInlineQueryResultVoiceNote#954da949.
|
|
v := InputInlineQueryResultVoiceNote{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// DecodeTDLibJSONInputInlineQueryResult implements binary de-serialization for InputInlineQueryResultClass.
|
|
func DecodeTDLibJSONInputInlineQueryResult(buf tdjson.Decoder) (InputInlineQueryResultClass, error) {
|
|
id, err := buf.FindTypeID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case "inputInlineQueryResultAnimation":
|
|
// Decoding inputInlineQueryResultAnimation#a7335216.
|
|
v := InputInlineQueryResultAnimation{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultArticle":
|
|
// Decoding inputInlineQueryResultArticle#763583bc.
|
|
v := InputInlineQueryResultArticle{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultAudio":
|
|
// Decoding inputInlineQueryResultAudio#4b1c35d4.
|
|
v := InputInlineQueryResultAudio{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultContact":
|
|
// Decoding inputInlineQueryResultContact#6e08b5d2.
|
|
v := InputInlineQueryResultContact{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultDocument":
|
|
// Decoding inputInlineQueryResultDocument#227fd0cd.
|
|
v := InputInlineQueryResultDocument{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultGame":
|
|
// Decoding inputInlineQueryResultGame#39951fd7.
|
|
v := InputInlineQueryResultGame{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultLocation":
|
|
// Decoding inputInlineQueryResultLocation#8f7cbe56.
|
|
v := InputInlineQueryResultLocation{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultPhoto":
|
|
// Decoding inputInlineQueryResultPhoto#bd0b361f.
|
|
v := InputInlineQueryResultPhoto{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultSticker":
|
|
// Decoding inputInlineQueryResultSticker#10550459.
|
|
v := InputInlineQueryResultSticker{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultVenue":
|
|
// Decoding inputInlineQueryResultVenue#2049c13d.
|
|
v := InputInlineQueryResultVenue{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultVideo":
|
|
// Decoding inputInlineQueryResultVideo#66c344e7.
|
|
v := InputInlineQueryResultVideo{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputInlineQueryResultVoiceNote":
|
|
// Decoding inputInlineQueryResultVoiceNote#954da949.
|
|
v := InputInlineQueryResultVoiceNote{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", tdjson.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// InputInlineQueryResult boxes the InputInlineQueryResultClass providing a helper.
|
|
type InputInlineQueryResultBox struct {
|
|
InputInlineQueryResult InputInlineQueryResultClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for InputInlineQueryResultBox.
|
|
func (b *InputInlineQueryResultBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InputInlineQueryResultBox to nil")
|
|
}
|
|
v, err := DecodeInputInlineQueryResult(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InputInlineQueryResult = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for InputInlineQueryResultBox.
|
|
func (b *InputInlineQueryResultBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.InputInlineQueryResult == nil {
|
|
return fmt.Errorf("unable to encode InputInlineQueryResultClass as nil")
|
|
}
|
|
return b.InputInlineQueryResult.Encode(buf)
|
|
}
|
|
|
|
// DecodeTDLibJSON implements bin.Decoder for InputInlineQueryResultBox.
|
|
func (b *InputInlineQueryResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InputInlineQueryResultBox to nil")
|
|
}
|
|
v, err := DecodeTDLibJSONInputInlineQueryResult(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InputInlineQueryResult = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements bin.Encode for InputInlineQueryResultBox.
|
|
func (b *InputInlineQueryResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil || b.InputInlineQueryResult == nil {
|
|
return fmt.Errorf("unable to encode InputInlineQueryResultClass as nil")
|
|
}
|
|
return b.InputInlineQueryResult.EncodeTDLibJSON(buf)
|
|
}
|