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