move gotd fork into repo. (#111)
- 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
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GetStickerSetNameRequest represents TL type `getStickerSetName#3dfad681`.
|
||||
type GetStickerSetNameRequest struct {
|
||||
// Identifier of the sticker set
|
||||
SetID int64
|
||||
}
|
||||
|
||||
// GetStickerSetNameRequestTypeID is TL type id of GetStickerSetNameRequest.
|
||||
const GetStickerSetNameRequestTypeID = 0x3dfad681
|
||||
|
||||
// Ensuring interfaces in compile-time for GetStickerSetNameRequest.
|
||||
var (
|
||||
_ bin.Encoder = &GetStickerSetNameRequest{}
|
||||
_ bin.Decoder = &GetStickerSetNameRequest{}
|
||||
_ bin.BareEncoder = &GetStickerSetNameRequest{}
|
||||
_ bin.BareDecoder = &GetStickerSetNameRequest{}
|
||||
)
|
||||
|
||||
func (g *GetStickerSetNameRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.SetID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GetStickerSetNameRequest) String() string {
|
||||
if g == nil {
|
||||
return "GetStickerSetNameRequest(nil)"
|
||||
}
|
||||
type Alias GetStickerSetNameRequest
|
||||
return fmt.Sprintf("GetStickerSetNameRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GetStickerSetNameRequest) TypeID() uint32 {
|
||||
return GetStickerSetNameRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GetStickerSetNameRequest) TypeName() string {
|
||||
return "getStickerSetName"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GetStickerSetNameRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "getStickerSetName",
|
||||
ID: GetStickerSetNameRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SetID",
|
||||
SchemaName: "set_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GetStickerSetNameRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil")
|
||||
}
|
||||
b.PutID(GetStickerSetNameRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GetStickerSetNameRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil")
|
||||
}
|
||||
b.PutLong(g.SetID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GetStickerSetNameRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GetStickerSetNameRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode getStickerSetName#3dfad681: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GetStickerSetNameRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getStickerSetName#3dfad681: field set_id: %w", err)
|
||||
}
|
||||
g.SetID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GetStickerSetNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("getStickerSetName")
|
||||
b.Comma()
|
||||
b.FieldStart("set_id")
|
||||
b.PutLong(g.SetID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GetStickerSetNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("getStickerSetName"); err != nil {
|
||||
return fmt.Errorf("unable to decode getStickerSetName#3dfad681: %w", err)
|
||||
}
|
||||
case "set_id":
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getStickerSetName#3dfad681: field set_id: %w", err)
|
||||
}
|
||||
g.SetID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetSetID returns value of SetID field.
|
||||
func (g *GetStickerSetNameRequest) GetSetID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.SetID
|
||||
}
|
||||
|
||||
// GetStickerSetName invokes method getStickerSetName#3dfad681 returning error if any.
|
||||
func (c *Client) GetStickerSetName(ctx context.Context, setid int64) (*Text, error) {
|
||||
var result Text
|
||||
|
||||
request := &GetStickerSetNameRequest{
|
||||
SetID: setid,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user