144 lines
3.7 KiB
Go
Generated
144 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{}
|
|
)
|
|
|
|
// BotsGetAdminedBotsRequest represents TL type `bots.getAdminedBots#b0711d83`.
|
|
// Get a list of bots owned by the current user
|
|
//
|
|
// See https://core.telegram.org/method/bots.getAdminedBots for reference.
|
|
type BotsGetAdminedBotsRequest struct {
|
|
}
|
|
|
|
// BotsGetAdminedBotsRequestTypeID is TL type id of BotsGetAdminedBotsRequest.
|
|
const BotsGetAdminedBotsRequestTypeID = 0xb0711d83
|
|
|
|
// Ensuring interfaces in compile-time for BotsGetAdminedBotsRequest.
|
|
var (
|
|
_ bin.Encoder = &BotsGetAdminedBotsRequest{}
|
|
_ bin.Decoder = &BotsGetAdminedBotsRequest{}
|
|
_ bin.BareEncoder = &BotsGetAdminedBotsRequest{}
|
|
_ bin.BareDecoder = &BotsGetAdminedBotsRequest{}
|
|
)
|
|
|
|
func (g *BotsGetAdminedBotsRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *BotsGetAdminedBotsRequest) String() string {
|
|
if g == nil {
|
|
return "BotsGetAdminedBotsRequest(nil)"
|
|
}
|
|
type Alias BotsGetAdminedBotsRequest
|
|
return fmt.Sprintf("BotsGetAdminedBotsRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*BotsGetAdminedBotsRequest) TypeID() uint32 {
|
|
return BotsGetAdminedBotsRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*BotsGetAdminedBotsRequest) TypeName() string {
|
|
return "bots.getAdminedBots"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *BotsGetAdminedBotsRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "bots.getAdminedBots",
|
|
ID: BotsGetAdminedBotsRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *BotsGetAdminedBotsRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode bots.getAdminedBots#b0711d83 as nil")
|
|
}
|
|
b.PutID(BotsGetAdminedBotsRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *BotsGetAdminedBotsRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode bots.getAdminedBots#b0711d83 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *BotsGetAdminedBotsRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode bots.getAdminedBots#b0711d83 to nil")
|
|
}
|
|
if err := b.ConsumeID(BotsGetAdminedBotsRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode bots.getAdminedBots#b0711d83: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *BotsGetAdminedBotsRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode bots.getAdminedBots#b0711d83 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// BotsGetAdminedBots invokes method bots.getAdminedBots#b0711d83 returning error if any.
|
|
// Get a list of bots owned by the current user
|
|
//
|
|
// See https://core.telegram.org/method/bots.getAdminedBots for reference.
|
|
func (c *Client) BotsGetAdminedBots(ctx context.Context) ([]UserClass, error) {
|
|
var result UserClassVector
|
|
|
|
request := &BotsGetAdminedBotsRequest{}
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return []UserClass(result.Elems), nil
|
|
}
|