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
207 lines
5.3 KiB
Go
207 lines
5.3 KiB
Go
// 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{}
|
|
)
|
|
|
|
// DeleteBusinessConnectedBotRequest represents TL type `deleteBusinessConnectedBot#9e9b7e55`.
|
|
type DeleteBusinessConnectedBotRequest struct {
|
|
// Unique user identifier for the bot
|
|
BotUserID int64
|
|
}
|
|
|
|
// DeleteBusinessConnectedBotRequestTypeID is TL type id of DeleteBusinessConnectedBotRequest.
|
|
const DeleteBusinessConnectedBotRequestTypeID = 0x9e9b7e55
|
|
|
|
// Ensuring interfaces in compile-time for DeleteBusinessConnectedBotRequest.
|
|
var (
|
|
_ bin.Encoder = &DeleteBusinessConnectedBotRequest{}
|
|
_ bin.Decoder = &DeleteBusinessConnectedBotRequest{}
|
|
_ bin.BareEncoder = &DeleteBusinessConnectedBotRequest{}
|
|
_ bin.BareDecoder = &DeleteBusinessConnectedBotRequest{}
|
|
)
|
|
|
|
func (d *DeleteBusinessConnectedBotRequest) Zero() bool {
|
|
if d == nil {
|
|
return true
|
|
}
|
|
if !(d.BotUserID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (d *DeleteBusinessConnectedBotRequest) String() string {
|
|
if d == nil {
|
|
return "DeleteBusinessConnectedBotRequest(nil)"
|
|
}
|
|
type Alias DeleteBusinessConnectedBotRequest
|
|
return fmt.Sprintf("DeleteBusinessConnectedBotRequest%+v", Alias(*d))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*DeleteBusinessConnectedBotRequest) TypeID() uint32 {
|
|
return DeleteBusinessConnectedBotRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*DeleteBusinessConnectedBotRequest) TypeName() string {
|
|
return "deleteBusinessConnectedBot"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (d *DeleteBusinessConnectedBotRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "deleteBusinessConnectedBot",
|
|
ID: DeleteBusinessConnectedBotRequestTypeID,
|
|
}
|
|
if d == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BotUserID",
|
|
SchemaName: "bot_user_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (d *DeleteBusinessConnectedBotRequest) Encode(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil")
|
|
}
|
|
b.PutID(DeleteBusinessConnectedBotRequestTypeID)
|
|
return d.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (d *DeleteBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil")
|
|
}
|
|
b.PutInt53(d.BotUserID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (d *DeleteBusinessConnectedBotRequest) Decode(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil")
|
|
}
|
|
if err := b.ConsumeID(DeleteBusinessConnectedBotRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: %w", err)
|
|
}
|
|
return d.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (d *DeleteBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: field bot_user_id: %w", err)
|
|
}
|
|
d.BotUserID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (d *DeleteBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("deleteBusinessConnectedBot")
|
|
b.Comma()
|
|
b.FieldStart("bot_user_id")
|
|
b.PutInt53(d.BotUserID)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (d *DeleteBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("deleteBusinessConnectedBot"); err != nil {
|
|
return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: %w", err)
|
|
}
|
|
case "bot_user_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: field bot_user_id: %w", err)
|
|
}
|
|
d.BotUserID = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetBotUserID returns value of BotUserID field.
|
|
func (d *DeleteBusinessConnectedBotRequest) GetBotUserID() (value int64) {
|
|
if d == nil {
|
|
return
|
|
}
|
|
return d.BotUserID
|
|
}
|
|
|
|
// DeleteBusinessConnectedBot invokes method deleteBusinessConnectedBot#9e9b7e55 returning error if any.
|
|
func (c *Client) DeleteBusinessConnectedBot(ctx context.Context, botuserid int64) error {
|
|
var ok Ok
|
|
|
|
request := &DeleteBusinessConnectedBotRequest{
|
|
BotUserID: botuserid,
|
|
}
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|