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,205 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountGetThemesRequest represents TL type `account.getThemes#7206e458`.
|
||||
// Get installed themes
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getThemes for reference.
|
||||
type AccountGetThemesRequest struct {
|
||||
// Theme format, a string that identifies the theming engines supported by the client
|
||||
Format string
|
||||
// Hash used for caching, for more info click here¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/offsets#hash-generation
|
||||
Hash int64
|
||||
}
|
||||
|
||||
// AccountGetThemesRequestTypeID is TL type id of AccountGetThemesRequest.
|
||||
const AccountGetThemesRequestTypeID = 0x7206e458
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountGetThemesRequest.
|
||||
var (
|
||||
_ bin.Encoder = &AccountGetThemesRequest{}
|
||||
_ bin.Decoder = &AccountGetThemesRequest{}
|
||||
_ bin.BareEncoder = &AccountGetThemesRequest{}
|
||||
_ bin.BareDecoder = &AccountGetThemesRequest{}
|
||||
)
|
||||
|
||||
func (g *AccountGetThemesRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Format == "") {
|
||||
return false
|
||||
}
|
||||
if !(g.Hash == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *AccountGetThemesRequest) String() string {
|
||||
if g == nil {
|
||||
return "AccountGetThemesRequest(nil)"
|
||||
}
|
||||
type Alias AccountGetThemesRequest
|
||||
return fmt.Sprintf("AccountGetThemesRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountGetThemesRequest from given interface.
|
||||
func (g *AccountGetThemesRequest) FillFrom(from interface {
|
||||
GetFormat() (value string)
|
||||
GetHash() (value int64)
|
||||
}) {
|
||||
g.Format = from.GetFormat()
|
||||
g.Hash = from.GetHash()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountGetThemesRequest) TypeID() uint32 {
|
||||
return AccountGetThemesRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountGetThemesRequest) TypeName() string {
|
||||
return "account.getThemes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *AccountGetThemesRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.getThemes",
|
||||
ID: AccountGetThemesRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Format",
|
||||
SchemaName: "format",
|
||||
},
|
||||
{
|
||||
Name: "Hash",
|
||||
SchemaName: "hash",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *AccountGetThemesRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getThemes#7206e458 as nil")
|
||||
}
|
||||
b.PutID(AccountGetThemesRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *AccountGetThemesRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode account.getThemes#7206e458 as nil")
|
||||
}
|
||||
b.PutString(g.Format)
|
||||
b.PutLong(g.Hash)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *AccountGetThemesRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getThemes#7206e458 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountGetThemesRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.getThemes#7206e458: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *AccountGetThemesRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode account.getThemes#7206e458 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getThemes#7206e458: field format: %w", err)
|
||||
}
|
||||
g.Format = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.getThemes#7206e458: field hash: %w", err)
|
||||
}
|
||||
g.Hash = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetFormat returns value of Format field.
|
||||
func (g *AccountGetThemesRequest) GetFormat() (value string) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Format
|
||||
}
|
||||
|
||||
// GetHash returns value of Hash field.
|
||||
func (g *AccountGetThemesRequest) GetHash() (value int64) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Hash
|
||||
}
|
||||
|
||||
// AccountGetThemes invokes method account.getThemes#7206e458 returning error if any.
|
||||
// Get installed themes
|
||||
//
|
||||
// See https://core.telegram.org/method/account.getThemes for reference.
|
||||
func (c *Client) AccountGetThemes(ctx context.Context, request *AccountGetThemesRequest) (AccountThemesClass, error) {
|
||||
var result AccountThemesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Themes, nil
|
||||
}
|
||||
Reference in New Issue
Block a user