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 MessagesEditQuickReplyShortcutRequest struct {
ShortcutID int
Shortcut string
}
const MessagesEditQuickReplyShortcutRequestTypeID = 0x5c003cef
var (
_ bin .Encoder = &MessagesEditQuickReplyShortcutRequest {}
_ bin .Decoder = &MessagesEditQuickReplyShortcutRequest {}
_ bin .BareEncoder = &MessagesEditQuickReplyShortcutRequest {}
_ bin .BareDecoder = &MessagesEditQuickReplyShortcutRequest {}
)
func (e *MessagesEditQuickReplyShortcutRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .ShortcutID == 0 ) {
return false
}
if !(e .Shortcut == "" ) {
return false
}
return true
}
func (e *MessagesEditQuickReplyShortcutRequest ) String () string {
if e == nil {
return "MessagesEditQuickReplyShortcutRequest(nil)"
}
type Alias MessagesEditQuickReplyShortcutRequest
return fmt .Sprintf ("MessagesEditQuickReplyShortcutRequest%+v" , Alias (*e ))
}
func (e *MessagesEditQuickReplyShortcutRequest ) FillFrom (from interface {
GetShortcutID () (value int )
GetShortcut () (value string )
}) {
e .ShortcutID = from .GetShortcutID ()
e .Shortcut = from .GetShortcut ()
}
func (*MessagesEditQuickReplyShortcutRequest ) TypeID () uint32 {
return MessagesEditQuickReplyShortcutRequestTypeID
}
func (*MessagesEditQuickReplyShortcutRequest ) TypeName () string {
return "messages.editQuickReplyShortcut"
}
func (e *MessagesEditQuickReplyShortcutRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.editQuickReplyShortcut" ,
ID : MessagesEditQuickReplyShortcutRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShortcutID" ,
SchemaName : "shortcut_id" ,
},
{
Name : "Shortcut" ,
SchemaName : "shortcut" ,
},
}
return typ
}
func (e *MessagesEditQuickReplyShortcutRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editQuickReplyShortcut#5c003cef as nil" )
}
b .PutID (MessagesEditQuickReplyShortcutRequestTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEditQuickReplyShortcutRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editQuickReplyShortcut#5c003cef as nil" )
}
b .PutInt (e .ShortcutID )
b .PutString (e .Shortcut )
return nil
}
func (e *MessagesEditQuickReplyShortcutRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editQuickReplyShortcut#5c003cef to nil" )
}
if err := b .ConsumeID (MessagesEditQuickReplyShortcutRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.editQuickReplyShortcut#5c003cef: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEditQuickReplyShortcutRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editQuickReplyShortcut#5c003cef to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editQuickReplyShortcut#5c003cef: field shortcut_id: %w" , err )
}
e .ShortcutID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editQuickReplyShortcut#5c003cef: field shortcut: %w" , err )
}
e .Shortcut = value
}
return nil
}
func (e *MessagesEditQuickReplyShortcutRequest ) GetShortcutID () (value int ) {
if e == nil {
return
}
return e .ShortcutID
}
func (e *MessagesEditQuickReplyShortcutRequest ) GetShortcut () (value string ) {
if e == nil {
return
}
return e .Shortcut
}
func (c *Client ) MessagesEditQuickReplyShortcut (ctx context .Context , request *MessagesEditQuickReplyShortcutRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , nil
}
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 .