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,282 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GetArchivedStickerSetsRequest represents TL type `getArchivedStickerSets#3bb8424d`.
|
||||
type GetArchivedStickerSetsRequest struct {
|
||||
// Type of the sticker sets to return
|
||||
StickerType StickerTypeClass
|
||||
// Identifier of the sticker set from which to return the result; use 0 to get results
|
||||
// from the beginning
|
||||
OffsetStickerSetID int64
|
||||
// The maximum number of sticker sets to return; up to 100
|
||||
Limit int32
|
||||
}
|
||||
|
||||
// GetArchivedStickerSetsRequestTypeID is TL type id of GetArchivedStickerSetsRequest.
|
||||
const GetArchivedStickerSetsRequestTypeID = 0x3bb8424d
|
||||
|
||||
// Ensuring interfaces in compile-time for GetArchivedStickerSetsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &GetArchivedStickerSetsRequest{}
|
||||
_ bin.Decoder = &GetArchivedStickerSetsRequest{}
|
||||
_ bin.BareEncoder = &GetArchivedStickerSetsRequest{}
|
||||
_ bin.BareDecoder = &GetArchivedStickerSetsRequest{}
|
||||
)
|
||||
|
||||
func (g *GetArchivedStickerSetsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.StickerType == nil) {
|
||||
return false
|
||||
}
|
||||
if !(g.OffsetStickerSetID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(g.Limit == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GetArchivedStickerSetsRequest) String() string {
|
||||
if g == nil {
|
||||
return "GetArchivedStickerSetsRequest(nil)"
|
||||
}
|
||||
type Alias GetArchivedStickerSetsRequest
|
||||
return fmt.Sprintf("GetArchivedStickerSetsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GetArchivedStickerSetsRequest) TypeID() uint32 {
|
||||
return GetArchivedStickerSetsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GetArchivedStickerSetsRequest) TypeName() string {
|
||||
return "getArchivedStickerSets"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GetArchivedStickerSetsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "getArchivedStickerSets",
|
||||
ID: GetArchivedStickerSetsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "StickerType",
|
||||
SchemaName: "sticker_type",
|
||||
},
|
||||
{
|
||||
Name: "OffsetStickerSetID",
|
||||
SchemaName: "offset_sticker_set_id",
|
||||
},
|
||||
{
|
||||
Name: "Limit",
|
||||
SchemaName: "limit",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GetArchivedStickerSetsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getArchivedStickerSets#3bb8424d as nil")
|
||||
}
|
||||
b.PutID(GetArchivedStickerSetsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GetArchivedStickerSetsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getArchivedStickerSets#3bb8424d as nil")
|
||||
}
|
||||
if g.StickerType == nil {
|
||||
return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type is nil")
|
||||
}
|
||||
if err := g.StickerType.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err)
|
||||
}
|
||||
b.PutLong(g.OffsetStickerSetID)
|
||||
b.PutInt32(g.Limit)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GetArchivedStickerSetsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getArchivedStickerSets#3bb8424d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GetArchivedStickerSetsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GetArchivedStickerSetsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getArchivedStickerSets#3bb8424d to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeStickerType(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err)
|
||||
}
|
||||
g.StickerType = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field offset_sticker_set_id: %w", err)
|
||||
}
|
||||
g.OffsetStickerSetID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field limit: %w", err)
|
||||
}
|
||||
g.Limit = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GetArchivedStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getArchivedStickerSets#3bb8424d as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("getArchivedStickerSets")
|
||||
b.Comma()
|
||||
b.FieldStart("sticker_type")
|
||||
if g.StickerType == nil {
|
||||
return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type is nil")
|
||||
}
|
||||
if err := g.StickerType.EncodeTDLibJSON(b); err != nil {
|
||||
return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err)
|
||||
}
|
||||
b.Comma()
|
||||
b.FieldStart("offset_sticker_set_id")
|
||||
b.PutLong(g.OffsetStickerSetID)
|
||||
b.Comma()
|
||||
b.FieldStart("limit")
|
||||
b.PutInt32(g.Limit)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GetArchivedStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getArchivedStickerSets#3bb8424d to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("getArchivedStickerSets"); err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: %w", err)
|
||||
}
|
||||
case "sticker_type":
|
||||
value, err := DecodeTDLibJSONStickerType(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err)
|
||||
}
|
||||
g.StickerType = value
|
||||
case "offset_sticker_set_id":
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field offset_sticker_set_id: %w", err)
|
||||
}
|
||||
g.OffsetStickerSetID = value
|
||||
case "limit":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field limit: %w", err)
|
||||
}
|
||||
g.Limit = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetStickerType returns value of StickerType field.
|
||||
func (g *GetArchivedStickerSetsRequest) GetStickerType() (value StickerTypeClass) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.StickerType
|
||||
}
|
||||
|
||||
// GetOffsetStickerSetID returns value of OffsetStickerSetID field.
|
||||
func (g *GetArchivedStickerSetsRequest) GetOffsetStickerSetID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.OffsetStickerSetID
|
||||
}
|
||||
|
||||
// GetLimit returns value of Limit field.
|
||||
func (g *GetArchivedStickerSetsRequest) GetLimit() (value int32) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Limit
|
||||
}
|
||||
|
||||
// GetArchivedStickerSets invokes method getArchivedStickerSets#3bb8424d returning error if any.
|
||||
func (c *Client) GetArchivedStickerSets(ctx context.Context, request *GetArchivedStickerSetsRequest) (*StickerSets, error) {
|
||||
var result StickerSets
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user