package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type InputBotInlineResult struct {
Flags bin .Fields
ID string
Type string
Title string
Description string
URL string
Thumb InputWebDocument
Content InputWebDocument
SendMessage InputBotInlineMessageClass
}
const InputBotInlineResultTypeID = 0x88bf9319
func (i InputBotInlineResult ) construct () InputBotInlineResultClass { return &i }
var (
_ bin .Encoder = &InputBotInlineResult {}
_ bin .Decoder = &InputBotInlineResult {}
_ bin .BareEncoder = &InputBotInlineResult {}
_ bin .BareDecoder = &InputBotInlineResult {}
_ InputBotInlineResultClass = &InputBotInlineResult {}
)
func (i *InputBotInlineResult ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .ID == "" ) {
return false
}
if !(i .Type == "" ) {
return false
}
if !(i .Title == "" ) {
return false
}
if !(i .Description == "" ) {
return false
}
if !(i .URL == "" ) {
return false
}
if !(i .Thumb .Zero ()) {
return false
}
if !(i .Content .Zero ()) {
return false
}
if !(i .SendMessage == nil ) {
return false
}
return true
}
func (i *InputBotInlineResult ) String () string {
if i == nil {
return "InputBotInlineResult(nil)"
}
type Alias InputBotInlineResult
return fmt .Sprintf ("InputBotInlineResult%+v" , Alias (*i ))
}
func (i *InputBotInlineResult ) FillFrom (from interface {
GetID () (value string )
GetType () (value string )
GetTitle () (value string , ok bool )
GetDescription () (value string , ok bool )
GetURL () (value string , ok bool )
GetThumb () (value InputWebDocument , ok bool )
GetContent () (value InputWebDocument , ok bool )
GetSendMessage () (value InputBotInlineMessageClass )
}) {
i .ID = from .GetID ()
i .Type = from .GetType ()
if val , ok := from .GetTitle (); ok {
i .Title = val
}
if val , ok := from .GetDescription (); ok {
i .Description = val
}
if val , ok := from .GetURL (); ok {
i .URL = val
}
if val , ok := from .GetThumb (); ok {
i .Thumb = val
}
if val , ok := from .GetContent (); ok {
i .Content = val
}
i .SendMessage = from .GetSendMessage ()
}
func (*InputBotInlineResult ) TypeID () uint32 {
return InputBotInlineResultTypeID
}
func (*InputBotInlineResult ) TypeName () string {
return "inputBotInlineResult"
}
func (i *InputBotInlineResult ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputBotInlineResult" ,
ID : InputBotInlineResultTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Type" ,
SchemaName : "type" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "Description" ,
SchemaName : "description" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
Null : !i .Flags .Has (3 ),
},
{
Name : "Thumb" ,
SchemaName : "thumb" ,
Null : !i .Flags .Has (4 ),
},
{
Name : "Content" ,
SchemaName : "content" ,
Null : !i .Flags .Has (5 ),
},
{
Name : "SendMessage" ,
SchemaName : "send_message" ,
},
}
return typ
}
func (i *InputBotInlineResult ) SetFlags () {
if !(i .Title == "" ) {
i .Flags .Set (1 )
}
if !(i .Description == "" ) {
i .Flags .Set (2 )
}
if !(i .URL == "" ) {
i .Flags .Set (3 )
}
if !(i .Thumb .Zero ()) {
i .Flags .Set (4 )
}
if !(i .Content .Zero ()) {
i .Flags .Set (5 )
}
}
func (i *InputBotInlineResult ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResult#88bf9319 as nil" )
}
b .PutID (InputBotInlineResultTypeID )
return i .EncodeBare (b )
}
func (i *InputBotInlineResult ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResult#88bf9319 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResult#88bf9319: field flags: %w" , err )
}
b .PutString (i .ID )
b .PutString (i .Type )
if i .Flags .Has (1 ) {
b .PutString (i .Title )
}
if i .Flags .Has (2 ) {
b .PutString (i .Description )
}
if i .Flags .Has (3 ) {
b .PutString (i .URL )
}
if i .Flags .Has (4 ) {
if err := i .Thumb .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResult#88bf9319: field thumb: %w" , err )
}
}
if i .Flags .Has (5 ) {
if err := i .Content .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResult#88bf9319: field content: %w" , err )
}
}
if i .SendMessage == nil {
return fmt .Errorf ("unable to encode inputBotInlineResult#88bf9319: field send_message is nil" )
}
if err := i .SendMessage .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResult#88bf9319: field send_message: %w" , err )
}
return nil
}
func (i *InputBotInlineResult ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResult#88bf9319 to nil" )
}
if err := b .ConsumeID (InputBotInlineResultTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputBotInlineResult ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResult#88bf9319 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field type: %w" , err )
}
i .Type = value
}
if i .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field title: %w" , err )
}
i .Title = value
}
if i .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field description: %w" , err )
}
i .Description = value
}
if i .Flags .Has (3 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field url: %w" , err )
}
i .URL = value
}
if i .Flags .Has (4 ) {
if err := i .Thumb .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field thumb: %w" , err )
}
}
if i .Flags .Has (5 ) {
if err := i .Content .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field content: %w" , err )
}
}
{
value , err := DecodeInputBotInlineMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResult#88bf9319: field send_message: %w" , err )
}
i .SendMessage = value
}
return nil
}
func (i *InputBotInlineResult ) GetID () (value string ) {
if i == nil {
return
}
return i .ID
}
func (i *InputBotInlineResult ) GetType () (value string ) {
if i == nil {
return
}
return i .Type
}
func (i *InputBotInlineResult ) SetTitle (value string ) {
i .Flags .Set (1 )
i .Title = value
}
func (i *InputBotInlineResult ) GetTitle () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .Title , true
}
func (i *InputBotInlineResult ) SetDescription (value string ) {
i .Flags .Set (2 )
i .Description = value
}
func (i *InputBotInlineResult ) GetDescription () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (2 ) {
return value , false
}
return i .Description , true
}
func (i *InputBotInlineResult ) SetURL (value string ) {
i .Flags .Set (3 )
i .URL = value
}
func (i *InputBotInlineResult ) GetURL () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (3 ) {
return value , false
}
return i .URL , true
}
func (i *InputBotInlineResult ) SetThumb (value InputWebDocument ) {
i .Flags .Set (4 )
i .Thumb = value
}
func (i *InputBotInlineResult ) GetThumb () (value InputWebDocument , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (4 ) {
return value , false
}
return i .Thumb , true
}
func (i *InputBotInlineResult ) SetContent (value InputWebDocument ) {
i .Flags .Set (5 )
i .Content = value
}
func (i *InputBotInlineResult ) GetContent () (value InputWebDocument , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (5 ) {
return value , false
}
return i .Content , true
}
func (i *InputBotInlineResult ) GetSendMessage () (value InputBotInlineMessageClass ) {
if i == nil {
return
}
return i .SendMessage
}
type InputBotInlineResultPhoto struct {
ID string
Type string
Photo InputPhotoClass
SendMessage InputBotInlineMessageClass
}
const InputBotInlineResultPhotoTypeID = 0xa8d864a7
func (i InputBotInlineResultPhoto ) construct () InputBotInlineResultClass { return &i }
var (
_ bin .Encoder = &InputBotInlineResultPhoto {}
_ bin .Decoder = &InputBotInlineResultPhoto {}
_ bin .BareEncoder = &InputBotInlineResultPhoto {}
_ bin .BareDecoder = &InputBotInlineResultPhoto {}
_ InputBotInlineResultClass = &InputBotInlineResultPhoto {}
)
func (i *InputBotInlineResultPhoto ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == "" ) {
return false
}
if !(i .Type == "" ) {
return false
}
if !(i .Photo == nil ) {
return false
}
if !(i .SendMessage == nil ) {
return false
}
return true
}
func (i *InputBotInlineResultPhoto ) String () string {
if i == nil {
return "InputBotInlineResultPhoto(nil)"
}
type Alias InputBotInlineResultPhoto
return fmt .Sprintf ("InputBotInlineResultPhoto%+v" , Alias (*i ))
}
func (i *InputBotInlineResultPhoto ) FillFrom (from interface {
GetID () (value string )
GetType () (value string )
GetPhoto () (value InputPhotoClass )
GetSendMessage () (value InputBotInlineMessageClass )
}) {
i .ID = from .GetID ()
i .Type = from .GetType ()
i .Photo = from .GetPhoto ()
i .SendMessage = from .GetSendMessage ()
}
func (*InputBotInlineResultPhoto ) TypeID () uint32 {
return InputBotInlineResultPhotoTypeID
}
func (*InputBotInlineResultPhoto ) TypeName () string {
return "inputBotInlineResultPhoto"
}
func (i *InputBotInlineResultPhoto ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputBotInlineResultPhoto" ,
ID : InputBotInlineResultPhotoTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Type" ,
SchemaName : "type" ,
},
{
Name : "Photo" ,
SchemaName : "photo" ,
},
{
Name : "SendMessage" ,
SchemaName : "send_message" ,
},
}
return typ
}
func (i *InputBotInlineResultPhoto ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResultPhoto#a8d864a7 as nil" )
}
b .PutID (InputBotInlineResultPhotoTypeID )
return i .EncodeBare (b )
}
func (i *InputBotInlineResultPhoto ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResultPhoto#a8d864a7 as nil" )
}
b .PutString (i .ID )
b .PutString (i .Type )
if i .Photo == nil {
return fmt .Errorf ("unable to encode inputBotInlineResultPhoto#a8d864a7: field photo is nil" )
}
if err := i .Photo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResultPhoto#a8d864a7: field photo: %w" , err )
}
if i .SendMessage == nil {
return fmt .Errorf ("unable to encode inputBotInlineResultPhoto#a8d864a7: field send_message is nil" )
}
if err := i .SendMessage .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResultPhoto#a8d864a7: field send_message: %w" , err )
}
return nil
}
func (i *InputBotInlineResultPhoto ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResultPhoto#a8d864a7 to nil" )
}
if err := b .ConsumeID (InputBotInlineResultPhotoTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultPhoto#a8d864a7: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputBotInlineResultPhoto ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResultPhoto#a8d864a7 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultPhoto#a8d864a7: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultPhoto#a8d864a7: field type: %w" , err )
}
i .Type = value
}
{
value , err := DecodeInputPhoto (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultPhoto#a8d864a7: field photo: %w" , err )
}
i .Photo = value
}
{
value , err := DecodeInputBotInlineMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultPhoto#a8d864a7: field send_message: %w" , err )
}
i .SendMessage = value
}
return nil
}
func (i *InputBotInlineResultPhoto ) GetID () (value string ) {
if i == nil {
return
}
return i .ID
}
func (i *InputBotInlineResultPhoto ) GetType () (value string ) {
if i == nil {
return
}
return i .Type
}
func (i *InputBotInlineResultPhoto ) GetPhoto () (value InputPhotoClass ) {
if i == nil {
return
}
return i .Photo
}
func (i *InputBotInlineResultPhoto ) GetSendMessage () (value InputBotInlineMessageClass ) {
if i == nil {
return
}
return i .SendMessage
}
type InputBotInlineResultDocument struct {
Flags bin .Fields
ID string
Type string
Title string
Description string
Document InputDocumentClass
SendMessage InputBotInlineMessageClass
}
const InputBotInlineResultDocumentTypeID = 0xfff8fdc4
func (i InputBotInlineResultDocument ) construct () InputBotInlineResultClass { return &i }
var (
_ bin .Encoder = &InputBotInlineResultDocument {}
_ bin .Decoder = &InputBotInlineResultDocument {}
_ bin .BareEncoder = &InputBotInlineResultDocument {}
_ bin .BareDecoder = &InputBotInlineResultDocument {}
_ InputBotInlineResultClass = &InputBotInlineResultDocument {}
)
func (i *InputBotInlineResultDocument ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .ID == "" ) {
return false
}
if !(i .Type == "" ) {
return false
}
if !(i .Title == "" ) {
return false
}
if !(i .Description == "" ) {
return false
}
if !(i .Document == nil ) {
return false
}
if !(i .SendMessage == nil ) {
return false
}
return true
}
func (i *InputBotInlineResultDocument ) String () string {
if i == nil {
return "InputBotInlineResultDocument(nil)"
}
type Alias InputBotInlineResultDocument
return fmt .Sprintf ("InputBotInlineResultDocument%+v" , Alias (*i ))
}
func (i *InputBotInlineResultDocument ) FillFrom (from interface {
GetID () (value string )
GetType () (value string )
GetTitle () (value string , ok bool )
GetDescription () (value string , ok bool )
GetDocument () (value InputDocumentClass )
GetSendMessage () (value InputBotInlineMessageClass )
}) {
i .ID = from .GetID ()
i .Type = from .GetType ()
if val , ok := from .GetTitle (); ok {
i .Title = val
}
if val , ok := from .GetDescription (); ok {
i .Description = val
}
i .Document = from .GetDocument ()
i .SendMessage = from .GetSendMessage ()
}
func (*InputBotInlineResultDocument ) TypeID () uint32 {
return InputBotInlineResultDocumentTypeID
}
func (*InputBotInlineResultDocument ) TypeName () string {
return "inputBotInlineResultDocument"
}
func (i *InputBotInlineResultDocument ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputBotInlineResultDocument" ,
ID : InputBotInlineResultDocumentTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Type" ,
SchemaName : "type" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "Description" ,
SchemaName : "description" ,
Null : !i .Flags .Has (2 ),
},
{
Name : "Document" ,
SchemaName : "document" ,
},
{
Name : "SendMessage" ,
SchemaName : "send_message" ,
},
}
return typ
}
func (i *InputBotInlineResultDocument ) SetFlags () {
if !(i .Title == "" ) {
i .Flags .Set (1 )
}
if !(i .Description == "" ) {
i .Flags .Set (2 )
}
}
func (i *InputBotInlineResultDocument ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResultDocument#fff8fdc4 as nil" )
}
b .PutID (InputBotInlineResultDocumentTypeID )
return i .EncodeBare (b )
}
func (i *InputBotInlineResultDocument ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResultDocument#fff8fdc4 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResultDocument#fff8fdc4: field flags: %w" , err )
}
b .PutString (i .ID )
b .PutString (i .Type )
if i .Flags .Has (1 ) {
b .PutString (i .Title )
}
if i .Flags .Has (2 ) {
b .PutString (i .Description )
}
if i .Document == nil {
return fmt .Errorf ("unable to encode inputBotInlineResultDocument#fff8fdc4: field document is nil" )
}
if err := i .Document .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResultDocument#fff8fdc4: field document: %w" , err )
}
if i .SendMessage == nil {
return fmt .Errorf ("unable to encode inputBotInlineResultDocument#fff8fdc4: field send_message is nil" )
}
if err := i .SendMessage .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResultDocument#fff8fdc4: field send_message: %w" , err )
}
return nil
}
func (i *InputBotInlineResultDocument ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResultDocument#fff8fdc4 to nil" )
}
if err := b .ConsumeID (InputBotInlineResultDocumentTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputBotInlineResultDocument ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResultDocument#fff8fdc4 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field type: %w" , err )
}
i .Type = value
}
if i .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field title: %w" , err )
}
i .Title = value
}
if i .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field description: %w" , err )
}
i .Description = value
}
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field document: %w" , err )
}
i .Document = value
}
{
value , err := DecodeInputBotInlineMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultDocument#fff8fdc4: field send_message: %w" , err )
}
i .SendMessage = value
}
return nil
}
func (i *InputBotInlineResultDocument ) GetID () (value string ) {
if i == nil {
return
}
return i .ID
}
func (i *InputBotInlineResultDocument ) GetType () (value string ) {
if i == nil {
return
}
return i .Type
}
func (i *InputBotInlineResultDocument ) SetTitle (value string ) {
i .Flags .Set (1 )
i .Title = value
}
func (i *InputBotInlineResultDocument ) GetTitle () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .Title , true
}
func (i *InputBotInlineResultDocument ) SetDescription (value string ) {
i .Flags .Set (2 )
i .Description = value
}
func (i *InputBotInlineResultDocument ) GetDescription () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (2 ) {
return value , false
}
return i .Description , true
}
func (i *InputBotInlineResultDocument ) GetDocument () (value InputDocumentClass ) {
if i == nil {
return
}
return i .Document
}
func (i *InputBotInlineResultDocument ) GetSendMessage () (value InputBotInlineMessageClass ) {
if i == nil {
return
}
return i .SendMessage
}
type InputBotInlineResultGame struct {
ID string
ShortName string
SendMessage InputBotInlineMessageClass
}
const InputBotInlineResultGameTypeID = 0x4fa417f2
func (i InputBotInlineResultGame ) construct () InputBotInlineResultClass { return &i }
var (
_ bin .Encoder = &InputBotInlineResultGame {}
_ bin .Decoder = &InputBotInlineResultGame {}
_ bin .BareEncoder = &InputBotInlineResultGame {}
_ bin .BareDecoder = &InputBotInlineResultGame {}
_ InputBotInlineResultClass = &InputBotInlineResultGame {}
)
func (i *InputBotInlineResultGame ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == "" ) {
return false
}
if !(i .ShortName == "" ) {
return false
}
if !(i .SendMessage == nil ) {
return false
}
return true
}
func (i *InputBotInlineResultGame ) String () string {
if i == nil {
return "InputBotInlineResultGame(nil)"
}
type Alias InputBotInlineResultGame
return fmt .Sprintf ("InputBotInlineResultGame%+v" , Alias (*i ))
}
func (i *InputBotInlineResultGame ) FillFrom (from interface {
GetID () (value string )
GetShortName () (value string )
GetSendMessage () (value InputBotInlineMessageClass )
}) {
i .ID = from .GetID ()
i .ShortName = from .GetShortName ()
i .SendMessage = from .GetSendMessage ()
}
func (*InputBotInlineResultGame ) TypeID () uint32 {
return InputBotInlineResultGameTypeID
}
func (*InputBotInlineResultGame ) TypeName () string {
return "inputBotInlineResultGame"
}
func (i *InputBotInlineResultGame ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputBotInlineResultGame" ,
ID : InputBotInlineResultGameTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "ShortName" ,
SchemaName : "short_name" ,
},
{
Name : "SendMessage" ,
SchemaName : "send_message" ,
},
}
return typ
}
func (i *InputBotInlineResultGame ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResultGame#4fa417f2 as nil" )
}
b .PutID (InputBotInlineResultGameTypeID )
return i .EncodeBare (b )
}
func (i *InputBotInlineResultGame ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputBotInlineResultGame#4fa417f2 as nil" )
}
b .PutString (i .ID )
b .PutString (i .ShortName )
if i .SendMessage == nil {
return fmt .Errorf ("unable to encode inputBotInlineResultGame#4fa417f2: field send_message is nil" )
}
if err := i .SendMessage .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputBotInlineResultGame#4fa417f2: field send_message: %w" , err )
}
return nil
}
func (i *InputBotInlineResultGame ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResultGame#4fa417f2 to nil" )
}
if err := b .ConsumeID (InputBotInlineResultGameTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultGame#4fa417f2: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputBotInlineResultGame ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputBotInlineResultGame#4fa417f2 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultGame#4fa417f2: field id: %w" , err )
}
i .ID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultGame#4fa417f2: field short_name: %w" , err )
}
i .ShortName = value
}
{
value , err := DecodeInputBotInlineMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode inputBotInlineResultGame#4fa417f2: field send_message: %w" , err )
}
i .SendMessage = value
}
return nil
}
func (i *InputBotInlineResultGame ) GetID () (value string ) {
if i == nil {
return
}
return i .ID
}
func (i *InputBotInlineResultGame ) GetShortName () (value string ) {
if i == nil {
return
}
return i .ShortName
}
func (i *InputBotInlineResultGame ) GetSendMessage () (value InputBotInlineMessageClass ) {
if i == nil {
return
}
return i .SendMessage
}
const InputBotInlineResultClassName = "InputBotInlineResult"
type InputBotInlineResultClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputBotInlineResultClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value string )
GetSendMessage () (value InputBotInlineMessageClass )
}
func DecodeInputBotInlineResult (buf *bin .Buffer ) (InputBotInlineResultClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputBotInlineResultTypeID :
v := InputBotInlineResult {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputBotInlineResultClass: %w" , err )
}
return &v , nil
case InputBotInlineResultPhotoTypeID :
v := InputBotInlineResultPhoto {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputBotInlineResultClass: %w" , err )
}
return &v , nil
case InputBotInlineResultDocumentTypeID :
v := InputBotInlineResultDocument {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputBotInlineResultClass: %w" , err )
}
return &v , nil
case InputBotInlineResultGameTypeID :
v := InputBotInlineResultGame {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputBotInlineResultClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputBotInlineResultClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputBotInlineResultBox struct {
InputBotInlineResult InputBotInlineResultClass
}
func (b *InputBotInlineResultBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputBotInlineResultBox to nil" )
}
v , err := DecodeInputBotInlineResult (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputBotInlineResult = v
return nil
}
func (b *InputBotInlineResultBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputBotInlineResult == nil {
return fmt .Errorf ("unable to encode InputBotInlineResultClass as nil" )
}
return b .InputBotInlineResult .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .