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

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