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{}
|
||||
)
|
||||
|
||||
// GetBasicGroupRequest represents TL type `getBasicGroup#9e893654`.
|
||||
type GetBasicGroupRequest struct {
|
||||
// Basic group identifier
|
||||
BasicGroupID int64
|
||||
}
|
||||
|
||||
// GetBasicGroupRequestTypeID is TL type id of GetBasicGroupRequest.
|
||||
const GetBasicGroupRequestTypeID = 0x9e893654
|
||||
|
||||
// Ensuring interfaces in compile-time for GetBasicGroupRequest.
|
||||
var (
|
||||
_ bin.Encoder = &GetBasicGroupRequest{}
|
||||
_ bin.Decoder = &GetBasicGroupRequest{}
|
||||
_ bin.BareEncoder = &GetBasicGroupRequest{}
|
||||
_ bin.BareDecoder = &GetBasicGroupRequest{}
|
||||
)
|
||||
|
||||
func (g *GetBasicGroupRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.BasicGroupID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GetBasicGroupRequest) String() string {
|
||||
if g == nil {
|
||||
return "GetBasicGroupRequest(nil)"
|
||||
}
|
||||
type Alias GetBasicGroupRequest
|
||||
return fmt.Sprintf("GetBasicGroupRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GetBasicGroupRequest) TypeID() uint32 {
|
||||
return GetBasicGroupRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GetBasicGroupRequest) TypeName() string {
|
||||
return "getBasicGroup"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GetBasicGroupRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "getBasicGroup",
|
||||
ID: GetBasicGroupRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BasicGroupID",
|
||||
SchemaName: "basic_group_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GetBasicGroupRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getBasicGroup#9e893654 as nil")
|
||||
}
|
||||
b.PutID(GetBasicGroupRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GetBasicGroupRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getBasicGroup#9e893654 as nil")
|
||||
}
|
||||
b.PutInt53(g.BasicGroupID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GetBasicGroupRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getBasicGroup#9e893654 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GetBasicGroupRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode getBasicGroup#9e893654: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GetBasicGroupRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getBasicGroup#9e893654 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getBasicGroup#9e893654: field basic_group_id: %w", err)
|
||||
}
|
||||
g.BasicGroupID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GetBasicGroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getBasicGroup#9e893654 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("getBasicGroup")
|
||||
b.Comma()
|
||||
b.FieldStart("basic_group_id")
|
||||
b.PutInt53(g.BasicGroupID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GetBasicGroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getBasicGroup#9e893654 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("getBasicGroup"); err != nil {
|
||||
return fmt.Errorf("unable to decode getBasicGroup#9e893654: %w", err)
|
||||
}
|
||||
case "basic_group_id":
|
||||
value, err := b.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getBasicGroup#9e893654: field basic_group_id: %w", err)
|
||||
}
|
||||
g.BasicGroupID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetBasicGroupID returns value of BasicGroupID field.
|
||||
func (g *GetBasicGroupRequest) GetBasicGroupID() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.BasicGroupID
|
||||
}
|
||||
|
||||
// GetBasicGroup invokes method getBasicGroup#9e893654 returning error if any.
|
||||
func (c *Client) GetBasicGroup(ctx context.Context, basicgroupid int64) (*BasicGroup, error) {
|
||||
var result BasicGroup
|
||||
|
||||
request := &GetBasicGroupRequest{
|
||||
BasicGroupID: basicgroupid,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user