Files
mautrix-telegram/pkg/gotd/tg/tl_bots_requested_button_gen.go
T
2026-04-01 21:08:49 +03:00

162 lines
3.7 KiB
Go
Generated

// Code generated by gotdgen, DO NOT EDIT.
package tg
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{}
)
// BotsRequestedButton represents TL type `bots.requestedButton#f13bbcd7`.
//
// See https://core.telegram.org/constructor/bots.requestedButton for reference.
type BotsRequestedButton struct {
// WebappReqID field of BotsRequestedButton.
WebappReqID string
}
// BotsRequestedButtonTypeID is TL type id of BotsRequestedButton.
const BotsRequestedButtonTypeID = 0xf13bbcd7
// Ensuring interfaces in compile-time for BotsRequestedButton.
var (
_ bin.Encoder = &BotsRequestedButton{}
_ bin.Decoder = &BotsRequestedButton{}
_ bin.BareEncoder = &BotsRequestedButton{}
_ bin.BareDecoder = &BotsRequestedButton{}
)
func (r *BotsRequestedButton) Zero() bool {
if r == nil {
return true
}
if !(r.WebappReqID == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (r *BotsRequestedButton) String() string {
if r == nil {
return "BotsRequestedButton(nil)"
}
type Alias BotsRequestedButton
return fmt.Sprintf("BotsRequestedButton%+v", Alias(*r))
}
// FillFrom fills BotsRequestedButton from given interface.
func (r *BotsRequestedButton) FillFrom(from interface {
GetWebappReqID() (value string)
}) {
r.WebappReqID = from.GetWebappReqID()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*BotsRequestedButton) TypeID() uint32 {
return BotsRequestedButtonTypeID
}
// TypeName returns name of type in TL schema.
func (*BotsRequestedButton) TypeName() string {
return "bots.requestedButton"
}
// TypeInfo returns info about TL type.
func (r *BotsRequestedButton) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "bots.requestedButton",
ID: BotsRequestedButtonTypeID,
}
if r == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "WebappReqID",
SchemaName: "webapp_req_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (r *BotsRequestedButton) Encode(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't encode bots.requestedButton#f13bbcd7 as nil")
}
b.PutID(BotsRequestedButtonTypeID)
return r.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (r *BotsRequestedButton) EncodeBare(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't encode bots.requestedButton#f13bbcd7 as nil")
}
b.PutString(r.WebappReqID)
return nil
}
// Decode implements bin.Decoder.
func (r *BotsRequestedButton) Decode(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't decode bots.requestedButton#f13bbcd7 to nil")
}
if err := b.ConsumeID(BotsRequestedButtonTypeID); err != nil {
return fmt.Errorf("unable to decode bots.requestedButton#f13bbcd7: %w", err)
}
return r.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (r *BotsRequestedButton) DecodeBare(b *bin.Buffer) error {
if r == nil {
return fmt.Errorf("can't decode bots.requestedButton#f13bbcd7 to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode bots.requestedButton#f13bbcd7: field webapp_req_id: %w", err)
}
r.WebappReqID = value
}
return nil
}
// GetWebappReqID returns value of WebappReqID field.
func (r *BotsRequestedButton) GetWebappReqID() (value string) {
if r == nil {
return
}
return r.WebappReqID
}