7a04f298d2
- 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
197 lines
5.0 KiB
Go
Generated
197 lines
5.0 KiB
Go
Generated
// 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{}
|
|
)
|
|
|
|
// AccountGetWallPaperRequest represents TL type `account.getWallPaper#fc8ddbea`.
|
|
// Get info about a certain wallpaper¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/wallpapers
|
|
//
|
|
// See https://core.telegram.org/method/account.getWallPaper for reference.
|
|
type AccountGetWallPaperRequest struct {
|
|
// The wallpaper¹ to get info about
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/wallpapers
|
|
Wallpaper InputWallPaperClass
|
|
}
|
|
|
|
// AccountGetWallPaperRequestTypeID is TL type id of AccountGetWallPaperRequest.
|
|
const AccountGetWallPaperRequestTypeID = 0xfc8ddbea
|
|
|
|
// Ensuring interfaces in compile-time for AccountGetWallPaperRequest.
|
|
var (
|
|
_ bin.Encoder = &AccountGetWallPaperRequest{}
|
|
_ bin.Decoder = &AccountGetWallPaperRequest{}
|
|
_ bin.BareEncoder = &AccountGetWallPaperRequest{}
|
|
_ bin.BareDecoder = &AccountGetWallPaperRequest{}
|
|
)
|
|
|
|
func (g *AccountGetWallPaperRequest) Zero() bool {
|
|
if g == nil {
|
|
return true
|
|
}
|
|
if !(g.Wallpaper == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (g *AccountGetWallPaperRequest) String() string {
|
|
if g == nil {
|
|
return "AccountGetWallPaperRequest(nil)"
|
|
}
|
|
type Alias AccountGetWallPaperRequest
|
|
return fmt.Sprintf("AccountGetWallPaperRequest%+v", Alias(*g))
|
|
}
|
|
|
|
// FillFrom fills AccountGetWallPaperRequest from given interface.
|
|
func (g *AccountGetWallPaperRequest) FillFrom(from interface {
|
|
GetWallpaper() (value InputWallPaperClass)
|
|
}) {
|
|
g.Wallpaper = from.GetWallpaper()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AccountGetWallPaperRequest) TypeID() uint32 {
|
|
return AccountGetWallPaperRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AccountGetWallPaperRequest) TypeName() string {
|
|
return "account.getWallPaper"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (g *AccountGetWallPaperRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "account.getWallPaper",
|
|
ID: AccountGetWallPaperRequestTypeID,
|
|
}
|
|
if g == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Wallpaper",
|
|
SchemaName: "wallpaper",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (g *AccountGetWallPaperRequest) Encode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode account.getWallPaper#fc8ddbea as nil")
|
|
}
|
|
b.PutID(AccountGetWallPaperRequestTypeID)
|
|
return g.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (g *AccountGetWallPaperRequest) EncodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't encode account.getWallPaper#fc8ddbea as nil")
|
|
}
|
|
if g.Wallpaper == nil {
|
|
return fmt.Errorf("unable to encode account.getWallPaper#fc8ddbea: field wallpaper is nil")
|
|
}
|
|
if err := g.Wallpaper.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode account.getWallPaper#fc8ddbea: field wallpaper: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (g *AccountGetWallPaperRequest) Decode(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode account.getWallPaper#fc8ddbea to nil")
|
|
}
|
|
if err := b.ConsumeID(AccountGetWallPaperRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode account.getWallPaper#fc8ddbea: %w", err)
|
|
}
|
|
return g.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (g *AccountGetWallPaperRequest) DecodeBare(b *bin.Buffer) error {
|
|
if g == nil {
|
|
return fmt.Errorf("can't decode account.getWallPaper#fc8ddbea to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputWallPaper(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode account.getWallPaper#fc8ddbea: field wallpaper: %w", err)
|
|
}
|
|
g.Wallpaper = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetWallpaper returns value of Wallpaper field.
|
|
func (g *AccountGetWallPaperRequest) GetWallpaper() (value InputWallPaperClass) {
|
|
if g == nil {
|
|
return
|
|
}
|
|
return g.Wallpaper
|
|
}
|
|
|
|
// AccountGetWallPaper invokes method account.getWallPaper#fc8ddbea returning error if any.
|
|
// Get info about a certain wallpaper¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/wallpapers
|
|
//
|
|
// Possible errors:
|
|
//
|
|
// 400 WALLPAPER_INVALID: The specified wallpaper is invalid.
|
|
//
|
|
// See https://core.telegram.org/method/account.getWallPaper for reference.
|
|
func (c *Client) AccountGetWallPaper(ctx context.Context, wallpaper InputWallPaperClass) (WallPaperClass, error) {
|
|
var result WallPaperBox
|
|
|
|
request := &AccountGetWallPaperRequest{
|
|
Wallpaper: wallpaper,
|
|
}
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return nil, err
|
|
}
|
|
return result.WallPaper, nil
|
|
}
|