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
1227 lines
34 KiB
Go
1227 lines
34 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{}
|
|
)
|
|
|
|
// ChatActionBarReportSpam represents TL type `chatActionBarReportSpam#b1c0e61a`.
|
|
type ChatActionBarReportSpam struct {
|
|
// If true, the chat was automatically archived and can be moved back to the main chat
|
|
// list using addChatToList simultaneously with setting chat notification settings to
|
|
// default using setChatNotificationSettings
|
|
CanUnarchive bool
|
|
}
|
|
|
|
// ChatActionBarReportSpamTypeID is TL type id of ChatActionBarReportSpam.
|
|
const ChatActionBarReportSpamTypeID = 0xb1c0e61a
|
|
|
|
// construct implements constructor of ChatActionBarClass.
|
|
func (c ChatActionBarReportSpam) construct() ChatActionBarClass { return &c }
|
|
|
|
// Ensuring interfaces in compile-time for ChatActionBarReportSpam.
|
|
var (
|
|
_ bin.Encoder = &ChatActionBarReportSpam{}
|
|
_ bin.Decoder = &ChatActionBarReportSpam{}
|
|
_ bin.BareEncoder = &ChatActionBarReportSpam{}
|
|
_ bin.BareDecoder = &ChatActionBarReportSpam{}
|
|
|
|
_ ChatActionBarClass = &ChatActionBarReportSpam{}
|
|
)
|
|
|
|
func (c *ChatActionBarReportSpam) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.CanUnarchive == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *ChatActionBarReportSpam) String() string {
|
|
if c == nil {
|
|
return "ChatActionBarReportSpam(nil)"
|
|
}
|
|
type Alias ChatActionBarReportSpam
|
|
return fmt.Sprintf("ChatActionBarReportSpam%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChatActionBarReportSpam) TypeID() uint32 {
|
|
return ChatActionBarReportSpamTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChatActionBarReportSpam) TypeName() string {
|
|
return "chatActionBarReportSpam"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *ChatActionBarReportSpam) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chatActionBarReportSpam",
|
|
ID: ChatActionBarReportSpamTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "CanUnarchive",
|
|
SchemaName: "can_unarchive",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *ChatActionBarReportSpam) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarReportSpam#b1c0e61a as nil")
|
|
}
|
|
b.PutID(ChatActionBarReportSpamTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *ChatActionBarReportSpam) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarReportSpam#b1c0e61a as nil")
|
|
}
|
|
b.PutBool(c.CanUnarchive)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *ChatActionBarReportSpam) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarReportSpam#b1c0e61a to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatActionBarReportSpamTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *ChatActionBarReportSpam) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarReportSpam#b1c0e61a to nil")
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: field can_unarchive: %w", err)
|
|
}
|
|
c.CanUnarchive = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *ChatActionBarReportSpam) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarReportSpam#b1c0e61a as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chatActionBarReportSpam")
|
|
b.Comma()
|
|
b.FieldStart("can_unarchive")
|
|
b.PutBool(c.CanUnarchive)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *ChatActionBarReportSpam) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarReportSpam#b1c0e61a to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chatActionBarReportSpam"); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: %w", err)
|
|
}
|
|
case "can_unarchive":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: field can_unarchive: %w", err)
|
|
}
|
|
c.CanUnarchive = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetCanUnarchive returns value of CanUnarchive field.
|
|
func (c *ChatActionBarReportSpam) GetCanUnarchive() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.CanUnarchive
|
|
}
|
|
|
|
// ChatActionBarInviteMembers represents TL type `chatActionBarInviteMembers#76557c70`.
|
|
type ChatActionBarInviteMembers struct {
|
|
}
|
|
|
|
// ChatActionBarInviteMembersTypeID is TL type id of ChatActionBarInviteMembers.
|
|
const ChatActionBarInviteMembersTypeID = 0x76557c70
|
|
|
|
// construct implements constructor of ChatActionBarClass.
|
|
func (c ChatActionBarInviteMembers) construct() ChatActionBarClass { return &c }
|
|
|
|
// Ensuring interfaces in compile-time for ChatActionBarInviteMembers.
|
|
var (
|
|
_ bin.Encoder = &ChatActionBarInviteMembers{}
|
|
_ bin.Decoder = &ChatActionBarInviteMembers{}
|
|
_ bin.BareEncoder = &ChatActionBarInviteMembers{}
|
|
_ bin.BareDecoder = &ChatActionBarInviteMembers{}
|
|
|
|
_ ChatActionBarClass = &ChatActionBarInviteMembers{}
|
|
)
|
|
|
|
func (c *ChatActionBarInviteMembers) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *ChatActionBarInviteMembers) String() string {
|
|
if c == nil {
|
|
return "ChatActionBarInviteMembers(nil)"
|
|
}
|
|
type Alias ChatActionBarInviteMembers
|
|
return fmt.Sprintf("ChatActionBarInviteMembers%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChatActionBarInviteMembers) TypeID() uint32 {
|
|
return ChatActionBarInviteMembersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChatActionBarInviteMembers) TypeName() string {
|
|
return "chatActionBarInviteMembers"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *ChatActionBarInviteMembers) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chatActionBarInviteMembers",
|
|
ID: ChatActionBarInviteMembersTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *ChatActionBarInviteMembers) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarInviteMembers#76557c70 as nil")
|
|
}
|
|
b.PutID(ChatActionBarInviteMembersTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *ChatActionBarInviteMembers) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarInviteMembers#76557c70 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *ChatActionBarInviteMembers) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarInviteMembers#76557c70 to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatActionBarInviteMembersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarInviteMembers#76557c70: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *ChatActionBarInviteMembers) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarInviteMembers#76557c70 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *ChatActionBarInviteMembers) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarInviteMembers#76557c70 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chatActionBarInviteMembers")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *ChatActionBarInviteMembers) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarInviteMembers#76557c70 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chatActionBarInviteMembers"); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarInviteMembers#76557c70: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// ChatActionBarReportAddBlock represents TL type `chatActionBarReportAddBlock#a7f98e8b`.
|
|
type ChatActionBarReportAddBlock struct {
|
|
// If true, the chat was automatically archived and can be moved back to the main chat
|
|
// list using addChatToList simultaneously with setting chat notification settings to
|
|
// default using setChatNotificationSettings
|
|
CanUnarchive bool
|
|
// Basic information about the other user in the chat; may be null if unknown
|
|
AccountInfo AccountInfo
|
|
}
|
|
|
|
// ChatActionBarReportAddBlockTypeID is TL type id of ChatActionBarReportAddBlock.
|
|
const ChatActionBarReportAddBlockTypeID = 0xa7f98e8b
|
|
|
|
// construct implements constructor of ChatActionBarClass.
|
|
func (c ChatActionBarReportAddBlock) construct() ChatActionBarClass { return &c }
|
|
|
|
// Ensuring interfaces in compile-time for ChatActionBarReportAddBlock.
|
|
var (
|
|
_ bin.Encoder = &ChatActionBarReportAddBlock{}
|
|
_ bin.Decoder = &ChatActionBarReportAddBlock{}
|
|
_ bin.BareEncoder = &ChatActionBarReportAddBlock{}
|
|
_ bin.BareDecoder = &ChatActionBarReportAddBlock{}
|
|
|
|
_ ChatActionBarClass = &ChatActionBarReportAddBlock{}
|
|
)
|
|
|
|
func (c *ChatActionBarReportAddBlock) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.CanUnarchive == false) {
|
|
return false
|
|
}
|
|
if !(c.AccountInfo.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *ChatActionBarReportAddBlock) String() string {
|
|
if c == nil {
|
|
return "ChatActionBarReportAddBlock(nil)"
|
|
}
|
|
type Alias ChatActionBarReportAddBlock
|
|
return fmt.Sprintf("ChatActionBarReportAddBlock%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChatActionBarReportAddBlock) TypeID() uint32 {
|
|
return ChatActionBarReportAddBlockTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChatActionBarReportAddBlock) TypeName() string {
|
|
return "chatActionBarReportAddBlock"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *ChatActionBarReportAddBlock) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chatActionBarReportAddBlock",
|
|
ID: ChatActionBarReportAddBlockTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "CanUnarchive",
|
|
SchemaName: "can_unarchive",
|
|
},
|
|
{
|
|
Name: "AccountInfo",
|
|
SchemaName: "account_info",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *ChatActionBarReportAddBlock) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarReportAddBlock#a7f98e8b as nil")
|
|
}
|
|
b.PutID(ChatActionBarReportAddBlockTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *ChatActionBarReportAddBlock) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarReportAddBlock#a7f98e8b as nil")
|
|
}
|
|
b.PutBool(c.CanUnarchive)
|
|
if err := c.AccountInfo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chatActionBarReportAddBlock#a7f98e8b: field account_info: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *ChatActionBarReportAddBlock) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarReportAddBlock#a7f98e8b to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatActionBarReportAddBlockTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a7f98e8b: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *ChatActionBarReportAddBlock) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarReportAddBlock#a7f98e8b to nil")
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a7f98e8b: field can_unarchive: %w", err)
|
|
}
|
|
c.CanUnarchive = value
|
|
}
|
|
{
|
|
if err := c.AccountInfo.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a7f98e8b: field account_info: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *ChatActionBarReportAddBlock) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarReportAddBlock#a7f98e8b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chatActionBarReportAddBlock")
|
|
b.Comma()
|
|
b.FieldStart("can_unarchive")
|
|
b.PutBool(c.CanUnarchive)
|
|
b.Comma()
|
|
b.FieldStart("account_info")
|
|
if err := c.AccountInfo.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chatActionBarReportAddBlock#a7f98e8b: field account_info: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *ChatActionBarReportAddBlock) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarReportAddBlock#a7f98e8b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chatActionBarReportAddBlock"); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a7f98e8b: %w", err)
|
|
}
|
|
case "can_unarchive":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a7f98e8b: field can_unarchive: %w", err)
|
|
}
|
|
c.CanUnarchive = value
|
|
case "account_info":
|
|
if err := c.AccountInfo.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a7f98e8b: field account_info: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetCanUnarchive returns value of CanUnarchive field.
|
|
func (c *ChatActionBarReportAddBlock) GetCanUnarchive() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.CanUnarchive
|
|
}
|
|
|
|
// GetAccountInfo returns value of AccountInfo field.
|
|
func (c *ChatActionBarReportAddBlock) GetAccountInfo() (value AccountInfo) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.AccountInfo
|
|
}
|
|
|
|
// ChatActionBarAddContact represents TL type `chatActionBarAddContact#d44a5811`.
|
|
type ChatActionBarAddContact struct {
|
|
}
|
|
|
|
// ChatActionBarAddContactTypeID is TL type id of ChatActionBarAddContact.
|
|
const ChatActionBarAddContactTypeID = 0xd44a5811
|
|
|
|
// construct implements constructor of ChatActionBarClass.
|
|
func (c ChatActionBarAddContact) construct() ChatActionBarClass { return &c }
|
|
|
|
// Ensuring interfaces in compile-time for ChatActionBarAddContact.
|
|
var (
|
|
_ bin.Encoder = &ChatActionBarAddContact{}
|
|
_ bin.Decoder = &ChatActionBarAddContact{}
|
|
_ bin.BareEncoder = &ChatActionBarAddContact{}
|
|
_ bin.BareDecoder = &ChatActionBarAddContact{}
|
|
|
|
_ ChatActionBarClass = &ChatActionBarAddContact{}
|
|
)
|
|
|
|
func (c *ChatActionBarAddContact) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *ChatActionBarAddContact) String() string {
|
|
if c == nil {
|
|
return "ChatActionBarAddContact(nil)"
|
|
}
|
|
type Alias ChatActionBarAddContact
|
|
return fmt.Sprintf("ChatActionBarAddContact%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChatActionBarAddContact) TypeID() uint32 {
|
|
return ChatActionBarAddContactTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChatActionBarAddContact) TypeName() string {
|
|
return "chatActionBarAddContact"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *ChatActionBarAddContact) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chatActionBarAddContact",
|
|
ID: ChatActionBarAddContactTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *ChatActionBarAddContact) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarAddContact#d44a5811 as nil")
|
|
}
|
|
b.PutID(ChatActionBarAddContactTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *ChatActionBarAddContact) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarAddContact#d44a5811 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *ChatActionBarAddContact) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarAddContact#d44a5811 to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatActionBarAddContactTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarAddContact#d44a5811: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *ChatActionBarAddContact) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarAddContact#d44a5811 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *ChatActionBarAddContact) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarAddContact#d44a5811 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chatActionBarAddContact")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *ChatActionBarAddContact) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarAddContact#d44a5811 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chatActionBarAddContact"); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarAddContact#d44a5811: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// ChatActionBarSharePhoneNumber represents TL type `chatActionBarSharePhoneNumber#218efd9`.
|
|
type ChatActionBarSharePhoneNumber struct {
|
|
}
|
|
|
|
// ChatActionBarSharePhoneNumberTypeID is TL type id of ChatActionBarSharePhoneNumber.
|
|
const ChatActionBarSharePhoneNumberTypeID = 0x218efd9
|
|
|
|
// construct implements constructor of ChatActionBarClass.
|
|
func (c ChatActionBarSharePhoneNumber) construct() ChatActionBarClass { return &c }
|
|
|
|
// Ensuring interfaces in compile-time for ChatActionBarSharePhoneNumber.
|
|
var (
|
|
_ bin.Encoder = &ChatActionBarSharePhoneNumber{}
|
|
_ bin.Decoder = &ChatActionBarSharePhoneNumber{}
|
|
_ bin.BareEncoder = &ChatActionBarSharePhoneNumber{}
|
|
_ bin.BareDecoder = &ChatActionBarSharePhoneNumber{}
|
|
|
|
_ ChatActionBarClass = &ChatActionBarSharePhoneNumber{}
|
|
)
|
|
|
|
func (c *ChatActionBarSharePhoneNumber) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *ChatActionBarSharePhoneNumber) String() string {
|
|
if c == nil {
|
|
return "ChatActionBarSharePhoneNumber(nil)"
|
|
}
|
|
type Alias ChatActionBarSharePhoneNumber
|
|
return fmt.Sprintf("ChatActionBarSharePhoneNumber%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChatActionBarSharePhoneNumber) TypeID() uint32 {
|
|
return ChatActionBarSharePhoneNumberTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChatActionBarSharePhoneNumber) TypeName() string {
|
|
return "chatActionBarSharePhoneNumber"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *ChatActionBarSharePhoneNumber) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chatActionBarSharePhoneNumber",
|
|
ID: ChatActionBarSharePhoneNumberTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *ChatActionBarSharePhoneNumber) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarSharePhoneNumber#218efd9 as nil")
|
|
}
|
|
b.PutID(ChatActionBarSharePhoneNumberTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *ChatActionBarSharePhoneNumber) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarSharePhoneNumber#218efd9 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *ChatActionBarSharePhoneNumber) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarSharePhoneNumber#218efd9 to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatActionBarSharePhoneNumberTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarSharePhoneNumber#218efd9: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *ChatActionBarSharePhoneNumber) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarSharePhoneNumber#218efd9 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *ChatActionBarSharePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarSharePhoneNumber#218efd9 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chatActionBarSharePhoneNumber")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *ChatActionBarSharePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarSharePhoneNumber#218efd9 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chatActionBarSharePhoneNumber"); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarSharePhoneNumber#218efd9: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// ChatActionBarJoinRequest represents TL type `chatActionBarJoinRequest#3dd18308`.
|
|
type ChatActionBarJoinRequest struct {
|
|
// Title of the chat to which the join request was sent
|
|
Title string
|
|
// True, if the join request was sent to a channel chat
|
|
IsChannel bool
|
|
// Point in time (Unix timestamp) when the join request was sent
|
|
RequestDate int32
|
|
}
|
|
|
|
// ChatActionBarJoinRequestTypeID is TL type id of ChatActionBarJoinRequest.
|
|
const ChatActionBarJoinRequestTypeID = 0x3dd18308
|
|
|
|
// construct implements constructor of ChatActionBarClass.
|
|
func (c ChatActionBarJoinRequest) construct() ChatActionBarClass { return &c }
|
|
|
|
// Ensuring interfaces in compile-time for ChatActionBarJoinRequest.
|
|
var (
|
|
_ bin.Encoder = &ChatActionBarJoinRequest{}
|
|
_ bin.Decoder = &ChatActionBarJoinRequest{}
|
|
_ bin.BareEncoder = &ChatActionBarJoinRequest{}
|
|
_ bin.BareDecoder = &ChatActionBarJoinRequest{}
|
|
|
|
_ ChatActionBarClass = &ChatActionBarJoinRequest{}
|
|
)
|
|
|
|
func (c *ChatActionBarJoinRequest) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.Title == "") {
|
|
return false
|
|
}
|
|
if !(c.IsChannel == false) {
|
|
return false
|
|
}
|
|
if !(c.RequestDate == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *ChatActionBarJoinRequest) String() string {
|
|
if c == nil {
|
|
return "ChatActionBarJoinRequest(nil)"
|
|
}
|
|
type Alias ChatActionBarJoinRequest
|
|
return fmt.Sprintf("ChatActionBarJoinRequest%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*ChatActionBarJoinRequest) TypeID() uint32 {
|
|
return ChatActionBarJoinRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*ChatActionBarJoinRequest) TypeName() string {
|
|
return "chatActionBarJoinRequest"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *ChatActionBarJoinRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chatActionBarJoinRequest",
|
|
ID: ChatActionBarJoinRequestTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "IsChannel",
|
|
SchemaName: "is_channel",
|
|
},
|
|
{
|
|
Name: "RequestDate",
|
|
SchemaName: "request_date",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *ChatActionBarJoinRequest) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarJoinRequest#3dd18308 as nil")
|
|
}
|
|
b.PutID(ChatActionBarJoinRequestTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *ChatActionBarJoinRequest) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarJoinRequest#3dd18308 as nil")
|
|
}
|
|
b.PutString(c.Title)
|
|
b.PutBool(c.IsChannel)
|
|
b.PutInt32(c.RequestDate)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *ChatActionBarJoinRequest) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarJoinRequest#3dd18308 to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatActionBarJoinRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *ChatActionBarJoinRequest) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarJoinRequest#3dd18308 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field title: %w", err)
|
|
}
|
|
c.Title = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field is_channel: %w", err)
|
|
}
|
|
c.IsChannel = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field request_date: %w", err)
|
|
}
|
|
c.RequestDate = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *ChatActionBarJoinRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chatActionBarJoinRequest#3dd18308 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chatActionBarJoinRequest")
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(c.Title)
|
|
b.Comma()
|
|
b.FieldStart("is_channel")
|
|
b.PutBool(c.IsChannel)
|
|
b.Comma()
|
|
b.FieldStart("request_date")
|
|
b.PutInt32(c.RequestDate)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *ChatActionBarJoinRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chatActionBarJoinRequest#3dd18308 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chatActionBarJoinRequest"); err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: %w", err)
|
|
}
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field title: %w", err)
|
|
}
|
|
c.Title = value
|
|
case "is_channel":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field is_channel: %w", err)
|
|
}
|
|
c.IsChannel = value
|
|
case "request_date":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field request_date: %w", err)
|
|
}
|
|
c.RequestDate = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (c *ChatActionBarJoinRequest) GetTitle() (value string) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Title
|
|
}
|
|
|
|
// GetIsChannel returns value of IsChannel field.
|
|
func (c *ChatActionBarJoinRequest) GetIsChannel() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.IsChannel
|
|
}
|
|
|
|
// GetRequestDate returns value of RequestDate field.
|
|
func (c *ChatActionBarJoinRequest) GetRequestDate() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.RequestDate
|
|
}
|
|
|
|
// ChatActionBarClassName is schema name of ChatActionBarClass.
|
|
const ChatActionBarClassName = "ChatActionBar"
|
|
|
|
// ChatActionBarClass represents ChatActionBar generic type.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tdapi.DecodeChatActionBar(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tdapi.ChatActionBarReportSpam: // chatActionBarReportSpam#b1c0e61a
|
|
// case *tdapi.ChatActionBarInviteMembers: // chatActionBarInviteMembers#76557c70
|
|
// case *tdapi.ChatActionBarReportAddBlock: // chatActionBarReportAddBlock#a7f98e8b
|
|
// case *tdapi.ChatActionBarAddContact: // chatActionBarAddContact#d44a5811
|
|
// case *tdapi.ChatActionBarSharePhoneNumber: // chatActionBarSharePhoneNumber#218efd9
|
|
// case *tdapi.ChatActionBarJoinRequest: // chatActionBarJoinRequest#3dd18308
|
|
// default: panic(v)
|
|
// }
|
|
type ChatActionBarClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() ChatActionBarClass
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
TypeID() uint32
|
|
// TypeName returns name of type in TL schema.
|
|
TypeName() string
|
|
// String implements fmt.Stringer.
|
|
String() string
|
|
// Zero returns true if current object has a zero value.
|
|
Zero() bool
|
|
|
|
EncodeTDLibJSON(b tdjson.Encoder) error
|
|
DecodeTDLibJSON(b tdjson.Decoder) error
|
|
}
|
|
|
|
// DecodeChatActionBar implements binary de-serialization for ChatActionBarClass.
|
|
func DecodeChatActionBar(buf *bin.Buffer) (ChatActionBarClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case ChatActionBarReportSpamTypeID:
|
|
// Decoding chatActionBarReportSpam#b1c0e61a.
|
|
v := ChatActionBarReportSpam{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case ChatActionBarInviteMembersTypeID:
|
|
// Decoding chatActionBarInviteMembers#76557c70.
|
|
v := ChatActionBarInviteMembers{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case ChatActionBarReportAddBlockTypeID:
|
|
// Decoding chatActionBarReportAddBlock#a7f98e8b.
|
|
v := ChatActionBarReportAddBlock{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case ChatActionBarAddContactTypeID:
|
|
// Decoding chatActionBarAddContact#d44a5811.
|
|
v := ChatActionBarAddContact{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case ChatActionBarSharePhoneNumberTypeID:
|
|
// Decoding chatActionBarSharePhoneNumber#218efd9.
|
|
v := ChatActionBarSharePhoneNumber{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case ChatActionBarJoinRequestTypeID:
|
|
// Decoding chatActionBarJoinRequest#3dd18308.
|
|
v := ChatActionBarJoinRequest{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// DecodeTDLibJSONChatActionBar implements binary de-serialization for ChatActionBarClass.
|
|
func DecodeTDLibJSONChatActionBar(buf tdjson.Decoder) (ChatActionBarClass, error) {
|
|
id, err := buf.FindTypeID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case "chatActionBarReportSpam":
|
|
// Decoding chatActionBarReportSpam#b1c0e61a.
|
|
v := ChatActionBarReportSpam{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "chatActionBarInviteMembers":
|
|
// Decoding chatActionBarInviteMembers#76557c70.
|
|
v := ChatActionBarInviteMembers{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "chatActionBarReportAddBlock":
|
|
// Decoding chatActionBarReportAddBlock#a7f98e8b.
|
|
v := ChatActionBarReportAddBlock{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "chatActionBarAddContact":
|
|
// Decoding chatActionBarAddContact#d44a5811.
|
|
v := ChatActionBarAddContact{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "chatActionBarSharePhoneNumber":
|
|
// Decoding chatActionBarSharePhoneNumber#218efd9.
|
|
v := ChatActionBarSharePhoneNumber{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "chatActionBarJoinRequest":
|
|
// Decoding chatActionBarJoinRequest#3dd18308.
|
|
v := ChatActionBarJoinRequest{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", tdjson.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// ChatActionBar boxes the ChatActionBarClass providing a helper.
|
|
type ChatActionBarBox struct {
|
|
ChatActionBar ChatActionBarClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for ChatActionBarBox.
|
|
func (b *ChatActionBarBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode ChatActionBarBox to nil")
|
|
}
|
|
v, err := DecodeChatActionBar(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.ChatActionBar = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for ChatActionBarBox.
|
|
func (b *ChatActionBarBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.ChatActionBar == nil {
|
|
return fmt.Errorf("unable to encode ChatActionBarClass as nil")
|
|
}
|
|
return b.ChatActionBar.Encode(buf)
|
|
}
|
|
|
|
// DecodeTDLibJSON implements bin.Decoder for ChatActionBarBox.
|
|
func (b *ChatActionBarBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode ChatActionBarBox to nil")
|
|
}
|
|
v, err := DecodeTDLibJSONChatActionBar(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.ChatActionBar = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements bin.Encode for ChatActionBarBox.
|
|
func (b *ChatActionBarBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil || b.ChatActionBar == nil {
|
|
return fmt.Errorf("unable to encode ChatActionBarClass as nil")
|
|
}
|
|
return b.ChatActionBar.EncodeTDLibJSON(buf)
|
|
}
|