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

150 lines
4.0 KiB
Go

// 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{}
)
// AccountGetConnectedBotsRequest represents TL type `account.getConnectedBots#4ea4c80f`.
// List all currently connected business bots »¹
//
// Links:
// 1. https://core.telegram.org/api/business#connected-bots
//
// See https://core.telegram.org/method/account.getConnectedBots for reference.
type AccountGetConnectedBotsRequest struct {
}
// AccountGetConnectedBotsRequestTypeID is TL type id of AccountGetConnectedBotsRequest.
const AccountGetConnectedBotsRequestTypeID = 0x4ea4c80f
// Ensuring interfaces in compile-time for AccountGetConnectedBotsRequest.
var (
_ bin.Encoder = &AccountGetConnectedBotsRequest{}
_ bin.Decoder = &AccountGetConnectedBotsRequest{}
_ bin.BareEncoder = &AccountGetConnectedBotsRequest{}
_ bin.BareDecoder = &AccountGetConnectedBotsRequest{}
)
func (g *AccountGetConnectedBotsRequest) Zero() bool {
if g == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (g *AccountGetConnectedBotsRequest) String() string {
if g == nil {
return "AccountGetConnectedBotsRequest(nil)"
}
type Alias AccountGetConnectedBotsRequest
return fmt.Sprintf("AccountGetConnectedBotsRequest%+v", Alias(*g))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*AccountGetConnectedBotsRequest) TypeID() uint32 {
return AccountGetConnectedBotsRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*AccountGetConnectedBotsRequest) TypeName() string {
return "account.getConnectedBots"
}
// TypeInfo returns info about TL type.
func (g *AccountGetConnectedBotsRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "account.getConnectedBots",
ID: AccountGetConnectedBotsRequestTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (g *AccountGetConnectedBotsRequest) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode account.getConnectedBots#4ea4c80f as nil")
}
b.PutID(AccountGetConnectedBotsRequestTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *AccountGetConnectedBotsRequest) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode account.getConnectedBots#4ea4c80f as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (g *AccountGetConnectedBotsRequest) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode account.getConnectedBots#4ea4c80f to nil")
}
if err := b.ConsumeID(AccountGetConnectedBotsRequestTypeID); err != nil {
return fmt.Errorf("unable to decode account.getConnectedBots#4ea4c80f: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *AccountGetConnectedBotsRequest) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode account.getConnectedBots#4ea4c80f to nil")
}
return nil
}
// AccountGetConnectedBots invokes method account.getConnectedBots#4ea4c80f returning error if any.
// List all currently connected business bots »¹
//
// Links:
// 1. https://core.telegram.org/api/business#connected-bots
//
// See https://core.telegram.org/method/account.getConnectedBots for reference.
func (c *Client) AccountGetConnectedBots(ctx context.Context) (*AccountConnectedBots, error) {
var result AccountConnectedBots
request := &AccountGetConnectedBotsRequest{}
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
return nil, err
}
return &result, nil
}