7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
155 lines
3.9 KiB
Go
155 lines
3.9 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{}
|
|
)
|
|
|
|
// HelpGetConfigRequest represents TL type `help.getConfig#c4f9186b`.
|
|
// Returns current configuration, including data center configuration.
|
|
//
|
|
// See https://core.telegram.org/method/help.getConfig for reference.
|
|
type HelpGetConfigRequest struct {
|
|
}
|
|
|
|
// HelpGetConfigRequestTypeID is TL type id of HelpGetConfigRequest.
|
|
const HelpGetConfigRequestTypeID = 0xc4f9186b
|
|
|
|
// Ensuring interfaces in compile-time for HelpGetConfigRequest.
|
|
var (
|
|
_ bin.Encoder = &HelpGetConfigRequest{}
|
|
_ bin.Decoder = &HelpGetConfigRequest{}
|
|
_ bin.BareEncoder = &HelpGetConfigRequest{}
|
|
_ bin.BareDecoder = &HelpGetConfigRequest{}
|
|
)
|
|
|
|
func (g *HelpGetConfigRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *HelpGetConfigRequest) String() string {
|
|
if g == nil {
|
|
return "HelpGetConfigRequest(nil)"
|
|
}
|
|
type Alias HelpGetConfigRequest
|
|
return fmt.Sprintf("HelpGetConfigRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*HelpGetConfigRequest) TypeID() uint32 {
|
|
return HelpGetConfigRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*HelpGetConfigRequest) TypeName() string {
|
|
return "help.getConfig"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *HelpGetConfigRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "help.getConfig",
|
|
ID: HelpGetConfigRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *HelpGetConfigRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode help.getConfig#c4f9186b as nil")
|
|
}
|
|
b.PutID(HelpGetConfigRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *HelpGetConfigRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode help.getConfig#c4f9186b as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *HelpGetConfigRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode help.getConfig#c4f9186b to nil")
|
|
}
|
|
if err := b.ConsumeID(HelpGetConfigRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode help.getConfig#c4f9186b: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *HelpGetConfigRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode help.getConfig#c4f9186b to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// HelpGetConfig invokes method help.getConfig#c4f9186b returning error if any.
|
|
// Returns current configuration, including data center configuration.
|
|
//
|
|
// Possible errors:
|
|
//
|
|
// 400 CONNECTION_API_ID_INVALID: The provided API id is invalid.
|
|
// 400 CONNECTION_APP_VERSION_EMPTY: App version is empty.
|
|
// 400 CONNECTION_LAYER_INVALID: Layer invalid.
|
|
// 400 DATA_INVALID: Encrypted data invalid.
|
|
// 400 MSG_ID_INVALID: Invalid message ID provided.
|
|
// 400 USERNAME_INVALID: The provided username is not valid.
|
|
// 403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this.
|
|
//
|
|
// See https://core.telegram.org/method/help.getConfig for reference.
|
|
// Can be used by bots.
|
|
func (c *Client) HelpGetConfig(ctx context.Context) (*Config, error) {
|
|
var result Config
|
|
|
|
request := &HelpGetConfigRequest{}
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return &result, nil
|
|
}
|