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 InputQuickReplyShortcut struct {
Shortcut string
}
const InputQuickReplyShortcutTypeID = 0x24596d41
func (i InputQuickReplyShortcut ) construct () InputQuickReplyShortcutClass { return &i }
var (
_ bin .Encoder = &InputQuickReplyShortcut {}
_ bin .Decoder = &InputQuickReplyShortcut {}
_ bin .BareEncoder = &InputQuickReplyShortcut {}
_ bin .BareDecoder = &InputQuickReplyShortcut {}
_ InputQuickReplyShortcutClass = &InputQuickReplyShortcut {}
)
func (i *InputQuickReplyShortcut ) Zero () bool {
if i == nil {
return true
}
if !(i .Shortcut == "" ) {
return false
}
return true
}
func (i *InputQuickReplyShortcut ) String () string {
if i == nil {
return "InputQuickReplyShortcut(nil)"
}
type Alias InputQuickReplyShortcut
return fmt .Sprintf ("InputQuickReplyShortcut%+v" , Alias (*i ))
}
func (i *InputQuickReplyShortcut ) FillFrom (from interface {
GetShortcut () (value string )
}) {
i .Shortcut = from .GetShortcut ()
}
func (*InputQuickReplyShortcut ) TypeID () uint32 {
return InputQuickReplyShortcutTypeID
}
func (*InputQuickReplyShortcut ) TypeName () string {
return "inputQuickReplyShortcut"
}
func (i *InputQuickReplyShortcut ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputQuickReplyShortcut" ,
ID : InputQuickReplyShortcutTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Shortcut" ,
SchemaName : "shortcut" ,
},
}
return typ
}
func (i *InputQuickReplyShortcut ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputQuickReplyShortcut#24596d41 as nil" )
}
b .PutID (InputQuickReplyShortcutTypeID )
return i .EncodeBare (b )
}
func (i *InputQuickReplyShortcut ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputQuickReplyShortcut#24596d41 as nil" )
}
b .PutString (i .Shortcut )
return nil
}
func (i *InputQuickReplyShortcut ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputQuickReplyShortcut#24596d41 to nil" )
}
if err := b .ConsumeID (InputQuickReplyShortcutTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputQuickReplyShortcut#24596d41: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputQuickReplyShortcut ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputQuickReplyShortcut#24596d41 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputQuickReplyShortcut#24596d41: field shortcut: %w" , err )
}
i .Shortcut = value
}
return nil
}
func (i *InputQuickReplyShortcut ) GetShortcut () (value string ) {
if i == nil {
return
}
return i .Shortcut
}
type InputQuickReplyShortcutID struct {
ShortcutID int
}
const InputQuickReplyShortcutIDTypeID = 0x1190cf1
func (i InputQuickReplyShortcutID ) construct () InputQuickReplyShortcutClass { return &i }
var (
_ bin .Encoder = &InputQuickReplyShortcutID {}
_ bin .Decoder = &InputQuickReplyShortcutID {}
_ bin .BareEncoder = &InputQuickReplyShortcutID {}
_ bin .BareDecoder = &InputQuickReplyShortcutID {}
_ InputQuickReplyShortcutClass = &InputQuickReplyShortcutID {}
)
func (i *InputQuickReplyShortcutID ) Zero () bool {
if i == nil {
return true
}
if !(i .ShortcutID == 0 ) {
return false
}
return true
}
func (i *InputQuickReplyShortcutID ) String () string {
if i == nil {
return "InputQuickReplyShortcutID(nil)"
}
type Alias InputQuickReplyShortcutID
return fmt .Sprintf ("InputQuickReplyShortcutID%+v" , Alias (*i ))
}
func (i *InputQuickReplyShortcutID ) FillFrom (from interface {
GetShortcutID () (value int )
}) {
i .ShortcutID = from .GetShortcutID ()
}
func (*InputQuickReplyShortcutID ) TypeID () uint32 {
return InputQuickReplyShortcutIDTypeID
}
func (*InputQuickReplyShortcutID ) TypeName () string {
return "inputQuickReplyShortcutId"
}
func (i *InputQuickReplyShortcutID ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputQuickReplyShortcutId" ,
ID : InputQuickReplyShortcutIDTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShortcutID" ,
SchemaName : "shortcut_id" ,
},
}
return typ
}
func (i *InputQuickReplyShortcutID ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputQuickReplyShortcutId#1190cf1 as nil" )
}
b .PutID (InputQuickReplyShortcutIDTypeID )
return i .EncodeBare (b )
}
func (i *InputQuickReplyShortcutID ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputQuickReplyShortcutId#1190cf1 as nil" )
}
b .PutInt (i .ShortcutID )
return nil
}
func (i *InputQuickReplyShortcutID ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputQuickReplyShortcutId#1190cf1 to nil" )
}
if err := b .ConsumeID (InputQuickReplyShortcutIDTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputQuickReplyShortcutId#1190cf1: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputQuickReplyShortcutID ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputQuickReplyShortcutId#1190cf1 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputQuickReplyShortcutId#1190cf1: field shortcut_id: %w" , err )
}
i .ShortcutID = value
}
return nil
}
func (i *InputQuickReplyShortcutID ) GetShortcutID () (value int ) {
if i == nil {
return
}
return i .ShortcutID
}
const InputQuickReplyShortcutClassName = "InputQuickReplyShortcut"
type InputQuickReplyShortcutClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputQuickReplyShortcutClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputQuickReplyShortcut (buf *bin .Buffer ) (InputQuickReplyShortcutClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputQuickReplyShortcutTypeID :
v := InputQuickReplyShortcut {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputQuickReplyShortcutClass: %w" , err )
}
return &v , nil
case InputQuickReplyShortcutIDTypeID :
v := InputQuickReplyShortcutID {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputQuickReplyShortcutClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputQuickReplyShortcutClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputQuickReplyShortcutBox struct {
InputQuickReplyShortcut InputQuickReplyShortcutClass
}
func (b *InputQuickReplyShortcutBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputQuickReplyShortcutBox to nil" )
}
v , err := DecodeInputQuickReplyShortcut (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputQuickReplyShortcut = v
return nil
}
func (b *InputQuickReplyShortcutBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputQuickReplyShortcut == nil {
return fmt .Errorf ("unable to encode InputQuickReplyShortcutClass as nil" )
}
return b .InputQuickReplyShortcut .Encode (buf )
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .