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

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