Files
mautrix-telegram/pkg/gotd/tdapi/tl_edit_quick_reply_message_gen.go
T
2025-06-27 20:03:37 -07:00

284 lines
7.6 KiB
Go
Generated

// 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{}
)
// EditQuickReplyMessageRequest represents TL type `editQuickReplyMessage#4cc978e`.
type EditQuickReplyMessageRequest struct {
// Unique identifier of the quick reply shortcut with the message
ShortcutID int32
// Identifier of the message
MessageID int64
// New content of the message. Must be one of the following types: inputMessageText,
// inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or
// inputMessageVideo
InputMessageContent InputMessageContentClass
}
// EditQuickReplyMessageRequestTypeID is TL type id of EditQuickReplyMessageRequest.
const EditQuickReplyMessageRequestTypeID = 0x4cc978e
// Ensuring interfaces in compile-time for EditQuickReplyMessageRequest.
var (
_ bin.Encoder = &EditQuickReplyMessageRequest{}
_ bin.Decoder = &EditQuickReplyMessageRequest{}
_ bin.BareEncoder = &EditQuickReplyMessageRequest{}
_ bin.BareDecoder = &EditQuickReplyMessageRequest{}
)
func (e *EditQuickReplyMessageRequest) Zero() bool {
if e == nil {
return true
}
if !(e.ShortcutID == 0) {
return false
}
if !(e.MessageID == 0) {
return false
}
if !(e.InputMessageContent == nil) {
return false
}
return true
}
// String implements fmt.Stringer.
func (e *EditQuickReplyMessageRequest) String() string {
if e == nil {
return "EditQuickReplyMessageRequest(nil)"
}
type Alias EditQuickReplyMessageRequest
return fmt.Sprintf("EditQuickReplyMessageRequest%+v", Alias(*e))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*EditQuickReplyMessageRequest) TypeID() uint32 {
return EditQuickReplyMessageRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*EditQuickReplyMessageRequest) TypeName() string {
return "editQuickReplyMessage"
}
// TypeInfo returns info about TL type.
func (e *EditQuickReplyMessageRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "editQuickReplyMessage",
ID: EditQuickReplyMessageRequestTypeID,
}
if e == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ShortcutID",
SchemaName: "shortcut_id",
},
{
Name: "MessageID",
SchemaName: "message_id",
},
{
Name: "InputMessageContent",
SchemaName: "input_message_content",
},
}
return typ
}
// Encode implements bin.Encoder.
func (e *EditQuickReplyMessageRequest) Encode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode editQuickReplyMessage#4cc978e as nil")
}
b.PutID(EditQuickReplyMessageRequestTypeID)
return e.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (e *EditQuickReplyMessageRequest) EncodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode editQuickReplyMessage#4cc978e as nil")
}
b.PutInt32(e.ShortcutID)
b.PutInt53(e.MessageID)
if e.InputMessageContent == nil {
return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content is nil")
}
if err := e.InputMessageContent.Encode(b); err != nil {
return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content: %w", err)
}
return nil
}
// Decode implements bin.Decoder.
func (e *EditQuickReplyMessageRequest) Decode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode editQuickReplyMessage#4cc978e to nil")
}
if err := b.ConsumeID(EditQuickReplyMessageRequestTypeID); err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: %w", err)
}
return e.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (e *EditQuickReplyMessageRequest) DecodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode editQuickReplyMessage#4cc978e to nil")
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field shortcut_id: %w", err)
}
e.ShortcutID = value
}
{
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field message_id: %w", err)
}
e.MessageID = value
}
{
value, err := DecodeInputMessageContent(b)
if err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field input_message_content: %w", err)
}
e.InputMessageContent = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (e *EditQuickReplyMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
if e == nil {
return fmt.Errorf("can't encode editQuickReplyMessage#4cc978e as nil")
}
b.ObjStart()
b.PutID("editQuickReplyMessage")
b.Comma()
b.FieldStart("shortcut_id")
b.PutInt32(e.ShortcutID)
b.Comma()
b.FieldStart("message_id")
b.PutInt53(e.MessageID)
b.Comma()
b.FieldStart("input_message_content")
if e.InputMessageContent == nil {
return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content is nil")
}
if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content: %w", err)
}
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (e *EditQuickReplyMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
if e == nil {
return fmt.Errorf("can't decode editQuickReplyMessage#4cc978e to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("editQuickReplyMessage"); err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: %w", err)
}
case "shortcut_id":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field shortcut_id: %w", err)
}
e.ShortcutID = value
case "message_id":
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field message_id: %w", err)
}
e.MessageID = value
case "input_message_content":
value, err := DecodeTDLibJSONInputMessageContent(b)
if err != nil {
return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field input_message_content: %w", err)
}
e.InputMessageContent = value
default:
return b.Skip()
}
return nil
})
}
// GetShortcutID returns value of ShortcutID field.
func (e *EditQuickReplyMessageRequest) GetShortcutID() (value int32) {
if e == nil {
return
}
return e.ShortcutID
}
// GetMessageID returns value of MessageID field.
func (e *EditQuickReplyMessageRequest) GetMessageID() (value int64) {
if e == nil {
return
}
return e.MessageID
}
// GetInputMessageContent returns value of InputMessageContent field.
func (e *EditQuickReplyMessageRequest) GetInputMessageContent() (value InputMessageContentClass) {
if e == nil {
return
}
return e.InputMessageContent
}
// EditQuickReplyMessage invokes method editQuickReplyMessage#4cc978e returning error if any.
func (c *Client) EditQuickReplyMessage(ctx context.Context, request *EditQuickReplyMessageRequest) error {
var ok Ok
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
return err
}
return nil
}