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,239 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GetStarSubscriptionsRequest represents TL type `getStarSubscriptions#d9c7b2ec`.
|
||||
type GetStarSubscriptionsRequest struct {
|
||||
// Pass true to receive only expiring subscriptions for which there are no enough
|
||||
// Telegram Stars to extend
|
||||
OnlyExpiring bool
|
||||
// Offset of the first subscription to return as received from the previous request; use
|
||||
// empty string to get the first chunk of results
|
||||
Offset string
|
||||
}
|
||||
|
||||
// GetStarSubscriptionsRequestTypeID is TL type id of GetStarSubscriptionsRequest.
|
||||
const GetStarSubscriptionsRequestTypeID = 0xd9c7b2ec
|
||||
|
||||
// Ensuring interfaces in compile-time for GetStarSubscriptionsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &GetStarSubscriptionsRequest{}
|
||||
_ bin.Decoder = &GetStarSubscriptionsRequest{}
|
||||
_ bin.BareEncoder = &GetStarSubscriptionsRequest{}
|
||||
_ bin.BareDecoder = &GetStarSubscriptionsRequest{}
|
||||
)
|
||||
|
||||
func (g *GetStarSubscriptionsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.OnlyExpiring == false) {
|
||||
return false
|
||||
}
|
||||
if !(g.Offset == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GetStarSubscriptionsRequest) String() string {
|
||||
if g == nil {
|
||||
return "GetStarSubscriptionsRequest(nil)"
|
||||
}
|
||||
type Alias GetStarSubscriptionsRequest
|
||||
return fmt.Sprintf("GetStarSubscriptionsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GetStarSubscriptionsRequest) TypeID() uint32 {
|
||||
return GetStarSubscriptionsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GetStarSubscriptionsRequest) TypeName() string {
|
||||
return "getStarSubscriptions"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GetStarSubscriptionsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "getStarSubscriptions",
|
||||
ID: GetStarSubscriptionsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "OnlyExpiring",
|
||||
SchemaName: "only_expiring",
|
||||
},
|
||||
{
|
||||
Name: "Offset",
|
||||
SchemaName: "offset",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GetStarSubscriptionsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getStarSubscriptions#d9c7b2ec as nil")
|
||||
}
|
||||
b.PutID(GetStarSubscriptionsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GetStarSubscriptionsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getStarSubscriptions#d9c7b2ec as nil")
|
||||
}
|
||||
b.PutBool(g.OnlyExpiring)
|
||||
b.PutString(g.Offset)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GetStarSubscriptionsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getStarSubscriptions#d9c7b2ec to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GetStarSubscriptionsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GetStarSubscriptionsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getStarSubscriptions#d9c7b2ec to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field only_expiring: %w", err)
|
||||
}
|
||||
g.OnlyExpiring = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field offset: %w", err)
|
||||
}
|
||||
g.Offset = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GetStarSubscriptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode getStarSubscriptions#d9c7b2ec as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("getStarSubscriptions")
|
||||
b.Comma()
|
||||
b.FieldStart("only_expiring")
|
||||
b.PutBool(g.OnlyExpiring)
|
||||
b.Comma()
|
||||
b.FieldStart("offset")
|
||||
b.PutString(g.Offset)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GetStarSubscriptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode getStarSubscriptions#d9c7b2ec to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("getStarSubscriptions"); err != nil {
|
||||
return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: %w", err)
|
||||
}
|
||||
case "only_expiring":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field only_expiring: %w", err)
|
||||
}
|
||||
g.OnlyExpiring = value
|
||||
case "offset":
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field offset: %w", err)
|
||||
}
|
||||
g.Offset = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetOnlyExpiring returns value of OnlyExpiring field.
|
||||
func (g *GetStarSubscriptionsRequest) GetOnlyExpiring() (value bool) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.OnlyExpiring
|
||||
}
|
||||
|
||||
// GetOffset returns value of Offset field.
|
||||
func (g *GetStarSubscriptionsRequest) GetOffset() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Offset
|
||||
}
|
||||
|
||||
// GetStarSubscriptions invokes method getStarSubscriptions#d9c7b2ec returning error if any.
|
||||
func (c *Client) GetStarSubscriptions(ctx context.Context, request *GetStarSubscriptionsRequest) (*StarSubscriptions, error) {
|
||||
var result StarSubscriptions
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user