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
238 lines
5.9 KiB
Go
238 lines
5.9 KiB
Go
// 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{}
|
|
)
|
|
|
|
// SetUserEmojiStatusRequest represents TL type `setUserEmojiStatus#e5165bcb`.
|
|
type SetUserEmojiStatusRequest struct {
|
|
// Identifier of the user
|
|
UserID int64
|
|
// New emoji status; pass null to switch to the default badge
|
|
EmojiStatus EmojiStatus
|
|
}
|
|
|
|
// SetUserEmojiStatusRequestTypeID is TL type id of SetUserEmojiStatusRequest.
|
|
const SetUserEmojiStatusRequestTypeID = 0xe5165bcb
|
|
|
|
// Ensuring interfaces in compile-time for SetUserEmojiStatusRequest.
|
|
var (
|
|
_ bin.Encoder = &SetUserEmojiStatusRequest{}
|
|
_ bin.Decoder = &SetUserEmojiStatusRequest{}
|
|
_ bin.BareEncoder = &SetUserEmojiStatusRequest{}
|
|
_ bin.BareDecoder = &SetUserEmojiStatusRequest{}
|
|
)
|
|
|
|
func (s *SetUserEmojiStatusRequest) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(s.EmojiStatus.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *SetUserEmojiStatusRequest) String() string {
|
|
if s == nil {
|
|
return "SetUserEmojiStatusRequest(nil)"
|
|
}
|
|
type Alias SetUserEmojiStatusRequest
|
|
return fmt.Sprintf("SetUserEmojiStatusRequest%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*SetUserEmojiStatusRequest) TypeID() uint32 {
|
|
return SetUserEmojiStatusRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*SetUserEmojiStatusRequest) TypeName() string {
|
|
return "setUserEmojiStatus"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *SetUserEmojiStatusRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "setUserEmojiStatus",
|
|
ID: SetUserEmojiStatusRequestTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "EmojiStatus",
|
|
SchemaName: "emoji_status",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *SetUserEmojiStatusRequest) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setUserEmojiStatus#e5165bcb as nil")
|
|
}
|
|
b.PutID(SetUserEmojiStatusRequestTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *SetUserEmojiStatusRequest) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setUserEmojiStatus#e5165bcb as nil")
|
|
}
|
|
b.PutInt53(s.UserID)
|
|
if err := s.EmojiStatus.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *SetUserEmojiStatusRequest) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setUserEmojiStatus#e5165bcb to nil")
|
|
}
|
|
if err := b.ConsumeID(SetUserEmojiStatusRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *SetUserEmojiStatusRequest) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setUserEmojiStatus#e5165bcb to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field user_id: %w", err)
|
|
}
|
|
s.UserID = value
|
|
}
|
|
{
|
|
if err := s.EmojiStatus.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *SetUserEmojiStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode setUserEmojiStatus#e5165bcb as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("setUserEmojiStatus")
|
|
b.Comma()
|
|
b.FieldStart("user_id")
|
|
b.PutInt53(s.UserID)
|
|
b.Comma()
|
|
b.FieldStart("emoji_status")
|
|
if err := s.EmojiStatus.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *SetUserEmojiStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode setUserEmojiStatus#e5165bcb to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("setUserEmojiStatus"); err != nil {
|
|
return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: %w", err)
|
|
}
|
|
case "user_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field user_id: %w", err)
|
|
}
|
|
s.UserID = value
|
|
case "emoji_status":
|
|
if err := s.EmojiStatus.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (s *SetUserEmojiStatusRequest) GetUserID() (value int64) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.UserID
|
|
}
|
|
|
|
// GetEmojiStatus returns value of EmojiStatus field.
|
|
func (s *SetUserEmojiStatusRequest) GetEmojiStatus() (value EmojiStatus) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.EmojiStatus
|
|
}
|
|
|
|
// SetUserEmojiStatus invokes method setUserEmojiStatus#e5165bcb returning error if any.
|
|
func (c *Client) SetUserEmojiStatus(ctx context.Context, request *SetUserEmojiStatusRequest) error {
|
|
var ok Ok
|
|
|
|
if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|