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,178 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tg
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// HelpGetAppUpdateRequest represents TL type `help.getAppUpdate#522d5a7d`.
|
||||
// Returns information on update availability for the current application.
|
||||
//
|
||||
// See https://core.telegram.org/method/help.getAppUpdate for reference.
|
||||
type HelpGetAppUpdateRequest struct {
|
||||
// Source
|
||||
Source string
|
||||
}
|
||||
|
||||
// HelpGetAppUpdateRequestTypeID is TL type id of HelpGetAppUpdateRequest.
|
||||
const HelpGetAppUpdateRequestTypeID = 0x522d5a7d
|
||||
|
||||
// Ensuring interfaces in compile-time for HelpGetAppUpdateRequest.
|
||||
var (
|
||||
_ bin.Encoder = &HelpGetAppUpdateRequest{}
|
||||
_ bin.Decoder = &HelpGetAppUpdateRequest{}
|
||||
_ bin.BareEncoder = &HelpGetAppUpdateRequest{}
|
||||
_ bin.BareDecoder = &HelpGetAppUpdateRequest{}
|
||||
)
|
||||
|
||||
func (g *HelpGetAppUpdateRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Source == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *HelpGetAppUpdateRequest) String() string {
|
||||
if g == nil {
|
||||
return "HelpGetAppUpdateRequest(nil)"
|
||||
}
|
||||
type Alias HelpGetAppUpdateRequest
|
||||
return fmt.Sprintf("HelpGetAppUpdateRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills HelpGetAppUpdateRequest from given interface.
|
||||
func (g *HelpGetAppUpdateRequest) FillFrom(from interface {
|
||||
GetSource() (value string)
|
||||
}) {
|
||||
g.Source = from.GetSource()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*HelpGetAppUpdateRequest) TypeID() uint32 {
|
||||
return HelpGetAppUpdateRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*HelpGetAppUpdateRequest) TypeName() string {
|
||||
return "help.getAppUpdate"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *HelpGetAppUpdateRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "help.getAppUpdate",
|
||||
ID: HelpGetAppUpdateRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Source",
|
||||
SchemaName: "source",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *HelpGetAppUpdateRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode help.getAppUpdate#522d5a7d as nil")
|
||||
}
|
||||
b.PutID(HelpGetAppUpdateRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *HelpGetAppUpdateRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode help.getAppUpdate#522d5a7d as nil")
|
||||
}
|
||||
b.PutString(g.Source)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *HelpGetAppUpdateRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode help.getAppUpdate#522d5a7d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(HelpGetAppUpdateRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode help.getAppUpdate#522d5a7d: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *HelpGetAppUpdateRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode help.getAppUpdate#522d5a7d to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode help.getAppUpdate#522d5a7d: field source: %w", err)
|
||||
}
|
||||
g.Source = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSource returns value of Source field.
|
||||
func (g *HelpGetAppUpdateRequest) GetSource() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Source
|
||||
}
|
||||
|
||||
// HelpGetAppUpdate invokes method help.getAppUpdate#522d5a7d returning error if any.
|
||||
// Returns information on update availability for the current application.
|
||||
//
|
||||
// See https://core.telegram.org/method/help.getAppUpdate for reference.
|
||||
func (c *Client) HelpGetAppUpdate(ctx context.Context, source string) (HelpAppUpdateClass, error) {
|
||||
var result HelpAppUpdateBox
|
||||
|
||||
request := &HelpGetAppUpdateRequest{
|
||||
Source: source,
|
||||
}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.AppUpdate, nil
|
||||
}
|
||||
Reference in New Issue
Block a user