32846 lines
835 KiB
Go
Generated
32846 lines
835 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{}
|
|
)
|
|
|
|
// UpdateNewMessage represents TL type `updateNewMessage#1f2b0afd`.
|
|
// New message in a private chat or in a basic group¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel#basic-groups
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewMessage for reference.
|
|
type UpdateNewMessage struct {
|
|
// Message
|
|
Message MessageClass
|
|
// New quantity of actions in a message box
|
|
Pts int
|
|
// Number of generated events
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateNewMessageTypeID is TL type id of UpdateNewMessage.
|
|
const UpdateNewMessageTypeID = 0x1f2b0afd
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewMessage{}
|
|
_ bin.Decoder = &UpdateNewMessage{}
|
|
_ bin.BareEncoder = &UpdateNewMessage{}
|
|
_ bin.BareDecoder = &UpdateNewMessage{}
|
|
|
|
_ UpdateClass = &UpdateNewMessage{}
|
|
)
|
|
|
|
func (u *UpdateNewMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateNewMessage(nil)"
|
|
}
|
|
type Alias UpdateNewMessage
|
|
return fmt.Sprintf("UpdateNewMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewMessage from given interface.
|
|
func (u *UpdateNewMessage) FillFrom(from interface {
|
|
GetMessage() (value MessageClass)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewMessage) TypeID() uint32 {
|
|
return UpdateNewMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewMessage) TypeName() string {
|
|
return "updateNewMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewMessage",
|
|
ID: UpdateNewMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewMessage#1f2b0afd as nil")
|
|
}
|
|
b.PutID(UpdateNewMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewMessage#1f2b0afd as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateNewMessage#1f2b0afd: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewMessage#1f2b0afd: field message: %w", err)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewMessage#1f2b0afd to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewMessage#1f2b0afd: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewMessage#1f2b0afd to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewMessage#1f2b0afd: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewMessage#1f2b0afd: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewMessage#1f2b0afd: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateNewMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateNewMessage) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateNewMessage) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateMessageID represents TL type `updateMessageID#4e90bfd6`.
|
|
// Sent message with random_id client identifier was assigned an identifier.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMessageID for reference.
|
|
type UpdateMessageID struct {
|
|
// id identifier of a respective Message¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/type/Message
|
|
ID int
|
|
// Previously transferred client random_id identifier
|
|
RandomID int64
|
|
}
|
|
|
|
// UpdateMessageIDTypeID is TL type id of UpdateMessageID.
|
|
const UpdateMessageIDTypeID = 0x4e90bfd6
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMessageID) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMessageID.
|
|
var (
|
|
_ bin.Encoder = &UpdateMessageID{}
|
|
_ bin.Decoder = &UpdateMessageID{}
|
|
_ bin.BareEncoder = &UpdateMessageID{}
|
|
_ bin.BareDecoder = &UpdateMessageID{}
|
|
|
|
_ UpdateClass = &UpdateMessageID{}
|
|
)
|
|
|
|
func (u *UpdateMessageID) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ID == 0) {
|
|
return false
|
|
}
|
|
if !(u.RandomID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMessageID) String() string {
|
|
if u == nil {
|
|
return "UpdateMessageID(nil)"
|
|
}
|
|
type Alias UpdateMessageID
|
|
return fmt.Sprintf("UpdateMessageID%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMessageID from given interface.
|
|
func (u *UpdateMessageID) FillFrom(from interface {
|
|
GetID() (value int)
|
|
GetRandomID() (value int64)
|
|
}) {
|
|
u.ID = from.GetID()
|
|
u.RandomID = from.GetRandomID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMessageID) TypeID() uint32 {
|
|
return UpdateMessageIDTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMessageID) TypeName() string {
|
|
return "updateMessageID"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMessageID) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMessageID",
|
|
ID: UpdateMessageIDTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "RandomID",
|
|
SchemaName: "random_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMessageID) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessageID#4e90bfd6 as nil")
|
|
}
|
|
b.PutID(UpdateMessageIDTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMessageID) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessageID#4e90bfd6 as nil")
|
|
}
|
|
b.PutInt(u.ID)
|
|
b.PutLong(u.RandomID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMessageID) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessageID#4e90bfd6 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMessageIDTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageID#4e90bfd6: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMessageID) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessageID#4e90bfd6 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageID#4e90bfd6: field id: %w", err)
|
|
}
|
|
u.ID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageID#4e90bfd6: field random_id: %w", err)
|
|
}
|
|
u.RandomID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (u *UpdateMessageID) GetID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ID
|
|
}
|
|
|
|
// GetRandomID returns value of RandomID field.
|
|
func (u *UpdateMessageID) GetRandomID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.RandomID
|
|
}
|
|
|
|
// UpdateDeleteMessages represents TL type `updateDeleteMessages#a20db0e5`.
|
|
// Messages were deleted.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDeleteMessages for reference.
|
|
type UpdateDeleteMessages struct {
|
|
// List of identifiers of deleted messages
|
|
Messages []int
|
|
// New quality of actions in a message box
|
|
Pts int
|
|
// Number of generated events¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateDeleteMessagesTypeID is TL type id of UpdateDeleteMessages.
|
|
const UpdateDeleteMessagesTypeID = 0xa20db0e5
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDeleteMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDeleteMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateDeleteMessages{}
|
|
_ bin.Decoder = &UpdateDeleteMessages{}
|
|
_ bin.BareEncoder = &UpdateDeleteMessages{}
|
|
_ bin.BareDecoder = &UpdateDeleteMessages{}
|
|
|
|
_ UpdateClass = &UpdateDeleteMessages{}
|
|
)
|
|
|
|
func (u *UpdateDeleteMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDeleteMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateDeleteMessages(nil)"
|
|
}
|
|
type Alias UpdateDeleteMessages
|
|
return fmt.Sprintf("UpdateDeleteMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDeleteMessages from given interface.
|
|
func (u *UpdateDeleteMessages) FillFrom(from interface {
|
|
GetMessages() (value []int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Messages = from.GetMessages()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDeleteMessages) TypeID() uint32 {
|
|
return UpdateDeleteMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDeleteMessages) TypeName() string {
|
|
return "updateDeleteMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDeleteMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDeleteMessages",
|
|
ID: UpdateDeleteMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDeleteMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteMessages#a20db0e5 as nil")
|
|
}
|
|
b.PutID(UpdateDeleteMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDeleteMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteMessages#a20db0e5 as nil")
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDeleteMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteMessages#a20db0e5 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDeleteMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteMessages#a20db0e5: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDeleteMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteMessages#a20db0e5 to nil")
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteMessages#a20db0e5: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteMessages#a20db0e5: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteMessages#a20db0e5: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteMessages#a20db0e5: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateDeleteMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateDeleteMessages) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateDeleteMessages) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateUserTyping represents TL type `updateUserTyping#2a17bf5c`.
|
|
// The user is preparing a message; typing, recording, uploading, etc. This update is
|
|
// valid for 6 seconds. If no further updates of this kind are received after 6 seconds,
|
|
// it should be considered that the user stopped doing whatever they were doing
|
|
//
|
|
// See https://core.telegram.org/constructor/updateUserTyping for reference.
|
|
type UpdateUserTyping struct {
|
|
// Flags field of UpdateUserTyping.
|
|
Flags bin.Fields
|
|
// User id
|
|
UserID int64
|
|
// TopMsgID field of UpdateUserTyping.
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// Action type
|
|
Action SendMessageActionClass
|
|
}
|
|
|
|
// UpdateUserTypingTypeID is TL type id of UpdateUserTyping.
|
|
const UpdateUserTypingTypeID = 0x2a17bf5c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateUserTyping) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateUserTyping.
|
|
var (
|
|
_ bin.Encoder = &UpdateUserTyping{}
|
|
_ bin.Decoder = &UpdateUserTyping{}
|
|
_ bin.BareEncoder = &UpdateUserTyping{}
|
|
_ bin.BareDecoder = &UpdateUserTyping{}
|
|
|
|
_ UpdateClass = &UpdateUserTyping{}
|
|
)
|
|
|
|
func (u *UpdateUserTyping) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Action == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateUserTyping) String() string {
|
|
if u == nil {
|
|
return "UpdateUserTyping(nil)"
|
|
}
|
|
type Alias UpdateUserTyping
|
|
return fmt.Sprintf("UpdateUserTyping%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateUserTyping from given interface.
|
|
func (u *UpdateUserTyping) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetAction() (value SendMessageActionClass)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
u.Action = from.GetAction()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateUserTyping) TypeID() uint32 {
|
|
return UpdateUserTypingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateUserTyping) TypeName() string {
|
|
return "updateUserTyping"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateUserTyping) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateUserTyping",
|
|
ID: UpdateUserTypingTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Action",
|
|
SchemaName: "action",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateUserTyping) SetFlags() {
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateUserTyping) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserTyping#2a17bf5c as nil")
|
|
}
|
|
b.PutID(UpdateUserTypingTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateUserTyping) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserTyping#2a17bf5c as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateUserTyping#2a17bf5c: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.UserID)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
if u.Action == nil {
|
|
return fmt.Errorf("unable to encode updateUserTyping#2a17bf5c: field action is nil")
|
|
}
|
|
if err := u.Action.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateUserTyping#2a17bf5c: field action: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateUserTyping) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserTyping#2a17bf5c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateUserTypingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserTyping#2a17bf5c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateUserTyping) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserTyping#2a17bf5c to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserTyping#2a17bf5c: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserTyping#2a17bf5c: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserTyping#2a17bf5c: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
{
|
|
value, err := DecodeSendMessageAction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserTyping#2a17bf5c: field action: %w", err)
|
|
}
|
|
u.Action = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateUserTyping) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateUserTyping) SetTopMsgID(value int) {
|
|
u.Flags.Set(0)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateUserTyping) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// GetAction returns value of Action field.
|
|
func (u *UpdateUserTyping) GetAction() (value SendMessageActionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Action
|
|
}
|
|
|
|
// UpdateChatUserTyping represents TL type `updateChatUserTyping#83487af0`.
|
|
// The user is preparing a message in a group; typing, recording, uploading, etc. This
|
|
// update is valid for 6 seconds. If no further updates of this kind are received after 6
|
|
// seconds, it should be considered that the user stopped doing whatever they were doing
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatUserTyping for reference.
|
|
type UpdateChatUserTyping struct {
|
|
// Group id
|
|
ChatID int64
|
|
// Peer that started typing (can be the chat itself, in case of anonymous admins).
|
|
FromID PeerClass
|
|
// Type of action
|
|
Action SendMessageActionClass
|
|
}
|
|
|
|
// UpdateChatUserTypingTypeID is TL type id of UpdateChatUserTyping.
|
|
const UpdateChatUserTypingTypeID = 0x83487af0
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatUserTyping) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatUserTyping.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatUserTyping{}
|
|
_ bin.Decoder = &UpdateChatUserTyping{}
|
|
_ bin.BareEncoder = &UpdateChatUserTyping{}
|
|
_ bin.BareDecoder = &UpdateChatUserTyping{}
|
|
|
|
_ UpdateClass = &UpdateChatUserTyping{}
|
|
)
|
|
|
|
func (u *UpdateChatUserTyping) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.FromID == nil) {
|
|
return false
|
|
}
|
|
if !(u.Action == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatUserTyping) String() string {
|
|
if u == nil {
|
|
return "UpdateChatUserTyping(nil)"
|
|
}
|
|
type Alias UpdateChatUserTyping
|
|
return fmt.Sprintf("UpdateChatUserTyping%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatUserTyping from given interface.
|
|
func (u *UpdateChatUserTyping) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
GetFromID() (value PeerClass)
|
|
GetAction() (value SendMessageActionClass)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.FromID = from.GetFromID()
|
|
u.Action = from.GetAction()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatUserTyping) TypeID() uint32 {
|
|
return UpdateChatUserTypingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatUserTyping) TypeName() string {
|
|
return "updateChatUserTyping"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatUserTyping) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatUserTyping",
|
|
ID: UpdateChatUserTypingTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "FromID",
|
|
SchemaName: "from_id",
|
|
},
|
|
{
|
|
Name: "Action",
|
|
SchemaName: "action",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatUserTyping) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatUserTyping#83487af0 as nil")
|
|
}
|
|
b.PutID(UpdateChatUserTypingTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatUserTyping) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatUserTyping#83487af0 as nil")
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
if u.FromID == nil {
|
|
return fmt.Errorf("unable to encode updateChatUserTyping#83487af0: field from_id is nil")
|
|
}
|
|
if err := u.FromID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatUserTyping#83487af0: field from_id: %w", err)
|
|
}
|
|
if u.Action == nil {
|
|
return fmt.Errorf("unable to encode updateChatUserTyping#83487af0: field action is nil")
|
|
}
|
|
if err := u.Action.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatUserTyping#83487af0: field action: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatUserTyping) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatUserTyping#83487af0 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatUserTypingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatUserTyping#83487af0: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatUserTyping) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatUserTyping#83487af0 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatUserTyping#83487af0: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatUserTyping#83487af0: field from_id: %w", err)
|
|
}
|
|
u.FromID = value
|
|
}
|
|
{
|
|
value, err := DecodeSendMessageAction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatUserTyping#83487af0: field action: %w", err)
|
|
}
|
|
u.Action = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChatUserTyping) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetFromID returns value of FromID field.
|
|
func (u *UpdateChatUserTyping) GetFromID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.FromID
|
|
}
|
|
|
|
// GetAction returns value of Action field.
|
|
func (u *UpdateChatUserTyping) GetAction() (value SendMessageActionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Action
|
|
}
|
|
|
|
// UpdateChatParticipants represents TL type `updateChatParticipants#7761198`.
|
|
// Composition of chat participants changed.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatParticipants for reference.
|
|
type UpdateChatParticipants struct {
|
|
// Updated chat participants
|
|
Participants ChatParticipantsClass
|
|
}
|
|
|
|
// UpdateChatParticipantsTypeID is TL type id of UpdateChatParticipants.
|
|
const UpdateChatParticipantsTypeID = 0x7761198
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatParticipants) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatParticipants.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatParticipants{}
|
|
_ bin.Decoder = &UpdateChatParticipants{}
|
|
_ bin.BareEncoder = &UpdateChatParticipants{}
|
|
_ bin.BareDecoder = &UpdateChatParticipants{}
|
|
|
|
_ UpdateClass = &UpdateChatParticipants{}
|
|
)
|
|
|
|
func (u *UpdateChatParticipants) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Participants == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatParticipants) String() string {
|
|
if u == nil {
|
|
return "UpdateChatParticipants(nil)"
|
|
}
|
|
type Alias UpdateChatParticipants
|
|
return fmt.Sprintf("UpdateChatParticipants%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatParticipants from given interface.
|
|
func (u *UpdateChatParticipants) FillFrom(from interface {
|
|
GetParticipants() (value ChatParticipantsClass)
|
|
}) {
|
|
u.Participants = from.GetParticipants()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatParticipants) TypeID() uint32 {
|
|
return UpdateChatParticipantsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatParticipants) TypeName() string {
|
|
return "updateChatParticipants"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatParticipants) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatParticipants",
|
|
ID: UpdateChatParticipantsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Participants",
|
|
SchemaName: "participants",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatParticipants) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipants#7761198 as nil")
|
|
}
|
|
b.PutID(UpdateChatParticipantsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatParticipants) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipants#7761198 as nil")
|
|
}
|
|
if u.Participants == nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipants#7761198: field participants is nil")
|
|
}
|
|
if err := u.Participants.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipants#7761198: field participants: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatParticipants) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipants#7761198 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatParticipantsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipants#7761198: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatParticipants) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipants#7761198 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeChatParticipants(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipants#7761198: field participants: %w", err)
|
|
}
|
|
u.Participants = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetParticipants returns value of Participants field.
|
|
func (u *UpdateChatParticipants) GetParticipants() (value ChatParticipantsClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Participants
|
|
}
|
|
|
|
// UpdateUserStatus represents TL type `updateUserStatus#e5bdf8de`.
|
|
// Contact status update.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateUserStatus for reference.
|
|
type UpdateUserStatus struct {
|
|
// User identifier
|
|
UserID int64
|
|
// New status
|
|
Status UserStatusClass
|
|
}
|
|
|
|
// UpdateUserStatusTypeID is TL type id of UpdateUserStatus.
|
|
const UpdateUserStatusTypeID = 0xe5bdf8de
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateUserStatus) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateUserStatus.
|
|
var (
|
|
_ bin.Encoder = &UpdateUserStatus{}
|
|
_ bin.Decoder = &UpdateUserStatus{}
|
|
_ bin.BareEncoder = &UpdateUserStatus{}
|
|
_ bin.BareDecoder = &UpdateUserStatus{}
|
|
|
|
_ UpdateClass = &UpdateUserStatus{}
|
|
)
|
|
|
|
func (u *UpdateUserStatus) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Status == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateUserStatus) String() string {
|
|
if u == nil {
|
|
return "UpdateUserStatus(nil)"
|
|
}
|
|
type Alias UpdateUserStatus
|
|
return fmt.Sprintf("UpdateUserStatus%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateUserStatus from given interface.
|
|
func (u *UpdateUserStatus) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetStatus() (value UserStatusClass)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.Status = from.GetStatus()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateUserStatus) TypeID() uint32 {
|
|
return UpdateUserStatusTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateUserStatus) TypeName() string {
|
|
return "updateUserStatus"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateUserStatus) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateUserStatus",
|
|
ID: UpdateUserStatusTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Status",
|
|
SchemaName: "status",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateUserStatus) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserStatus#e5bdf8de as nil")
|
|
}
|
|
b.PutID(UpdateUserStatusTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateUserStatus) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserStatus#e5bdf8de as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
if u.Status == nil {
|
|
return fmt.Errorf("unable to encode updateUserStatus#e5bdf8de: field status is nil")
|
|
}
|
|
if err := u.Status.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateUserStatus#e5bdf8de: field status: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateUserStatus) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserStatus#e5bdf8de to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateUserStatusTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserStatus#e5bdf8de: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateUserStatus) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserStatus#e5bdf8de to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserStatus#e5bdf8de: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := DecodeUserStatus(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserStatus#e5bdf8de: field status: %w", err)
|
|
}
|
|
u.Status = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateUserStatus) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetStatus returns value of Status field.
|
|
func (u *UpdateUserStatus) GetStatus() (value UserStatusClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Status
|
|
}
|
|
|
|
// UpdateUserName represents TL type `updateUserName#a7848924`.
|
|
// Changes the user's first name, last name and username.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateUserName for reference.
|
|
type UpdateUserName struct {
|
|
// User identifier
|
|
UserID int64
|
|
// New first name. Corresponds to the new value of real_first_name field of the
|
|
// userFull¹ constructor.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/userFull
|
|
FirstName string
|
|
// New last name. Corresponds to the new value of real_last_name field of the userFull¹
|
|
// constructor.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/userFull
|
|
LastName string
|
|
// Usernames.
|
|
Usernames []Username
|
|
}
|
|
|
|
// UpdateUserNameTypeID is TL type id of UpdateUserName.
|
|
const UpdateUserNameTypeID = 0xa7848924
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateUserName) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateUserName.
|
|
var (
|
|
_ bin.Encoder = &UpdateUserName{}
|
|
_ bin.Decoder = &UpdateUserName{}
|
|
_ bin.BareEncoder = &UpdateUserName{}
|
|
_ bin.BareDecoder = &UpdateUserName{}
|
|
|
|
_ UpdateClass = &UpdateUserName{}
|
|
)
|
|
|
|
func (u *UpdateUserName) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.FirstName == "") {
|
|
return false
|
|
}
|
|
if !(u.LastName == "") {
|
|
return false
|
|
}
|
|
if !(u.Usernames == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateUserName) String() string {
|
|
if u == nil {
|
|
return "UpdateUserName(nil)"
|
|
}
|
|
type Alias UpdateUserName
|
|
return fmt.Sprintf("UpdateUserName%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateUserName from given interface.
|
|
func (u *UpdateUserName) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetFirstName() (value string)
|
|
GetLastName() (value string)
|
|
GetUsernames() (value []Username)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.FirstName = from.GetFirstName()
|
|
u.LastName = from.GetLastName()
|
|
u.Usernames = from.GetUsernames()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateUserName) TypeID() uint32 {
|
|
return UpdateUserNameTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateUserName) TypeName() string {
|
|
return "updateUserName"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateUserName) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateUserName",
|
|
ID: UpdateUserNameTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "FirstName",
|
|
SchemaName: "first_name",
|
|
},
|
|
{
|
|
Name: "LastName",
|
|
SchemaName: "last_name",
|
|
},
|
|
{
|
|
Name: "Usernames",
|
|
SchemaName: "usernames",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateUserName) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserName#a7848924 as nil")
|
|
}
|
|
b.PutID(UpdateUserNameTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateUserName) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserName#a7848924 as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.FirstName)
|
|
b.PutString(u.LastName)
|
|
b.PutVectorHeader(len(u.Usernames))
|
|
for idx, v := range u.Usernames {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateUserName#a7848924: field usernames element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateUserName) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserName#a7848924 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateUserNameTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserName#a7848924: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateUserName) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserName#a7848924 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserName#a7848924: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserName#a7848924: field first_name: %w", err)
|
|
}
|
|
u.FirstName = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserName#a7848924: field last_name: %w", err)
|
|
}
|
|
u.LastName = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserName#a7848924: field usernames: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Usernames = make([]Username, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value Username
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserName#a7848924: field usernames: %w", err)
|
|
}
|
|
u.Usernames = append(u.Usernames, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateUserName) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetFirstName returns value of FirstName field.
|
|
func (u *UpdateUserName) GetFirstName() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.FirstName
|
|
}
|
|
|
|
// GetLastName returns value of LastName field.
|
|
func (u *UpdateUserName) GetLastName() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.LastName
|
|
}
|
|
|
|
// GetUsernames returns value of Usernames field.
|
|
func (u *UpdateUserName) GetUsernames() (value []Username) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Usernames
|
|
}
|
|
|
|
// UpdateNewAuthorization represents TL type `updateNewAuthorization#8951abef`.
|
|
// A new session logged into the current user's account through an unknown device.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewAuthorization for reference.
|
|
type UpdateNewAuthorization struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the session is unconfirmed, see here »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/auth#confirming-login
|
|
Unconfirmed bool
|
|
// Hash used for caching, for more info click here¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/offsets#hash-generation
|
|
Hash int64
|
|
// Authorization date
|
|
//
|
|
// Use SetDate and GetDate helpers.
|
|
Date int
|
|
// Name of device, for example Android
|
|
//
|
|
// Use SetDevice and GetDevice helpers.
|
|
Device string
|
|
// Location, for example USA, NY (IP=1.2.3.4)
|
|
//
|
|
// Use SetLocation and GetLocation helpers.
|
|
Location string
|
|
}
|
|
|
|
// UpdateNewAuthorizationTypeID is TL type id of UpdateNewAuthorization.
|
|
const UpdateNewAuthorizationTypeID = 0x8951abef
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewAuthorization) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewAuthorization.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewAuthorization{}
|
|
_ bin.Decoder = &UpdateNewAuthorization{}
|
|
_ bin.BareEncoder = &UpdateNewAuthorization{}
|
|
_ bin.BareDecoder = &UpdateNewAuthorization{}
|
|
|
|
_ UpdateClass = &UpdateNewAuthorization{}
|
|
)
|
|
|
|
func (u *UpdateNewAuthorization) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Unconfirmed == false) {
|
|
return false
|
|
}
|
|
if !(u.Hash == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.Device == "") {
|
|
return false
|
|
}
|
|
if !(u.Location == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewAuthorization) String() string {
|
|
if u == nil {
|
|
return "UpdateNewAuthorization(nil)"
|
|
}
|
|
type Alias UpdateNewAuthorization
|
|
return fmt.Sprintf("UpdateNewAuthorization%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewAuthorization from given interface.
|
|
func (u *UpdateNewAuthorization) FillFrom(from interface {
|
|
GetUnconfirmed() (value bool)
|
|
GetHash() (value int64)
|
|
GetDate() (value int, ok bool)
|
|
GetDevice() (value string, ok bool)
|
|
GetLocation() (value string, ok bool)
|
|
}) {
|
|
u.Unconfirmed = from.GetUnconfirmed()
|
|
u.Hash = from.GetHash()
|
|
if val, ok := from.GetDate(); ok {
|
|
u.Date = val
|
|
}
|
|
|
|
if val, ok := from.GetDevice(); ok {
|
|
u.Device = val
|
|
}
|
|
|
|
if val, ok := from.GetLocation(); ok {
|
|
u.Location = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewAuthorization) TypeID() uint32 {
|
|
return UpdateNewAuthorizationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewAuthorization) TypeName() string {
|
|
return "updateNewAuthorization"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewAuthorization) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewAuthorization",
|
|
ID: UpdateNewAuthorizationTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Unconfirmed",
|
|
SchemaName: "unconfirmed",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Hash",
|
|
SchemaName: "hash",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Device",
|
|
SchemaName: "device",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Location",
|
|
SchemaName: "location",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateNewAuthorization) SetFlags() {
|
|
if !(u.Unconfirmed == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.Date == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.Device == "") {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.Location == "") {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewAuthorization) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewAuthorization#8951abef as nil")
|
|
}
|
|
b.PutID(UpdateNewAuthorizationTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewAuthorization) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewAuthorization#8951abef as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewAuthorization#8951abef: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.Hash)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.Date)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutString(u.Device)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutString(u.Location)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewAuthorization) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewAuthorization#8951abef to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewAuthorizationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewAuthorization#8951abef: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewAuthorization) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewAuthorization#8951abef to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewAuthorization#8951abef: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Unconfirmed = u.Flags.Has(0)
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewAuthorization#8951abef: field hash: %w", err)
|
|
}
|
|
u.Hash = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewAuthorization#8951abef: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewAuthorization#8951abef: field device: %w", err)
|
|
}
|
|
u.Device = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewAuthorization#8951abef: field location: %w", err)
|
|
}
|
|
u.Location = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetUnconfirmed sets value of Unconfirmed conditional field.
|
|
func (u *UpdateNewAuthorization) SetUnconfirmed(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Unconfirmed = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Unconfirmed = false
|
|
}
|
|
}
|
|
|
|
// GetUnconfirmed returns value of Unconfirmed conditional field.
|
|
func (u *UpdateNewAuthorization) GetUnconfirmed() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetHash returns value of Hash field.
|
|
func (u *UpdateNewAuthorization) GetHash() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Hash
|
|
}
|
|
|
|
// SetDate sets value of Date conditional field.
|
|
func (u *UpdateNewAuthorization) SetDate(value int) {
|
|
u.Flags.Set(0)
|
|
u.Date = value
|
|
}
|
|
|
|
// GetDate returns value of Date conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateNewAuthorization) GetDate() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Date, true
|
|
}
|
|
|
|
// SetDevice sets value of Device conditional field.
|
|
func (u *UpdateNewAuthorization) SetDevice(value string) {
|
|
u.Flags.Set(0)
|
|
u.Device = value
|
|
}
|
|
|
|
// GetDevice returns value of Device conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateNewAuthorization) GetDevice() (value string, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Device, true
|
|
}
|
|
|
|
// SetLocation sets value of Location conditional field.
|
|
func (u *UpdateNewAuthorization) SetLocation(value string) {
|
|
u.Flags.Set(0)
|
|
u.Location = value
|
|
}
|
|
|
|
// GetLocation returns value of Location conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateNewAuthorization) GetLocation() (value string, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Location, true
|
|
}
|
|
|
|
// UpdateNewEncryptedMessage represents TL type `updateNewEncryptedMessage#12bcbd9a`.
|
|
// New encrypted message.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewEncryptedMessage for reference.
|
|
type UpdateNewEncryptedMessage struct {
|
|
// Message
|
|
Message EncryptedMessageClass
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateNewEncryptedMessageTypeID is TL type id of UpdateNewEncryptedMessage.
|
|
const UpdateNewEncryptedMessageTypeID = 0x12bcbd9a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewEncryptedMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewEncryptedMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewEncryptedMessage{}
|
|
_ bin.Decoder = &UpdateNewEncryptedMessage{}
|
|
_ bin.BareEncoder = &UpdateNewEncryptedMessage{}
|
|
_ bin.BareDecoder = &UpdateNewEncryptedMessage{}
|
|
|
|
_ UpdateClass = &UpdateNewEncryptedMessage{}
|
|
)
|
|
|
|
func (u *UpdateNewEncryptedMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewEncryptedMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateNewEncryptedMessage(nil)"
|
|
}
|
|
type Alias UpdateNewEncryptedMessage
|
|
return fmt.Sprintf("UpdateNewEncryptedMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewEncryptedMessage from given interface.
|
|
func (u *UpdateNewEncryptedMessage) FillFrom(from interface {
|
|
GetMessage() (value EncryptedMessageClass)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewEncryptedMessage) TypeID() uint32 {
|
|
return UpdateNewEncryptedMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewEncryptedMessage) TypeName() string {
|
|
return "updateNewEncryptedMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewEncryptedMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewEncryptedMessage",
|
|
ID: UpdateNewEncryptedMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewEncryptedMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewEncryptedMessage#12bcbd9a as nil")
|
|
}
|
|
b.PutID(UpdateNewEncryptedMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewEncryptedMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewEncryptedMessage#12bcbd9a as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateNewEncryptedMessage#12bcbd9a: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewEncryptedMessage#12bcbd9a: field message: %w", err)
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewEncryptedMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewEncryptedMessage#12bcbd9a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewEncryptedMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewEncryptedMessage#12bcbd9a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewEncryptedMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewEncryptedMessage#12bcbd9a to nil")
|
|
}
|
|
{
|
|
value, err := DecodeEncryptedMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewEncryptedMessage#12bcbd9a: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewEncryptedMessage#12bcbd9a: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateNewEncryptedMessage) GetMessage() (value EncryptedMessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateNewEncryptedMessage) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateEncryptedChatTyping represents TL type `updateEncryptedChatTyping#1710f156`.
|
|
// Interlocutor is typing a message in an encrypted chat. Update period is 6 second. If
|
|
// upon this time there is no repeated update, it shall be considered that the
|
|
// interlocutor stopped typing.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateEncryptedChatTyping for reference.
|
|
type UpdateEncryptedChatTyping struct {
|
|
// Chat ID
|
|
ChatID int
|
|
}
|
|
|
|
// UpdateEncryptedChatTypingTypeID is TL type id of UpdateEncryptedChatTyping.
|
|
const UpdateEncryptedChatTypingTypeID = 0x1710f156
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateEncryptedChatTyping) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateEncryptedChatTyping.
|
|
var (
|
|
_ bin.Encoder = &UpdateEncryptedChatTyping{}
|
|
_ bin.Decoder = &UpdateEncryptedChatTyping{}
|
|
_ bin.BareEncoder = &UpdateEncryptedChatTyping{}
|
|
_ bin.BareDecoder = &UpdateEncryptedChatTyping{}
|
|
|
|
_ UpdateClass = &UpdateEncryptedChatTyping{}
|
|
)
|
|
|
|
func (u *UpdateEncryptedChatTyping) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateEncryptedChatTyping) String() string {
|
|
if u == nil {
|
|
return "UpdateEncryptedChatTyping(nil)"
|
|
}
|
|
type Alias UpdateEncryptedChatTyping
|
|
return fmt.Sprintf("UpdateEncryptedChatTyping%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateEncryptedChatTyping from given interface.
|
|
func (u *UpdateEncryptedChatTyping) FillFrom(from interface {
|
|
GetChatID() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateEncryptedChatTyping) TypeID() uint32 {
|
|
return UpdateEncryptedChatTypingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateEncryptedChatTyping) TypeName() string {
|
|
return "updateEncryptedChatTyping"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateEncryptedChatTyping) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateEncryptedChatTyping",
|
|
ID: UpdateEncryptedChatTypingTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateEncryptedChatTyping) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEncryptedChatTyping#1710f156 as nil")
|
|
}
|
|
b.PutID(UpdateEncryptedChatTypingTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateEncryptedChatTyping) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEncryptedChatTyping#1710f156 as nil")
|
|
}
|
|
b.PutInt(u.ChatID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateEncryptedChatTyping) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEncryptedChatTyping#1710f156 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateEncryptedChatTypingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryptedChatTyping#1710f156: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateEncryptedChatTyping) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEncryptedChatTyping#1710f156 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryptedChatTyping#1710f156: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateEncryptedChatTyping) GetChatID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// UpdateEncryption represents TL type `updateEncryption#b4a2e88d`.
|
|
// Change of state in an encrypted chat.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateEncryption for reference.
|
|
type UpdateEncryption struct {
|
|
// Encrypted chat
|
|
Chat EncryptedChatClass
|
|
// Date of change
|
|
Date int
|
|
}
|
|
|
|
// UpdateEncryptionTypeID is TL type id of UpdateEncryption.
|
|
const UpdateEncryptionTypeID = 0xb4a2e88d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateEncryption) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateEncryption.
|
|
var (
|
|
_ bin.Encoder = &UpdateEncryption{}
|
|
_ bin.Decoder = &UpdateEncryption{}
|
|
_ bin.BareEncoder = &UpdateEncryption{}
|
|
_ bin.BareDecoder = &UpdateEncryption{}
|
|
|
|
_ UpdateClass = &UpdateEncryption{}
|
|
)
|
|
|
|
func (u *UpdateEncryption) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Chat == nil) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateEncryption) String() string {
|
|
if u == nil {
|
|
return "UpdateEncryption(nil)"
|
|
}
|
|
type Alias UpdateEncryption
|
|
return fmt.Sprintf("UpdateEncryption%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateEncryption from given interface.
|
|
func (u *UpdateEncryption) FillFrom(from interface {
|
|
GetChat() (value EncryptedChatClass)
|
|
GetDate() (value int)
|
|
}) {
|
|
u.Chat = from.GetChat()
|
|
u.Date = from.GetDate()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateEncryption) TypeID() uint32 {
|
|
return UpdateEncryptionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateEncryption) TypeName() string {
|
|
return "updateEncryption"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateEncryption) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateEncryption",
|
|
ID: UpdateEncryptionTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Chat",
|
|
SchemaName: "chat",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateEncryption) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEncryption#b4a2e88d as nil")
|
|
}
|
|
b.PutID(UpdateEncryptionTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateEncryption) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEncryption#b4a2e88d as nil")
|
|
}
|
|
if u.Chat == nil {
|
|
return fmt.Errorf("unable to encode updateEncryption#b4a2e88d: field chat is nil")
|
|
}
|
|
if err := u.Chat.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateEncryption#b4a2e88d: field chat: %w", err)
|
|
}
|
|
b.PutInt(u.Date)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateEncryption) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEncryption#b4a2e88d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateEncryptionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryption#b4a2e88d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateEncryption) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEncryption#b4a2e88d to nil")
|
|
}
|
|
{
|
|
value, err := DecodeEncryptedChat(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryption#b4a2e88d: field chat: %w", err)
|
|
}
|
|
u.Chat = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryption#b4a2e88d: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChat returns value of Chat field.
|
|
func (u *UpdateEncryption) GetChat() (value EncryptedChatClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Chat
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateEncryption) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// UpdateEncryptedMessagesRead represents TL type `updateEncryptedMessagesRead#38fe25b7`.
|
|
// Communication history in an encrypted chat was marked as read.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateEncryptedMessagesRead for reference.
|
|
type UpdateEncryptedMessagesRead struct {
|
|
// Chat ID
|
|
ChatID int
|
|
// Maximum value of data for read messages
|
|
MaxDate int
|
|
// Time when messages were read
|
|
Date int
|
|
}
|
|
|
|
// UpdateEncryptedMessagesReadTypeID is TL type id of UpdateEncryptedMessagesRead.
|
|
const UpdateEncryptedMessagesReadTypeID = 0x38fe25b7
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateEncryptedMessagesRead) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateEncryptedMessagesRead.
|
|
var (
|
|
_ bin.Encoder = &UpdateEncryptedMessagesRead{}
|
|
_ bin.Decoder = &UpdateEncryptedMessagesRead{}
|
|
_ bin.BareEncoder = &UpdateEncryptedMessagesRead{}
|
|
_ bin.BareDecoder = &UpdateEncryptedMessagesRead{}
|
|
|
|
_ UpdateClass = &UpdateEncryptedMessagesRead{}
|
|
)
|
|
|
|
func (u *UpdateEncryptedMessagesRead) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.MaxDate == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateEncryptedMessagesRead) String() string {
|
|
if u == nil {
|
|
return "UpdateEncryptedMessagesRead(nil)"
|
|
}
|
|
type Alias UpdateEncryptedMessagesRead
|
|
return fmt.Sprintf("UpdateEncryptedMessagesRead%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateEncryptedMessagesRead from given interface.
|
|
func (u *UpdateEncryptedMessagesRead) FillFrom(from interface {
|
|
GetChatID() (value int)
|
|
GetMaxDate() (value int)
|
|
GetDate() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.MaxDate = from.GetMaxDate()
|
|
u.Date = from.GetDate()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateEncryptedMessagesRead) TypeID() uint32 {
|
|
return UpdateEncryptedMessagesReadTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateEncryptedMessagesRead) TypeName() string {
|
|
return "updateEncryptedMessagesRead"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateEncryptedMessagesRead) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateEncryptedMessagesRead",
|
|
ID: UpdateEncryptedMessagesReadTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "MaxDate",
|
|
SchemaName: "max_date",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateEncryptedMessagesRead) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEncryptedMessagesRead#38fe25b7 as nil")
|
|
}
|
|
b.PutID(UpdateEncryptedMessagesReadTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateEncryptedMessagesRead) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEncryptedMessagesRead#38fe25b7 as nil")
|
|
}
|
|
b.PutInt(u.ChatID)
|
|
b.PutInt(u.MaxDate)
|
|
b.PutInt(u.Date)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateEncryptedMessagesRead) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEncryptedMessagesRead#38fe25b7 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateEncryptedMessagesReadTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryptedMessagesRead#38fe25b7: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateEncryptedMessagesRead) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEncryptedMessagesRead#38fe25b7 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryptedMessagesRead#38fe25b7: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryptedMessagesRead#38fe25b7: field max_date: %w", err)
|
|
}
|
|
u.MaxDate = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEncryptedMessagesRead#38fe25b7: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateEncryptedMessagesRead) GetChatID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetMaxDate returns value of MaxDate field.
|
|
func (u *UpdateEncryptedMessagesRead) GetMaxDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MaxDate
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateEncryptedMessagesRead) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// UpdateChatParticipantAdd represents TL type `updateChatParticipantAdd#3dda5451`.
|
|
// New group member.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatParticipantAdd for reference.
|
|
type UpdateChatParticipantAdd struct {
|
|
// Group ID
|
|
ChatID int64
|
|
// ID of the new member
|
|
UserID int64
|
|
// ID of the user, who added member to the group
|
|
InviterID int64
|
|
// When was the participant added
|
|
Date int
|
|
// Chat version number
|
|
Version int
|
|
}
|
|
|
|
// UpdateChatParticipantAddTypeID is TL type id of UpdateChatParticipantAdd.
|
|
const UpdateChatParticipantAddTypeID = 0x3dda5451
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatParticipantAdd) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatParticipantAdd.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatParticipantAdd{}
|
|
_ bin.Decoder = &UpdateChatParticipantAdd{}
|
|
_ bin.BareEncoder = &UpdateChatParticipantAdd{}
|
|
_ bin.BareDecoder = &UpdateChatParticipantAdd{}
|
|
|
|
_ UpdateClass = &UpdateChatParticipantAdd{}
|
|
)
|
|
|
|
func (u *UpdateChatParticipantAdd) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.InviterID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.Version == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatParticipantAdd) String() string {
|
|
if u == nil {
|
|
return "UpdateChatParticipantAdd(nil)"
|
|
}
|
|
type Alias UpdateChatParticipantAdd
|
|
return fmt.Sprintf("UpdateChatParticipantAdd%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatParticipantAdd from given interface.
|
|
func (u *UpdateChatParticipantAdd) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetInviterID() (value int64)
|
|
GetDate() (value int)
|
|
GetVersion() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.UserID = from.GetUserID()
|
|
u.InviterID = from.GetInviterID()
|
|
u.Date = from.GetDate()
|
|
u.Version = from.GetVersion()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatParticipantAdd) TypeID() uint32 {
|
|
return UpdateChatParticipantAddTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatParticipantAdd) TypeName() string {
|
|
return "updateChatParticipantAdd"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatParticipantAdd) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatParticipantAdd",
|
|
ID: UpdateChatParticipantAddTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "InviterID",
|
|
SchemaName: "inviter_id",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatParticipantAdd) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantAdd#3dda5451 as nil")
|
|
}
|
|
b.PutID(UpdateChatParticipantAddTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatParticipantAdd) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantAdd#3dda5451 as nil")
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
b.PutLong(u.UserID)
|
|
b.PutLong(u.InviterID)
|
|
b.PutInt(u.Date)
|
|
b.PutInt(u.Version)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatParticipantAdd) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantAdd#3dda5451 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatParticipantAddTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdd#3dda5451: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatParticipantAdd) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantAdd#3dda5451 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdd#3dda5451: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdd#3dda5451: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdd#3dda5451: field inviter_id: %w", err)
|
|
}
|
|
u.InviterID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdd#3dda5451: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdd#3dda5451: field version: %w", err)
|
|
}
|
|
u.Version = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChatParticipantAdd) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateChatParticipantAdd) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetInviterID returns value of InviterID field.
|
|
func (u *UpdateChatParticipantAdd) GetInviterID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.InviterID
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateChatParticipantAdd) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (u *UpdateChatParticipantAdd) GetVersion() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Version
|
|
}
|
|
|
|
// UpdateChatParticipantDelete represents TL type `updateChatParticipantDelete#e32f3d77`.
|
|
// A member has left the group.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatParticipantDelete for reference.
|
|
type UpdateChatParticipantDelete struct {
|
|
// Group ID
|
|
ChatID int64
|
|
// ID of the user
|
|
UserID int64
|
|
// Used in basic groups to reorder updates and make sure that all of them was received.
|
|
Version int
|
|
}
|
|
|
|
// UpdateChatParticipantDeleteTypeID is TL type id of UpdateChatParticipantDelete.
|
|
const UpdateChatParticipantDeleteTypeID = 0xe32f3d77
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatParticipantDelete) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatParticipantDelete.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatParticipantDelete{}
|
|
_ bin.Decoder = &UpdateChatParticipantDelete{}
|
|
_ bin.BareEncoder = &UpdateChatParticipantDelete{}
|
|
_ bin.BareDecoder = &UpdateChatParticipantDelete{}
|
|
|
|
_ UpdateClass = &UpdateChatParticipantDelete{}
|
|
)
|
|
|
|
func (u *UpdateChatParticipantDelete) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Version == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatParticipantDelete) String() string {
|
|
if u == nil {
|
|
return "UpdateChatParticipantDelete(nil)"
|
|
}
|
|
type Alias UpdateChatParticipantDelete
|
|
return fmt.Sprintf("UpdateChatParticipantDelete%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatParticipantDelete from given interface.
|
|
func (u *UpdateChatParticipantDelete) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetVersion() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.UserID = from.GetUserID()
|
|
u.Version = from.GetVersion()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatParticipantDelete) TypeID() uint32 {
|
|
return UpdateChatParticipantDeleteTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatParticipantDelete) TypeName() string {
|
|
return "updateChatParticipantDelete"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatParticipantDelete) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatParticipantDelete",
|
|
ID: UpdateChatParticipantDeleteTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatParticipantDelete) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantDelete#e32f3d77 as nil")
|
|
}
|
|
b.PutID(UpdateChatParticipantDeleteTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatParticipantDelete) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantDelete#e32f3d77 as nil")
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
b.PutLong(u.UserID)
|
|
b.PutInt(u.Version)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatParticipantDelete) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantDelete#e32f3d77 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatParticipantDeleteTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantDelete#e32f3d77: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatParticipantDelete) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantDelete#e32f3d77 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantDelete#e32f3d77: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantDelete#e32f3d77: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantDelete#e32f3d77: field version: %w", err)
|
|
}
|
|
u.Version = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChatParticipantDelete) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateChatParticipantDelete) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (u *UpdateChatParticipantDelete) GetVersion() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Version
|
|
}
|
|
|
|
// UpdateDCOptions represents TL type `updateDcOptions#8e5e9873`.
|
|
// Changes in the data center configuration options.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDcOptions for reference.
|
|
type UpdateDCOptions struct {
|
|
// New connection options
|
|
DCOptions []DCOption
|
|
}
|
|
|
|
// UpdateDCOptionsTypeID is TL type id of UpdateDCOptions.
|
|
const UpdateDCOptionsTypeID = 0x8e5e9873
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDCOptions) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDCOptions.
|
|
var (
|
|
_ bin.Encoder = &UpdateDCOptions{}
|
|
_ bin.Decoder = &UpdateDCOptions{}
|
|
_ bin.BareEncoder = &UpdateDCOptions{}
|
|
_ bin.BareDecoder = &UpdateDCOptions{}
|
|
|
|
_ UpdateClass = &UpdateDCOptions{}
|
|
)
|
|
|
|
func (u *UpdateDCOptions) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.DCOptions == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDCOptions) String() string {
|
|
if u == nil {
|
|
return "UpdateDCOptions(nil)"
|
|
}
|
|
type Alias UpdateDCOptions
|
|
return fmt.Sprintf("UpdateDCOptions%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDCOptions from given interface.
|
|
func (u *UpdateDCOptions) FillFrom(from interface {
|
|
GetDCOptions() (value []DCOption)
|
|
}) {
|
|
u.DCOptions = from.GetDCOptions()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDCOptions) TypeID() uint32 {
|
|
return UpdateDCOptionsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDCOptions) TypeName() string {
|
|
return "updateDcOptions"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDCOptions) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDcOptions",
|
|
ID: UpdateDCOptionsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "DCOptions",
|
|
SchemaName: "dc_options",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDCOptions) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDcOptions#8e5e9873 as nil")
|
|
}
|
|
b.PutID(UpdateDCOptionsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDCOptions) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDcOptions#8e5e9873 as nil")
|
|
}
|
|
b.PutVectorHeader(len(u.DCOptions))
|
|
for idx, v := range u.DCOptions {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDcOptions#8e5e9873: field dc_options element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDCOptions) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDcOptions#8e5e9873 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDCOptionsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDcOptions#8e5e9873: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDCOptions) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDcOptions#8e5e9873 to nil")
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDcOptions#8e5e9873: field dc_options: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.DCOptions = make([]DCOption, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value DCOption
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateDcOptions#8e5e9873: field dc_options: %w", err)
|
|
}
|
|
u.DCOptions = append(u.DCOptions, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetDCOptions returns value of DCOptions field.
|
|
func (u *UpdateDCOptions) GetDCOptions() (value []DCOption) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.DCOptions
|
|
}
|
|
|
|
// UpdateNotifySettings represents TL type `updateNotifySettings#bec268ef`.
|
|
// Changes in notification settings.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNotifySettings for reference.
|
|
type UpdateNotifySettings struct {
|
|
// Notification source
|
|
Peer NotifyPeerClass
|
|
// New notification settings
|
|
NotifySettings PeerNotifySettings
|
|
}
|
|
|
|
// UpdateNotifySettingsTypeID is TL type id of UpdateNotifySettings.
|
|
const UpdateNotifySettingsTypeID = 0xbec268ef
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNotifySettings) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNotifySettings.
|
|
var (
|
|
_ bin.Encoder = &UpdateNotifySettings{}
|
|
_ bin.Decoder = &UpdateNotifySettings{}
|
|
_ bin.BareEncoder = &UpdateNotifySettings{}
|
|
_ bin.BareDecoder = &UpdateNotifySettings{}
|
|
|
|
_ UpdateClass = &UpdateNotifySettings{}
|
|
)
|
|
|
|
func (u *UpdateNotifySettings) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.NotifySettings.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNotifySettings) String() string {
|
|
if u == nil {
|
|
return "UpdateNotifySettings(nil)"
|
|
}
|
|
type Alias UpdateNotifySettings
|
|
return fmt.Sprintf("UpdateNotifySettings%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNotifySettings from given interface.
|
|
func (u *UpdateNotifySettings) FillFrom(from interface {
|
|
GetPeer() (value NotifyPeerClass)
|
|
GetNotifySettings() (value PeerNotifySettings)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.NotifySettings = from.GetNotifySettings()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNotifySettings) TypeID() uint32 {
|
|
return UpdateNotifySettingsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNotifySettings) TypeName() string {
|
|
return "updateNotifySettings"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNotifySettings) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNotifySettings",
|
|
ID: UpdateNotifySettingsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "NotifySettings",
|
|
SchemaName: "notify_settings",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNotifySettings) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNotifySettings#bec268ef as nil")
|
|
}
|
|
b.PutID(UpdateNotifySettingsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNotifySettings) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNotifySettings#bec268ef as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateNotifySettings#bec268ef: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNotifySettings#bec268ef: field peer: %w", err)
|
|
}
|
|
if err := u.NotifySettings.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNotifySettings#bec268ef: field notify_settings: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNotifySettings) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNotifySettings#bec268ef to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNotifySettingsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNotifySettings#bec268ef: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNotifySettings) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNotifySettings#bec268ef to nil")
|
|
}
|
|
{
|
|
value, err := DecodeNotifyPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNotifySettings#bec268ef: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
if err := u.NotifySettings.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateNotifySettings#bec268ef: field notify_settings: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateNotifySettings) GetPeer() (value NotifyPeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetNotifySettings returns value of NotifySettings field.
|
|
func (u *UpdateNotifySettings) GetNotifySettings() (value PeerNotifySettings) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.NotifySettings
|
|
}
|
|
|
|
// UpdateServiceNotification represents TL type `updateServiceNotification#ebe46819`.
|
|
// A service message for the user.
|
|
// The app must show the message to the user upon receiving this update. In case the
|
|
// popup parameter was passed, the text message must be displayed in a popup alert
|
|
// immediately upon receipt. It is recommended to handle the text as you would an
|
|
// ordinary message in terms of highlighting links, etc. The message must also be stored
|
|
// locally as part of the message history with the user id 777000 (Telegram
|
|
// Notifications).
|
|
//
|
|
// See https://core.telegram.org/constructor/updateServiceNotification for reference.
|
|
type UpdateServiceNotification struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// If set, the message must be displayed in a popup.
|
|
Popup bool
|
|
// If set, any eventual webpage preview will be shown on top of the message instead of at
|
|
// the bottom.
|
|
InvertMedia bool
|
|
// When was the notification receivedThe message must also be stored locally as part of
|
|
// the message history with the user id 777000 (Telegram Notifications).
|
|
//
|
|
// Use SetInboxDate and GetInboxDate helpers.
|
|
InboxDate int
|
|
// String, identical in format and contents to the type¹ field in API errors. Describes
|
|
// type of service message. It is acceptable to ignore repeated messages of the same type
|
|
// within a short period of time (15 minutes).
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/errors#error-type
|
|
Type string
|
|
// Message text
|
|
Message string
|
|
// Media content (optional)
|
|
Media MessageMediaClass
|
|
// Message entities for styled text¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/entities
|
|
Entities []MessageEntityClass
|
|
}
|
|
|
|
// UpdateServiceNotificationTypeID is TL type id of UpdateServiceNotification.
|
|
const UpdateServiceNotificationTypeID = 0xebe46819
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateServiceNotification) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateServiceNotification.
|
|
var (
|
|
_ bin.Encoder = &UpdateServiceNotification{}
|
|
_ bin.Decoder = &UpdateServiceNotification{}
|
|
_ bin.BareEncoder = &UpdateServiceNotification{}
|
|
_ bin.BareDecoder = &UpdateServiceNotification{}
|
|
|
|
_ UpdateClass = &UpdateServiceNotification{}
|
|
)
|
|
|
|
func (u *UpdateServiceNotification) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Popup == false) {
|
|
return false
|
|
}
|
|
if !(u.InvertMedia == false) {
|
|
return false
|
|
}
|
|
if !(u.InboxDate == 0) {
|
|
return false
|
|
}
|
|
if !(u.Type == "") {
|
|
return false
|
|
}
|
|
if !(u.Message == "") {
|
|
return false
|
|
}
|
|
if !(u.Media == nil) {
|
|
return false
|
|
}
|
|
if !(u.Entities == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateServiceNotification) String() string {
|
|
if u == nil {
|
|
return "UpdateServiceNotification(nil)"
|
|
}
|
|
type Alias UpdateServiceNotification
|
|
return fmt.Sprintf("UpdateServiceNotification%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateServiceNotification from given interface.
|
|
func (u *UpdateServiceNotification) FillFrom(from interface {
|
|
GetPopup() (value bool)
|
|
GetInvertMedia() (value bool)
|
|
GetInboxDate() (value int, ok bool)
|
|
GetType() (value string)
|
|
GetMessage() (value string)
|
|
GetMedia() (value MessageMediaClass)
|
|
GetEntities() (value []MessageEntityClass)
|
|
}) {
|
|
u.Popup = from.GetPopup()
|
|
u.InvertMedia = from.GetInvertMedia()
|
|
if val, ok := from.GetInboxDate(); ok {
|
|
u.InboxDate = val
|
|
}
|
|
|
|
u.Type = from.GetType()
|
|
u.Message = from.GetMessage()
|
|
u.Media = from.GetMedia()
|
|
u.Entities = from.GetEntities()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateServiceNotification) TypeID() uint32 {
|
|
return UpdateServiceNotificationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateServiceNotification) TypeName() string {
|
|
return "updateServiceNotification"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateServiceNotification) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateServiceNotification",
|
|
ID: UpdateServiceNotificationTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Popup",
|
|
SchemaName: "popup",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "InvertMedia",
|
|
SchemaName: "invert_media",
|
|
Null: !u.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "InboxDate",
|
|
SchemaName: "inbox_date",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Type",
|
|
SchemaName: "type",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "Media",
|
|
SchemaName: "media",
|
|
},
|
|
{
|
|
Name: "Entities",
|
|
SchemaName: "entities",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateServiceNotification) SetFlags() {
|
|
if !(u.Popup == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.InvertMedia == false) {
|
|
u.Flags.Set(2)
|
|
}
|
|
if !(u.InboxDate == 0) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateServiceNotification) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateServiceNotification#ebe46819 as nil")
|
|
}
|
|
b.PutID(UpdateServiceNotificationTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateServiceNotification) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateServiceNotification#ebe46819 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateServiceNotification#ebe46819: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutInt(u.InboxDate)
|
|
}
|
|
b.PutString(u.Type)
|
|
b.PutString(u.Message)
|
|
if u.Media == nil {
|
|
return fmt.Errorf("unable to encode updateServiceNotification#ebe46819: field media is nil")
|
|
}
|
|
if err := u.Media.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateServiceNotification#ebe46819: field media: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Entities))
|
|
for idx, v := range u.Entities {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updateServiceNotification#ebe46819: field entities element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateServiceNotification#ebe46819: field entities element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateServiceNotification) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateServiceNotification#ebe46819 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateServiceNotificationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateServiceNotification) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateServiceNotification#ebe46819 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Popup = u.Flags.Has(0)
|
|
u.InvertMedia = u.Flags.Has(2)
|
|
if u.Flags.Has(1) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field inbox_date: %w", err)
|
|
}
|
|
u.InboxDate = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field type: %w", err)
|
|
}
|
|
u.Type = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
{
|
|
value, err := DecodeMessageMedia(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field media: %w", err)
|
|
}
|
|
u.Media = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field entities: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Entities = make([]MessageEntityClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeMessageEntity(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateServiceNotification#ebe46819: field entities: %w", err)
|
|
}
|
|
u.Entities = append(u.Entities, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPopup sets value of Popup conditional field.
|
|
func (u *UpdateServiceNotification) SetPopup(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Popup = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Popup = false
|
|
}
|
|
}
|
|
|
|
// GetPopup returns value of Popup conditional field.
|
|
func (u *UpdateServiceNotification) GetPopup() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// SetInvertMedia sets value of InvertMedia conditional field.
|
|
func (u *UpdateServiceNotification) SetInvertMedia(value bool) {
|
|
if value {
|
|
u.Flags.Set(2)
|
|
u.InvertMedia = true
|
|
} else {
|
|
u.Flags.Unset(2)
|
|
u.InvertMedia = false
|
|
}
|
|
}
|
|
|
|
// GetInvertMedia returns value of InvertMedia conditional field.
|
|
func (u *UpdateServiceNotification) GetInvertMedia() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(2)
|
|
}
|
|
|
|
// SetInboxDate sets value of InboxDate conditional field.
|
|
func (u *UpdateServiceNotification) SetInboxDate(value int) {
|
|
u.Flags.Set(1)
|
|
u.InboxDate = value
|
|
}
|
|
|
|
// GetInboxDate returns value of InboxDate conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateServiceNotification) GetInboxDate() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.InboxDate, true
|
|
}
|
|
|
|
// GetType returns value of Type field.
|
|
func (u *UpdateServiceNotification) GetType() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Type
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateServiceNotification) GetMessage() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// GetMedia returns value of Media field.
|
|
func (u *UpdateServiceNotification) GetMedia() (value MessageMediaClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Media
|
|
}
|
|
|
|
// GetEntities returns value of Entities field.
|
|
func (u *UpdateServiceNotification) GetEntities() (value []MessageEntityClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Entities
|
|
}
|
|
|
|
// MapEntities returns field Entities wrapped in MessageEntityClassArray helper.
|
|
func (u *UpdateServiceNotification) MapEntities() (value MessageEntityClassArray) {
|
|
return MessageEntityClassArray(u.Entities)
|
|
}
|
|
|
|
// UpdatePrivacy represents TL type `updatePrivacy#ee3b272a`.
|
|
// Privacy rules were changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePrivacy for reference.
|
|
type UpdatePrivacy struct {
|
|
// Peers to which the privacy rules apply
|
|
Key PrivacyKeyClass
|
|
// New privacy rules
|
|
Rules []PrivacyRuleClass
|
|
}
|
|
|
|
// UpdatePrivacyTypeID is TL type id of UpdatePrivacy.
|
|
const UpdatePrivacyTypeID = 0xee3b272a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePrivacy) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePrivacy.
|
|
var (
|
|
_ bin.Encoder = &UpdatePrivacy{}
|
|
_ bin.Decoder = &UpdatePrivacy{}
|
|
_ bin.BareEncoder = &UpdatePrivacy{}
|
|
_ bin.BareDecoder = &UpdatePrivacy{}
|
|
|
|
_ UpdateClass = &UpdatePrivacy{}
|
|
)
|
|
|
|
func (u *UpdatePrivacy) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Key == nil) {
|
|
return false
|
|
}
|
|
if !(u.Rules == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePrivacy) String() string {
|
|
if u == nil {
|
|
return "UpdatePrivacy(nil)"
|
|
}
|
|
type Alias UpdatePrivacy
|
|
return fmt.Sprintf("UpdatePrivacy%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePrivacy from given interface.
|
|
func (u *UpdatePrivacy) FillFrom(from interface {
|
|
GetKey() (value PrivacyKeyClass)
|
|
GetRules() (value []PrivacyRuleClass)
|
|
}) {
|
|
u.Key = from.GetKey()
|
|
u.Rules = from.GetRules()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePrivacy) TypeID() uint32 {
|
|
return UpdatePrivacyTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePrivacy) TypeName() string {
|
|
return "updatePrivacy"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePrivacy) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePrivacy",
|
|
ID: UpdatePrivacyTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Key",
|
|
SchemaName: "key",
|
|
},
|
|
{
|
|
Name: "Rules",
|
|
SchemaName: "rules",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePrivacy) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePrivacy#ee3b272a as nil")
|
|
}
|
|
b.PutID(UpdatePrivacyTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePrivacy) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePrivacy#ee3b272a as nil")
|
|
}
|
|
if u.Key == nil {
|
|
return fmt.Errorf("unable to encode updatePrivacy#ee3b272a: field key is nil")
|
|
}
|
|
if err := u.Key.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePrivacy#ee3b272a: field key: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Rules))
|
|
for idx, v := range u.Rules {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updatePrivacy#ee3b272a: field rules element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePrivacy#ee3b272a: field rules element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePrivacy) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePrivacy#ee3b272a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePrivacyTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePrivacy#ee3b272a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePrivacy) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePrivacy#ee3b272a to nil")
|
|
}
|
|
{
|
|
value, err := DecodePrivacyKey(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePrivacy#ee3b272a: field key: %w", err)
|
|
}
|
|
u.Key = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePrivacy#ee3b272a: field rules: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Rules = make([]PrivacyRuleClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodePrivacyRule(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePrivacy#ee3b272a: field rules: %w", err)
|
|
}
|
|
u.Rules = append(u.Rules, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetKey returns value of Key field.
|
|
func (u *UpdatePrivacy) GetKey() (value PrivacyKeyClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Key
|
|
}
|
|
|
|
// GetRules returns value of Rules field.
|
|
func (u *UpdatePrivacy) GetRules() (value []PrivacyRuleClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Rules
|
|
}
|
|
|
|
// MapRules returns field Rules wrapped in PrivacyRuleClassArray helper.
|
|
func (u *UpdatePrivacy) MapRules() (value PrivacyRuleClassArray) {
|
|
return PrivacyRuleClassArray(u.Rules)
|
|
}
|
|
|
|
// UpdateUserPhone represents TL type `updateUserPhone#5492a13`.
|
|
// A user's phone number was changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateUserPhone for reference.
|
|
type UpdateUserPhone struct {
|
|
// User ID
|
|
UserID int64
|
|
// New phone number
|
|
Phone string
|
|
}
|
|
|
|
// UpdateUserPhoneTypeID is TL type id of UpdateUserPhone.
|
|
const UpdateUserPhoneTypeID = 0x5492a13
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateUserPhone) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateUserPhone.
|
|
var (
|
|
_ bin.Encoder = &UpdateUserPhone{}
|
|
_ bin.Decoder = &UpdateUserPhone{}
|
|
_ bin.BareEncoder = &UpdateUserPhone{}
|
|
_ bin.BareDecoder = &UpdateUserPhone{}
|
|
|
|
_ UpdateClass = &UpdateUserPhone{}
|
|
)
|
|
|
|
func (u *UpdateUserPhone) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Phone == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateUserPhone) String() string {
|
|
if u == nil {
|
|
return "UpdateUserPhone(nil)"
|
|
}
|
|
type Alias UpdateUserPhone
|
|
return fmt.Sprintf("UpdateUserPhone%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateUserPhone from given interface.
|
|
func (u *UpdateUserPhone) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetPhone() (value string)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.Phone = from.GetPhone()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateUserPhone) TypeID() uint32 {
|
|
return UpdateUserPhoneTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateUserPhone) TypeName() string {
|
|
return "updateUserPhone"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateUserPhone) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateUserPhone",
|
|
ID: UpdateUserPhoneTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Phone",
|
|
SchemaName: "phone",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateUserPhone) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserPhone#5492a13 as nil")
|
|
}
|
|
b.PutID(UpdateUserPhoneTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateUserPhone) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserPhone#5492a13 as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.Phone)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateUserPhone) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserPhone#5492a13 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateUserPhoneTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserPhone#5492a13: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateUserPhone) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserPhone#5492a13 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserPhone#5492a13: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserPhone#5492a13: field phone: %w", err)
|
|
}
|
|
u.Phone = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateUserPhone) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetPhone returns value of Phone field.
|
|
func (u *UpdateUserPhone) GetPhone() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Phone
|
|
}
|
|
|
|
// UpdateReadHistoryInbox represents TL type `updateReadHistoryInbox#9e84bc99`.
|
|
// Incoming messages were read
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadHistoryInbox for reference.
|
|
type UpdateReadHistoryInbox struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Peer folder ID, for more info click here¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders#peer-folders
|
|
//
|
|
// Use SetFolderID and GetFolderID helpers.
|
|
FolderID int
|
|
// Peer
|
|
Peer PeerClass
|
|
// TopMsgID field of UpdateReadHistoryInbox.
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// Maximum ID of messages read
|
|
MaxID int
|
|
// Number of messages that are still unread
|
|
StillUnreadCount int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateReadHistoryInboxTypeID is TL type id of UpdateReadHistoryInbox.
|
|
const UpdateReadHistoryInboxTypeID = 0x9e84bc99
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadHistoryInbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadHistoryInbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadHistoryInbox{}
|
|
_ bin.Decoder = &UpdateReadHistoryInbox{}
|
|
_ bin.BareEncoder = &UpdateReadHistoryInbox{}
|
|
_ bin.BareDecoder = &UpdateReadHistoryInbox{}
|
|
|
|
_ UpdateClass = &UpdateReadHistoryInbox{}
|
|
)
|
|
|
|
func (u *UpdateReadHistoryInbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.FolderID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.MaxID == 0) {
|
|
return false
|
|
}
|
|
if !(u.StillUnreadCount == 0) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadHistoryInbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadHistoryInbox(nil)"
|
|
}
|
|
type Alias UpdateReadHistoryInbox
|
|
return fmt.Sprintf("UpdateReadHistoryInbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadHistoryInbox from given interface.
|
|
func (u *UpdateReadHistoryInbox) FillFrom(from interface {
|
|
GetFolderID() (value int, ok bool)
|
|
GetPeer() (value PeerClass)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetMaxID() (value int)
|
|
GetStillUnreadCount() (value int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
if val, ok := from.GetFolderID(); ok {
|
|
u.FolderID = val
|
|
}
|
|
|
|
u.Peer = from.GetPeer()
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
u.MaxID = from.GetMaxID()
|
|
u.StillUnreadCount = from.GetStillUnreadCount()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadHistoryInbox) TypeID() uint32 {
|
|
return UpdateReadHistoryInboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadHistoryInbox) TypeName() string {
|
|
return "updateReadHistoryInbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadHistoryInbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadHistoryInbox",
|
|
ID: UpdateReadHistoryInboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "FolderID",
|
|
SchemaName: "folder_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "MaxID",
|
|
SchemaName: "max_id",
|
|
},
|
|
{
|
|
Name: "StillUnreadCount",
|
|
SchemaName: "still_unread_count",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateReadHistoryInbox) SetFlags() {
|
|
if !(u.FolderID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadHistoryInbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadHistoryInbox#9e84bc99 as nil")
|
|
}
|
|
b.PutID(UpdateReadHistoryInboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadHistoryInbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadHistoryInbox#9e84bc99 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadHistoryInbox#9e84bc99: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.FolderID)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateReadHistoryInbox#9e84bc99: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadHistoryInbox#9e84bc99: field peer: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
b.PutInt(u.MaxID)
|
|
b.PutInt(u.StillUnreadCount)
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadHistoryInbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadHistoryInbox#9e84bc99 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadHistoryInboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadHistoryInbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadHistoryInbox#9e84bc99 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field flags: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field folder_id: %w", err)
|
|
}
|
|
u.FolderID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field max_id: %w", err)
|
|
}
|
|
u.MaxID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field still_unread_count: %w", err)
|
|
}
|
|
u.StillUnreadCount = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryInbox#9e84bc99: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetFolderID sets value of FolderID conditional field.
|
|
func (u *UpdateReadHistoryInbox) SetFolderID(value int) {
|
|
u.Flags.Set(0)
|
|
u.FolderID = value
|
|
}
|
|
|
|
// GetFolderID returns value of FolderID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateReadHistoryInbox) GetFolderID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.FolderID, true
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateReadHistoryInbox) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateReadHistoryInbox) SetTopMsgID(value int) {
|
|
u.Flags.Set(1)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateReadHistoryInbox) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// GetMaxID returns value of MaxID field.
|
|
func (u *UpdateReadHistoryInbox) GetMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MaxID
|
|
}
|
|
|
|
// GetStillUnreadCount returns value of StillUnreadCount field.
|
|
func (u *UpdateReadHistoryInbox) GetStillUnreadCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.StillUnreadCount
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateReadHistoryInbox) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateReadHistoryInbox) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateReadHistoryOutbox represents TL type `updateReadHistoryOutbox#2f2f21bf`.
|
|
// Outgoing messages were read
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadHistoryOutbox for reference.
|
|
type UpdateReadHistoryOutbox struct {
|
|
// Peer
|
|
Peer PeerClass
|
|
// Maximum ID of read outgoing messages
|
|
MaxID int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateReadHistoryOutboxTypeID is TL type id of UpdateReadHistoryOutbox.
|
|
const UpdateReadHistoryOutboxTypeID = 0x2f2f21bf
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadHistoryOutbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadHistoryOutbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadHistoryOutbox{}
|
|
_ bin.Decoder = &UpdateReadHistoryOutbox{}
|
|
_ bin.BareEncoder = &UpdateReadHistoryOutbox{}
|
|
_ bin.BareDecoder = &UpdateReadHistoryOutbox{}
|
|
|
|
_ UpdateClass = &UpdateReadHistoryOutbox{}
|
|
)
|
|
|
|
func (u *UpdateReadHistoryOutbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MaxID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadHistoryOutbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadHistoryOutbox(nil)"
|
|
}
|
|
type Alias UpdateReadHistoryOutbox
|
|
return fmt.Sprintf("UpdateReadHistoryOutbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadHistoryOutbox from given interface.
|
|
func (u *UpdateReadHistoryOutbox) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMaxID() (value int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MaxID = from.GetMaxID()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadHistoryOutbox) TypeID() uint32 {
|
|
return UpdateReadHistoryOutboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadHistoryOutbox) TypeName() string {
|
|
return "updateReadHistoryOutbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadHistoryOutbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadHistoryOutbox",
|
|
ID: UpdateReadHistoryOutboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MaxID",
|
|
SchemaName: "max_id",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadHistoryOutbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadHistoryOutbox#2f2f21bf as nil")
|
|
}
|
|
b.PutID(UpdateReadHistoryOutboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadHistoryOutbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadHistoryOutbox#2f2f21bf as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateReadHistoryOutbox#2f2f21bf: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadHistoryOutbox#2f2f21bf: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MaxID)
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadHistoryOutbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadHistoryOutbox#2f2f21bf to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadHistoryOutboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryOutbox#2f2f21bf: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadHistoryOutbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadHistoryOutbox#2f2f21bf to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryOutbox#2f2f21bf: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryOutbox#2f2f21bf: field max_id: %w", err)
|
|
}
|
|
u.MaxID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryOutbox#2f2f21bf: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadHistoryOutbox#2f2f21bf: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateReadHistoryOutbox) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMaxID returns value of MaxID field.
|
|
func (u *UpdateReadHistoryOutbox) GetMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MaxID
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateReadHistoryOutbox) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateReadHistoryOutbox) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateWebPage represents TL type `updateWebPage#7f891213`.
|
|
// An instant view¹ webpage preview was generated
|
|
//
|
|
// Links:
|
|
// 1. https://instantview.telegram.org
|
|
//
|
|
// See https://core.telegram.org/constructor/updateWebPage for reference.
|
|
type UpdateWebPage struct {
|
|
// Webpage preview
|
|
Webpage WebPageClass
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateWebPageTypeID is TL type id of UpdateWebPage.
|
|
const UpdateWebPageTypeID = 0x7f891213
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateWebPage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateWebPage.
|
|
var (
|
|
_ bin.Encoder = &UpdateWebPage{}
|
|
_ bin.Decoder = &UpdateWebPage{}
|
|
_ bin.BareEncoder = &UpdateWebPage{}
|
|
_ bin.BareDecoder = &UpdateWebPage{}
|
|
|
|
_ UpdateClass = &UpdateWebPage{}
|
|
)
|
|
|
|
func (u *UpdateWebPage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Webpage == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateWebPage) String() string {
|
|
if u == nil {
|
|
return "UpdateWebPage(nil)"
|
|
}
|
|
type Alias UpdateWebPage
|
|
return fmt.Sprintf("UpdateWebPage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateWebPage from given interface.
|
|
func (u *UpdateWebPage) FillFrom(from interface {
|
|
GetWebpage() (value WebPageClass)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Webpage = from.GetWebpage()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateWebPage) TypeID() uint32 {
|
|
return UpdateWebPageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateWebPage) TypeName() string {
|
|
return "updateWebPage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateWebPage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateWebPage",
|
|
ID: UpdateWebPageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Webpage",
|
|
SchemaName: "webpage",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateWebPage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateWebPage#7f891213 as nil")
|
|
}
|
|
b.PutID(UpdateWebPageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateWebPage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateWebPage#7f891213 as nil")
|
|
}
|
|
if u.Webpage == nil {
|
|
return fmt.Errorf("unable to encode updateWebPage#7f891213: field webpage is nil")
|
|
}
|
|
if err := u.Webpage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateWebPage#7f891213: field webpage: %w", err)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateWebPage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateWebPage#7f891213 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateWebPageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateWebPage#7f891213: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateWebPage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateWebPage#7f891213 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeWebPage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateWebPage#7f891213: field webpage: %w", err)
|
|
}
|
|
u.Webpage = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateWebPage#7f891213: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateWebPage#7f891213: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetWebpage returns value of Webpage field.
|
|
func (u *UpdateWebPage) GetWebpage() (value WebPageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Webpage
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateWebPage) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateWebPage) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateReadMessagesContents represents TL type `updateReadMessagesContents#f8227181`.
|
|
// Contents of messages in the common message box¹ were read (emitted specifically for
|
|
// messages like voice messages or video, only once the media is watched and marked as
|
|
// read using messages.readMessageContents²).
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/updates
|
|
// 2. https://core.telegram.org/method/messages.readMessageContents
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadMessagesContents for reference.
|
|
type UpdateReadMessagesContents struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// IDs of read messages
|
|
Messages []int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
// When was the last message in messages marked as read.
|
|
//
|
|
// Use SetDate and GetDate helpers.
|
|
Date int
|
|
}
|
|
|
|
// UpdateReadMessagesContentsTypeID is TL type id of UpdateReadMessagesContents.
|
|
const UpdateReadMessagesContentsTypeID = 0xf8227181
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadMessagesContents) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadMessagesContents.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadMessagesContents{}
|
|
_ bin.Decoder = &UpdateReadMessagesContents{}
|
|
_ bin.BareEncoder = &UpdateReadMessagesContents{}
|
|
_ bin.BareDecoder = &UpdateReadMessagesContents{}
|
|
|
|
_ UpdateClass = &UpdateReadMessagesContents{}
|
|
)
|
|
|
|
func (u *UpdateReadMessagesContents) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadMessagesContents) String() string {
|
|
if u == nil {
|
|
return "UpdateReadMessagesContents(nil)"
|
|
}
|
|
type Alias UpdateReadMessagesContents
|
|
return fmt.Sprintf("UpdateReadMessagesContents%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadMessagesContents from given interface.
|
|
func (u *UpdateReadMessagesContents) FillFrom(from interface {
|
|
GetMessages() (value []int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
GetDate() (value int, ok bool)
|
|
}) {
|
|
u.Messages = from.GetMessages()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
if val, ok := from.GetDate(); ok {
|
|
u.Date = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadMessagesContents) TypeID() uint32 {
|
|
return UpdateReadMessagesContentsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadMessagesContents) TypeName() string {
|
|
return "updateReadMessagesContents"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadMessagesContents) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadMessagesContents",
|
|
ID: UpdateReadMessagesContentsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateReadMessagesContents) SetFlags() {
|
|
if !(u.Date == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadMessagesContents) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadMessagesContents#f8227181 as nil")
|
|
}
|
|
b.PutID(UpdateReadMessagesContentsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadMessagesContents) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadMessagesContents#f8227181 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadMessagesContents#f8227181: field flags: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.Date)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadMessagesContents) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadMessagesContents#f8227181 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadMessagesContentsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadMessagesContents) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadMessagesContents#f8227181 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMessagesContents#f8227181: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateReadMessagesContents) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateReadMessagesContents) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateReadMessagesContents) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// SetDate sets value of Date conditional field.
|
|
func (u *UpdateReadMessagesContents) SetDate(value int) {
|
|
u.Flags.Set(0)
|
|
u.Date = value
|
|
}
|
|
|
|
// GetDate returns value of Date conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateReadMessagesContents) GetDate() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Date, true
|
|
}
|
|
|
|
// UpdateChannelTooLong represents TL type `updateChannelTooLong#108d941f`.
|
|
// There are new updates in the specified channel, the client must fetch them.
|
|
// If the difference is too long or if the channel isn't currently in the states, start
|
|
// fetching from the specified pts.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelTooLong for reference.
|
|
type UpdateChannelTooLong struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// The channel
|
|
ChannelID int64
|
|
// The PTS¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
//
|
|
// Use SetPts and GetPts helpers.
|
|
Pts int
|
|
}
|
|
|
|
// UpdateChannelTooLongTypeID is TL type id of UpdateChannelTooLong.
|
|
const UpdateChannelTooLongTypeID = 0x108d941f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelTooLong) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelTooLong.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelTooLong{}
|
|
_ bin.Decoder = &UpdateChannelTooLong{}
|
|
_ bin.BareEncoder = &UpdateChannelTooLong{}
|
|
_ bin.BareDecoder = &UpdateChannelTooLong{}
|
|
|
|
_ UpdateClass = &UpdateChannelTooLong{}
|
|
)
|
|
|
|
func (u *UpdateChannelTooLong) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelTooLong) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelTooLong(nil)"
|
|
}
|
|
type Alias UpdateChannelTooLong
|
|
return fmt.Sprintf("UpdateChannelTooLong%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelTooLong from given interface.
|
|
func (u *UpdateChannelTooLong) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetPts() (value int, ok bool)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
if val, ok := from.GetPts(); ok {
|
|
u.Pts = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelTooLong) TypeID() uint32 {
|
|
return UpdateChannelTooLongTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelTooLong) TypeName() string {
|
|
return "updateChannelTooLong"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelTooLong) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelTooLong",
|
|
ID: UpdateChannelTooLongTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateChannelTooLong) SetFlags() {
|
|
if !(u.Pts == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelTooLong) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelTooLong#108d941f as nil")
|
|
}
|
|
b.PutID(UpdateChannelTooLongTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelTooLong) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelTooLong#108d941f as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelTooLong#108d941f: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.Pts)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelTooLong) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelTooLong#108d941f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelTooLongTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelTooLong#108d941f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelTooLong) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelTooLong#108d941f to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelTooLong#108d941f: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelTooLong#108d941f: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelTooLong#108d941f: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelTooLong) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// SetPts sets value of Pts conditional field.
|
|
func (u *UpdateChannelTooLong) SetPts(value int) {
|
|
u.Flags.Set(0)
|
|
u.Pts = value
|
|
}
|
|
|
|
// GetPts returns value of Pts conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelTooLong) GetPts() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Pts, true
|
|
}
|
|
|
|
// UpdateChannel represents TL type `updateChannel#635b4c09`.
|
|
// Channel/supergroup (channel¹ and/or channelFull²) information was updated.
|
|
// This update can only be received through getDifference or in
|
|
// updates¹/updatesCombined² constructors, so it will always come bundled with the
|
|
// updated channel³, that should be applied as usual »⁴, without re-fetching the info
|
|
// manually.
|
|
// However, full peer information will not come bundled in updates, so the full peer
|
|
// cache (channelFull¹) must be invalidated for channel_id when receiving this update.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/constructor/channel
|
|
// 2. https://core.telegram.org/constructor/channelFull
|
|
// 3. https://core.telegram.org/constructor/updates
|
|
// 4. https://core.telegram.org/constructor/updatesCombined
|
|
// 5. https://core.telegram.org/constructor/channel
|
|
// 6. https://core.telegram.org/api/peers
|
|
// 7. https://core.telegram.org/constructor/channelFull
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannel for reference.
|
|
type UpdateChannel struct {
|
|
// Channel ID
|
|
ChannelID int64
|
|
}
|
|
|
|
// UpdateChannelTypeID is TL type id of UpdateChannel.
|
|
const UpdateChannelTypeID = 0x635b4c09
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannel) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannel.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannel{}
|
|
_ bin.Decoder = &UpdateChannel{}
|
|
_ bin.BareEncoder = &UpdateChannel{}
|
|
_ bin.BareDecoder = &UpdateChannel{}
|
|
|
|
_ UpdateClass = &UpdateChannel{}
|
|
)
|
|
|
|
func (u *UpdateChannel) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannel) String() string {
|
|
if u == nil {
|
|
return "UpdateChannel(nil)"
|
|
}
|
|
type Alias UpdateChannel
|
|
return fmt.Sprintf("UpdateChannel%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannel from given interface.
|
|
func (u *UpdateChannel) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannel) TypeID() uint32 {
|
|
return UpdateChannelTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannel) TypeName() string {
|
|
return "updateChannel"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannel) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannel",
|
|
ID: UpdateChannelTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannel) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannel#635b4c09 as nil")
|
|
}
|
|
b.PutID(UpdateChannelTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannel) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannel#635b4c09 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannel) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannel#635b4c09 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannel#635b4c09: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannel) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannel#635b4c09 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannel#635b4c09: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannel) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// UpdateNewChannelMessage represents TL type `updateNewChannelMessage#62ba04d9`.
|
|
// A new message was sent in a channel/supergroup¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewChannelMessage for reference.
|
|
type UpdateNewChannelMessage struct {
|
|
// New message
|
|
Message MessageClass
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateNewChannelMessageTypeID is TL type id of UpdateNewChannelMessage.
|
|
const UpdateNewChannelMessageTypeID = 0x62ba04d9
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewChannelMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewChannelMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewChannelMessage{}
|
|
_ bin.Decoder = &UpdateNewChannelMessage{}
|
|
_ bin.BareEncoder = &UpdateNewChannelMessage{}
|
|
_ bin.BareDecoder = &UpdateNewChannelMessage{}
|
|
|
|
_ UpdateClass = &UpdateNewChannelMessage{}
|
|
)
|
|
|
|
func (u *UpdateNewChannelMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewChannelMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateNewChannelMessage(nil)"
|
|
}
|
|
type Alias UpdateNewChannelMessage
|
|
return fmt.Sprintf("UpdateNewChannelMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewChannelMessage from given interface.
|
|
func (u *UpdateNewChannelMessage) FillFrom(from interface {
|
|
GetMessage() (value MessageClass)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewChannelMessage) TypeID() uint32 {
|
|
return UpdateNewChannelMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewChannelMessage) TypeName() string {
|
|
return "updateNewChannelMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewChannelMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewChannelMessage",
|
|
ID: UpdateNewChannelMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewChannelMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewChannelMessage#62ba04d9 as nil")
|
|
}
|
|
b.PutID(UpdateNewChannelMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewChannelMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewChannelMessage#62ba04d9 as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateNewChannelMessage#62ba04d9: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewChannelMessage#62ba04d9: field message: %w", err)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewChannelMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewChannelMessage#62ba04d9 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewChannelMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewChannelMessage#62ba04d9: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewChannelMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewChannelMessage#62ba04d9 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewChannelMessage#62ba04d9: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewChannelMessage#62ba04d9: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewChannelMessage#62ba04d9: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateNewChannelMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateNewChannelMessage) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateNewChannelMessage) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateReadChannelInbox represents TL type `updateReadChannelInbox#922e6e10`.
|
|
// Incoming messages in a channel/supergroup¹ were read
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadChannelInbox for reference.
|
|
type UpdateReadChannelInbox struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Peer folder ID, for more info click here¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders#peer-folders
|
|
//
|
|
// Use SetFolderID and GetFolderID helpers.
|
|
FolderID int
|
|
// Channel/supergroup ID
|
|
ChannelID int64
|
|
// Position up to which all incoming messages are read.
|
|
MaxID int
|
|
// Count of messages weren't read yet
|
|
StillUnreadCount int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
}
|
|
|
|
// UpdateReadChannelInboxTypeID is TL type id of UpdateReadChannelInbox.
|
|
const UpdateReadChannelInboxTypeID = 0x922e6e10
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadChannelInbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadChannelInbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadChannelInbox{}
|
|
_ bin.Decoder = &UpdateReadChannelInbox{}
|
|
_ bin.BareEncoder = &UpdateReadChannelInbox{}
|
|
_ bin.BareDecoder = &UpdateReadChannelInbox{}
|
|
|
|
_ UpdateClass = &UpdateReadChannelInbox{}
|
|
)
|
|
|
|
func (u *UpdateReadChannelInbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.FolderID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.MaxID == 0) {
|
|
return false
|
|
}
|
|
if !(u.StillUnreadCount == 0) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadChannelInbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadChannelInbox(nil)"
|
|
}
|
|
type Alias UpdateReadChannelInbox
|
|
return fmt.Sprintf("UpdateReadChannelInbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadChannelInbox from given interface.
|
|
func (u *UpdateReadChannelInbox) FillFrom(from interface {
|
|
GetFolderID() (value int, ok bool)
|
|
GetChannelID() (value int64)
|
|
GetMaxID() (value int)
|
|
GetStillUnreadCount() (value int)
|
|
GetPts() (value int)
|
|
}) {
|
|
if val, ok := from.GetFolderID(); ok {
|
|
u.FolderID = val
|
|
}
|
|
|
|
u.ChannelID = from.GetChannelID()
|
|
u.MaxID = from.GetMaxID()
|
|
u.StillUnreadCount = from.GetStillUnreadCount()
|
|
u.Pts = from.GetPts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadChannelInbox) TypeID() uint32 {
|
|
return UpdateReadChannelInboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadChannelInbox) TypeName() string {
|
|
return "updateReadChannelInbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadChannelInbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadChannelInbox",
|
|
ID: UpdateReadChannelInboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "FolderID",
|
|
SchemaName: "folder_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "MaxID",
|
|
SchemaName: "max_id",
|
|
},
|
|
{
|
|
Name: "StillUnreadCount",
|
|
SchemaName: "still_unread_count",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateReadChannelInbox) SetFlags() {
|
|
if !(u.FolderID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadChannelInbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelInbox#922e6e10 as nil")
|
|
}
|
|
b.PutID(UpdateReadChannelInboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadChannelInbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelInbox#922e6e10 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadChannelInbox#922e6e10: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.FolderID)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.MaxID)
|
|
b.PutInt(u.StillUnreadCount)
|
|
b.PutInt(u.Pts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadChannelInbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelInbox#922e6e10 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadChannelInboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadChannelInbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelInbox#922e6e10 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: field flags: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: field folder_id: %w", err)
|
|
}
|
|
u.FolderID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: field max_id: %w", err)
|
|
}
|
|
u.MaxID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: field still_unread_count: %w", err)
|
|
}
|
|
u.StillUnreadCount = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelInbox#922e6e10: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetFolderID sets value of FolderID conditional field.
|
|
func (u *UpdateReadChannelInbox) SetFolderID(value int) {
|
|
u.Flags.Set(0)
|
|
u.FolderID = value
|
|
}
|
|
|
|
// GetFolderID returns value of FolderID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateReadChannelInbox) GetFolderID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.FolderID, true
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateReadChannelInbox) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetMaxID returns value of MaxID field.
|
|
func (u *UpdateReadChannelInbox) GetMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MaxID
|
|
}
|
|
|
|
// GetStillUnreadCount returns value of StillUnreadCount field.
|
|
func (u *UpdateReadChannelInbox) GetStillUnreadCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.StillUnreadCount
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateReadChannelInbox) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// UpdateDeleteChannelMessages represents TL type `updateDeleteChannelMessages#c32d5b12`.
|
|
// Some messages in a supergroup/channel¹ were deleted
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDeleteChannelMessages for reference.
|
|
type UpdateDeleteChannelMessages struct {
|
|
// Channel ID
|
|
ChannelID int64
|
|
// IDs of messages that were deleted
|
|
Messages []int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateDeleteChannelMessagesTypeID is TL type id of UpdateDeleteChannelMessages.
|
|
const UpdateDeleteChannelMessagesTypeID = 0xc32d5b12
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDeleteChannelMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDeleteChannelMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateDeleteChannelMessages{}
|
|
_ bin.Decoder = &UpdateDeleteChannelMessages{}
|
|
_ bin.BareEncoder = &UpdateDeleteChannelMessages{}
|
|
_ bin.BareDecoder = &UpdateDeleteChannelMessages{}
|
|
|
|
_ UpdateClass = &UpdateDeleteChannelMessages{}
|
|
)
|
|
|
|
func (u *UpdateDeleteChannelMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDeleteChannelMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateDeleteChannelMessages(nil)"
|
|
}
|
|
type Alias UpdateDeleteChannelMessages
|
|
return fmt.Sprintf("UpdateDeleteChannelMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDeleteChannelMessages from given interface.
|
|
func (u *UpdateDeleteChannelMessages) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetMessages() (value []int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.Messages = from.GetMessages()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDeleteChannelMessages) TypeID() uint32 {
|
|
return UpdateDeleteChannelMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDeleteChannelMessages) TypeName() string {
|
|
return "updateDeleteChannelMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDeleteChannelMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDeleteChannelMessages",
|
|
ID: UpdateDeleteChannelMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDeleteChannelMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteChannelMessages#c32d5b12 as nil")
|
|
}
|
|
b.PutID(UpdateDeleteChannelMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDeleteChannelMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteChannelMessages#c32d5b12 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDeleteChannelMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteChannelMessages#c32d5b12 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDeleteChannelMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteChannelMessages#c32d5b12: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDeleteChannelMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteChannelMessages#c32d5b12 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteChannelMessages#c32d5b12: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteChannelMessages#c32d5b12: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteChannelMessages#c32d5b12: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteChannelMessages#c32d5b12: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteChannelMessages#c32d5b12: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateDeleteChannelMessages) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateDeleteChannelMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateDeleteChannelMessages) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateDeleteChannelMessages) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateChannelMessageViews represents TL type `updateChannelMessageViews#f226ac08`.
|
|
// The view counter of a message in a channel has changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelMessageViews for reference.
|
|
type UpdateChannelMessageViews struct {
|
|
// Channel ID
|
|
ChannelID int64
|
|
// ID of the message
|
|
ID int
|
|
// New view counter
|
|
Views int
|
|
}
|
|
|
|
// UpdateChannelMessageViewsTypeID is TL type id of UpdateChannelMessageViews.
|
|
const UpdateChannelMessageViewsTypeID = 0xf226ac08
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelMessageViews) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelMessageViews.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelMessageViews{}
|
|
_ bin.Decoder = &UpdateChannelMessageViews{}
|
|
_ bin.BareEncoder = &UpdateChannelMessageViews{}
|
|
_ bin.BareDecoder = &UpdateChannelMessageViews{}
|
|
|
|
_ UpdateClass = &UpdateChannelMessageViews{}
|
|
)
|
|
|
|
func (u *UpdateChannelMessageViews) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Views == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelMessageViews) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelMessageViews(nil)"
|
|
}
|
|
type Alias UpdateChannelMessageViews
|
|
return fmt.Sprintf("UpdateChannelMessageViews%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelMessageViews from given interface.
|
|
func (u *UpdateChannelMessageViews) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetID() (value int)
|
|
GetViews() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.ID = from.GetID()
|
|
u.Views = from.GetViews()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelMessageViews) TypeID() uint32 {
|
|
return UpdateChannelMessageViewsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelMessageViews) TypeName() string {
|
|
return "updateChannelMessageViews"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelMessageViews) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelMessageViews",
|
|
ID: UpdateChannelMessageViewsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Views",
|
|
SchemaName: "views",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelMessageViews) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelMessageViews#f226ac08 as nil")
|
|
}
|
|
b.PutID(UpdateChannelMessageViewsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelMessageViews) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelMessageViews#f226ac08 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.ID)
|
|
b.PutInt(u.Views)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelMessageViews) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelMessageViews#f226ac08 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelMessageViewsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageViews#f226ac08: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelMessageViews) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelMessageViews#f226ac08 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageViews#f226ac08: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageViews#f226ac08: field id: %w", err)
|
|
}
|
|
u.ID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageViews#f226ac08: field views: %w", err)
|
|
}
|
|
u.Views = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelMessageViews) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (u *UpdateChannelMessageViews) GetID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ID
|
|
}
|
|
|
|
// GetViews returns value of Views field.
|
|
func (u *UpdateChannelMessageViews) GetViews() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Views
|
|
}
|
|
|
|
// UpdateChatParticipantAdmin represents TL type `updateChatParticipantAdmin#d7ca61a2`.
|
|
// Admin permissions of a user in a basic group¹ were changed
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel#basic-groups
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatParticipantAdmin for reference.
|
|
type UpdateChatParticipantAdmin struct {
|
|
// Chat ID
|
|
ChatID int64
|
|
// ID of the (de)admined user
|
|
UserID int64
|
|
// Whether the user was rendered admin
|
|
IsAdmin bool
|
|
// Used in basic groups to reorder updates and make sure that all of them was received.
|
|
Version int
|
|
}
|
|
|
|
// UpdateChatParticipantAdminTypeID is TL type id of UpdateChatParticipantAdmin.
|
|
const UpdateChatParticipantAdminTypeID = 0xd7ca61a2
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatParticipantAdmin) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatParticipantAdmin.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatParticipantAdmin{}
|
|
_ bin.Decoder = &UpdateChatParticipantAdmin{}
|
|
_ bin.BareEncoder = &UpdateChatParticipantAdmin{}
|
|
_ bin.BareDecoder = &UpdateChatParticipantAdmin{}
|
|
|
|
_ UpdateClass = &UpdateChatParticipantAdmin{}
|
|
)
|
|
|
|
func (u *UpdateChatParticipantAdmin) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.IsAdmin == false) {
|
|
return false
|
|
}
|
|
if !(u.Version == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatParticipantAdmin) String() string {
|
|
if u == nil {
|
|
return "UpdateChatParticipantAdmin(nil)"
|
|
}
|
|
type Alias UpdateChatParticipantAdmin
|
|
return fmt.Sprintf("UpdateChatParticipantAdmin%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatParticipantAdmin from given interface.
|
|
func (u *UpdateChatParticipantAdmin) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetIsAdmin() (value bool)
|
|
GetVersion() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.UserID = from.GetUserID()
|
|
u.IsAdmin = from.GetIsAdmin()
|
|
u.Version = from.GetVersion()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatParticipantAdmin) TypeID() uint32 {
|
|
return UpdateChatParticipantAdminTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatParticipantAdmin) TypeName() string {
|
|
return "updateChatParticipantAdmin"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatParticipantAdmin) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatParticipantAdmin",
|
|
ID: UpdateChatParticipantAdminTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "IsAdmin",
|
|
SchemaName: "is_admin",
|
|
},
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatParticipantAdmin) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantAdmin#d7ca61a2 as nil")
|
|
}
|
|
b.PutID(UpdateChatParticipantAdminTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatParticipantAdmin) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantAdmin#d7ca61a2 as nil")
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
b.PutLong(u.UserID)
|
|
b.PutBool(u.IsAdmin)
|
|
b.PutInt(u.Version)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatParticipantAdmin) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantAdmin#d7ca61a2 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatParticipantAdminTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdmin#d7ca61a2: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatParticipantAdmin) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantAdmin#d7ca61a2 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdmin#d7ca61a2: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdmin#d7ca61a2: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdmin#d7ca61a2: field is_admin: %w", err)
|
|
}
|
|
u.IsAdmin = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantAdmin#d7ca61a2: field version: %w", err)
|
|
}
|
|
u.Version = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChatParticipantAdmin) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateChatParticipantAdmin) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetIsAdmin returns value of IsAdmin field.
|
|
func (u *UpdateChatParticipantAdmin) GetIsAdmin() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.IsAdmin
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (u *UpdateChatParticipantAdmin) GetVersion() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Version
|
|
}
|
|
|
|
// UpdateNewStickerSet represents TL type `updateNewStickerSet#688a30aa`.
|
|
// A new stickerset was installed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewStickerSet for reference.
|
|
type UpdateNewStickerSet struct {
|
|
// The installed stickerset
|
|
Stickerset MessagesStickerSetClass
|
|
}
|
|
|
|
// UpdateNewStickerSetTypeID is TL type id of UpdateNewStickerSet.
|
|
const UpdateNewStickerSetTypeID = 0x688a30aa
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewStickerSet) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewStickerSet.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewStickerSet{}
|
|
_ bin.Decoder = &UpdateNewStickerSet{}
|
|
_ bin.BareEncoder = &UpdateNewStickerSet{}
|
|
_ bin.BareDecoder = &UpdateNewStickerSet{}
|
|
|
|
_ UpdateClass = &UpdateNewStickerSet{}
|
|
)
|
|
|
|
func (u *UpdateNewStickerSet) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Stickerset == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewStickerSet) String() string {
|
|
if u == nil {
|
|
return "UpdateNewStickerSet(nil)"
|
|
}
|
|
type Alias UpdateNewStickerSet
|
|
return fmt.Sprintf("UpdateNewStickerSet%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewStickerSet from given interface.
|
|
func (u *UpdateNewStickerSet) FillFrom(from interface {
|
|
GetStickerset() (value MessagesStickerSetClass)
|
|
}) {
|
|
u.Stickerset = from.GetStickerset()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewStickerSet) TypeID() uint32 {
|
|
return UpdateNewStickerSetTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewStickerSet) TypeName() string {
|
|
return "updateNewStickerSet"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewStickerSet) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewStickerSet",
|
|
ID: UpdateNewStickerSetTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Stickerset",
|
|
SchemaName: "stickerset",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewStickerSet) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewStickerSet#688a30aa as nil")
|
|
}
|
|
b.PutID(UpdateNewStickerSetTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewStickerSet) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewStickerSet#688a30aa as nil")
|
|
}
|
|
if u.Stickerset == nil {
|
|
return fmt.Errorf("unable to encode updateNewStickerSet#688a30aa: field stickerset is nil")
|
|
}
|
|
if err := u.Stickerset.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewStickerSet#688a30aa: field stickerset: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewStickerSet) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewStickerSet#688a30aa to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewStickerSetTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewStickerSet#688a30aa: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewStickerSet) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewStickerSet#688a30aa to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessagesStickerSet(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewStickerSet#688a30aa: field stickerset: %w", err)
|
|
}
|
|
u.Stickerset = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetStickerset returns value of Stickerset field.
|
|
func (u *UpdateNewStickerSet) GetStickerset() (value MessagesStickerSetClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Stickerset
|
|
}
|
|
|
|
// UpdateStickerSetsOrder represents TL type `updateStickerSetsOrder#bb2d201`.
|
|
// The order of stickersets was changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStickerSetsOrder for reference.
|
|
type UpdateStickerSetsOrder struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the updated stickers are mask stickers
|
|
Masks bool
|
|
// Whether the updated stickers are custom emoji stickers
|
|
Emojis bool
|
|
// New sticker order by sticker ID
|
|
Order []int64
|
|
}
|
|
|
|
// UpdateStickerSetsOrderTypeID is TL type id of UpdateStickerSetsOrder.
|
|
const UpdateStickerSetsOrderTypeID = 0xbb2d201
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStickerSetsOrder) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStickerSetsOrder.
|
|
var (
|
|
_ bin.Encoder = &UpdateStickerSetsOrder{}
|
|
_ bin.Decoder = &UpdateStickerSetsOrder{}
|
|
_ bin.BareEncoder = &UpdateStickerSetsOrder{}
|
|
_ bin.BareDecoder = &UpdateStickerSetsOrder{}
|
|
|
|
_ UpdateClass = &UpdateStickerSetsOrder{}
|
|
)
|
|
|
|
func (u *UpdateStickerSetsOrder) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Masks == false) {
|
|
return false
|
|
}
|
|
if !(u.Emojis == false) {
|
|
return false
|
|
}
|
|
if !(u.Order == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStickerSetsOrder) String() string {
|
|
if u == nil {
|
|
return "UpdateStickerSetsOrder(nil)"
|
|
}
|
|
type Alias UpdateStickerSetsOrder
|
|
return fmt.Sprintf("UpdateStickerSetsOrder%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStickerSetsOrder from given interface.
|
|
func (u *UpdateStickerSetsOrder) FillFrom(from interface {
|
|
GetMasks() (value bool)
|
|
GetEmojis() (value bool)
|
|
GetOrder() (value []int64)
|
|
}) {
|
|
u.Masks = from.GetMasks()
|
|
u.Emojis = from.GetEmojis()
|
|
u.Order = from.GetOrder()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStickerSetsOrder) TypeID() uint32 {
|
|
return UpdateStickerSetsOrderTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStickerSetsOrder) TypeName() string {
|
|
return "updateStickerSetsOrder"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStickerSetsOrder) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStickerSetsOrder",
|
|
ID: UpdateStickerSetsOrderTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Masks",
|
|
SchemaName: "masks",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Emojis",
|
|
SchemaName: "emojis",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Order",
|
|
SchemaName: "order",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateStickerSetsOrder) SetFlags() {
|
|
if !(u.Masks == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.Emojis == false) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStickerSetsOrder) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStickerSetsOrder#bb2d201 as nil")
|
|
}
|
|
b.PutID(UpdateStickerSetsOrderTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStickerSetsOrder) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStickerSetsOrder#bb2d201 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStickerSetsOrder#bb2d201: field flags: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Order))
|
|
for _, v := range u.Order {
|
|
b.PutLong(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStickerSetsOrder) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStickerSetsOrder#bb2d201 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStickerSetsOrderTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStickerSetsOrder#bb2d201: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStickerSetsOrder) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStickerSetsOrder#bb2d201 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateStickerSetsOrder#bb2d201: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Masks = u.Flags.Has(0)
|
|
u.Emojis = u.Flags.Has(1)
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStickerSetsOrder#bb2d201: field order: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Order = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStickerSetsOrder#bb2d201: field order: %w", err)
|
|
}
|
|
u.Order = append(u.Order, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetMasks sets value of Masks conditional field.
|
|
func (u *UpdateStickerSetsOrder) SetMasks(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Masks = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Masks = false
|
|
}
|
|
}
|
|
|
|
// GetMasks returns value of Masks conditional field.
|
|
func (u *UpdateStickerSetsOrder) GetMasks() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// SetEmojis sets value of Emojis conditional field.
|
|
func (u *UpdateStickerSetsOrder) SetEmojis(value bool) {
|
|
if value {
|
|
u.Flags.Set(1)
|
|
u.Emojis = true
|
|
} else {
|
|
u.Flags.Unset(1)
|
|
u.Emojis = false
|
|
}
|
|
}
|
|
|
|
// GetEmojis returns value of Emojis conditional field.
|
|
func (u *UpdateStickerSetsOrder) GetEmojis() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(1)
|
|
}
|
|
|
|
// GetOrder returns value of Order field.
|
|
func (u *UpdateStickerSetsOrder) GetOrder() (value []int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Order
|
|
}
|
|
|
|
// UpdateStickerSets represents TL type `updateStickerSets#31c24808`.
|
|
// Installed stickersets have changed, the client should refetch them as described in the
|
|
// docs¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stickers#installing-stickersets
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStickerSets for reference.
|
|
type UpdateStickerSets struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether mask stickersets have changed
|
|
Masks bool
|
|
// Whether the list of installed custom emoji stickersets¹ has changed
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/custom-emoji
|
|
Emojis bool
|
|
}
|
|
|
|
// UpdateStickerSetsTypeID is TL type id of UpdateStickerSets.
|
|
const UpdateStickerSetsTypeID = 0x31c24808
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStickerSets) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStickerSets.
|
|
var (
|
|
_ bin.Encoder = &UpdateStickerSets{}
|
|
_ bin.Decoder = &UpdateStickerSets{}
|
|
_ bin.BareEncoder = &UpdateStickerSets{}
|
|
_ bin.BareDecoder = &UpdateStickerSets{}
|
|
|
|
_ UpdateClass = &UpdateStickerSets{}
|
|
)
|
|
|
|
func (u *UpdateStickerSets) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Masks == false) {
|
|
return false
|
|
}
|
|
if !(u.Emojis == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStickerSets) String() string {
|
|
if u == nil {
|
|
return "UpdateStickerSets(nil)"
|
|
}
|
|
type Alias UpdateStickerSets
|
|
return fmt.Sprintf("UpdateStickerSets%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStickerSets from given interface.
|
|
func (u *UpdateStickerSets) FillFrom(from interface {
|
|
GetMasks() (value bool)
|
|
GetEmojis() (value bool)
|
|
}) {
|
|
u.Masks = from.GetMasks()
|
|
u.Emojis = from.GetEmojis()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStickerSets) TypeID() uint32 {
|
|
return UpdateStickerSetsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStickerSets) TypeName() string {
|
|
return "updateStickerSets"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStickerSets) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStickerSets",
|
|
ID: UpdateStickerSetsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Masks",
|
|
SchemaName: "masks",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Emojis",
|
|
SchemaName: "emojis",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateStickerSets) SetFlags() {
|
|
if !(u.Masks == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.Emojis == false) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStickerSets) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStickerSets#31c24808 as nil")
|
|
}
|
|
b.PutID(UpdateStickerSetsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStickerSets) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStickerSets#31c24808 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStickerSets#31c24808: field flags: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStickerSets) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStickerSets#31c24808 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStickerSetsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStickerSets#31c24808: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStickerSets) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStickerSets#31c24808 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateStickerSets#31c24808: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Masks = u.Flags.Has(0)
|
|
u.Emojis = u.Flags.Has(1)
|
|
return nil
|
|
}
|
|
|
|
// SetMasks sets value of Masks conditional field.
|
|
func (u *UpdateStickerSets) SetMasks(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Masks = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Masks = false
|
|
}
|
|
}
|
|
|
|
// GetMasks returns value of Masks conditional field.
|
|
func (u *UpdateStickerSets) GetMasks() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// SetEmojis sets value of Emojis conditional field.
|
|
func (u *UpdateStickerSets) SetEmojis(value bool) {
|
|
if value {
|
|
u.Flags.Set(1)
|
|
u.Emojis = true
|
|
} else {
|
|
u.Flags.Unset(1)
|
|
u.Emojis = false
|
|
}
|
|
}
|
|
|
|
// GetEmojis returns value of Emojis conditional field.
|
|
func (u *UpdateStickerSets) GetEmojis() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(1)
|
|
}
|
|
|
|
// UpdateSavedGifs represents TL type `updateSavedGifs#9375341e`.
|
|
// The saved gif list has changed, the client should refetch it using messages
|
|
// getSavedGifs¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/messages.getSavedGifs
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSavedGifs for reference.
|
|
type UpdateSavedGifs struct {
|
|
}
|
|
|
|
// UpdateSavedGifsTypeID is TL type id of UpdateSavedGifs.
|
|
const UpdateSavedGifsTypeID = 0x9375341e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSavedGifs) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSavedGifs.
|
|
var (
|
|
_ bin.Encoder = &UpdateSavedGifs{}
|
|
_ bin.Decoder = &UpdateSavedGifs{}
|
|
_ bin.BareEncoder = &UpdateSavedGifs{}
|
|
_ bin.BareDecoder = &UpdateSavedGifs{}
|
|
|
|
_ UpdateClass = &UpdateSavedGifs{}
|
|
)
|
|
|
|
func (u *UpdateSavedGifs) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSavedGifs) String() string {
|
|
if u == nil {
|
|
return "UpdateSavedGifs(nil)"
|
|
}
|
|
type Alias UpdateSavedGifs
|
|
return fmt.Sprintf("UpdateSavedGifs%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSavedGifs) TypeID() uint32 {
|
|
return UpdateSavedGifsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSavedGifs) TypeName() string {
|
|
return "updateSavedGifs"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSavedGifs) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSavedGifs",
|
|
ID: UpdateSavedGifsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSavedGifs) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedGifs#9375341e as nil")
|
|
}
|
|
b.PutID(UpdateSavedGifsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSavedGifs) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedGifs#9375341e as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSavedGifs) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedGifs#9375341e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSavedGifsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSavedGifs#9375341e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSavedGifs) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedGifs#9375341e to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateBotInlineQuery represents TL type `updateBotInlineQuery#496f379c`.
|
|
// An incoming inline query
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotInlineQuery for reference.
|
|
type UpdateBotInlineQuery struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Query ID
|
|
QueryID int64
|
|
// User that sent the query
|
|
UserID int64
|
|
// Text of query
|
|
Query string
|
|
// Attached geolocation
|
|
//
|
|
// Use SetGeo and GetGeo helpers.
|
|
Geo GeoPointClass
|
|
// Type of the chat from which the inline query was sent.
|
|
//
|
|
// Use SetPeerType and GetPeerType helpers.
|
|
PeerType InlineQueryPeerTypeClass
|
|
// Offset to navigate through results
|
|
Offset string
|
|
}
|
|
|
|
// UpdateBotInlineQueryTypeID is TL type id of UpdateBotInlineQuery.
|
|
const UpdateBotInlineQueryTypeID = 0x496f379c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotInlineQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotInlineQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotInlineQuery{}
|
|
_ bin.Decoder = &UpdateBotInlineQuery{}
|
|
_ bin.BareEncoder = &UpdateBotInlineQuery{}
|
|
_ bin.BareDecoder = &UpdateBotInlineQuery{}
|
|
|
|
_ UpdateClass = &UpdateBotInlineQuery{}
|
|
)
|
|
|
|
func (u *UpdateBotInlineQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Query == "") {
|
|
return false
|
|
}
|
|
if !(u.Geo == nil) {
|
|
return false
|
|
}
|
|
if !(u.PeerType == nil) {
|
|
return false
|
|
}
|
|
if !(u.Offset == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotInlineQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateBotInlineQuery(nil)"
|
|
}
|
|
type Alias UpdateBotInlineQuery
|
|
return fmt.Sprintf("UpdateBotInlineQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotInlineQuery from given interface.
|
|
func (u *UpdateBotInlineQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetQuery() (value string)
|
|
GetGeo() (value GeoPointClass, ok bool)
|
|
GetPeerType() (value InlineQueryPeerTypeClass, ok bool)
|
|
GetOffset() (value string)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.UserID = from.GetUserID()
|
|
u.Query = from.GetQuery()
|
|
if val, ok := from.GetGeo(); ok {
|
|
u.Geo = val
|
|
}
|
|
|
|
if val, ok := from.GetPeerType(); ok {
|
|
u.PeerType = val
|
|
}
|
|
|
|
u.Offset = from.GetOffset()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotInlineQuery) TypeID() uint32 {
|
|
return UpdateBotInlineQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotInlineQuery) TypeName() string {
|
|
return "updateBotInlineQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotInlineQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotInlineQuery",
|
|
ID: UpdateBotInlineQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Query",
|
|
SchemaName: "query",
|
|
},
|
|
{
|
|
Name: "Geo",
|
|
SchemaName: "geo",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "PeerType",
|
|
SchemaName: "peer_type",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Offset",
|
|
SchemaName: "offset",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBotInlineQuery) SetFlags() {
|
|
if !(u.Geo == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.PeerType == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotInlineQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotInlineQuery#496f379c as nil")
|
|
}
|
|
b.PutID(UpdateBotInlineQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotInlineQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotInlineQuery#496f379c as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineQuery#496f379c: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.Query)
|
|
if u.Flags.Has(0) {
|
|
if u.Geo == nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineQuery#496f379c: field geo is nil")
|
|
}
|
|
if err := u.Geo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineQuery#496f379c: field geo: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.PeerType == nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineQuery#496f379c: field peer_type is nil")
|
|
}
|
|
if err := u.PeerType.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineQuery#496f379c: field peer_type: %w", err)
|
|
}
|
|
}
|
|
b.PutString(u.Offset)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotInlineQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotInlineQuery#496f379c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotInlineQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotInlineQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotInlineQuery#496f379c to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field query: %w", err)
|
|
}
|
|
u.Query = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeGeoPoint(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field geo: %w", err)
|
|
}
|
|
u.Geo = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodeInlineQueryPeerType(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field peer_type: %w", err)
|
|
}
|
|
u.PeerType = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineQuery#496f379c: field offset: %w", err)
|
|
}
|
|
u.Offset = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateBotInlineQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotInlineQuery) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetQuery returns value of Query field.
|
|
func (u *UpdateBotInlineQuery) GetQuery() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Query
|
|
}
|
|
|
|
// SetGeo sets value of Geo conditional field.
|
|
func (u *UpdateBotInlineQuery) SetGeo(value GeoPointClass) {
|
|
u.Flags.Set(0)
|
|
u.Geo = value
|
|
}
|
|
|
|
// GetGeo returns value of Geo conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotInlineQuery) GetGeo() (value GeoPointClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Geo, true
|
|
}
|
|
|
|
// SetPeerType sets value of PeerType conditional field.
|
|
func (u *UpdateBotInlineQuery) SetPeerType(value InlineQueryPeerTypeClass) {
|
|
u.Flags.Set(1)
|
|
u.PeerType = value
|
|
}
|
|
|
|
// GetPeerType returns value of PeerType conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotInlineQuery) GetPeerType() (value InlineQueryPeerTypeClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.PeerType, true
|
|
}
|
|
|
|
// GetOffset returns value of Offset field.
|
|
func (u *UpdateBotInlineQuery) GetOffset() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Offset
|
|
}
|
|
|
|
// UpdateBotInlineSend represents TL type `updateBotInlineSend#12f12a07`.
|
|
// The result of an inline query that was chosen by a user and sent to their chat partner
|
|
// Please see our documentation on the feedback collecting¹ for details on how to
|
|
// enable these updates for your bot.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/bots/inline#collecting-feedback
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotInlineSend for reference.
|
|
type UpdateBotInlineSend struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// The user that chose the result
|
|
UserID int64
|
|
// The query that was used to obtain the result
|
|
Query string
|
|
// Optional. Sender location, only for bots that require user location
|
|
//
|
|
// Use SetGeo and GetGeo helpers.
|
|
Geo GeoPointClass
|
|
// The unique identifier for the result that was chosen
|
|
ID string
|
|
// Identifier of the sent inline message. Available only if there is an inline keyboard
|
|
// attached to the message. Will be also received in callback queries and can be used to
|
|
// edit the message.
|
|
//
|
|
// Use SetMsgID and GetMsgID helpers.
|
|
MsgID InputBotInlineMessageIDClass
|
|
}
|
|
|
|
// UpdateBotInlineSendTypeID is TL type id of UpdateBotInlineSend.
|
|
const UpdateBotInlineSendTypeID = 0x12f12a07
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotInlineSend) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotInlineSend.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotInlineSend{}
|
|
_ bin.Decoder = &UpdateBotInlineSend{}
|
|
_ bin.BareEncoder = &UpdateBotInlineSend{}
|
|
_ bin.BareDecoder = &UpdateBotInlineSend{}
|
|
|
|
_ UpdateClass = &UpdateBotInlineSend{}
|
|
)
|
|
|
|
func (u *UpdateBotInlineSend) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Query == "") {
|
|
return false
|
|
}
|
|
if !(u.Geo == nil) {
|
|
return false
|
|
}
|
|
if !(u.ID == "") {
|
|
return false
|
|
}
|
|
if !(u.MsgID == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotInlineSend) String() string {
|
|
if u == nil {
|
|
return "UpdateBotInlineSend(nil)"
|
|
}
|
|
type Alias UpdateBotInlineSend
|
|
return fmt.Sprintf("UpdateBotInlineSend%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotInlineSend from given interface.
|
|
func (u *UpdateBotInlineSend) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetQuery() (value string)
|
|
GetGeo() (value GeoPointClass, ok bool)
|
|
GetID() (value string)
|
|
GetMsgID() (value InputBotInlineMessageIDClass, ok bool)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.Query = from.GetQuery()
|
|
if val, ok := from.GetGeo(); ok {
|
|
u.Geo = val
|
|
}
|
|
|
|
u.ID = from.GetID()
|
|
if val, ok := from.GetMsgID(); ok {
|
|
u.MsgID = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotInlineSend) TypeID() uint32 {
|
|
return UpdateBotInlineSendTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotInlineSend) TypeName() string {
|
|
return "updateBotInlineSend"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotInlineSend) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotInlineSend",
|
|
ID: UpdateBotInlineSendTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Query",
|
|
SchemaName: "query",
|
|
},
|
|
{
|
|
Name: "Geo",
|
|
SchemaName: "geo",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBotInlineSend) SetFlags() {
|
|
if !(u.Geo == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.MsgID == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotInlineSend) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotInlineSend#12f12a07 as nil")
|
|
}
|
|
b.PutID(UpdateBotInlineSendTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotInlineSend) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotInlineSend#12f12a07 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineSend#12f12a07: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.Query)
|
|
if u.Flags.Has(0) {
|
|
if u.Geo == nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineSend#12f12a07: field geo is nil")
|
|
}
|
|
if err := u.Geo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineSend#12f12a07: field geo: %w", err)
|
|
}
|
|
}
|
|
b.PutString(u.ID)
|
|
if u.Flags.Has(1) {
|
|
if u.MsgID == nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineSend#12f12a07: field msg_id is nil")
|
|
}
|
|
if err := u.MsgID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotInlineSend#12f12a07: field msg_id: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotInlineSend) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotInlineSend#12f12a07 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotInlineSendTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotInlineSend) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotInlineSend#12f12a07 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: field query: %w", err)
|
|
}
|
|
u.Query = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeGeoPoint(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: field geo: %w", err)
|
|
}
|
|
u.Geo = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: field id: %w", err)
|
|
}
|
|
u.ID = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodeInputBotInlineMessageID(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotInlineSend#12f12a07: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotInlineSend) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetQuery returns value of Query field.
|
|
func (u *UpdateBotInlineSend) GetQuery() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Query
|
|
}
|
|
|
|
// SetGeo sets value of Geo conditional field.
|
|
func (u *UpdateBotInlineSend) SetGeo(value GeoPointClass) {
|
|
u.Flags.Set(0)
|
|
u.Geo = value
|
|
}
|
|
|
|
// GetGeo returns value of Geo conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotInlineSend) GetGeo() (value GeoPointClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Geo, true
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (u *UpdateBotInlineSend) GetID() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ID
|
|
}
|
|
|
|
// SetMsgID sets value of MsgID conditional field.
|
|
func (u *UpdateBotInlineSend) SetMsgID(value InputBotInlineMessageIDClass) {
|
|
u.Flags.Set(1)
|
|
u.MsgID = value
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotInlineSend) GetMsgID() (value InputBotInlineMessageIDClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.MsgID, true
|
|
}
|
|
|
|
// UpdateEditChannelMessage represents TL type `updateEditChannelMessage#1b3f4df7`.
|
|
// A message was edited in a channel/supergroup¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateEditChannelMessage for reference.
|
|
type UpdateEditChannelMessage struct {
|
|
// The new message
|
|
Message MessageClass
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateEditChannelMessageTypeID is TL type id of UpdateEditChannelMessage.
|
|
const UpdateEditChannelMessageTypeID = 0x1b3f4df7
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateEditChannelMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateEditChannelMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateEditChannelMessage{}
|
|
_ bin.Decoder = &UpdateEditChannelMessage{}
|
|
_ bin.BareEncoder = &UpdateEditChannelMessage{}
|
|
_ bin.BareDecoder = &UpdateEditChannelMessage{}
|
|
|
|
_ UpdateClass = &UpdateEditChannelMessage{}
|
|
)
|
|
|
|
func (u *UpdateEditChannelMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateEditChannelMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateEditChannelMessage(nil)"
|
|
}
|
|
type Alias UpdateEditChannelMessage
|
|
return fmt.Sprintf("UpdateEditChannelMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateEditChannelMessage from given interface.
|
|
func (u *UpdateEditChannelMessage) FillFrom(from interface {
|
|
GetMessage() (value MessageClass)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateEditChannelMessage) TypeID() uint32 {
|
|
return UpdateEditChannelMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateEditChannelMessage) TypeName() string {
|
|
return "updateEditChannelMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateEditChannelMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateEditChannelMessage",
|
|
ID: UpdateEditChannelMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateEditChannelMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEditChannelMessage#1b3f4df7 as nil")
|
|
}
|
|
b.PutID(UpdateEditChannelMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateEditChannelMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEditChannelMessage#1b3f4df7 as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateEditChannelMessage#1b3f4df7: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateEditChannelMessage#1b3f4df7: field message: %w", err)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateEditChannelMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEditChannelMessage#1b3f4df7 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateEditChannelMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateEditChannelMessage#1b3f4df7: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateEditChannelMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEditChannelMessage#1b3f4df7 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEditChannelMessage#1b3f4df7: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEditChannelMessage#1b3f4df7: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEditChannelMessage#1b3f4df7: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateEditChannelMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateEditChannelMessage) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateEditChannelMessage) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateBotCallbackQuery represents TL type `updateBotCallbackQuery#b9cfc48d`.
|
|
// A callback button was pressed, and the button data was sent to the bot that created
|
|
// the button
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotCallbackQuery for reference.
|
|
type UpdateBotCallbackQuery struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Query ID
|
|
QueryID int64
|
|
// ID of the user that pressed the button
|
|
UserID int64
|
|
// Chat where the inline keyboard was sent
|
|
Peer PeerClass
|
|
// Message ID
|
|
MsgID int
|
|
// Global identifier, uniquely corresponding to the chat to which the message with the
|
|
// callback button was sent. Useful for high scores in games.
|
|
ChatInstance int64
|
|
// Callback data
|
|
//
|
|
// Use SetData and GetData helpers.
|
|
Data []byte
|
|
// Short name of a Game to be returned, serves as the unique identifier for the game
|
|
//
|
|
// Use SetGameShortName and GetGameShortName helpers.
|
|
GameShortName string
|
|
}
|
|
|
|
// UpdateBotCallbackQueryTypeID is TL type id of UpdateBotCallbackQuery.
|
|
const UpdateBotCallbackQueryTypeID = 0xb9cfc48d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotCallbackQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotCallbackQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotCallbackQuery{}
|
|
_ bin.Decoder = &UpdateBotCallbackQuery{}
|
|
_ bin.BareEncoder = &UpdateBotCallbackQuery{}
|
|
_ bin.BareDecoder = &UpdateBotCallbackQuery{}
|
|
|
|
_ UpdateClass = &UpdateBotCallbackQuery{}
|
|
)
|
|
|
|
func (u *UpdateBotCallbackQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ChatInstance == 0) {
|
|
return false
|
|
}
|
|
if !(u.Data == nil) {
|
|
return false
|
|
}
|
|
if !(u.GameShortName == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotCallbackQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateBotCallbackQuery(nil)"
|
|
}
|
|
type Alias UpdateBotCallbackQuery
|
|
return fmt.Sprintf("UpdateBotCallbackQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotCallbackQuery from given interface.
|
|
func (u *UpdateBotCallbackQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
GetChatInstance() (value int64)
|
|
GetData() (value []byte, ok bool)
|
|
GetGameShortName() (value string, ok bool)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.UserID = from.GetUserID()
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
u.ChatInstance = from.GetChatInstance()
|
|
if val, ok := from.GetData(); ok {
|
|
u.Data = val
|
|
}
|
|
|
|
if val, ok := from.GetGameShortName(); ok {
|
|
u.GameShortName = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotCallbackQuery) TypeID() uint32 {
|
|
return UpdateBotCallbackQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotCallbackQuery) TypeName() string {
|
|
return "updateBotCallbackQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotCallbackQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotCallbackQuery",
|
|
ID: UpdateBotCallbackQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "ChatInstance",
|
|
SchemaName: "chat_instance",
|
|
},
|
|
{
|
|
Name: "Data",
|
|
SchemaName: "data",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "GameShortName",
|
|
SchemaName: "game_short_name",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBotCallbackQuery) SetFlags() {
|
|
if !(u.Data == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.GameShortName == "") {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotCallbackQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotCallbackQuery#b9cfc48d as nil")
|
|
}
|
|
b.PutID(UpdateBotCallbackQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotCallbackQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotCallbackQuery#b9cfc48d as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotCallbackQuery#b9cfc48d: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
b.PutLong(u.UserID)
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotCallbackQuery#b9cfc48d: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotCallbackQuery#b9cfc48d: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
b.PutLong(u.ChatInstance)
|
|
if u.Flags.Has(0) {
|
|
b.PutBytes(u.Data)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutString(u.GameShortName)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotCallbackQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotCallbackQuery#b9cfc48d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotCallbackQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotCallbackQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotCallbackQuery#b9cfc48d to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field chat_instance: %w", err)
|
|
}
|
|
u.ChatInstance = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field data: %w", err)
|
|
}
|
|
u.Data = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCallbackQuery#b9cfc48d: field game_short_name: %w", err)
|
|
}
|
|
u.GameShortName = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateBotCallbackQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotCallbackQuery) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotCallbackQuery) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateBotCallbackQuery) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// GetChatInstance returns value of ChatInstance field.
|
|
func (u *UpdateBotCallbackQuery) GetChatInstance() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatInstance
|
|
}
|
|
|
|
// SetData sets value of Data conditional field.
|
|
func (u *UpdateBotCallbackQuery) SetData(value []byte) {
|
|
u.Flags.Set(0)
|
|
u.Data = value
|
|
}
|
|
|
|
// GetData returns value of Data conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotCallbackQuery) GetData() (value []byte, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Data, true
|
|
}
|
|
|
|
// SetGameShortName sets value of GameShortName conditional field.
|
|
func (u *UpdateBotCallbackQuery) SetGameShortName(value string) {
|
|
u.Flags.Set(1)
|
|
u.GameShortName = value
|
|
}
|
|
|
|
// GetGameShortName returns value of GameShortName conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotCallbackQuery) GetGameShortName() (value string, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.GameShortName, true
|
|
}
|
|
|
|
// UpdateEditMessage represents TL type `updateEditMessage#e40370a3`.
|
|
// A message was edited
|
|
//
|
|
// See https://core.telegram.org/constructor/updateEditMessage for reference.
|
|
type UpdateEditMessage struct {
|
|
// The new edited message
|
|
Message MessageClass
|
|
// PTS¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// PTS count¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateEditMessageTypeID is TL type id of UpdateEditMessage.
|
|
const UpdateEditMessageTypeID = 0xe40370a3
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateEditMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateEditMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateEditMessage{}
|
|
_ bin.Decoder = &UpdateEditMessage{}
|
|
_ bin.BareEncoder = &UpdateEditMessage{}
|
|
_ bin.BareDecoder = &UpdateEditMessage{}
|
|
|
|
_ UpdateClass = &UpdateEditMessage{}
|
|
)
|
|
|
|
func (u *UpdateEditMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateEditMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateEditMessage(nil)"
|
|
}
|
|
type Alias UpdateEditMessage
|
|
return fmt.Sprintf("UpdateEditMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateEditMessage from given interface.
|
|
func (u *UpdateEditMessage) FillFrom(from interface {
|
|
GetMessage() (value MessageClass)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateEditMessage) TypeID() uint32 {
|
|
return UpdateEditMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateEditMessage) TypeName() string {
|
|
return "updateEditMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateEditMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateEditMessage",
|
|
ID: UpdateEditMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateEditMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEditMessage#e40370a3 as nil")
|
|
}
|
|
b.PutID(UpdateEditMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateEditMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEditMessage#e40370a3 as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateEditMessage#e40370a3: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateEditMessage#e40370a3: field message: %w", err)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateEditMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEditMessage#e40370a3 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateEditMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateEditMessage#e40370a3: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateEditMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEditMessage#e40370a3 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEditMessage#e40370a3: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEditMessage#e40370a3: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEditMessage#e40370a3: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateEditMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateEditMessage) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateEditMessage) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateInlineBotCallbackQuery represents TL type `updateInlineBotCallbackQuery#691e9052`.
|
|
// This notification is received by bots when a button is pressed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateInlineBotCallbackQuery for reference.
|
|
type UpdateInlineBotCallbackQuery struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Query ID
|
|
QueryID int64
|
|
// ID of the user that pressed the button
|
|
UserID int64
|
|
// ID of the inline message with the button
|
|
MsgID InputBotInlineMessageIDClass
|
|
// Global identifier, uniquely corresponding to the chat to which the message with the
|
|
// callback button was sent. Useful for high scores in games.
|
|
ChatInstance int64
|
|
// Data associated with the callback button. Be aware that a bad client can send
|
|
// arbitrary data in this field.
|
|
//
|
|
// Use SetData and GetData helpers.
|
|
Data []byte
|
|
// Short name of a Game to be returned, serves as the unique identifier for the game
|
|
//
|
|
// Use SetGameShortName and GetGameShortName helpers.
|
|
GameShortName string
|
|
}
|
|
|
|
// UpdateInlineBotCallbackQueryTypeID is TL type id of UpdateInlineBotCallbackQuery.
|
|
const UpdateInlineBotCallbackQueryTypeID = 0x691e9052
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateInlineBotCallbackQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateInlineBotCallbackQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateInlineBotCallbackQuery{}
|
|
_ bin.Decoder = &UpdateInlineBotCallbackQuery{}
|
|
_ bin.BareEncoder = &UpdateInlineBotCallbackQuery{}
|
|
_ bin.BareDecoder = &UpdateInlineBotCallbackQuery{}
|
|
|
|
_ UpdateClass = &UpdateInlineBotCallbackQuery{}
|
|
)
|
|
|
|
func (u *UpdateInlineBotCallbackQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == nil) {
|
|
return false
|
|
}
|
|
if !(u.ChatInstance == 0) {
|
|
return false
|
|
}
|
|
if !(u.Data == nil) {
|
|
return false
|
|
}
|
|
if !(u.GameShortName == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateInlineBotCallbackQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateInlineBotCallbackQuery(nil)"
|
|
}
|
|
type Alias UpdateInlineBotCallbackQuery
|
|
return fmt.Sprintf("UpdateInlineBotCallbackQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateInlineBotCallbackQuery from given interface.
|
|
func (u *UpdateInlineBotCallbackQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetMsgID() (value InputBotInlineMessageIDClass)
|
|
GetChatInstance() (value int64)
|
|
GetData() (value []byte, ok bool)
|
|
GetGameShortName() (value string, ok bool)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.UserID = from.GetUserID()
|
|
u.MsgID = from.GetMsgID()
|
|
u.ChatInstance = from.GetChatInstance()
|
|
if val, ok := from.GetData(); ok {
|
|
u.Data = val
|
|
}
|
|
|
|
if val, ok := from.GetGameShortName(); ok {
|
|
u.GameShortName = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateInlineBotCallbackQuery) TypeID() uint32 {
|
|
return UpdateInlineBotCallbackQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateInlineBotCallbackQuery) TypeName() string {
|
|
return "updateInlineBotCallbackQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateInlineBotCallbackQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateInlineBotCallbackQuery",
|
|
ID: UpdateInlineBotCallbackQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "ChatInstance",
|
|
SchemaName: "chat_instance",
|
|
},
|
|
{
|
|
Name: "Data",
|
|
SchemaName: "data",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "GameShortName",
|
|
SchemaName: "game_short_name",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateInlineBotCallbackQuery) SetFlags() {
|
|
if !(u.Data == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.GameShortName == "") {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateInlineBotCallbackQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateInlineBotCallbackQuery#691e9052 as nil")
|
|
}
|
|
b.PutID(UpdateInlineBotCallbackQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateInlineBotCallbackQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateInlineBotCallbackQuery#691e9052 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateInlineBotCallbackQuery#691e9052: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
b.PutLong(u.UserID)
|
|
if u.MsgID == nil {
|
|
return fmt.Errorf("unable to encode updateInlineBotCallbackQuery#691e9052: field msg_id is nil")
|
|
}
|
|
if err := u.MsgID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateInlineBotCallbackQuery#691e9052: field msg_id: %w", err)
|
|
}
|
|
b.PutLong(u.ChatInstance)
|
|
if u.Flags.Has(0) {
|
|
b.PutBytes(u.Data)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutString(u.GameShortName)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateInlineBotCallbackQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateInlineBotCallbackQuery#691e9052 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateInlineBotCallbackQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateInlineBotCallbackQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateInlineBotCallbackQuery#691e9052 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := DecodeInputBotInlineMessageID(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field chat_instance: %w", err)
|
|
}
|
|
u.ChatInstance = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field data: %w", err)
|
|
}
|
|
u.Data = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateInlineBotCallbackQuery#691e9052: field game_short_name: %w", err)
|
|
}
|
|
u.GameShortName = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateInlineBotCallbackQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateInlineBotCallbackQuery) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateInlineBotCallbackQuery) GetMsgID() (value InputBotInlineMessageIDClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// GetChatInstance returns value of ChatInstance field.
|
|
func (u *UpdateInlineBotCallbackQuery) GetChatInstance() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatInstance
|
|
}
|
|
|
|
// SetData sets value of Data conditional field.
|
|
func (u *UpdateInlineBotCallbackQuery) SetData(value []byte) {
|
|
u.Flags.Set(0)
|
|
u.Data = value
|
|
}
|
|
|
|
// GetData returns value of Data conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateInlineBotCallbackQuery) GetData() (value []byte, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Data, true
|
|
}
|
|
|
|
// SetGameShortName sets value of GameShortName conditional field.
|
|
func (u *UpdateInlineBotCallbackQuery) SetGameShortName(value string) {
|
|
u.Flags.Set(1)
|
|
u.GameShortName = value
|
|
}
|
|
|
|
// GetGameShortName returns value of GameShortName conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateInlineBotCallbackQuery) GetGameShortName() (value string, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.GameShortName, true
|
|
}
|
|
|
|
// UpdateReadChannelOutbox represents TL type `updateReadChannelOutbox#b75f99a9`.
|
|
// Outgoing messages in a channel/supergroup¹ were read
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadChannelOutbox for reference.
|
|
type UpdateReadChannelOutbox struct {
|
|
// Channel/supergroup ID
|
|
ChannelID int64
|
|
// Position up to which all outgoing messages are read.
|
|
MaxID int
|
|
}
|
|
|
|
// UpdateReadChannelOutboxTypeID is TL type id of UpdateReadChannelOutbox.
|
|
const UpdateReadChannelOutboxTypeID = 0xb75f99a9
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadChannelOutbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadChannelOutbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadChannelOutbox{}
|
|
_ bin.Decoder = &UpdateReadChannelOutbox{}
|
|
_ bin.BareEncoder = &UpdateReadChannelOutbox{}
|
|
_ bin.BareDecoder = &UpdateReadChannelOutbox{}
|
|
|
|
_ UpdateClass = &UpdateReadChannelOutbox{}
|
|
)
|
|
|
|
func (u *UpdateReadChannelOutbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.MaxID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadChannelOutbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadChannelOutbox(nil)"
|
|
}
|
|
type Alias UpdateReadChannelOutbox
|
|
return fmt.Sprintf("UpdateReadChannelOutbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadChannelOutbox from given interface.
|
|
func (u *UpdateReadChannelOutbox) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetMaxID() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.MaxID = from.GetMaxID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadChannelOutbox) TypeID() uint32 {
|
|
return UpdateReadChannelOutboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadChannelOutbox) TypeName() string {
|
|
return "updateReadChannelOutbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadChannelOutbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadChannelOutbox",
|
|
ID: UpdateReadChannelOutboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "MaxID",
|
|
SchemaName: "max_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadChannelOutbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelOutbox#b75f99a9 as nil")
|
|
}
|
|
b.PutID(UpdateReadChannelOutboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadChannelOutbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelOutbox#b75f99a9 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.MaxID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadChannelOutbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelOutbox#b75f99a9 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadChannelOutboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelOutbox#b75f99a9: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadChannelOutbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelOutbox#b75f99a9 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelOutbox#b75f99a9: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelOutbox#b75f99a9: field max_id: %w", err)
|
|
}
|
|
u.MaxID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateReadChannelOutbox) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetMaxID returns value of MaxID field.
|
|
func (u *UpdateReadChannelOutbox) GetMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MaxID
|
|
}
|
|
|
|
// UpdateDraftMessage represents TL type `updateDraftMessage#edfc111e`.
|
|
// Notifies a change of a message draft¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/drafts
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDraftMessage for reference.
|
|
type UpdateDraftMessage struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// The peer to which the draft is associated
|
|
Peer PeerClass
|
|
// ID of the forum topic¹ to which the draft is associated
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/forum#forum-topics
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// If set, the draft is related to the specified monoforum topic ID »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/monoforum
|
|
//
|
|
// Use SetSavedPeerID and GetSavedPeerID helpers.
|
|
SavedPeerID PeerClass
|
|
// The draft
|
|
Draft DraftMessageClass
|
|
}
|
|
|
|
// UpdateDraftMessageTypeID is TL type id of UpdateDraftMessage.
|
|
const UpdateDraftMessageTypeID = 0xedfc111e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDraftMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDraftMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateDraftMessage{}
|
|
_ bin.Decoder = &UpdateDraftMessage{}
|
|
_ bin.BareEncoder = &UpdateDraftMessage{}
|
|
_ bin.BareDecoder = &UpdateDraftMessage{}
|
|
|
|
_ UpdateClass = &UpdateDraftMessage{}
|
|
)
|
|
|
|
func (u *UpdateDraftMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
if !(u.Draft == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDraftMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateDraftMessage(nil)"
|
|
}
|
|
type Alias UpdateDraftMessage
|
|
return fmt.Sprintf("UpdateDraftMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDraftMessage from given interface.
|
|
func (u *UpdateDraftMessage) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetSavedPeerID() (value PeerClass, ok bool)
|
|
GetDraft() (value DraftMessageClass)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
if val, ok := from.GetSavedPeerID(); ok {
|
|
u.SavedPeerID = val
|
|
}
|
|
|
|
u.Draft = from.GetDraft()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDraftMessage) TypeID() uint32 {
|
|
return UpdateDraftMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDraftMessage) TypeName() string {
|
|
return "updateDraftMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDraftMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDraftMessage",
|
|
ID: UpdateDraftMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Draft",
|
|
SchemaName: "draft",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateDraftMessage) SetFlags() {
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDraftMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDraftMessage#edfc111e as nil")
|
|
}
|
|
b.PutID(UpdateDraftMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDraftMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDraftMessage#edfc111e as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field peer: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field saved_peer_id: %w", err)
|
|
}
|
|
}
|
|
if u.Draft == nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field draft is nil")
|
|
}
|
|
if err := u.Draft.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDraftMessage#edfc111e: field draft: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDraftMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDraftMessage#edfc111e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDraftMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDraftMessage#edfc111e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDraftMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDraftMessage#edfc111e to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateDraftMessage#edfc111e: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDraftMessage#edfc111e: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDraftMessage#edfc111e: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDraftMessage#edfc111e: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
{
|
|
value, err := DecodeDraftMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDraftMessage#edfc111e: field draft: %w", err)
|
|
}
|
|
u.Draft = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateDraftMessage) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateDraftMessage) SetTopMsgID(value int) {
|
|
u.Flags.Set(0)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateDraftMessage) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// SetSavedPeerID sets value of SavedPeerID conditional field.
|
|
func (u *UpdateDraftMessage) SetSavedPeerID(value PeerClass) {
|
|
u.Flags.Set(1)
|
|
u.SavedPeerID = value
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateDraftMessage) GetSavedPeerID() (value PeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.SavedPeerID, true
|
|
}
|
|
|
|
// GetDraft returns value of Draft field.
|
|
func (u *UpdateDraftMessage) GetDraft() (value DraftMessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Draft
|
|
}
|
|
|
|
// UpdateReadFeaturedStickers represents TL type `updateReadFeaturedStickers#571d2742`.
|
|
// Some featured stickers were marked as read
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadFeaturedStickers for reference.
|
|
type UpdateReadFeaturedStickers struct {
|
|
}
|
|
|
|
// UpdateReadFeaturedStickersTypeID is TL type id of UpdateReadFeaturedStickers.
|
|
const UpdateReadFeaturedStickersTypeID = 0x571d2742
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadFeaturedStickers) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadFeaturedStickers.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadFeaturedStickers{}
|
|
_ bin.Decoder = &UpdateReadFeaturedStickers{}
|
|
_ bin.BareEncoder = &UpdateReadFeaturedStickers{}
|
|
_ bin.BareDecoder = &UpdateReadFeaturedStickers{}
|
|
|
|
_ UpdateClass = &UpdateReadFeaturedStickers{}
|
|
)
|
|
|
|
func (u *UpdateReadFeaturedStickers) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadFeaturedStickers) String() string {
|
|
if u == nil {
|
|
return "UpdateReadFeaturedStickers(nil)"
|
|
}
|
|
type Alias UpdateReadFeaturedStickers
|
|
return fmt.Sprintf("UpdateReadFeaturedStickers%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadFeaturedStickers) TypeID() uint32 {
|
|
return UpdateReadFeaturedStickersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadFeaturedStickers) TypeName() string {
|
|
return "updateReadFeaturedStickers"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadFeaturedStickers) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadFeaturedStickers",
|
|
ID: UpdateReadFeaturedStickersTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadFeaturedStickers) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadFeaturedStickers#571d2742 as nil")
|
|
}
|
|
b.PutID(UpdateReadFeaturedStickersTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadFeaturedStickers) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadFeaturedStickers#571d2742 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadFeaturedStickers) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadFeaturedStickers#571d2742 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadFeaturedStickersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadFeaturedStickers#571d2742: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadFeaturedStickers) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadFeaturedStickers#571d2742 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateRecentStickers represents TL type `updateRecentStickers#9a422c20`.
|
|
// The recent sticker list was updated
|
|
//
|
|
// See https://core.telegram.org/constructor/updateRecentStickers for reference.
|
|
type UpdateRecentStickers struct {
|
|
}
|
|
|
|
// UpdateRecentStickersTypeID is TL type id of UpdateRecentStickers.
|
|
const UpdateRecentStickersTypeID = 0x9a422c20
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateRecentStickers) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateRecentStickers.
|
|
var (
|
|
_ bin.Encoder = &UpdateRecentStickers{}
|
|
_ bin.Decoder = &UpdateRecentStickers{}
|
|
_ bin.BareEncoder = &UpdateRecentStickers{}
|
|
_ bin.BareDecoder = &UpdateRecentStickers{}
|
|
|
|
_ UpdateClass = &UpdateRecentStickers{}
|
|
)
|
|
|
|
func (u *UpdateRecentStickers) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateRecentStickers) String() string {
|
|
if u == nil {
|
|
return "UpdateRecentStickers(nil)"
|
|
}
|
|
type Alias UpdateRecentStickers
|
|
return fmt.Sprintf("UpdateRecentStickers%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateRecentStickers) TypeID() uint32 {
|
|
return UpdateRecentStickersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateRecentStickers) TypeName() string {
|
|
return "updateRecentStickers"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateRecentStickers) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateRecentStickers",
|
|
ID: UpdateRecentStickersTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateRecentStickers) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateRecentStickers#9a422c20 as nil")
|
|
}
|
|
b.PutID(UpdateRecentStickersTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateRecentStickers) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateRecentStickers#9a422c20 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateRecentStickers) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateRecentStickers#9a422c20 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateRecentStickersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateRecentStickers#9a422c20: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateRecentStickers) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateRecentStickers#9a422c20 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateConfig represents TL type `updateConfig#a229dd06`.
|
|
// The server-side configuration has changed; the client should re-fetch the config using
|
|
// help.getConfig¹ and help.getAppConfig².
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/help.getConfig
|
|
// 2. https://core.telegram.org/method/help.getAppConfig
|
|
//
|
|
// See https://core.telegram.org/constructor/updateConfig for reference.
|
|
type UpdateConfig struct {
|
|
}
|
|
|
|
// UpdateConfigTypeID is TL type id of UpdateConfig.
|
|
const UpdateConfigTypeID = 0xa229dd06
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateConfig) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateConfig.
|
|
var (
|
|
_ bin.Encoder = &UpdateConfig{}
|
|
_ bin.Decoder = &UpdateConfig{}
|
|
_ bin.BareEncoder = &UpdateConfig{}
|
|
_ bin.BareDecoder = &UpdateConfig{}
|
|
|
|
_ UpdateClass = &UpdateConfig{}
|
|
)
|
|
|
|
func (u *UpdateConfig) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateConfig) String() string {
|
|
if u == nil {
|
|
return "UpdateConfig(nil)"
|
|
}
|
|
type Alias UpdateConfig
|
|
return fmt.Sprintf("UpdateConfig%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateConfig) TypeID() uint32 {
|
|
return UpdateConfigTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateConfig) TypeName() string {
|
|
return "updateConfig"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateConfig) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateConfig",
|
|
ID: UpdateConfigTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateConfig) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateConfig#a229dd06 as nil")
|
|
}
|
|
b.PutID(UpdateConfigTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateConfig) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateConfig#a229dd06 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateConfig) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateConfig#a229dd06 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateConfigTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateConfig#a229dd06: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateConfig) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateConfig#a229dd06 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdatePtsChanged represents TL type `updatePtsChanged#3354678f`.
|
|
// Common message box sequence PTS¹ has changed, state has to be refetched using updates
|
|
// getState²
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/updates
|
|
// 2. https://core.telegram.org/api/updates#fetching-state
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePtsChanged for reference.
|
|
type UpdatePtsChanged struct {
|
|
}
|
|
|
|
// UpdatePtsChangedTypeID is TL type id of UpdatePtsChanged.
|
|
const UpdatePtsChangedTypeID = 0x3354678f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePtsChanged) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePtsChanged.
|
|
var (
|
|
_ bin.Encoder = &UpdatePtsChanged{}
|
|
_ bin.Decoder = &UpdatePtsChanged{}
|
|
_ bin.BareEncoder = &UpdatePtsChanged{}
|
|
_ bin.BareDecoder = &UpdatePtsChanged{}
|
|
|
|
_ UpdateClass = &UpdatePtsChanged{}
|
|
)
|
|
|
|
func (u *UpdatePtsChanged) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePtsChanged) String() string {
|
|
if u == nil {
|
|
return "UpdatePtsChanged(nil)"
|
|
}
|
|
type Alias UpdatePtsChanged
|
|
return fmt.Sprintf("UpdatePtsChanged%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePtsChanged) TypeID() uint32 {
|
|
return UpdatePtsChangedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePtsChanged) TypeName() string {
|
|
return "updatePtsChanged"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePtsChanged) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePtsChanged",
|
|
ID: UpdatePtsChangedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePtsChanged) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePtsChanged#3354678f as nil")
|
|
}
|
|
b.PutID(UpdatePtsChangedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePtsChanged) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePtsChanged#3354678f as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePtsChanged) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePtsChanged#3354678f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePtsChangedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePtsChanged#3354678f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePtsChanged) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePtsChanged#3354678f to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateChannelWebPage represents TL type `updateChannelWebPage#2f2ba99f`.
|
|
// A webpage preview of a link in a channel/supergroup¹ message was generated
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelWebPage for reference.
|
|
type UpdateChannelWebPage struct {
|
|
// Channel/supergroup¹ ID
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
ChannelID int64
|
|
// Generated webpage preview
|
|
Webpage WebPageClass
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateChannelWebPageTypeID is TL type id of UpdateChannelWebPage.
|
|
const UpdateChannelWebPageTypeID = 0x2f2ba99f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelWebPage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelWebPage.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelWebPage{}
|
|
_ bin.Decoder = &UpdateChannelWebPage{}
|
|
_ bin.BareEncoder = &UpdateChannelWebPage{}
|
|
_ bin.BareDecoder = &UpdateChannelWebPage{}
|
|
|
|
_ UpdateClass = &UpdateChannelWebPage{}
|
|
)
|
|
|
|
func (u *UpdateChannelWebPage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Webpage == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelWebPage) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelWebPage(nil)"
|
|
}
|
|
type Alias UpdateChannelWebPage
|
|
return fmt.Sprintf("UpdateChannelWebPage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelWebPage from given interface.
|
|
func (u *UpdateChannelWebPage) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetWebpage() (value WebPageClass)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.Webpage = from.GetWebpage()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelWebPage) TypeID() uint32 {
|
|
return UpdateChannelWebPageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelWebPage) TypeName() string {
|
|
return "updateChannelWebPage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelWebPage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelWebPage",
|
|
ID: UpdateChannelWebPageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "Webpage",
|
|
SchemaName: "webpage",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelWebPage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelWebPage#2f2ba99f as nil")
|
|
}
|
|
b.PutID(UpdateChannelWebPageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelWebPage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelWebPage#2f2ba99f as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.Webpage == nil {
|
|
return fmt.Errorf("unable to encode updateChannelWebPage#2f2ba99f: field webpage is nil")
|
|
}
|
|
if err := u.Webpage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelWebPage#2f2ba99f: field webpage: %w", err)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelWebPage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelWebPage#2f2ba99f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelWebPageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelWebPage#2f2ba99f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelWebPage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelWebPage#2f2ba99f to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelWebPage#2f2ba99f: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := DecodeWebPage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelWebPage#2f2ba99f: field webpage: %w", err)
|
|
}
|
|
u.Webpage = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelWebPage#2f2ba99f: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelWebPage#2f2ba99f: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelWebPage) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetWebpage returns value of Webpage field.
|
|
func (u *UpdateChannelWebPage) GetWebpage() (value WebPageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Webpage
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateChannelWebPage) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateChannelWebPage) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateDialogPinned represents TL type `updateDialogPinned#6e6fe51c`.
|
|
// A dialog was pinned/unpinned
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDialogPinned for reference.
|
|
type UpdateDialogPinned struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the dialog was pinned
|
|
Pinned bool
|
|
// Peer folder ID, for more info click here¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders#peer-folders
|
|
//
|
|
// Use SetFolderID and GetFolderID helpers.
|
|
FolderID int
|
|
// The dialog
|
|
Peer DialogPeerClass
|
|
}
|
|
|
|
// UpdateDialogPinnedTypeID is TL type id of UpdateDialogPinned.
|
|
const UpdateDialogPinnedTypeID = 0x6e6fe51c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDialogPinned) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDialogPinned.
|
|
var (
|
|
_ bin.Encoder = &UpdateDialogPinned{}
|
|
_ bin.Decoder = &UpdateDialogPinned{}
|
|
_ bin.BareEncoder = &UpdateDialogPinned{}
|
|
_ bin.BareDecoder = &UpdateDialogPinned{}
|
|
|
|
_ UpdateClass = &UpdateDialogPinned{}
|
|
)
|
|
|
|
func (u *UpdateDialogPinned) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Pinned == false) {
|
|
return false
|
|
}
|
|
if !(u.FolderID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDialogPinned) String() string {
|
|
if u == nil {
|
|
return "UpdateDialogPinned(nil)"
|
|
}
|
|
type Alias UpdateDialogPinned
|
|
return fmt.Sprintf("UpdateDialogPinned%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDialogPinned from given interface.
|
|
func (u *UpdateDialogPinned) FillFrom(from interface {
|
|
GetPinned() (value bool)
|
|
GetFolderID() (value int, ok bool)
|
|
GetPeer() (value DialogPeerClass)
|
|
}) {
|
|
u.Pinned = from.GetPinned()
|
|
if val, ok := from.GetFolderID(); ok {
|
|
u.FolderID = val
|
|
}
|
|
|
|
u.Peer = from.GetPeer()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDialogPinned) TypeID() uint32 {
|
|
return UpdateDialogPinnedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDialogPinned) TypeName() string {
|
|
return "updateDialogPinned"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDialogPinned) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDialogPinned",
|
|
ID: UpdateDialogPinnedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pinned",
|
|
SchemaName: "pinned",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "FolderID",
|
|
SchemaName: "folder_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateDialogPinned) SetFlags() {
|
|
if !(u.Pinned == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.FolderID == 0) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDialogPinned) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogPinned#6e6fe51c as nil")
|
|
}
|
|
b.PutID(UpdateDialogPinnedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDialogPinned) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogPinned#6e6fe51c as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogPinned#6e6fe51c: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutInt(u.FolderID)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateDialogPinned#6e6fe51c: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogPinned#6e6fe51c: field peer: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDialogPinned) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogPinned#6e6fe51c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDialogPinnedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogPinned#6e6fe51c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDialogPinned) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogPinned#6e6fe51c to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogPinned#6e6fe51c: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Pinned = u.Flags.Has(0)
|
|
if u.Flags.Has(1) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogPinned#6e6fe51c: field folder_id: %w", err)
|
|
}
|
|
u.FolderID = value
|
|
}
|
|
{
|
|
value, err := DecodeDialogPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogPinned#6e6fe51c: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPinned sets value of Pinned conditional field.
|
|
func (u *UpdateDialogPinned) SetPinned(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Pinned = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Pinned = false
|
|
}
|
|
}
|
|
|
|
// GetPinned returns value of Pinned conditional field.
|
|
func (u *UpdateDialogPinned) GetPinned() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// SetFolderID sets value of FolderID conditional field.
|
|
func (u *UpdateDialogPinned) SetFolderID(value int) {
|
|
u.Flags.Set(1)
|
|
u.FolderID = value
|
|
}
|
|
|
|
// GetFolderID returns value of FolderID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateDialogPinned) GetFolderID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.FolderID, true
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateDialogPinned) GetPeer() (value DialogPeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// UpdatePinnedDialogs represents TL type `updatePinnedDialogs#fa0f3ca2`.
|
|
// Pinned dialogs were updated
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePinnedDialogs for reference.
|
|
type UpdatePinnedDialogs struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Peer folder ID, for more info click here¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders#peer-folders
|
|
//
|
|
// Use SetFolderID and GetFolderID helpers.
|
|
FolderID int
|
|
// New order of pinned dialogs
|
|
//
|
|
// Use SetOrder and GetOrder helpers.
|
|
Order []DialogPeerClass
|
|
}
|
|
|
|
// UpdatePinnedDialogsTypeID is TL type id of UpdatePinnedDialogs.
|
|
const UpdatePinnedDialogsTypeID = 0xfa0f3ca2
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePinnedDialogs) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePinnedDialogs.
|
|
var (
|
|
_ bin.Encoder = &UpdatePinnedDialogs{}
|
|
_ bin.Decoder = &UpdatePinnedDialogs{}
|
|
_ bin.BareEncoder = &UpdatePinnedDialogs{}
|
|
_ bin.BareDecoder = &UpdatePinnedDialogs{}
|
|
|
|
_ UpdateClass = &UpdatePinnedDialogs{}
|
|
)
|
|
|
|
func (u *UpdatePinnedDialogs) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.FolderID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Order == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePinnedDialogs) String() string {
|
|
if u == nil {
|
|
return "UpdatePinnedDialogs(nil)"
|
|
}
|
|
type Alias UpdatePinnedDialogs
|
|
return fmt.Sprintf("UpdatePinnedDialogs%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePinnedDialogs from given interface.
|
|
func (u *UpdatePinnedDialogs) FillFrom(from interface {
|
|
GetFolderID() (value int, ok bool)
|
|
GetOrder() (value []DialogPeerClass, ok bool)
|
|
}) {
|
|
if val, ok := from.GetFolderID(); ok {
|
|
u.FolderID = val
|
|
}
|
|
|
|
if val, ok := from.GetOrder(); ok {
|
|
u.Order = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePinnedDialogs) TypeID() uint32 {
|
|
return UpdatePinnedDialogsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePinnedDialogs) TypeName() string {
|
|
return "updatePinnedDialogs"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePinnedDialogs) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePinnedDialogs",
|
|
ID: UpdatePinnedDialogsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "FolderID",
|
|
SchemaName: "folder_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Order",
|
|
SchemaName: "order",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePinnedDialogs) SetFlags() {
|
|
if !(u.FolderID == 0) {
|
|
u.Flags.Set(1)
|
|
}
|
|
if !(u.Order == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePinnedDialogs) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedDialogs#fa0f3ca2 as nil")
|
|
}
|
|
b.PutID(UpdatePinnedDialogsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePinnedDialogs) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedDialogs#fa0f3ca2 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedDialogs#fa0f3ca2: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutInt(u.FolderID)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutVectorHeader(len(u.Order))
|
|
for idx, v := range u.Order {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updatePinnedDialogs#fa0f3ca2: field order element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedDialogs#fa0f3ca2: field order element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePinnedDialogs) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedDialogs#fa0f3ca2 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePinnedDialogsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedDialogs#fa0f3ca2: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePinnedDialogs) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedDialogs#fa0f3ca2 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedDialogs#fa0f3ca2: field flags: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedDialogs#fa0f3ca2: field folder_id: %w", err)
|
|
}
|
|
u.FolderID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedDialogs#fa0f3ca2: field order: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Order = make([]DialogPeerClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeDialogPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedDialogs#fa0f3ca2: field order: %w", err)
|
|
}
|
|
u.Order = append(u.Order, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetFolderID sets value of FolderID conditional field.
|
|
func (u *UpdatePinnedDialogs) SetFolderID(value int) {
|
|
u.Flags.Set(1)
|
|
u.FolderID = value
|
|
}
|
|
|
|
// GetFolderID returns value of FolderID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdatePinnedDialogs) GetFolderID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.FolderID, true
|
|
}
|
|
|
|
// SetOrder sets value of Order conditional field.
|
|
func (u *UpdatePinnedDialogs) SetOrder(value []DialogPeerClass) {
|
|
u.Flags.Set(0)
|
|
u.Order = value
|
|
}
|
|
|
|
// GetOrder returns value of Order conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdatePinnedDialogs) GetOrder() (value []DialogPeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Order, true
|
|
}
|
|
|
|
// MapOrder returns field Order wrapped in DialogPeerClassArray helper.
|
|
func (u *UpdatePinnedDialogs) MapOrder() (value DialogPeerClassArray, ok bool) {
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return DialogPeerClassArray(u.Order), true
|
|
}
|
|
|
|
// UpdateBotWebhookJSON represents TL type `updateBotWebhookJSON#8317c0c3`.
|
|
// A new incoming event; for bots only
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotWebhookJSON for reference.
|
|
type UpdateBotWebhookJSON struct {
|
|
// The event
|
|
Data DataJSON
|
|
}
|
|
|
|
// UpdateBotWebhookJSONTypeID is TL type id of UpdateBotWebhookJSON.
|
|
const UpdateBotWebhookJSONTypeID = 0x8317c0c3
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotWebhookJSON) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotWebhookJSON.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotWebhookJSON{}
|
|
_ bin.Decoder = &UpdateBotWebhookJSON{}
|
|
_ bin.BareEncoder = &UpdateBotWebhookJSON{}
|
|
_ bin.BareDecoder = &UpdateBotWebhookJSON{}
|
|
|
|
_ UpdateClass = &UpdateBotWebhookJSON{}
|
|
)
|
|
|
|
func (u *UpdateBotWebhookJSON) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Data.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotWebhookJSON) String() string {
|
|
if u == nil {
|
|
return "UpdateBotWebhookJSON(nil)"
|
|
}
|
|
type Alias UpdateBotWebhookJSON
|
|
return fmt.Sprintf("UpdateBotWebhookJSON%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotWebhookJSON from given interface.
|
|
func (u *UpdateBotWebhookJSON) FillFrom(from interface {
|
|
GetData() (value DataJSON)
|
|
}) {
|
|
u.Data = from.GetData()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotWebhookJSON) TypeID() uint32 {
|
|
return UpdateBotWebhookJSONTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotWebhookJSON) TypeName() string {
|
|
return "updateBotWebhookJSON"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotWebhookJSON) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotWebhookJSON",
|
|
ID: UpdateBotWebhookJSONTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Data",
|
|
SchemaName: "data",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotWebhookJSON) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotWebhookJSON#8317c0c3 as nil")
|
|
}
|
|
b.PutID(UpdateBotWebhookJSONTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotWebhookJSON) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotWebhookJSON#8317c0c3 as nil")
|
|
}
|
|
if err := u.Data.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotWebhookJSON#8317c0c3: field data: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotWebhookJSON) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotWebhookJSON#8317c0c3 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotWebhookJSONTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotWebhookJSON#8317c0c3: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotWebhookJSON) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotWebhookJSON#8317c0c3 to nil")
|
|
}
|
|
{
|
|
if err := u.Data.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotWebhookJSON#8317c0c3: field data: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetData returns value of Data field.
|
|
func (u *UpdateBotWebhookJSON) GetData() (value DataJSON) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Data
|
|
}
|
|
|
|
// UpdateBotWebhookJSONQuery represents TL type `updateBotWebhookJSONQuery#9b9240a6`.
|
|
// A new incoming query; for bots only
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotWebhookJSONQuery for reference.
|
|
type UpdateBotWebhookJSONQuery struct {
|
|
// Query identifier
|
|
QueryID int64
|
|
// Query data
|
|
Data DataJSON
|
|
// Query timeout
|
|
Timeout int
|
|
}
|
|
|
|
// UpdateBotWebhookJSONQueryTypeID is TL type id of UpdateBotWebhookJSONQuery.
|
|
const UpdateBotWebhookJSONQueryTypeID = 0x9b9240a6
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotWebhookJSONQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotWebhookJSONQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotWebhookJSONQuery{}
|
|
_ bin.Decoder = &UpdateBotWebhookJSONQuery{}
|
|
_ bin.BareEncoder = &UpdateBotWebhookJSONQuery{}
|
|
_ bin.BareDecoder = &UpdateBotWebhookJSONQuery{}
|
|
|
|
_ UpdateClass = &UpdateBotWebhookJSONQuery{}
|
|
)
|
|
|
|
func (u *UpdateBotWebhookJSONQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Data.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Timeout == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotWebhookJSONQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateBotWebhookJSONQuery(nil)"
|
|
}
|
|
type Alias UpdateBotWebhookJSONQuery
|
|
return fmt.Sprintf("UpdateBotWebhookJSONQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotWebhookJSONQuery from given interface.
|
|
func (u *UpdateBotWebhookJSONQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetData() (value DataJSON)
|
|
GetTimeout() (value int)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.Data = from.GetData()
|
|
u.Timeout = from.GetTimeout()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotWebhookJSONQuery) TypeID() uint32 {
|
|
return UpdateBotWebhookJSONQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotWebhookJSONQuery) TypeName() string {
|
|
return "updateBotWebhookJSONQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotWebhookJSONQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotWebhookJSONQuery",
|
|
ID: UpdateBotWebhookJSONQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "Data",
|
|
SchemaName: "data",
|
|
},
|
|
{
|
|
Name: "Timeout",
|
|
SchemaName: "timeout",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotWebhookJSONQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotWebhookJSONQuery#9b9240a6 as nil")
|
|
}
|
|
b.PutID(UpdateBotWebhookJSONQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotWebhookJSONQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotWebhookJSONQuery#9b9240a6 as nil")
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
if err := u.Data.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotWebhookJSONQuery#9b9240a6: field data: %w", err)
|
|
}
|
|
b.PutInt(u.Timeout)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotWebhookJSONQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotWebhookJSONQuery#9b9240a6 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotWebhookJSONQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotWebhookJSONQuery#9b9240a6: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotWebhookJSONQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotWebhookJSONQuery#9b9240a6 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotWebhookJSONQuery#9b9240a6: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
if err := u.Data.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotWebhookJSONQuery#9b9240a6: field data: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotWebhookJSONQuery#9b9240a6: field timeout: %w", err)
|
|
}
|
|
u.Timeout = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateBotWebhookJSONQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetData returns value of Data field.
|
|
func (u *UpdateBotWebhookJSONQuery) GetData() (value DataJSON) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Data
|
|
}
|
|
|
|
// GetTimeout returns value of Timeout field.
|
|
func (u *UpdateBotWebhookJSONQuery) GetTimeout() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Timeout
|
|
}
|
|
|
|
// UpdateBotShippingQuery represents TL type `updateBotShippingQuery#b5aefd7d`.
|
|
// This object contains information about an incoming shipping query.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotShippingQuery for reference.
|
|
type UpdateBotShippingQuery struct {
|
|
// Unique query identifier
|
|
QueryID int64
|
|
// User who sent the query
|
|
UserID int64
|
|
// Bot specified invoice payload
|
|
Payload []byte
|
|
// User specified shipping address
|
|
ShippingAddress PostAddress
|
|
}
|
|
|
|
// UpdateBotShippingQueryTypeID is TL type id of UpdateBotShippingQuery.
|
|
const UpdateBotShippingQueryTypeID = 0xb5aefd7d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotShippingQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotShippingQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotShippingQuery{}
|
|
_ bin.Decoder = &UpdateBotShippingQuery{}
|
|
_ bin.BareEncoder = &UpdateBotShippingQuery{}
|
|
_ bin.BareDecoder = &UpdateBotShippingQuery{}
|
|
|
|
_ UpdateClass = &UpdateBotShippingQuery{}
|
|
)
|
|
|
|
func (u *UpdateBotShippingQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Payload == nil) {
|
|
return false
|
|
}
|
|
if !(u.ShippingAddress.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotShippingQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateBotShippingQuery(nil)"
|
|
}
|
|
type Alias UpdateBotShippingQuery
|
|
return fmt.Sprintf("UpdateBotShippingQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotShippingQuery from given interface.
|
|
func (u *UpdateBotShippingQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetPayload() (value []byte)
|
|
GetShippingAddress() (value PostAddress)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.UserID = from.GetUserID()
|
|
u.Payload = from.GetPayload()
|
|
u.ShippingAddress = from.GetShippingAddress()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotShippingQuery) TypeID() uint32 {
|
|
return UpdateBotShippingQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotShippingQuery) TypeName() string {
|
|
return "updateBotShippingQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotShippingQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotShippingQuery",
|
|
ID: UpdateBotShippingQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Payload",
|
|
SchemaName: "payload",
|
|
},
|
|
{
|
|
Name: "ShippingAddress",
|
|
SchemaName: "shipping_address",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotShippingQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotShippingQuery#b5aefd7d as nil")
|
|
}
|
|
b.PutID(UpdateBotShippingQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotShippingQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotShippingQuery#b5aefd7d as nil")
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
b.PutLong(u.UserID)
|
|
b.PutBytes(u.Payload)
|
|
if err := u.ShippingAddress.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotShippingQuery#b5aefd7d: field shipping_address: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotShippingQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotShippingQuery#b5aefd7d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotShippingQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotShippingQuery#b5aefd7d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotShippingQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotShippingQuery#b5aefd7d to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotShippingQuery#b5aefd7d: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotShippingQuery#b5aefd7d: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotShippingQuery#b5aefd7d: field payload: %w", err)
|
|
}
|
|
u.Payload = value
|
|
}
|
|
{
|
|
if err := u.ShippingAddress.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotShippingQuery#b5aefd7d: field shipping_address: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateBotShippingQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotShippingQuery) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetPayload returns value of Payload field.
|
|
func (u *UpdateBotShippingQuery) GetPayload() (value []byte) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Payload
|
|
}
|
|
|
|
// GetShippingAddress returns value of ShippingAddress field.
|
|
func (u *UpdateBotShippingQuery) GetShippingAddress() (value PostAddress) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ShippingAddress
|
|
}
|
|
|
|
// UpdateBotPrecheckoutQuery represents TL type `updateBotPrecheckoutQuery#8caa9a96`.
|
|
// This object contains information about an incoming pre-checkout query.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotPrecheckoutQuery for reference.
|
|
type UpdateBotPrecheckoutQuery struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Unique query identifier
|
|
QueryID int64
|
|
// User who sent the query
|
|
UserID int64
|
|
// Bot specified invoice payload
|
|
Payload []byte
|
|
// Order info provided by the user
|
|
//
|
|
// Use SetInfo and GetInfo helpers.
|
|
Info PaymentRequestedInfo
|
|
// Identifier of the shipping option chosen by the user
|
|
//
|
|
// Use SetShippingOptionID and GetShippingOptionID helpers.
|
|
ShippingOptionID string
|
|
// Three-letter ISO 4217 currency¹ code, or XTR for Telegram Stars².
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/bots/payments#supported-currencies
|
|
// 2) https://core.telegram.org/api/stars
|
|
Currency string
|
|
// Total amount in the smallest units of the currency (integer, not float/double). For
|
|
// example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
|
|
// currencies.json¹, it shows the number of digits past the decimal point for each
|
|
// currency (2 for the majority of currencies).
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/bots/payments/currencies.json
|
|
TotalAmount int64
|
|
}
|
|
|
|
// UpdateBotPrecheckoutQueryTypeID is TL type id of UpdateBotPrecheckoutQuery.
|
|
const UpdateBotPrecheckoutQueryTypeID = 0x8caa9a96
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotPrecheckoutQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotPrecheckoutQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotPrecheckoutQuery{}
|
|
_ bin.Decoder = &UpdateBotPrecheckoutQuery{}
|
|
_ bin.BareEncoder = &UpdateBotPrecheckoutQuery{}
|
|
_ bin.BareDecoder = &UpdateBotPrecheckoutQuery{}
|
|
|
|
_ UpdateClass = &UpdateBotPrecheckoutQuery{}
|
|
)
|
|
|
|
func (u *UpdateBotPrecheckoutQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Payload == nil) {
|
|
return false
|
|
}
|
|
if !(u.Info.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ShippingOptionID == "") {
|
|
return false
|
|
}
|
|
if !(u.Currency == "") {
|
|
return false
|
|
}
|
|
if !(u.TotalAmount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotPrecheckoutQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateBotPrecheckoutQuery(nil)"
|
|
}
|
|
type Alias UpdateBotPrecheckoutQuery
|
|
return fmt.Sprintf("UpdateBotPrecheckoutQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotPrecheckoutQuery from given interface.
|
|
func (u *UpdateBotPrecheckoutQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetPayload() (value []byte)
|
|
GetInfo() (value PaymentRequestedInfo, ok bool)
|
|
GetShippingOptionID() (value string, ok bool)
|
|
GetCurrency() (value string)
|
|
GetTotalAmount() (value int64)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.UserID = from.GetUserID()
|
|
u.Payload = from.GetPayload()
|
|
if val, ok := from.GetInfo(); ok {
|
|
u.Info = val
|
|
}
|
|
|
|
if val, ok := from.GetShippingOptionID(); ok {
|
|
u.ShippingOptionID = val
|
|
}
|
|
|
|
u.Currency = from.GetCurrency()
|
|
u.TotalAmount = from.GetTotalAmount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotPrecheckoutQuery) TypeID() uint32 {
|
|
return UpdateBotPrecheckoutQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotPrecheckoutQuery) TypeName() string {
|
|
return "updateBotPrecheckoutQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotPrecheckoutQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotPrecheckoutQuery",
|
|
ID: UpdateBotPrecheckoutQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Payload",
|
|
SchemaName: "payload",
|
|
},
|
|
{
|
|
Name: "Info",
|
|
SchemaName: "info",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "ShippingOptionID",
|
|
SchemaName: "shipping_option_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Currency",
|
|
SchemaName: "currency",
|
|
},
|
|
{
|
|
Name: "TotalAmount",
|
|
SchemaName: "total_amount",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBotPrecheckoutQuery) SetFlags() {
|
|
if !(u.Info.Zero()) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.ShippingOptionID == "") {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotPrecheckoutQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotPrecheckoutQuery#8caa9a96 as nil")
|
|
}
|
|
b.PutID(UpdateBotPrecheckoutQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotPrecheckoutQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotPrecheckoutQuery#8caa9a96 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotPrecheckoutQuery#8caa9a96: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
b.PutLong(u.UserID)
|
|
b.PutBytes(u.Payload)
|
|
if u.Flags.Has(0) {
|
|
if err := u.Info.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotPrecheckoutQuery#8caa9a96: field info: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutString(u.ShippingOptionID)
|
|
}
|
|
b.PutString(u.Currency)
|
|
b.PutLong(u.TotalAmount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotPrecheckoutQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotPrecheckoutQuery#8caa9a96 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotPrecheckoutQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotPrecheckoutQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotPrecheckoutQuery#8caa9a96 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field payload: %w", err)
|
|
}
|
|
u.Payload = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
if err := u.Info.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field info: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field shipping_option_id: %w", err)
|
|
}
|
|
u.ShippingOptionID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field currency: %w", err)
|
|
}
|
|
u.Currency = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPrecheckoutQuery#8caa9a96: field total_amount: %w", err)
|
|
}
|
|
u.TotalAmount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateBotPrecheckoutQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotPrecheckoutQuery) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetPayload returns value of Payload field.
|
|
func (u *UpdateBotPrecheckoutQuery) GetPayload() (value []byte) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Payload
|
|
}
|
|
|
|
// SetInfo sets value of Info conditional field.
|
|
func (u *UpdateBotPrecheckoutQuery) SetInfo(value PaymentRequestedInfo) {
|
|
u.Flags.Set(0)
|
|
u.Info = value
|
|
}
|
|
|
|
// GetInfo returns value of Info conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotPrecheckoutQuery) GetInfo() (value PaymentRequestedInfo, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Info, true
|
|
}
|
|
|
|
// SetShippingOptionID sets value of ShippingOptionID conditional field.
|
|
func (u *UpdateBotPrecheckoutQuery) SetShippingOptionID(value string) {
|
|
u.Flags.Set(1)
|
|
u.ShippingOptionID = value
|
|
}
|
|
|
|
// GetShippingOptionID returns value of ShippingOptionID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotPrecheckoutQuery) GetShippingOptionID() (value string, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.ShippingOptionID, true
|
|
}
|
|
|
|
// GetCurrency returns value of Currency field.
|
|
func (u *UpdateBotPrecheckoutQuery) GetCurrency() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Currency
|
|
}
|
|
|
|
// GetTotalAmount returns value of TotalAmount field.
|
|
func (u *UpdateBotPrecheckoutQuery) GetTotalAmount() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.TotalAmount
|
|
}
|
|
|
|
// UpdatePhoneCall represents TL type `updatePhoneCall#ab0f6b1e`.
|
|
// An incoming phone call
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePhoneCall for reference.
|
|
type UpdatePhoneCall struct {
|
|
// Phone call
|
|
PhoneCall PhoneCallClass
|
|
}
|
|
|
|
// UpdatePhoneCallTypeID is TL type id of UpdatePhoneCall.
|
|
const UpdatePhoneCallTypeID = 0xab0f6b1e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePhoneCall) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePhoneCall.
|
|
var (
|
|
_ bin.Encoder = &UpdatePhoneCall{}
|
|
_ bin.Decoder = &UpdatePhoneCall{}
|
|
_ bin.BareEncoder = &UpdatePhoneCall{}
|
|
_ bin.BareDecoder = &UpdatePhoneCall{}
|
|
|
|
_ UpdateClass = &UpdatePhoneCall{}
|
|
)
|
|
|
|
func (u *UpdatePhoneCall) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.PhoneCall == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePhoneCall) String() string {
|
|
if u == nil {
|
|
return "UpdatePhoneCall(nil)"
|
|
}
|
|
type Alias UpdatePhoneCall
|
|
return fmt.Sprintf("UpdatePhoneCall%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePhoneCall from given interface.
|
|
func (u *UpdatePhoneCall) FillFrom(from interface {
|
|
GetPhoneCall() (value PhoneCallClass)
|
|
}) {
|
|
u.PhoneCall = from.GetPhoneCall()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePhoneCall) TypeID() uint32 {
|
|
return UpdatePhoneCallTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePhoneCall) TypeName() string {
|
|
return "updatePhoneCall"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePhoneCall) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePhoneCall",
|
|
ID: UpdatePhoneCallTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PhoneCall",
|
|
SchemaName: "phone_call",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePhoneCall) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePhoneCall#ab0f6b1e as nil")
|
|
}
|
|
b.PutID(UpdatePhoneCallTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePhoneCall) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePhoneCall#ab0f6b1e as nil")
|
|
}
|
|
if u.PhoneCall == nil {
|
|
return fmt.Errorf("unable to encode updatePhoneCall#ab0f6b1e: field phone_call is nil")
|
|
}
|
|
if err := u.PhoneCall.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePhoneCall#ab0f6b1e: field phone_call: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePhoneCall) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePhoneCall#ab0f6b1e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePhoneCallTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePhoneCall#ab0f6b1e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePhoneCall) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePhoneCall#ab0f6b1e to nil")
|
|
}
|
|
{
|
|
value, err := DecodePhoneCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePhoneCall#ab0f6b1e: field phone_call: %w", err)
|
|
}
|
|
u.PhoneCall = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPhoneCall returns value of PhoneCall field.
|
|
func (u *UpdatePhoneCall) GetPhoneCall() (value PhoneCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PhoneCall
|
|
}
|
|
|
|
// UpdateLangPackTooLong represents TL type `updateLangPackTooLong#46560264`.
|
|
// A language pack has changed, the client should manually fetch the changed strings
|
|
// using langpack.getDifference¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/langpack.getDifference
|
|
//
|
|
// See https://core.telegram.org/constructor/updateLangPackTooLong for reference.
|
|
type UpdateLangPackTooLong struct {
|
|
// Language code
|
|
LangCode string
|
|
}
|
|
|
|
// UpdateLangPackTooLongTypeID is TL type id of UpdateLangPackTooLong.
|
|
const UpdateLangPackTooLongTypeID = 0x46560264
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateLangPackTooLong) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateLangPackTooLong.
|
|
var (
|
|
_ bin.Encoder = &UpdateLangPackTooLong{}
|
|
_ bin.Decoder = &UpdateLangPackTooLong{}
|
|
_ bin.BareEncoder = &UpdateLangPackTooLong{}
|
|
_ bin.BareDecoder = &UpdateLangPackTooLong{}
|
|
|
|
_ UpdateClass = &UpdateLangPackTooLong{}
|
|
)
|
|
|
|
func (u *UpdateLangPackTooLong) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.LangCode == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateLangPackTooLong) String() string {
|
|
if u == nil {
|
|
return "UpdateLangPackTooLong(nil)"
|
|
}
|
|
type Alias UpdateLangPackTooLong
|
|
return fmt.Sprintf("UpdateLangPackTooLong%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateLangPackTooLong from given interface.
|
|
func (u *UpdateLangPackTooLong) FillFrom(from interface {
|
|
GetLangCode() (value string)
|
|
}) {
|
|
u.LangCode = from.GetLangCode()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateLangPackTooLong) TypeID() uint32 {
|
|
return UpdateLangPackTooLongTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateLangPackTooLong) TypeName() string {
|
|
return "updateLangPackTooLong"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateLangPackTooLong) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateLangPackTooLong",
|
|
ID: UpdateLangPackTooLongTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "LangCode",
|
|
SchemaName: "lang_code",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateLangPackTooLong) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateLangPackTooLong#46560264 as nil")
|
|
}
|
|
b.PutID(UpdateLangPackTooLongTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateLangPackTooLong) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateLangPackTooLong#46560264 as nil")
|
|
}
|
|
b.PutString(u.LangCode)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateLangPackTooLong) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateLangPackTooLong#46560264 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateLangPackTooLongTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateLangPackTooLong#46560264: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateLangPackTooLong) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateLangPackTooLong#46560264 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateLangPackTooLong#46560264: field lang_code: %w", err)
|
|
}
|
|
u.LangCode = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetLangCode returns value of LangCode field.
|
|
func (u *UpdateLangPackTooLong) GetLangCode() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.LangCode
|
|
}
|
|
|
|
// UpdateLangPack represents TL type `updateLangPack#56022f4d`.
|
|
// Language pack updated
|
|
//
|
|
// See https://core.telegram.org/constructor/updateLangPack for reference.
|
|
type UpdateLangPack struct {
|
|
// Changed strings
|
|
Difference LangPackDifference
|
|
}
|
|
|
|
// UpdateLangPackTypeID is TL type id of UpdateLangPack.
|
|
const UpdateLangPackTypeID = 0x56022f4d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateLangPack) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateLangPack.
|
|
var (
|
|
_ bin.Encoder = &UpdateLangPack{}
|
|
_ bin.Decoder = &UpdateLangPack{}
|
|
_ bin.BareEncoder = &UpdateLangPack{}
|
|
_ bin.BareDecoder = &UpdateLangPack{}
|
|
|
|
_ UpdateClass = &UpdateLangPack{}
|
|
)
|
|
|
|
func (u *UpdateLangPack) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Difference.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateLangPack) String() string {
|
|
if u == nil {
|
|
return "UpdateLangPack(nil)"
|
|
}
|
|
type Alias UpdateLangPack
|
|
return fmt.Sprintf("UpdateLangPack%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateLangPack from given interface.
|
|
func (u *UpdateLangPack) FillFrom(from interface {
|
|
GetDifference() (value LangPackDifference)
|
|
}) {
|
|
u.Difference = from.GetDifference()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateLangPack) TypeID() uint32 {
|
|
return UpdateLangPackTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateLangPack) TypeName() string {
|
|
return "updateLangPack"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateLangPack) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateLangPack",
|
|
ID: UpdateLangPackTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Difference",
|
|
SchemaName: "difference",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateLangPack) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateLangPack#56022f4d as nil")
|
|
}
|
|
b.PutID(UpdateLangPackTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateLangPack) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateLangPack#56022f4d as nil")
|
|
}
|
|
if err := u.Difference.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateLangPack#56022f4d: field difference: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateLangPack) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateLangPack#56022f4d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateLangPackTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateLangPack#56022f4d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateLangPack) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateLangPack#56022f4d to nil")
|
|
}
|
|
{
|
|
if err := u.Difference.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateLangPack#56022f4d: field difference: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetDifference returns value of Difference field.
|
|
func (u *UpdateLangPack) GetDifference() (value LangPackDifference) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Difference
|
|
}
|
|
|
|
// UpdateFavedStickers represents TL type `updateFavedStickers#e511996d`.
|
|
// The list of favorited stickers was changed, the client should call messages
|
|
// getFavedStickers¹ to refetch the new list
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/messages.getFavedStickers
|
|
//
|
|
// See https://core.telegram.org/constructor/updateFavedStickers for reference.
|
|
type UpdateFavedStickers struct {
|
|
}
|
|
|
|
// UpdateFavedStickersTypeID is TL type id of UpdateFavedStickers.
|
|
const UpdateFavedStickersTypeID = 0xe511996d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateFavedStickers) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateFavedStickers.
|
|
var (
|
|
_ bin.Encoder = &UpdateFavedStickers{}
|
|
_ bin.Decoder = &UpdateFavedStickers{}
|
|
_ bin.BareEncoder = &UpdateFavedStickers{}
|
|
_ bin.BareDecoder = &UpdateFavedStickers{}
|
|
|
|
_ UpdateClass = &UpdateFavedStickers{}
|
|
)
|
|
|
|
func (u *UpdateFavedStickers) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateFavedStickers) String() string {
|
|
if u == nil {
|
|
return "UpdateFavedStickers(nil)"
|
|
}
|
|
type Alias UpdateFavedStickers
|
|
return fmt.Sprintf("UpdateFavedStickers%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateFavedStickers) TypeID() uint32 {
|
|
return UpdateFavedStickersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateFavedStickers) TypeName() string {
|
|
return "updateFavedStickers"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateFavedStickers) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateFavedStickers",
|
|
ID: UpdateFavedStickersTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateFavedStickers) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateFavedStickers#e511996d as nil")
|
|
}
|
|
b.PutID(UpdateFavedStickersTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateFavedStickers) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateFavedStickers#e511996d as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateFavedStickers) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateFavedStickers#e511996d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateFavedStickersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateFavedStickers#e511996d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateFavedStickers) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateFavedStickers#e511996d to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateChannelReadMessagesContents represents TL type `updateChannelReadMessagesContents#25f324f7`.
|
|
// The specified channel/supergroup¹ messages were read (emitted specifically for
|
|
// messages like voice messages or video, only once the media is watched and marked as
|
|
// read using channels.readMessageContents²)
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
// 2. https://core.telegram.org/method/channels.readMessageContents
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelReadMessagesContents for reference.
|
|
type UpdateChannelReadMessagesContents struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Channel/supergroup¹ ID
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
ChannelID int64
|
|
// Forum topic ID¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/forum#forum-topics
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// If set, the messages were read within the specified monoforum topic »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/monoforum
|
|
//
|
|
// Use SetSavedPeerID and GetSavedPeerID helpers.
|
|
SavedPeerID PeerClass
|
|
// IDs of messages that were read
|
|
Messages []int
|
|
}
|
|
|
|
// UpdateChannelReadMessagesContentsTypeID is TL type id of UpdateChannelReadMessagesContents.
|
|
const UpdateChannelReadMessagesContentsTypeID = 0x25f324f7
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelReadMessagesContents) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelReadMessagesContents.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelReadMessagesContents{}
|
|
_ bin.Decoder = &UpdateChannelReadMessagesContents{}
|
|
_ bin.BareEncoder = &UpdateChannelReadMessagesContents{}
|
|
_ bin.BareDecoder = &UpdateChannelReadMessagesContents{}
|
|
|
|
_ UpdateClass = &UpdateChannelReadMessagesContents{}
|
|
)
|
|
|
|
func (u *UpdateChannelReadMessagesContents) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelReadMessagesContents) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelReadMessagesContents(nil)"
|
|
}
|
|
type Alias UpdateChannelReadMessagesContents
|
|
return fmt.Sprintf("UpdateChannelReadMessagesContents%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelReadMessagesContents from given interface.
|
|
func (u *UpdateChannelReadMessagesContents) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetSavedPeerID() (value PeerClass, ok bool)
|
|
GetMessages() (value []int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
if val, ok := from.GetSavedPeerID(); ok {
|
|
u.SavedPeerID = val
|
|
}
|
|
|
|
u.Messages = from.GetMessages()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelReadMessagesContents) TypeID() uint32 {
|
|
return UpdateChannelReadMessagesContentsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelReadMessagesContents) TypeName() string {
|
|
return "updateChannelReadMessagesContents"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelReadMessagesContents) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelReadMessagesContents",
|
|
ID: UpdateChannelReadMessagesContentsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateChannelReadMessagesContents) SetFlags() {
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelReadMessagesContents) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelReadMessagesContents#25f324f7 as nil")
|
|
}
|
|
b.PutID(UpdateChannelReadMessagesContentsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelReadMessagesContents) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelReadMessagesContents#25f324f7 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelReadMessagesContents#25f324f7: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateChannelReadMessagesContents#25f324f7: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelReadMessagesContents#25f324f7: field saved_peer_id: %w", err)
|
|
}
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelReadMessagesContents) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelReadMessagesContents#25f324f7 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelReadMessagesContentsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelReadMessagesContents) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelReadMessagesContents#25f324f7 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelReadMessagesContents#25f324f7: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelReadMessagesContents) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateChannelReadMessagesContents) SetTopMsgID(value int) {
|
|
u.Flags.Set(0)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelReadMessagesContents) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// SetSavedPeerID sets value of SavedPeerID conditional field.
|
|
func (u *UpdateChannelReadMessagesContents) SetSavedPeerID(value PeerClass) {
|
|
u.Flags.Set(1)
|
|
u.SavedPeerID = value
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelReadMessagesContents) GetSavedPeerID() (value PeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.SavedPeerID, true
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateChannelReadMessagesContents) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// UpdateContactsReset represents TL type `updateContactsReset#7084a7be`.
|
|
// All contacts were deleted
|
|
//
|
|
// See https://core.telegram.org/constructor/updateContactsReset for reference.
|
|
type UpdateContactsReset struct {
|
|
}
|
|
|
|
// UpdateContactsResetTypeID is TL type id of UpdateContactsReset.
|
|
const UpdateContactsResetTypeID = 0x7084a7be
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateContactsReset) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateContactsReset.
|
|
var (
|
|
_ bin.Encoder = &UpdateContactsReset{}
|
|
_ bin.Decoder = &UpdateContactsReset{}
|
|
_ bin.BareEncoder = &UpdateContactsReset{}
|
|
_ bin.BareDecoder = &UpdateContactsReset{}
|
|
|
|
_ UpdateClass = &UpdateContactsReset{}
|
|
)
|
|
|
|
func (u *UpdateContactsReset) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateContactsReset) String() string {
|
|
if u == nil {
|
|
return "UpdateContactsReset(nil)"
|
|
}
|
|
type Alias UpdateContactsReset
|
|
return fmt.Sprintf("UpdateContactsReset%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateContactsReset) TypeID() uint32 {
|
|
return UpdateContactsResetTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateContactsReset) TypeName() string {
|
|
return "updateContactsReset"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateContactsReset) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateContactsReset",
|
|
ID: UpdateContactsResetTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateContactsReset) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateContactsReset#7084a7be as nil")
|
|
}
|
|
b.PutID(UpdateContactsResetTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateContactsReset) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateContactsReset#7084a7be as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateContactsReset) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateContactsReset#7084a7be to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateContactsResetTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateContactsReset#7084a7be: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateContactsReset) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateContactsReset#7084a7be to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateChannelAvailableMessages represents TL type `updateChannelAvailableMessages#b23fc698`.
|
|
// The history of a channel/supergroup¹ was hidden.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelAvailableMessages for reference.
|
|
type UpdateChannelAvailableMessages struct {
|
|
// Channel/supergroup ID
|
|
ChannelID int64
|
|
// Identifier of a maximum unavailable message in a channel due to hidden history.
|
|
AvailableMinID int
|
|
}
|
|
|
|
// UpdateChannelAvailableMessagesTypeID is TL type id of UpdateChannelAvailableMessages.
|
|
const UpdateChannelAvailableMessagesTypeID = 0xb23fc698
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelAvailableMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelAvailableMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelAvailableMessages{}
|
|
_ bin.Decoder = &UpdateChannelAvailableMessages{}
|
|
_ bin.BareEncoder = &UpdateChannelAvailableMessages{}
|
|
_ bin.BareDecoder = &UpdateChannelAvailableMessages{}
|
|
|
|
_ UpdateClass = &UpdateChannelAvailableMessages{}
|
|
)
|
|
|
|
func (u *UpdateChannelAvailableMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.AvailableMinID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelAvailableMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelAvailableMessages(nil)"
|
|
}
|
|
type Alias UpdateChannelAvailableMessages
|
|
return fmt.Sprintf("UpdateChannelAvailableMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelAvailableMessages from given interface.
|
|
func (u *UpdateChannelAvailableMessages) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetAvailableMinID() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.AvailableMinID = from.GetAvailableMinID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelAvailableMessages) TypeID() uint32 {
|
|
return UpdateChannelAvailableMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelAvailableMessages) TypeName() string {
|
|
return "updateChannelAvailableMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelAvailableMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelAvailableMessages",
|
|
ID: UpdateChannelAvailableMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "AvailableMinID",
|
|
SchemaName: "available_min_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelAvailableMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelAvailableMessages#b23fc698 as nil")
|
|
}
|
|
b.PutID(UpdateChannelAvailableMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelAvailableMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelAvailableMessages#b23fc698 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.AvailableMinID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelAvailableMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelAvailableMessages#b23fc698 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelAvailableMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelAvailableMessages#b23fc698: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelAvailableMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelAvailableMessages#b23fc698 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelAvailableMessages#b23fc698: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelAvailableMessages#b23fc698: field available_min_id: %w", err)
|
|
}
|
|
u.AvailableMinID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelAvailableMessages) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetAvailableMinID returns value of AvailableMinID field.
|
|
func (u *UpdateChannelAvailableMessages) GetAvailableMinID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.AvailableMinID
|
|
}
|
|
|
|
// UpdateDialogUnreadMark represents TL type `updateDialogUnreadMark#b658f23e`.
|
|
// The manual unread mark of a chat was changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDialogUnreadMark for reference.
|
|
type UpdateDialogUnreadMark struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Was the chat marked or unmarked as read
|
|
Unread bool
|
|
// The dialog
|
|
Peer DialogPeerClass
|
|
// If set, the mark is related to the specified monoforum topic ID »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/monoforum
|
|
//
|
|
// Use SetSavedPeerID and GetSavedPeerID helpers.
|
|
SavedPeerID PeerClass
|
|
}
|
|
|
|
// UpdateDialogUnreadMarkTypeID is TL type id of UpdateDialogUnreadMark.
|
|
const UpdateDialogUnreadMarkTypeID = 0xb658f23e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDialogUnreadMark) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDialogUnreadMark.
|
|
var (
|
|
_ bin.Encoder = &UpdateDialogUnreadMark{}
|
|
_ bin.Decoder = &UpdateDialogUnreadMark{}
|
|
_ bin.BareEncoder = &UpdateDialogUnreadMark{}
|
|
_ bin.BareDecoder = &UpdateDialogUnreadMark{}
|
|
|
|
_ UpdateClass = &UpdateDialogUnreadMark{}
|
|
)
|
|
|
|
func (u *UpdateDialogUnreadMark) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Unread == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDialogUnreadMark) String() string {
|
|
if u == nil {
|
|
return "UpdateDialogUnreadMark(nil)"
|
|
}
|
|
type Alias UpdateDialogUnreadMark
|
|
return fmt.Sprintf("UpdateDialogUnreadMark%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDialogUnreadMark from given interface.
|
|
func (u *UpdateDialogUnreadMark) FillFrom(from interface {
|
|
GetUnread() (value bool)
|
|
GetPeer() (value DialogPeerClass)
|
|
GetSavedPeerID() (value PeerClass, ok bool)
|
|
}) {
|
|
u.Unread = from.GetUnread()
|
|
u.Peer = from.GetPeer()
|
|
if val, ok := from.GetSavedPeerID(); ok {
|
|
u.SavedPeerID = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDialogUnreadMark) TypeID() uint32 {
|
|
return UpdateDialogUnreadMarkTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDialogUnreadMark) TypeName() string {
|
|
return "updateDialogUnreadMark"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDialogUnreadMark) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDialogUnreadMark",
|
|
ID: UpdateDialogUnreadMarkTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Unread",
|
|
SchemaName: "unread",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateDialogUnreadMark) SetFlags() {
|
|
if !(u.Unread == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDialogUnreadMark) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogUnreadMark#b658f23e as nil")
|
|
}
|
|
b.PutID(UpdateDialogUnreadMarkTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDialogUnreadMark) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogUnreadMark#b658f23e as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogUnreadMark#b658f23e: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateDialogUnreadMark#b658f23e: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogUnreadMark#b658f23e: field peer: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateDialogUnreadMark#b658f23e: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogUnreadMark#b658f23e: field saved_peer_id: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDialogUnreadMark) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogUnreadMark#b658f23e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDialogUnreadMarkTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogUnreadMark#b658f23e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDialogUnreadMark) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogUnreadMark#b658f23e to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogUnreadMark#b658f23e: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Unread = u.Flags.Has(0)
|
|
{
|
|
value, err := DecodeDialogPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogUnreadMark#b658f23e: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogUnreadMark#b658f23e: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetUnread sets value of Unread conditional field.
|
|
func (u *UpdateDialogUnreadMark) SetUnread(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Unread = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Unread = false
|
|
}
|
|
}
|
|
|
|
// GetUnread returns value of Unread conditional field.
|
|
func (u *UpdateDialogUnreadMark) GetUnread() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateDialogUnreadMark) GetPeer() (value DialogPeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// SetSavedPeerID sets value of SavedPeerID conditional field.
|
|
func (u *UpdateDialogUnreadMark) SetSavedPeerID(value PeerClass) {
|
|
u.Flags.Set(1)
|
|
u.SavedPeerID = value
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateDialogUnreadMark) GetSavedPeerID() (value PeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.SavedPeerID, true
|
|
}
|
|
|
|
// UpdateMessagePoll represents TL type `updateMessagePoll#d64c522b`.
|
|
// The results of a poll have changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMessagePoll for reference.
|
|
type UpdateMessagePoll struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Peer field of UpdateMessagePoll.
|
|
//
|
|
// Use SetPeer and GetPeer helpers.
|
|
Peer PeerClass
|
|
// MsgID field of UpdateMessagePoll.
|
|
//
|
|
// Use SetMsgID and GetMsgID helpers.
|
|
MsgID int
|
|
// TopMsgID field of UpdateMessagePoll.
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// Poll ID
|
|
PollID int64
|
|
// If the server knows the client hasn't cached this poll yet, the poll itself
|
|
//
|
|
// Use SetPoll and GetPoll helpers.
|
|
Poll Poll
|
|
// New poll results
|
|
Results PollResults
|
|
}
|
|
|
|
// UpdateMessagePollTypeID is TL type id of UpdateMessagePoll.
|
|
const UpdateMessagePollTypeID = 0xd64c522b
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMessagePoll) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMessagePoll.
|
|
var (
|
|
_ bin.Encoder = &UpdateMessagePoll{}
|
|
_ bin.Decoder = &UpdateMessagePoll{}
|
|
_ bin.BareEncoder = &UpdateMessagePoll{}
|
|
_ bin.BareDecoder = &UpdateMessagePoll{}
|
|
|
|
_ UpdateClass = &UpdateMessagePoll{}
|
|
)
|
|
|
|
func (u *UpdateMessagePoll) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.PollID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Poll.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Results.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMessagePoll) String() string {
|
|
if u == nil {
|
|
return "UpdateMessagePoll(nil)"
|
|
}
|
|
type Alias UpdateMessagePoll
|
|
return fmt.Sprintf("UpdateMessagePoll%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMessagePoll from given interface.
|
|
func (u *UpdateMessagePoll) FillFrom(from interface {
|
|
GetPeer() (value PeerClass, ok bool)
|
|
GetMsgID() (value int, ok bool)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetPollID() (value int64)
|
|
GetPoll() (value Poll, ok bool)
|
|
GetResults() (value PollResults)
|
|
}) {
|
|
if val, ok := from.GetPeer(); ok {
|
|
u.Peer = val
|
|
}
|
|
|
|
if val, ok := from.GetMsgID(); ok {
|
|
u.MsgID = val
|
|
}
|
|
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
u.PollID = from.GetPollID()
|
|
if val, ok := from.GetPoll(); ok {
|
|
u.Poll = val
|
|
}
|
|
|
|
u.Results = from.GetResults()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMessagePoll) TypeID() uint32 {
|
|
return UpdateMessagePollTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMessagePoll) TypeName() string {
|
|
return "updateMessagePoll"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMessagePoll) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMessagePoll",
|
|
ID: UpdateMessagePollTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "PollID",
|
|
SchemaName: "poll_id",
|
|
},
|
|
{
|
|
Name: "Poll",
|
|
SchemaName: "poll",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Results",
|
|
SchemaName: "results",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateMessagePoll) SetFlags() {
|
|
if !(u.Peer == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
u.Flags.Set(1)
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(2)
|
|
}
|
|
if !(u.Poll.Zero()) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMessagePoll) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessagePoll#d64c522b as nil")
|
|
}
|
|
b.PutID(UpdateMessagePollTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMessagePoll) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessagePoll#d64c522b as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field peer: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
b.PutInt(u.MsgID)
|
|
}
|
|
if u.Flags.Has(2) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
b.PutLong(u.PollID)
|
|
if u.Flags.Has(0) {
|
|
if err := u.Poll.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field poll: %w", err)
|
|
}
|
|
}
|
|
if err := u.Results.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessagePoll#d64c522b: field results: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMessagePoll) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessagePoll#d64c522b to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMessagePollTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMessagePoll) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessagePoll#d64c522b to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field flags: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
if u.Flags.Has(2) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field poll_id: %w", err)
|
|
}
|
|
u.PollID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
if err := u.Poll.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field poll: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := u.Results.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePoll#d64c522b: field results: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPeer sets value of Peer conditional field.
|
|
func (u *UpdateMessagePoll) SetPeer(value PeerClass) {
|
|
u.Flags.Set(1)
|
|
u.Peer = value
|
|
}
|
|
|
|
// GetPeer returns value of Peer conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateMessagePoll) GetPeer() (value PeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.Peer, true
|
|
}
|
|
|
|
// SetMsgID sets value of MsgID conditional field.
|
|
func (u *UpdateMessagePoll) SetMsgID(value int) {
|
|
u.Flags.Set(1)
|
|
u.MsgID = value
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateMessagePoll) GetMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.MsgID, true
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateMessagePoll) SetTopMsgID(value int) {
|
|
u.Flags.Set(2)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateMessagePoll) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(2) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// GetPollID returns value of PollID field.
|
|
func (u *UpdateMessagePoll) GetPollID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PollID
|
|
}
|
|
|
|
// SetPoll sets value of Poll conditional field.
|
|
func (u *UpdateMessagePoll) SetPoll(value Poll) {
|
|
u.Flags.Set(0)
|
|
u.Poll = value
|
|
}
|
|
|
|
// GetPoll returns value of Poll conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateMessagePoll) GetPoll() (value Poll, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Poll, true
|
|
}
|
|
|
|
// GetResults returns value of Results field.
|
|
func (u *UpdateMessagePoll) GetResults() (value PollResults) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Results
|
|
}
|
|
|
|
// UpdateChatDefaultBannedRights represents TL type `updateChatDefaultBannedRights#54c01850`.
|
|
// Default banned rights in a normal chat¹ were updated
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatDefaultBannedRights for reference.
|
|
type UpdateChatDefaultBannedRights struct {
|
|
// The chat
|
|
Peer PeerClass
|
|
// New default banned rights
|
|
DefaultBannedRights ChatBannedRights
|
|
// Version
|
|
Version int
|
|
}
|
|
|
|
// UpdateChatDefaultBannedRightsTypeID is TL type id of UpdateChatDefaultBannedRights.
|
|
const UpdateChatDefaultBannedRightsTypeID = 0x54c01850
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatDefaultBannedRights) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatDefaultBannedRights.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatDefaultBannedRights{}
|
|
_ bin.Decoder = &UpdateChatDefaultBannedRights{}
|
|
_ bin.BareEncoder = &UpdateChatDefaultBannedRights{}
|
|
_ bin.BareDecoder = &UpdateChatDefaultBannedRights{}
|
|
|
|
_ UpdateClass = &UpdateChatDefaultBannedRights{}
|
|
)
|
|
|
|
func (u *UpdateChatDefaultBannedRights) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.DefaultBannedRights.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Version == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatDefaultBannedRights) String() string {
|
|
if u == nil {
|
|
return "UpdateChatDefaultBannedRights(nil)"
|
|
}
|
|
type Alias UpdateChatDefaultBannedRights
|
|
return fmt.Sprintf("UpdateChatDefaultBannedRights%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatDefaultBannedRights from given interface.
|
|
func (u *UpdateChatDefaultBannedRights) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetDefaultBannedRights() (value ChatBannedRights)
|
|
GetVersion() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.DefaultBannedRights = from.GetDefaultBannedRights()
|
|
u.Version = from.GetVersion()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatDefaultBannedRights) TypeID() uint32 {
|
|
return UpdateChatDefaultBannedRightsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatDefaultBannedRights) TypeName() string {
|
|
return "updateChatDefaultBannedRights"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatDefaultBannedRights) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatDefaultBannedRights",
|
|
ID: UpdateChatDefaultBannedRightsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "DefaultBannedRights",
|
|
SchemaName: "default_banned_rights",
|
|
},
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatDefaultBannedRights) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatDefaultBannedRights#54c01850 as nil")
|
|
}
|
|
b.PutID(UpdateChatDefaultBannedRightsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatDefaultBannedRights) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatDefaultBannedRights#54c01850 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateChatDefaultBannedRights#54c01850: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatDefaultBannedRights#54c01850: field peer: %w", err)
|
|
}
|
|
if err := u.DefaultBannedRights.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatDefaultBannedRights#54c01850: field default_banned_rights: %w", err)
|
|
}
|
|
b.PutInt(u.Version)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatDefaultBannedRights) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatDefaultBannedRights#54c01850 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatDefaultBannedRightsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatDefaultBannedRights#54c01850: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatDefaultBannedRights) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatDefaultBannedRights#54c01850 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatDefaultBannedRights#54c01850: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
if err := u.DefaultBannedRights.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatDefaultBannedRights#54c01850: field default_banned_rights: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatDefaultBannedRights#54c01850: field version: %w", err)
|
|
}
|
|
u.Version = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateChatDefaultBannedRights) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetDefaultBannedRights returns value of DefaultBannedRights field.
|
|
func (u *UpdateChatDefaultBannedRights) GetDefaultBannedRights() (value ChatBannedRights) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.DefaultBannedRights
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (u *UpdateChatDefaultBannedRights) GetVersion() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Version
|
|
}
|
|
|
|
// UpdateFolderPeers represents TL type `updateFolderPeers#19360dc0`.
|
|
// The peer list of a peer folder¹ was updated
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/folders#peer-folders
|
|
//
|
|
// See https://core.telegram.org/constructor/updateFolderPeers for reference.
|
|
type UpdateFolderPeers struct {
|
|
// New peer list
|
|
FolderPeers []FolderPeer
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdateFolderPeersTypeID is TL type id of UpdateFolderPeers.
|
|
const UpdateFolderPeersTypeID = 0x19360dc0
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateFolderPeers) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateFolderPeers.
|
|
var (
|
|
_ bin.Encoder = &UpdateFolderPeers{}
|
|
_ bin.Decoder = &UpdateFolderPeers{}
|
|
_ bin.BareEncoder = &UpdateFolderPeers{}
|
|
_ bin.BareDecoder = &UpdateFolderPeers{}
|
|
|
|
_ UpdateClass = &UpdateFolderPeers{}
|
|
)
|
|
|
|
func (u *UpdateFolderPeers) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.FolderPeers == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateFolderPeers) String() string {
|
|
if u == nil {
|
|
return "UpdateFolderPeers(nil)"
|
|
}
|
|
type Alias UpdateFolderPeers
|
|
return fmt.Sprintf("UpdateFolderPeers%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateFolderPeers from given interface.
|
|
func (u *UpdateFolderPeers) FillFrom(from interface {
|
|
GetFolderPeers() (value []FolderPeer)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.FolderPeers = from.GetFolderPeers()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateFolderPeers) TypeID() uint32 {
|
|
return UpdateFolderPeersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateFolderPeers) TypeName() string {
|
|
return "updateFolderPeers"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateFolderPeers) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateFolderPeers",
|
|
ID: UpdateFolderPeersTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "FolderPeers",
|
|
SchemaName: "folder_peers",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateFolderPeers) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateFolderPeers#19360dc0 as nil")
|
|
}
|
|
b.PutID(UpdateFolderPeersTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateFolderPeers) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateFolderPeers#19360dc0 as nil")
|
|
}
|
|
b.PutVectorHeader(len(u.FolderPeers))
|
|
for idx, v := range u.FolderPeers {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateFolderPeers#19360dc0: field folder_peers element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateFolderPeers) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateFolderPeers#19360dc0 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateFolderPeersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateFolderPeers#19360dc0: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateFolderPeers) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateFolderPeers#19360dc0 to nil")
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateFolderPeers#19360dc0: field folder_peers: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.FolderPeers = make([]FolderPeer, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value FolderPeer
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateFolderPeers#19360dc0: field folder_peers: %w", err)
|
|
}
|
|
u.FolderPeers = append(u.FolderPeers, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateFolderPeers#19360dc0: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateFolderPeers#19360dc0: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetFolderPeers returns value of FolderPeers field.
|
|
func (u *UpdateFolderPeers) GetFolderPeers() (value []FolderPeer) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.FolderPeers
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdateFolderPeers) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdateFolderPeers) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdatePeerSettings represents TL type `updatePeerSettings#6a7e7366`.
|
|
// Settings of a certain peer have changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePeerSettings for reference.
|
|
type UpdatePeerSettings struct {
|
|
// The peer
|
|
Peer PeerClass
|
|
// Associated peer settings
|
|
Settings PeerSettings
|
|
}
|
|
|
|
// UpdatePeerSettingsTypeID is TL type id of UpdatePeerSettings.
|
|
const UpdatePeerSettingsTypeID = 0x6a7e7366
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePeerSettings) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePeerSettings.
|
|
var (
|
|
_ bin.Encoder = &UpdatePeerSettings{}
|
|
_ bin.Decoder = &UpdatePeerSettings{}
|
|
_ bin.BareEncoder = &UpdatePeerSettings{}
|
|
_ bin.BareDecoder = &UpdatePeerSettings{}
|
|
|
|
_ UpdateClass = &UpdatePeerSettings{}
|
|
)
|
|
|
|
func (u *UpdatePeerSettings) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Settings.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePeerSettings) String() string {
|
|
if u == nil {
|
|
return "UpdatePeerSettings(nil)"
|
|
}
|
|
type Alias UpdatePeerSettings
|
|
return fmt.Sprintf("UpdatePeerSettings%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePeerSettings from given interface.
|
|
func (u *UpdatePeerSettings) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetSettings() (value PeerSettings)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.Settings = from.GetSettings()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePeerSettings) TypeID() uint32 {
|
|
return UpdatePeerSettingsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePeerSettings) TypeName() string {
|
|
return "updatePeerSettings"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePeerSettings) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePeerSettings",
|
|
ID: UpdatePeerSettingsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Settings",
|
|
SchemaName: "settings",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePeerSettings) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerSettings#6a7e7366 as nil")
|
|
}
|
|
b.PutID(UpdatePeerSettingsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePeerSettings) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerSettings#6a7e7366 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePeerSettings#6a7e7366: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerSettings#6a7e7366: field peer: %w", err)
|
|
}
|
|
if err := u.Settings.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerSettings#6a7e7366: field settings: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePeerSettings) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerSettings#6a7e7366 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePeerSettingsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerSettings#6a7e7366: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePeerSettings) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerSettings#6a7e7366 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerSettings#6a7e7366: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
if err := u.Settings.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerSettings#6a7e7366: field settings: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePeerSettings) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetSettings returns value of Settings field.
|
|
func (u *UpdatePeerSettings) GetSettings() (value PeerSettings) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Settings
|
|
}
|
|
|
|
// UpdatePeerLocated represents TL type `updatePeerLocated#b4afcfb0`.
|
|
// List of peers near you was updated
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePeerLocated for reference.
|
|
type UpdatePeerLocated struct {
|
|
// Geolocated peer list update
|
|
Peers []PeerLocatedClass
|
|
}
|
|
|
|
// UpdatePeerLocatedTypeID is TL type id of UpdatePeerLocated.
|
|
const UpdatePeerLocatedTypeID = 0xb4afcfb0
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePeerLocated) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePeerLocated.
|
|
var (
|
|
_ bin.Encoder = &UpdatePeerLocated{}
|
|
_ bin.Decoder = &UpdatePeerLocated{}
|
|
_ bin.BareEncoder = &UpdatePeerLocated{}
|
|
_ bin.BareDecoder = &UpdatePeerLocated{}
|
|
|
|
_ UpdateClass = &UpdatePeerLocated{}
|
|
)
|
|
|
|
func (u *UpdatePeerLocated) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peers == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePeerLocated) String() string {
|
|
if u == nil {
|
|
return "UpdatePeerLocated(nil)"
|
|
}
|
|
type Alias UpdatePeerLocated
|
|
return fmt.Sprintf("UpdatePeerLocated%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePeerLocated from given interface.
|
|
func (u *UpdatePeerLocated) FillFrom(from interface {
|
|
GetPeers() (value []PeerLocatedClass)
|
|
}) {
|
|
u.Peers = from.GetPeers()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePeerLocated) TypeID() uint32 {
|
|
return UpdatePeerLocatedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePeerLocated) TypeName() string {
|
|
return "updatePeerLocated"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePeerLocated) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePeerLocated",
|
|
ID: UpdatePeerLocatedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peers",
|
|
SchemaName: "peers",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePeerLocated) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerLocated#b4afcfb0 as nil")
|
|
}
|
|
b.PutID(UpdatePeerLocatedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePeerLocated) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerLocated#b4afcfb0 as nil")
|
|
}
|
|
b.PutVectorHeader(len(u.Peers))
|
|
for idx, v := range u.Peers {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updatePeerLocated#b4afcfb0: field peers element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerLocated#b4afcfb0: field peers element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePeerLocated) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerLocated#b4afcfb0 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePeerLocatedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerLocated#b4afcfb0: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePeerLocated) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerLocated#b4afcfb0 to nil")
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerLocated#b4afcfb0: field peers: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Peers = make([]PeerLocatedClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodePeerLocated(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerLocated#b4afcfb0: field peers: %w", err)
|
|
}
|
|
u.Peers = append(u.Peers, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeers returns value of Peers field.
|
|
func (u *UpdatePeerLocated) GetPeers() (value []PeerLocatedClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peers
|
|
}
|
|
|
|
// MapPeers returns field Peers wrapped in PeerLocatedClassArray helper.
|
|
func (u *UpdatePeerLocated) MapPeers() (value PeerLocatedClassArray) {
|
|
return PeerLocatedClassArray(u.Peers)
|
|
}
|
|
|
|
// UpdateNewScheduledMessage represents TL type `updateNewScheduledMessage#39a51dfb`.
|
|
// A message was added to the schedule queue of a chat¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/scheduled-messages
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewScheduledMessage for reference.
|
|
type UpdateNewScheduledMessage struct {
|
|
// Message
|
|
Message MessageClass
|
|
}
|
|
|
|
// UpdateNewScheduledMessageTypeID is TL type id of UpdateNewScheduledMessage.
|
|
const UpdateNewScheduledMessageTypeID = 0x39a51dfb
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewScheduledMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewScheduledMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewScheduledMessage{}
|
|
_ bin.Decoder = &UpdateNewScheduledMessage{}
|
|
_ bin.BareEncoder = &UpdateNewScheduledMessage{}
|
|
_ bin.BareDecoder = &UpdateNewScheduledMessage{}
|
|
|
|
_ UpdateClass = &UpdateNewScheduledMessage{}
|
|
)
|
|
|
|
func (u *UpdateNewScheduledMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewScheduledMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateNewScheduledMessage(nil)"
|
|
}
|
|
type Alias UpdateNewScheduledMessage
|
|
return fmt.Sprintf("UpdateNewScheduledMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewScheduledMessage from given interface.
|
|
func (u *UpdateNewScheduledMessage) FillFrom(from interface {
|
|
GetMessage() (value MessageClass)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewScheduledMessage) TypeID() uint32 {
|
|
return UpdateNewScheduledMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewScheduledMessage) TypeName() string {
|
|
return "updateNewScheduledMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewScheduledMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewScheduledMessage",
|
|
ID: UpdateNewScheduledMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewScheduledMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewScheduledMessage#39a51dfb as nil")
|
|
}
|
|
b.PutID(UpdateNewScheduledMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewScheduledMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewScheduledMessage#39a51dfb as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateNewScheduledMessage#39a51dfb: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewScheduledMessage#39a51dfb: field message: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewScheduledMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewScheduledMessage#39a51dfb to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewScheduledMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewScheduledMessage#39a51dfb: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewScheduledMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewScheduledMessage#39a51dfb to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewScheduledMessage#39a51dfb: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateNewScheduledMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// UpdateDeleteScheduledMessages represents TL type `updateDeleteScheduledMessages#f2a71983`.
|
|
// Some scheduled messages¹ were deleted (or sent) from the schedule queue of a chat
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/scheduled-messages
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDeleteScheduledMessages for reference.
|
|
type UpdateDeleteScheduledMessages struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Peer
|
|
Peer PeerClass
|
|
// Deleted scheduled messages
|
|
Messages []int
|
|
// If set, this update indicates that some scheduled messages were sent (not simply
|
|
// deleted from the schedule queue). In this case, the messages field will contain the
|
|
// scheduled message IDs for the sent messages (initially returned in
|
|
// updateNewScheduledMessage¹), and sent_messages will contain the real message IDs for
|
|
// the sent messages.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/updateNewScheduledMessage
|
|
//
|
|
// Use SetSentMessages and GetSentMessages helpers.
|
|
SentMessages []int
|
|
}
|
|
|
|
// UpdateDeleteScheduledMessagesTypeID is TL type id of UpdateDeleteScheduledMessages.
|
|
const UpdateDeleteScheduledMessagesTypeID = 0xf2a71983
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDeleteScheduledMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDeleteScheduledMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateDeleteScheduledMessages{}
|
|
_ bin.Decoder = &UpdateDeleteScheduledMessages{}
|
|
_ bin.BareEncoder = &UpdateDeleteScheduledMessages{}
|
|
_ bin.BareDecoder = &UpdateDeleteScheduledMessages{}
|
|
|
|
_ UpdateClass = &UpdateDeleteScheduledMessages{}
|
|
)
|
|
|
|
func (u *UpdateDeleteScheduledMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.SentMessages == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDeleteScheduledMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateDeleteScheduledMessages(nil)"
|
|
}
|
|
type Alias UpdateDeleteScheduledMessages
|
|
return fmt.Sprintf("UpdateDeleteScheduledMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDeleteScheduledMessages from given interface.
|
|
func (u *UpdateDeleteScheduledMessages) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMessages() (value []int)
|
|
GetSentMessages() (value []int, ok bool)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.Messages = from.GetMessages()
|
|
if val, ok := from.GetSentMessages(); ok {
|
|
u.SentMessages = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDeleteScheduledMessages) TypeID() uint32 {
|
|
return UpdateDeleteScheduledMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDeleteScheduledMessages) TypeName() string {
|
|
return "updateDeleteScheduledMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDeleteScheduledMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDeleteScheduledMessages",
|
|
ID: UpdateDeleteScheduledMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "SentMessages",
|
|
SchemaName: "sent_messages",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateDeleteScheduledMessages) SetFlags() {
|
|
if !(u.SentMessages == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDeleteScheduledMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteScheduledMessages#f2a71983 as nil")
|
|
}
|
|
b.PutID(UpdateDeleteScheduledMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDeleteScheduledMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteScheduledMessages#f2a71983 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDeleteScheduledMessages#f2a71983: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateDeleteScheduledMessages#f2a71983: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDeleteScheduledMessages#f2a71983: field peer: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutVectorHeader(len(u.SentMessages))
|
|
for _, v := range u.SentMessages {
|
|
b.PutInt(v)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDeleteScheduledMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteScheduledMessages#f2a71983 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDeleteScheduledMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDeleteScheduledMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteScheduledMessages#f2a71983 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
if u.Flags.Has(0) {
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field sent_messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.SentMessages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteScheduledMessages#f2a71983: field sent_messages: %w", err)
|
|
}
|
|
u.SentMessages = append(u.SentMessages, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateDeleteScheduledMessages) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateDeleteScheduledMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// SetSentMessages sets value of SentMessages conditional field.
|
|
func (u *UpdateDeleteScheduledMessages) SetSentMessages(value []int) {
|
|
u.Flags.Set(0)
|
|
u.SentMessages = value
|
|
}
|
|
|
|
// GetSentMessages returns value of SentMessages conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateDeleteScheduledMessages) GetSentMessages() (value []int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.SentMessages, true
|
|
}
|
|
|
|
// UpdateTheme represents TL type `updateTheme#8216fba3`.
|
|
// A cloud theme was updated
|
|
//
|
|
// See https://core.telegram.org/constructor/updateTheme for reference.
|
|
type UpdateTheme struct {
|
|
// Theme
|
|
Theme Theme
|
|
}
|
|
|
|
// UpdateThemeTypeID is TL type id of UpdateTheme.
|
|
const UpdateThemeTypeID = 0x8216fba3
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateTheme) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateTheme.
|
|
var (
|
|
_ bin.Encoder = &UpdateTheme{}
|
|
_ bin.Decoder = &UpdateTheme{}
|
|
_ bin.BareEncoder = &UpdateTheme{}
|
|
_ bin.BareDecoder = &UpdateTheme{}
|
|
|
|
_ UpdateClass = &UpdateTheme{}
|
|
)
|
|
|
|
func (u *UpdateTheme) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Theme.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateTheme) String() string {
|
|
if u == nil {
|
|
return "UpdateTheme(nil)"
|
|
}
|
|
type Alias UpdateTheme
|
|
return fmt.Sprintf("UpdateTheme%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateTheme from given interface.
|
|
func (u *UpdateTheme) FillFrom(from interface {
|
|
GetTheme() (value Theme)
|
|
}) {
|
|
u.Theme = from.GetTheme()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateTheme) TypeID() uint32 {
|
|
return UpdateThemeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateTheme) TypeName() string {
|
|
return "updateTheme"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateTheme) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateTheme",
|
|
ID: UpdateThemeTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Theme",
|
|
SchemaName: "theme",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateTheme) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateTheme#8216fba3 as nil")
|
|
}
|
|
b.PutID(UpdateThemeTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateTheme) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateTheme#8216fba3 as nil")
|
|
}
|
|
if err := u.Theme.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateTheme#8216fba3: field theme: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateTheme) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateTheme#8216fba3 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateThemeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateTheme#8216fba3: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateTheme) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateTheme#8216fba3 to nil")
|
|
}
|
|
{
|
|
if err := u.Theme.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateTheme#8216fba3: field theme: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetTheme returns value of Theme field.
|
|
func (u *UpdateTheme) GetTheme() (value Theme) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Theme
|
|
}
|
|
|
|
// UpdateGeoLiveViewed represents TL type `updateGeoLiveViewed#871fb939`.
|
|
// Live geoposition message was viewed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGeoLiveViewed for reference.
|
|
type UpdateGeoLiveViewed struct {
|
|
// The user that viewed the live geoposition
|
|
Peer PeerClass
|
|
// Message ID of geoposition message
|
|
MsgID int
|
|
}
|
|
|
|
// UpdateGeoLiveViewedTypeID is TL type id of UpdateGeoLiveViewed.
|
|
const UpdateGeoLiveViewedTypeID = 0x871fb939
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGeoLiveViewed) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGeoLiveViewed.
|
|
var (
|
|
_ bin.Encoder = &UpdateGeoLiveViewed{}
|
|
_ bin.Decoder = &UpdateGeoLiveViewed{}
|
|
_ bin.BareEncoder = &UpdateGeoLiveViewed{}
|
|
_ bin.BareDecoder = &UpdateGeoLiveViewed{}
|
|
|
|
_ UpdateClass = &UpdateGeoLiveViewed{}
|
|
)
|
|
|
|
func (u *UpdateGeoLiveViewed) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGeoLiveViewed) String() string {
|
|
if u == nil {
|
|
return "UpdateGeoLiveViewed(nil)"
|
|
}
|
|
type Alias UpdateGeoLiveViewed
|
|
return fmt.Sprintf("UpdateGeoLiveViewed%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGeoLiveViewed from given interface.
|
|
func (u *UpdateGeoLiveViewed) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGeoLiveViewed) TypeID() uint32 {
|
|
return UpdateGeoLiveViewedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGeoLiveViewed) TypeName() string {
|
|
return "updateGeoLiveViewed"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGeoLiveViewed) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGeoLiveViewed",
|
|
ID: UpdateGeoLiveViewedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGeoLiveViewed) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGeoLiveViewed#871fb939 as nil")
|
|
}
|
|
b.PutID(UpdateGeoLiveViewedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGeoLiveViewed) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGeoLiveViewed#871fb939 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateGeoLiveViewed#871fb939: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGeoLiveViewed#871fb939: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGeoLiveViewed) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGeoLiveViewed#871fb939 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGeoLiveViewedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGeoLiveViewed#871fb939: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGeoLiveViewed) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGeoLiveViewed#871fb939 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGeoLiveViewed#871fb939: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGeoLiveViewed#871fb939: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateGeoLiveViewed) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateGeoLiveViewed) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// UpdateLoginToken represents TL type `updateLoginToken#564fe691`.
|
|
// A login token (for login via QR code) was accepted.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateLoginToken for reference.
|
|
type UpdateLoginToken struct {
|
|
}
|
|
|
|
// UpdateLoginTokenTypeID is TL type id of UpdateLoginToken.
|
|
const UpdateLoginTokenTypeID = 0x564fe691
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateLoginToken) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateLoginToken.
|
|
var (
|
|
_ bin.Encoder = &UpdateLoginToken{}
|
|
_ bin.Decoder = &UpdateLoginToken{}
|
|
_ bin.BareEncoder = &UpdateLoginToken{}
|
|
_ bin.BareDecoder = &UpdateLoginToken{}
|
|
|
|
_ UpdateClass = &UpdateLoginToken{}
|
|
)
|
|
|
|
func (u *UpdateLoginToken) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateLoginToken) String() string {
|
|
if u == nil {
|
|
return "UpdateLoginToken(nil)"
|
|
}
|
|
type Alias UpdateLoginToken
|
|
return fmt.Sprintf("UpdateLoginToken%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateLoginToken) TypeID() uint32 {
|
|
return UpdateLoginTokenTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateLoginToken) TypeName() string {
|
|
return "updateLoginToken"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateLoginToken) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateLoginToken",
|
|
ID: UpdateLoginTokenTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateLoginToken) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateLoginToken#564fe691 as nil")
|
|
}
|
|
b.PutID(UpdateLoginTokenTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateLoginToken) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateLoginToken#564fe691 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateLoginToken) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateLoginToken#564fe691 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateLoginTokenTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateLoginToken#564fe691: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateLoginToken) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateLoginToken#564fe691 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateMessagePollVote represents TL type `updateMessagePollVote#7699f014`.
|
|
// A specific peer has voted in a poll
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMessagePollVote for reference.
|
|
type UpdateMessagePollVote struct {
|
|
// Poll ID
|
|
PollID int64
|
|
// The peer that voted in the poll
|
|
Peer PeerClass
|
|
// Chosen option(s)
|
|
Options [][]byte
|
|
// Positions field of UpdateMessagePollVote.
|
|
Positions []int
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateMessagePollVoteTypeID is TL type id of UpdateMessagePollVote.
|
|
const UpdateMessagePollVoteTypeID = 0x7699f014
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMessagePollVote) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMessagePollVote.
|
|
var (
|
|
_ bin.Encoder = &UpdateMessagePollVote{}
|
|
_ bin.Decoder = &UpdateMessagePollVote{}
|
|
_ bin.BareEncoder = &UpdateMessagePollVote{}
|
|
_ bin.BareDecoder = &UpdateMessagePollVote{}
|
|
|
|
_ UpdateClass = &UpdateMessagePollVote{}
|
|
)
|
|
|
|
func (u *UpdateMessagePollVote) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.PollID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Options == nil) {
|
|
return false
|
|
}
|
|
if !(u.Positions == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMessagePollVote) String() string {
|
|
if u == nil {
|
|
return "UpdateMessagePollVote(nil)"
|
|
}
|
|
type Alias UpdateMessagePollVote
|
|
return fmt.Sprintf("UpdateMessagePollVote%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMessagePollVote from given interface.
|
|
func (u *UpdateMessagePollVote) FillFrom(from interface {
|
|
GetPollID() (value int64)
|
|
GetPeer() (value PeerClass)
|
|
GetOptions() (value [][]byte)
|
|
GetPositions() (value []int)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.PollID = from.GetPollID()
|
|
u.Peer = from.GetPeer()
|
|
u.Options = from.GetOptions()
|
|
u.Positions = from.GetPositions()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMessagePollVote) TypeID() uint32 {
|
|
return UpdateMessagePollVoteTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMessagePollVote) TypeName() string {
|
|
return "updateMessagePollVote"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMessagePollVote) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMessagePollVote",
|
|
ID: UpdateMessagePollVoteTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PollID",
|
|
SchemaName: "poll_id",
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Options",
|
|
SchemaName: "options",
|
|
},
|
|
{
|
|
Name: "Positions",
|
|
SchemaName: "positions",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMessagePollVote) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessagePollVote#7699f014 as nil")
|
|
}
|
|
b.PutID(UpdateMessagePollVoteTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMessagePollVote) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessagePollVote#7699f014 as nil")
|
|
}
|
|
b.PutLong(u.PollID)
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateMessagePollVote#7699f014: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessagePollVote#7699f014: field peer: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Options))
|
|
for _, v := range u.Options {
|
|
b.PutBytes(v)
|
|
}
|
|
b.PutVectorHeader(len(u.Positions))
|
|
for _, v := range u.Positions {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMessagePollVote) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessagePollVote#7699f014 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMessagePollVoteTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMessagePollVote) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessagePollVote#7699f014 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field poll_id: %w", err)
|
|
}
|
|
u.PollID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field options: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Options = make([][]byte, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field options: %w", err)
|
|
}
|
|
u.Options = append(u.Options, value)
|
|
}
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field positions: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Positions = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field positions: %w", err)
|
|
}
|
|
u.Positions = append(u.Positions, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessagePollVote#7699f014: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPollID returns value of PollID field.
|
|
func (u *UpdateMessagePollVote) GetPollID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PollID
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateMessagePollVote) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetOptions returns value of Options field.
|
|
func (u *UpdateMessagePollVote) GetOptions() (value [][]byte) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Options
|
|
}
|
|
|
|
// GetPositions returns value of Positions field.
|
|
func (u *UpdateMessagePollVote) GetPositions() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Positions
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateMessagePollVote) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateDialogFilter represents TL type `updateDialogFilter#26ffde7d`.
|
|
// A new folder¹ was added
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/folders
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDialogFilter for reference.
|
|
type UpdateDialogFilter struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Folder¹ ID
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders
|
|
ID int
|
|
// Folder¹ info
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders
|
|
//
|
|
// Use SetFilter and GetFilter helpers.
|
|
Filter DialogFilterClass
|
|
}
|
|
|
|
// UpdateDialogFilterTypeID is TL type id of UpdateDialogFilter.
|
|
const UpdateDialogFilterTypeID = 0x26ffde7d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDialogFilter) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDialogFilter.
|
|
var (
|
|
_ bin.Encoder = &UpdateDialogFilter{}
|
|
_ bin.Decoder = &UpdateDialogFilter{}
|
|
_ bin.BareEncoder = &UpdateDialogFilter{}
|
|
_ bin.BareDecoder = &UpdateDialogFilter{}
|
|
|
|
_ UpdateClass = &UpdateDialogFilter{}
|
|
)
|
|
|
|
func (u *UpdateDialogFilter) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Filter == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDialogFilter) String() string {
|
|
if u == nil {
|
|
return "UpdateDialogFilter(nil)"
|
|
}
|
|
type Alias UpdateDialogFilter
|
|
return fmt.Sprintf("UpdateDialogFilter%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDialogFilter from given interface.
|
|
func (u *UpdateDialogFilter) FillFrom(from interface {
|
|
GetID() (value int)
|
|
GetFilter() (value DialogFilterClass, ok bool)
|
|
}) {
|
|
u.ID = from.GetID()
|
|
if val, ok := from.GetFilter(); ok {
|
|
u.Filter = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDialogFilter) TypeID() uint32 {
|
|
return UpdateDialogFilterTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDialogFilter) TypeName() string {
|
|
return "updateDialogFilter"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDialogFilter) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDialogFilter",
|
|
ID: UpdateDialogFilterTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Filter",
|
|
SchemaName: "filter",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateDialogFilter) SetFlags() {
|
|
if !(u.Filter == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDialogFilter) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogFilter#26ffde7d as nil")
|
|
}
|
|
b.PutID(UpdateDialogFilterTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDialogFilter) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogFilter#26ffde7d as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogFilter#26ffde7d: field flags: %w", err)
|
|
}
|
|
b.PutInt(u.ID)
|
|
if u.Flags.Has(0) {
|
|
if u.Filter == nil {
|
|
return fmt.Errorf("unable to encode updateDialogFilter#26ffde7d: field filter is nil")
|
|
}
|
|
if err := u.Filter.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDialogFilter#26ffde7d: field filter: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDialogFilter) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogFilter#26ffde7d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDialogFilterTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilter#26ffde7d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDialogFilter) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogFilter#26ffde7d to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilter#26ffde7d: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilter#26ffde7d: field id: %w", err)
|
|
}
|
|
u.ID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeDialogFilter(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilter#26ffde7d: field filter: %w", err)
|
|
}
|
|
u.Filter = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (u *UpdateDialogFilter) GetID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ID
|
|
}
|
|
|
|
// SetFilter sets value of Filter conditional field.
|
|
func (u *UpdateDialogFilter) SetFilter(value DialogFilterClass) {
|
|
u.Flags.Set(0)
|
|
u.Filter = value
|
|
}
|
|
|
|
// GetFilter returns value of Filter conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateDialogFilter) GetFilter() (value DialogFilterClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Filter, true
|
|
}
|
|
|
|
// UpdateDialogFilterOrder represents TL type `updateDialogFilterOrder#a5d72105`.
|
|
// New folder¹ order
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/folders
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDialogFilterOrder for reference.
|
|
type UpdateDialogFilterOrder struct {
|
|
// Ordered folder IDs¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/folders
|
|
Order []int
|
|
}
|
|
|
|
// UpdateDialogFilterOrderTypeID is TL type id of UpdateDialogFilterOrder.
|
|
const UpdateDialogFilterOrderTypeID = 0xa5d72105
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDialogFilterOrder) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDialogFilterOrder.
|
|
var (
|
|
_ bin.Encoder = &UpdateDialogFilterOrder{}
|
|
_ bin.Decoder = &UpdateDialogFilterOrder{}
|
|
_ bin.BareEncoder = &UpdateDialogFilterOrder{}
|
|
_ bin.BareDecoder = &UpdateDialogFilterOrder{}
|
|
|
|
_ UpdateClass = &UpdateDialogFilterOrder{}
|
|
)
|
|
|
|
func (u *UpdateDialogFilterOrder) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Order == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDialogFilterOrder) String() string {
|
|
if u == nil {
|
|
return "UpdateDialogFilterOrder(nil)"
|
|
}
|
|
type Alias UpdateDialogFilterOrder
|
|
return fmt.Sprintf("UpdateDialogFilterOrder%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDialogFilterOrder from given interface.
|
|
func (u *UpdateDialogFilterOrder) FillFrom(from interface {
|
|
GetOrder() (value []int)
|
|
}) {
|
|
u.Order = from.GetOrder()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDialogFilterOrder) TypeID() uint32 {
|
|
return UpdateDialogFilterOrderTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDialogFilterOrder) TypeName() string {
|
|
return "updateDialogFilterOrder"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDialogFilterOrder) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDialogFilterOrder",
|
|
ID: UpdateDialogFilterOrderTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Order",
|
|
SchemaName: "order",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDialogFilterOrder) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogFilterOrder#a5d72105 as nil")
|
|
}
|
|
b.PutID(UpdateDialogFilterOrderTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDialogFilterOrder) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogFilterOrder#a5d72105 as nil")
|
|
}
|
|
b.PutVectorHeader(len(u.Order))
|
|
for _, v := range u.Order {
|
|
b.PutInt(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDialogFilterOrder) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogFilterOrder#a5d72105 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDialogFilterOrderTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilterOrder#a5d72105: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDialogFilterOrder) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogFilterOrder#a5d72105 to nil")
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilterOrder#a5d72105: field order: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Order = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilterOrder#a5d72105: field order: %w", err)
|
|
}
|
|
u.Order = append(u.Order, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetOrder returns value of Order field.
|
|
func (u *UpdateDialogFilterOrder) GetOrder() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Order
|
|
}
|
|
|
|
// UpdateDialogFilters represents TL type `updateDialogFilters#3504914f`.
|
|
// Clients should update folder¹ info
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/folders
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDialogFilters for reference.
|
|
type UpdateDialogFilters struct {
|
|
}
|
|
|
|
// UpdateDialogFiltersTypeID is TL type id of UpdateDialogFilters.
|
|
const UpdateDialogFiltersTypeID = 0x3504914f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDialogFilters) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDialogFilters.
|
|
var (
|
|
_ bin.Encoder = &UpdateDialogFilters{}
|
|
_ bin.Decoder = &UpdateDialogFilters{}
|
|
_ bin.BareEncoder = &UpdateDialogFilters{}
|
|
_ bin.BareDecoder = &UpdateDialogFilters{}
|
|
|
|
_ UpdateClass = &UpdateDialogFilters{}
|
|
)
|
|
|
|
func (u *UpdateDialogFilters) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDialogFilters) String() string {
|
|
if u == nil {
|
|
return "UpdateDialogFilters(nil)"
|
|
}
|
|
type Alias UpdateDialogFilters
|
|
return fmt.Sprintf("UpdateDialogFilters%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDialogFilters) TypeID() uint32 {
|
|
return UpdateDialogFiltersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDialogFilters) TypeName() string {
|
|
return "updateDialogFilters"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDialogFilters) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDialogFilters",
|
|
ID: UpdateDialogFiltersTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDialogFilters) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogFilters#3504914f as nil")
|
|
}
|
|
b.PutID(UpdateDialogFiltersTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDialogFilters) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDialogFilters#3504914f as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDialogFilters) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogFilters#3504914f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDialogFiltersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDialogFilters#3504914f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDialogFilters) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDialogFilters#3504914f to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdatePhoneCallSignalingData represents TL type `updatePhoneCallSignalingData#2661bf09`.
|
|
// Incoming phone call signaling payload
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePhoneCallSignalingData for reference.
|
|
type UpdatePhoneCallSignalingData struct {
|
|
// Phone call ID
|
|
PhoneCallID int64
|
|
// Signaling payload
|
|
Data []byte
|
|
}
|
|
|
|
// UpdatePhoneCallSignalingDataTypeID is TL type id of UpdatePhoneCallSignalingData.
|
|
const UpdatePhoneCallSignalingDataTypeID = 0x2661bf09
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePhoneCallSignalingData) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePhoneCallSignalingData.
|
|
var (
|
|
_ bin.Encoder = &UpdatePhoneCallSignalingData{}
|
|
_ bin.Decoder = &UpdatePhoneCallSignalingData{}
|
|
_ bin.BareEncoder = &UpdatePhoneCallSignalingData{}
|
|
_ bin.BareDecoder = &UpdatePhoneCallSignalingData{}
|
|
|
|
_ UpdateClass = &UpdatePhoneCallSignalingData{}
|
|
)
|
|
|
|
func (u *UpdatePhoneCallSignalingData) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.PhoneCallID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Data == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePhoneCallSignalingData) String() string {
|
|
if u == nil {
|
|
return "UpdatePhoneCallSignalingData(nil)"
|
|
}
|
|
type Alias UpdatePhoneCallSignalingData
|
|
return fmt.Sprintf("UpdatePhoneCallSignalingData%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePhoneCallSignalingData from given interface.
|
|
func (u *UpdatePhoneCallSignalingData) FillFrom(from interface {
|
|
GetPhoneCallID() (value int64)
|
|
GetData() (value []byte)
|
|
}) {
|
|
u.PhoneCallID = from.GetPhoneCallID()
|
|
u.Data = from.GetData()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePhoneCallSignalingData) TypeID() uint32 {
|
|
return UpdatePhoneCallSignalingDataTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePhoneCallSignalingData) TypeName() string {
|
|
return "updatePhoneCallSignalingData"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePhoneCallSignalingData) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePhoneCallSignalingData",
|
|
ID: UpdatePhoneCallSignalingDataTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PhoneCallID",
|
|
SchemaName: "phone_call_id",
|
|
},
|
|
{
|
|
Name: "Data",
|
|
SchemaName: "data",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePhoneCallSignalingData) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePhoneCallSignalingData#2661bf09 as nil")
|
|
}
|
|
b.PutID(UpdatePhoneCallSignalingDataTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePhoneCallSignalingData) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePhoneCallSignalingData#2661bf09 as nil")
|
|
}
|
|
b.PutLong(u.PhoneCallID)
|
|
b.PutBytes(u.Data)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePhoneCallSignalingData) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePhoneCallSignalingData#2661bf09 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePhoneCallSignalingDataTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePhoneCallSignalingData#2661bf09: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePhoneCallSignalingData) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePhoneCallSignalingData#2661bf09 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePhoneCallSignalingData#2661bf09: field phone_call_id: %w", err)
|
|
}
|
|
u.PhoneCallID = value
|
|
}
|
|
{
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePhoneCallSignalingData#2661bf09: field data: %w", err)
|
|
}
|
|
u.Data = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPhoneCallID returns value of PhoneCallID field.
|
|
func (u *UpdatePhoneCallSignalingData) GetPhoneCallID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PhoneCallID
|
|
}
|
|
|
|
// GetData returns value of Data field.
|
|
func (u *UpdatePhoneCallSignalingData) GetData() (value []byte) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Data
|
|
}
|
|
|
|
// UpdateChannelMessageForwards represents TL type `updateChannelMessageForwards#d29a27f4`.
|
|
// The forward counter of a message in a channel has changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelMessageForwards for reference.
|
|
type UpdateChannelMessageForwards struct {
|
|
// Channel ID
|
|
ChannelID int64
|
|
// ID of the message
|
|
ID int
|
|
// New forward counter
|
|
Forwards int
|
|
}
|
|
|
|
// UpdateChannelMessageForwardsTypeID is TL type id of UpdateChannelMessageForwards.
|
|
const UpdateChannelMessageForwardsTypeID = 0xd29a27f4
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelMessageForwards) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelMessageForwards.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelMessageForwards{}
|
|
_ bin.Decoder = &UpdateChannelMessageForwards{}
|
|
_ bin.BareEncoder = &UpdateChannelMessageForwards{}
|
|
_ bin.BareDecoder = &UpdateChannelMessageForwards{}
|
|
|
|
_ UpdateClass = &UpdateChannelMessageForwards{}
|
|
)
|
|
|
|
func (u *UpdateChannelMessageForwards) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Forwards == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelMessageForwards) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelMessageForwards(nil)"
|
|
}
|
|
type Alias UpdateChannelMessageForwards
|
|
return fmt.Sprintf("UpdateChannelMessageForwards%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelMessageForwards from given interface.
|
|
func (u *UpdateChannelMessageForwards) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetID() (value int)
|
|
GetForwards() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.ID = from.GetID()
|
|
u.Forwards = from.GetForwards()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelMessageForwards) TypeID() uint32 {
|
|
return UpdateChannelMessageForwardsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelMessageForwards) TypeName() string {
|
|
return "updateChannelMessageForwards"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelMessageForwards) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelMessageForwards",
|
|
ID: UpdateChannelMessageForwardsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Forwards",
|
|
SchemaName: "forwards",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelMessageForwards) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelMessageForwards#d29a27f4 as nil")
|
|
}
|
|
b.PutID(UpdateChannelMessageForwardsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelMessageForwards) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelMessageForwards#d29a27f4 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.ID)
|
|
b.PutInt(u.Forwards)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelMessageForwards) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelMessageForwards#d29a27f4 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelMessageForwardsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageForwards#d29a27f4: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelMessageForwards) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelMessageForwards#d29a27f4 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageForwards#d29a27f4: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageForwards#d29a27f4: field id: %w", err)
|
|
}
|
|
u.ID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelMessageForwards#d29a27f4: field forwards: %w", err)
|
|
}
|
|
u.Forwards = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelMessageForwards) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (u *UpdateChannelMessageForwards) GetID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ID
|
|
}
|
|
|
|
// GetForwards returns value of Forwards field.
|
|
func (u *UpdateChannelMessageForwards) GetForwards() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Forwards
|
|
}
|
|
|
|
// UpdateReadChannelDiscussionInbox represents TL type `updateReadChannelDiscussionInbox#d6b19546`.
|
|
// Incoming comments in a discussion thread¹ were marked as read
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/threads
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadChannelDiscussionInbox for reference.
|
|
type UpdateReadChannelDiscussionInbox struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Discussion group ID¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
ChannelID int64
|
|
// ID of the group message that started the thread¹ (message in linked discussion group)
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/threads
|
|
TopMsgID int
|
|
// Message ID of latest read incoming message for this thread¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/threads
|
|
ReadMaxID int
|
|
// If set, contains the ID of the channel¹ that contains the post that started the
|
|
// comment thread² in the discussion group (channel_id)
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
// 2) https://core.telegram.org/api/threads
|
|
//
|
|
// Use SetBroadcastID and GetBroadcastID helpers.
|
|
BroadcastID int64
|
|
// If set, contains the ID of the channel post that started the comment thread¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/threads
|
|
//
|
|
// Use SetBroadcastPost and GetBroadcastPost helpers.
|
|
BroadcastPost int
|
|
}
|
|
|
|
// UpdateReadChannelDiscussionInboxTypeID is TL type id of UpdateReadChannelDiscussionInbox.
|
|
const UpdateReadChannelDiscussionInboxTypeID = 0xd6b19546
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadChannelDiscussionInbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadChannelDiscussionInbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadChannelDiscussionInbox{}
|
|
_ bin.Decoder = &UpdateReadChannelDiscussionInbox{}
|
|
_ bin.BareEncoder = &UpdateReadChannelDiscussionInbox{}
|
|
_ bin.BareDecoder = &UpdateReadChannelDiscussionInbox{}
|
|
|
|
_ UpdateClass = &UpdateReadChannelDiscussionInbox{}
|
|
)
|
|
|
|
func (u *UpdateReadChannelDiscussionInbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ReadMaxID == 0) {
|
|
return false
|
|
}
|
|
if !(u.BroadcastID == 0) {
|
|
return false
|
|
}
|
|
if !(u.BroadcastPost == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadChannelDiscussionInbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadChannelDiscussionInbox(nil)"
|
|
}
|
|
type Alias UpdateReadChannelDiscussionInbox
|
|
return fmt.Sprintf("UpdateReadChannelDiscussionInbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadChannelDiscussionInbox from given interface.
|
|
func (u *UpdateReadChannelDiscussionInbox) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetTopMsgID() (value int)
|
|
GetReadMaxID() (value int)
|
|
GetBroadcastID() (value int64, ok bool)
|
|
GetBroadcastPost() (value int, ok bool)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.TopMsgID = from.GetTopMsgID()
|
|
u.ReadMaxID = from.GetReadMaxID()
|
|
if val, ok := from.GetBroadcastID(); ok {
|
|
u.BroadcastID = val
|
|
}
|
|
|
|
if val, ok := from.GetBroadcastPost(); ok {
|
|
u.BroadcastPost = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadChannelDiscussionInbox) TypeID() uint32 {
|
|
return UpdateReadChannelDiscussionInboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadChannelDiscussionInbox) TypeName() string {
|
|
return "updateReadChannelDiscussionInbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadChannelDiscussionInbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadChannelDiscussionInbox",
|
|
ID: UpdateReadChannelDiscussionInboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
},
|
|
{
|
|
Name: "ReadMaxID",
|
|
SchemaName: "read_max_id",
|
|
},
|
|
{
|
|
Name: "BroadcastID",
|
|
SchemaName: "broadcast_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "BroadcastPost",
|
|
SchemaName: "broadcast_post",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateReadChannelDiscussionInbox) SetFlags() {
|
|
if !(u.BroadcastID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.BroadcastPost == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadChannelDiscussionInbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelDiscussionInbox#d6b19546 as nil")
|
|
}
|
|
b.PutID(UpdateReadChannelDiscussionInboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadChannelDiscussionInbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelDiscussionInbox#d6b19546 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadChannelDiscussionInbox#d6b19546: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.TopMsgID)
|
|
b.PutInt(u.ReadMaxID)
|
|
if u.Flags.Has(0) {
|
|
b.PutLong(u.BroadcastID)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.BroadcastPost)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadChannelDiscussionInbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelDiscussionInbox#d6b19546 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadChannelDiscussionInboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadChannelDiscussionInbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelDiscussionInbox#d6b19546 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: field read_max_id: %w", err)
|
|
}
|
|
u.ReadMaxID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: field broadcast_id: %w", err)
|
|
}
|
|
u.BroadcastID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionInbox#d6b19546: field broadcast_post: %w", err)
|
|
}
|
|
u.BroadcastPost = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateReadChannelDiscussionInbox) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID field.
|
|
func (u *UpdateReadChannelDiscussionInbox) GetTopMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.TopMsgID
|
|
}
|
|
|
|
// GetReadMaxID returns value of ReadMaxID field.
|
|
func (u *UpdateReadChannelDiscussionInbox) GetReadMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ReadMaxID
|
|
}
|
|
|
|
// SetBroadcastID sets value of BroadcastID conditional field.
|
|
func (u *UpdateReadChannelDiscussionInbox) SetBroadcastID(value int64) {
|
|
u.Flags.Set(0)
|
|
u.BroadcastID = value
|
|
}
|
|
|
|
// GetBroadcastID returns value of BroadcastID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateReadChannelDiscussionInbox) GetBroadcastID() (value int64, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.BroadcastID, true
|
|
}
|
|
|
|
// SetBroadcastPost sets value of BroadcastPost conditional field.
|
|
func (u *UpdateReadChannelDiscussionInbox) SetBroadcastPost(value int) {
|
|
u.Flags.Set(0)
|
|
u.BroadcastPost = value
|
|
}
|
|
|
|
// GetBroadcastPost returns value of BroadcastPost conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateReadChannelDiscussionInbox) GetBroadcastPost() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.BroadcastPost, true
|
|
}
|
|
|
|
// UpdateReadChannelDiscussionOutbox represents TL type `updateReadChannelDiscussionOutbox#695c9e7c`.
|
|
// Outgoing comments in a discussion thread¹ were marked as read
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/threads
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadChannelDiscussionOutbox for reference.
|
|
type UpdateReadChannelDiscussionOutbox struct {
|
|
// Supergroup ID¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
ChannelID int64
|
|
// ID of the group message that started the thread¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/threads
|
|
TopMsgID int
|
|
// Message ID of latest read outgoing message for this thread¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/threads
|
|
ReadMaxID int
|
|
}
|
|
|
|
// UpdateReadChannelDiscussionOutboxTypeID is TL type id of UpdateReadChannelDiscussionOutbox.
|
|
const UpdateReadChannelDiscussionOutboxTypeID = 0x695c9e7c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadChannelDiscussionOutbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadChannelDiscussionOutbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadChannelDiscussionOutbox{}
|
|
_ bin.Decoder = &UpdateReadChannelDiscussionOutbox{}
|
|
_ bin.BareEncoder = &UpdateReadChannelDiscussionOutbox{}
|
|
_ bin.BareDecoder = &UpdateReadChannelDiscussionOutbox{}
|
|
|
|
_ UpdateClass = &UpdateReadChannelDiscussionOutbox{}
|
|
)
|
|
|
|
func (u *UpdateReadChannelDiscussionOutbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ReadMaxID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadChannelDiscussionOutbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadChannelDiscussionOutbox(nil)"
|
|
}
|
|
type Alias UpdateReadChannelDiscussionOutbox
|
|
return fmt.Sprintf("UpdateReadChannelDiscussionOutbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadChannelDiscussionOutbox from given interface.
|
|
func (u *UpdateReadChannelDiscussionOutbox) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetTopMsgID() (value int)
|
|
GetReadMaxID() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.TopMsgID = from.GetTopMsgID()
|
|
u.ReadMaxID = from.GetReadMaxID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadChannelDiscussionOutbox) TypeID() uint32 {
|
|
return UpdateReadChannelDiscussionOutboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadChannelDiscussionOutbox) TypeName() string {
|
|
return "updateReadChannelDiscussionOutbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadChannelDiscussionOutbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadChannelDiscussionOutbox",
|
|
ID: UpdateReadChannelDiscussionOutboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
},
|
|
{
|
|
Name: "ReadMaxID",
|
|
SchemaName: "read_max_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadChannelDiscussionOutbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelDiscussionOutbox#695c9e7c as nil")
|
|
}
|
|
b.PutID(UpdateReadChannelDiscussionOutboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadChannelDiscussionOutbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadChannelDiscussionOutbox#695c9e7c as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.TopMsgID)
|
|
b.PutInt(u.ReadMaxID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadChannelDiscussionOutbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelDiscussionOutbox#695c9e7c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadChannelDiscussionOutboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionOutbox#695c9e7c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadChannelDiscussionOutbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadChannelDiscussionOutbox#695c9e7c to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionOutbox#695c9e7c: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionOutbox#695c9e7c: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadChannelDiscussionOutbox#695c9e7c: field read_max_id: %w", err)
|
|
}
|
|
u.ReadMaxID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateReadChannelDiscussionOutbox) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID field.
|
|
func (u *UpdateReadChannelDiscussionOutbox) GetTopMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.TopMsgID
|
|
}
|
|
|
|
// GetReadMaxID returns value of ReadMaxID field.
|
|
func (u *UpdateReadChannelDiscussionOutbox) GetReadMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ReadMaxID
|
|
}
|
|
|
|
// UpdatePeerBlocked represents TL type `updatePeerBlocked#ebe07752`.
|
|
// We blocked a peer, see here »¹ for more info on blocklists.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/block
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePeerBlocked for reference.
|
|
type UpdatePeerBlocked struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the peer was blocked or unblocked
|
|
Blocked bool
|
|
// Whether the peer was added/removed to/from the story blocklist; if not set, this
|
|
// update affects the main blocklist, see here »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/block
|
|
BlockedMyStoriesFrom bool
|
|
// The (un)blocked peer
|
|
PeerID PeerClass
|
|
}
|
|
|
|
// UpdatePeerBlockedTypeID is TL type id of UpdatePeerBlocked.
|
|
const UpdatePeerBlockedTypeID = 0xebe07752
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePeerBlocked) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePeerBlocked.
|
|
var (
|
|
_ bin.Encoder = &UpdatePeerBlocked{}
|
|
_ bin.Decoder = &UpdatePeerBlocked{}
|
|
_ bin.BareEncoder = &UpdatePeerBlocked{}
|
|
_ bin.BareDecoder = &UpdatePeerBlocked{}
|
|
|
|
_ UpdateClass = &UpdatePeerBlocked{}
|
|
)
|
|
|
|
func (u *UpdatePeerBlocked) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Blocked == false) {
|
|
return false
|
|
}
|
|
if !(u.BlockedMyStoriesFrom == false) {
|
|
return false
|
|
}
|
|
if !(u.PeerID == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePeerBlocked) String() string {
|
|
if u == nil {
|
|
return "UpdatePeerBlocked(nil)"
|
|
}
|
|
type Alias UpdatePeerBlocked
|
|
return fmt.Sprintf("UpdatePeerBlocked%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePeerBlocked from given interface.
|
|
func (u *UpdatePeerBlocked) FillFrom(from interface {
|
|
GetBlocked() (value bool)
|
|
GetBlockedMyStoriesFrom() (value bool)
|
|
GetPeerID() (value PeerClass)
|
|
}) {
|
|
u.Blocked = from.GetBlocked()
|
|
u.BlockedMyStoriesFrom = from.GetBlockedMyStoriesFrom()
|
|
u.PeerID = from.GetPeerID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePeerBlocked) TypeID() uint32 {
|
|
return UpdatePeerBlockedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePeerBlocked) TypeName() string {
|
|
return "updatePeerBlocked"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePeerBlocked) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePeerBlocked",
|
|
ID: UpdatePeerBlockedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Blocked",
|
|
SchemaName: "blocked",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "BlockedMyStoriesFrom",
|
|
SchemaName: "blocked_my_stories_from",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "PeerID",
|
|
SchemaName: "peer_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePeerBlocked) SetFlags() {
|
|
if !(u.Blocked == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.BlockedMyStoriesFrom == false) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePeerBlocked) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerBlocked#ebe07752 as nil")
|
|
}
|
|
b.PutID(UpdatePeerBlockedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePeerBlocked) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerBlocked#ebe07752 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerBlocked#ebe07752: field flags: %w", err)
|
|
}
|
|
if u.PeerID == nil {
|
|
return fmt.Errorf("unable to encode updatePeerBlocked#ebe07752: field peer_id is nil")
|
|
}
|
|
if err := u.PeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerBlocked#ebe07752: field peer_id: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePeerBlocked) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerBlocked#ebe07752 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePeerBlockedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerBlocked#ebe07752: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePeerBlocked) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerBlocked#ebe07752 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerBlocked#ebe07752: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Blocked = u.Flags.Has(0)
|
|
u.BlockedMyStoriesFrom = u.Flags.Has(1)
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerBlocked#ebe07752: field peer_id: %w", err)
|
|
}
|
|
u.PeerID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetBlocked sets value of Blocked conditional field.
|
|
func (u *UpdatePeerBlocked) SetBlocked(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Blocked = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Blocked = false
|
|
}
|
|
}
|
|
|
|
// GetBlocked returns value of Blocked conditional field.
|
|
func (u *UpdatePeerBlocked) GetBlocked() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// SetBlockedMyStoriesFrom sets value of BlockedMyStoriesFrom conditional field.
|
|
func (u *UpdatePeerBlocked) SetBlockedMyStoriesFrom(value bool) {
|
|
if value {
|
|
u.Flags.Set(1)
|
|
u.BlockedMyStoriesFrom = true
|
|
} else {
|
|
u.Flags.Unset(1)
|
|
u.BlockedMyStoriesFrom = false
|
|
}
|
|
}
|
|
|
|
// GetBlockedMyStoriesFrom returns value of BlockedMyStoriesFrom conditional field.
|
|
func (u *UpdatePeerBlocked) GetBlockedMyStoriesFrom() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(1)
|
|
}
|
|
|
|
// GetPeerID returns value of PeerID field.
|
|
func (u *UpdatePeerBlocked) GetPeerID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PeerID
|
|
}
|
|
|
|
// UpdateChannelUserTyping represents TL type `updateChannelUserTyping#8c88c923`.
|
|
// A user is typing in a supergroup, channel¹ or message thread²
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
// 2. https://core.telegram.org/api/threads
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelUserTyping for reference.
|
|
type UpdateChannelUserTyping struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Channel ID
|
|
ChannelID int64
|
|
// Thread ID¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/threads
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// The peer that is typing
|
|
FromID PeerClass
|
|
// Whether the user is typing, sending a media or doing something else
|
|
Action SendMessageActionClass
|
|
}
|
|
|
|
// UpdateChannelUserTypingTypeID is TL type id of UpdateChannelUserTyping.
|
|
const UpdateChannelUserTypingTypeID = 0x8c88c923
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelUserTyping) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelUserTyping.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelUserTyping{}
|
|
_ bin.Decoder = &UpdateChannelUserTyping{}
|
|
_ bin.BareEncoder = &UpdateChannelUserTyping{}
|
|
_ bin.BareDecoder = &UpdateChannelUserTyping{}
|
|
|
|
_ UpdateClass = &UpdateChannelUserTyping{}
|
|
)
|
|
|
|
func (u *UpdateChannelUserTyping) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.FromID == nil) {
|
|
return false
|
|
}
|
|
if !(u.Action == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelUserTyping) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelUserTyping(nil)"
|
|
}
|
|
type Alias UpdateChannelUserTyping
|
|
return fmt.Sprintf("UpdateChannelUserTyping%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelUserTyping from given interface.
|
|
func (u *UpdateChannelUserTyping) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetFromID() (value PeerClass)
|
|
GetAction() (value SendMessageActionClass)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
u.FromID = from.GetFromID()
|
|
u.Action = from.GetAction()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelUserTyping) TypeID() uint32 {
|
|
return UpdateChannelUserTypingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelUserTyping) TypeName() string {
|
|
return "updateChannelUserTyping"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelUserTyping) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelUserTyping",
|
|
ID: UpdateChannelUserTypingTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "FromID",
|
|
SchemaName: "from_id",
|
|
},
|
|
{
|
|
Name: "Action",
|
|
SchemaName: "action",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateChannelUserTyping) SetFlags() {
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelUserTyping) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelUserTyping#8c88c923 as nil")
|
|
}
|
|
b.PutID(UpdateChannelUserTypingTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelUserTyping) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelUserTyping#8c88c923 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelUserTyping#8c88c923: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
if u.FromID == nil {
|
|
return fmt.Errorf("unable to encode updateChannelUserTyping#8c88c923: field from_id is nil")
|
|
}
|
|
if err := u.FromID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelUserTyping#8c88c923: field from_id: %w", err)
|
|
}
|
|
if u.Action == nil {
|
|
return fmt.Errorf("unable to encode updateChannelUserTyping#8c88c923: field action is nil")
|
|
}
|
|
if err := u.Action.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelUserTyping#8c88c923: field action: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelUserTyping) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelUserTyping#8c88c923 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelUserTypingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelUserTyping#8c88c923: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelUserTyping) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelUserTyping#8c88c923 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelUserTyping#8c88c923: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelUserTyping#8c88c923: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelUserTyping#8c88c923: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelUserTyping#8c88c923: field from_id: %w", err)
|
|
}
|
|
u.FromID = value
|
|
}
|
|
{
|
|
value, err := DecodeSendMessageAction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelUserTyping#8c88c923: field action: %w", err)
|
|
}
|
|
u.Action = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelUserTyping) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateChannelUserTyping) SetTopMsgID(value int) {
|
|
u.Flags.Set(0)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelUserTyping) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// GetFromID returns value of FromID field.
|
|
func (u *UpdateChannelUserTyping) GetFromID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.FromID
|
|
}
|
|
|
|
// GetAction returns value of Action field.
|
|
func (u *UpdateChannelUserTyping) GetAction() (value SendMessageActionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Action
|
|
}
|
|
|
|
// UpdatePinnedMessages represents TL type `updatePinnedMessages#ed85eab5`.
|
|
// Some messages were pinned in a chat
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePinnedMessages for reference.
|
|
type UpdatePinnedMessages struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the messages were pinned or unpinned
|
|
Pinned bool
|
|
// Peer
|
|
Peer PeerClass
|
|
// Message IDs
|
|
Messages []int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdatePinnedMessagesTypeID is TL type id of UpdatePinnedMessages.
|
|
const UpdatePinnedMessagesTypeID = 0xed85eab5
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePinnedMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePinnedMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdatePinnedMessages{}
|
|
_ bin.Decoder = &UpdatePinnedMessages{}
|
|
_ bin.BareEncoder = &UpdatePinnedMessages{}
|
|
_ bin.BareDecoder = &UpdatePinnedMessages{}
|
|
|
|
_ UpdateClass = &UpdatePinnedMessages{}
|
|
)
|
|
|
|
func (u *UpdatePinnedMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Pinned == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePinnedMessages) String() string {
|
|
if u == nil {
|
|
return "UpdatePinnedMessages(nil)"
|
|
}
|
|
type Alias UpdatePinnedMessages
|
|
return fmt.Sprintf("UpdatePinnedMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePinnedMessages from given interface.
|
|
func (u *UpdatePinnedMessages) FillFrom(from interface {
|
|
GetPinned() (value bool)
|
|
GetPeer() (value PeerClass)
|
|
GetMessages() (value []int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Pinned = from.GetPinned()
|
|
u.Peer = from.GetPeer()
|
|
u.Messages = from.GetMessages()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePinnedMessages) TypeID() uint32 {
|
|
return UpdatePinnedMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePinnedMessages) TypeName() string {
|
|
return "updatePinnedMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePinnedMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePinnedMessages",
|
|
ID: UpdatePinnedMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pinned",
|
|
SchemaName: "pinned",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePinnedMessages) SetFlags() {
|
|
if !(u.Pinned == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePinnedMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedMessages#ed85eab5 as nil")
|
|
}
|
|
b.PutID(UpdatePinnedMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePinnedMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedMessages#ed85eab5 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedMessages#ed85eab5: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePinnedMessages#ed85eab5: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedMessages#ed85eab5: field peer: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePinnedMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedMessages#ed85eab5 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePinnedMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePinnedMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedMessages#ed85eab5 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Pinned = u.Flags.Has(0)
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedMessages#ed85eab5: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPinned sets value of Pinned conditional field.
|
|
func (u *UpdatePinnedMessages) SetPinned(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Pinned = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Pinned = false
|
|
}
|
|
}
|
|
|
|
// GetPinned returns value of Pinned conditional field.
|
|
func (u *UpdatePinnedMessages) GetPinned() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePinnedMessages) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdatePinnedMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdatePinnedMessages) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdatePinnedMessages) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdatePinnedChannelMessages represents TL type `updatePinnedChannelMessages#5bb98608`.
|
|
// Messages were pinned/unpinned in a channel/supergroup¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePinnedChannelMessages for reference.
|
|
type UpdatePinnedChannelMessages struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the messages were pinned or unpinned
|
|
Pinned bool
|
|
// Channel ID
|
|
ChannelID int64
|
|
// Messages
|
|
Messages []int
|
|
// Event count after generation¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Pts int
|
|
// Number of events that were generated¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
PtsCount int
|
|
}
|
|
|
|
// UpdatePinnedChannelMessagesTypeID is TL type id of UpdatePinnedChannelMessages.
|
|
const UpdatePinnedChannelMessagesTypeID = 0x5bb98608
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePinnedChannelMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePinnedChannelMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdatePinnedChannelMessages{}
|
|
_ bin.Decoder = &UpdatePinnedChannelMessages{}
|
|
_ bin.BareEncoder = &UpdatePinnedChannelMessages{}
|
|
_ bin.BareDecoder = &UpdatePinnedChannelMessages{}
|
|
|
|
_ UpdateClass = &UpdatePinnedChannelMessages{}
|
|
)
|
|
|
|
func (u *UpdatePinnedChannelMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Pinned == false) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.Pts == 0) {
|
|
return false
|
|
}
|
|
if !(u.PtsCount == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePinnedChannelMessages) String() string {
|
|
if u == nil {
|
|
return "UpdatePinnedChannelMessages(nil)"
|
|
}
|
|
type Alias UpdatePinnedChannelMessages
|
|
return fmt.Sprintf("UpdatePinnedChannelMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePinnedChannelMessages from given interface.
|
|
func (u *UpdatePinnedChannelMessages) FillFrom(from interface {
|
|
GetPinned() (value bool)
|
|
GetChannelID() (value int64)
|
|
GetMessages() (value []int)
|
|
GetPts() (value int)
|
|
GetPtsCount() (value int)
|
|
}) {
|
|
u.Pinned = from.GetPinned()
|
|
u.ChannelID = from.GetChannelID()
|
|
u.Messages = from.GetMessages()
|
|
u.Pts = from.GetPts()
|
|
u.PtsCount = from.GetPtsCount()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePinnedChannelMessages) TypeID() uint32 {
|
|
return UpdatePinnedChannelMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePinnedChannelMessages) TypeName() string {
|
|
return "updatePinnedChannelMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePinnedChannelMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePinnedChannelMessages",
|
|
ID: UpdatePinnedChannelMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pinned",
|
|
SchemaName: "pinned",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "Pts",
|
|
SchemaName: "pts",
|
|
},
|
|
{
|
|
Name: "PtsCount",
|
|
SchemaName: "pts_count",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePinnedChannelMessages) SetFlags() {
|
|
if !(u.Pinned == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePinnedChannelMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedChannelMessages#5bb98608 as nil")
|
|
}
|
|
b.PutID(UpdatePinnedChannelMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePinnedChannelMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedChannelMessages#5bb98608 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedChannelMessages#5bb98608: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Pts)
|
|
b.PutInt(u.PtsCount)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePinnedChannelMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedChannelMessages#5bb98608 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePinnedChannelMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePinnedChannelMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedChannelMessages#5bb98608 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Pinned = u.Flags.Has(0)
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: field pts: %w", err)
|
|
}
|
|
u.Pts = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedChannelMessages#5bb98608: field pts_count: %w", err)
|
|
}
|
|
u.PtsCount = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPinned sets value of Pinned conditional field.
|
|
func (u *UpdatePinnedChannelMessages) SetPinned(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Pinned = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Pinned = false
|
|
}
|
|
}
|
|
|
|
// GetPinned returns value of Pinned conditional field.
|
|
func (u *UpdatePinnedChannelMessages) GetPinned() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdatePinnedChannelMessages) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdatePinnedChannelMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// GetPts returns value of Pts field.
|
|
func (u *UpdatePinnedChannelMessages) GetPts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Pts
|
|
}
|
|
|
|
// GetPtsCount returns value of PtsCount field.
|
|
func (u *UpdatePinnedChannelMessages) GetPtsCount() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.PtsCount
|
|
}
|
|
|
|
// UpdateChat represents TL type `updateChat#f89a6a4e`.
|
|
// Chat (chat¹ and/or chatFull²) information was updated.
|
|
// This update can only be received through getDifference or in
|
|
// updates¹/updatesCombined² constructors, so it will always come bundled with the
|
|
// updated chat³, that should be applied as usual »⁴, without re-fetching the info
|
|
// manually.
|
|
// However, full peer information will not come bundled in updates, so the full peer
|
|
// cache (chatFull¹) must be invalidated for chat_id when receiving this update.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/constructor/chat
|
|
// 2. https://core.telegram.org/constructor/chatFull
|
|
// 3. https://core.telegram.org/constructor/updates
|
|
// 4. https://core.telegram.org/constructor/updatesCombined
|
|
// 5. https://core.telegram.org/constructor/chat
|
|
// 6. https://core.telegram.org/api/peers
|
|
// 7. https://core.telegram.org/constructor/chatFull
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChat for reference.
|
|
type UpdateChat struct {
|
|
// Chat ID
|
|
ChatID int64
|
|
}
|
|
|
|
// UpdateChatTypeID is TL type id of UpdateChat.
|
|
const UpdateChatTypeID = 0xf89a6a4e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChat) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChat.
|
|
var (
|
|
_ bin.Encoder = &UpdateChat{}
|
|
_ bin.Decoder = &UpdateChat{}
|
|
_ bin.BareEncoder = &UpdateChat{}
|
|
_ bin.BareDecoder = &UpdateChat{}
|
|
|
|
_ UpdateClass = &UpdateChat{}
|
|
)
|
|
|
|
func (u *UpdateChat) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChat) String() string {
|
|
if u == nil {
|
|
return "UpdateChat(nil)"
|
|
}
|
|
type Alias UpdateChat
|
|
return fmt.Sprintf("UpdateChat%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChat from given interface.
|
|
func (u *UpdateChat) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChat) TypeID() uint32 {
|
|
return UpdateChatTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChat) TypeName() string {
|
|
return "updateChat"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChat) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChat",
|
|
ID: UpdateChatTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChat) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChat#f89a6a4e as nil")
|
|
}
|
|
b.PutID(UpdateChatTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChat) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChat#f89a6a4e as nil")
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChat) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChat#f89a6a4e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChat#f89a6a4e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChat) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChat#f89a6a4e to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChat#f89a6a4e: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChat) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// UpdateGroupCallParticipants represents TL type `updateGroupCallParticipants#f2ebdb4e`.
|
|
// The participant list of a certain group call has changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGroupCallParticipants for reference.
|
|
type UpdateGroupCallParticipants struct {
|
|
// Group call
|
|
Call InputGroupCallClass
|
|
// New participant list
|
|
Participants []GroupCallParticipant
|
|
// Version
|
|
Version int
|
|
}
|
|
|
|
// UpdateGroupCallParticipantsTypeID is TL type id of UpdateGroupCallParticipants.
|
|
const UpdateGroupCallParticipantsTypeID = 0xf2ebdb4e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGroupCallParticipants) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGroupCallParticipants.
|
|
var (
|
|
_ bin.Encoder = &UpdateGroupCallParticipants{}
|
|
_ bin.Decoder = &UpdateGroupCallParticipants{}
|
|
_ bin.BareEncoder = &UpdateGroupCallParticipants{}
|
|
_ bin.BareDecoder = &UpdateGroupCallParticipants{}
|
|
|
|
_ UpdateClass = &UpdateGroupCallParticipants{}
|
|
)
|
|
|
|
func (u *UpdateGroupCallParticipants) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Call == nil) {
|
|
return false
|
|
}
|
|
if !(u.Participants == nil) {
|
|
return false
|
|
}
|
|
if !(u.Version == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGroupCallParticipants) String() string {
|
|
if u == nil {
|
|
return "UpdateGroupCallParticipants(nil)"
|
|
}
|
|
type Alias UpdateGroupCallParticipants
|
|
return fmt.Sprintf("UpdateGroupCallParticipants%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGroupCallParticipants from given interface.
|
|
func (u *UpdateGroupCallParticipants) FillFrom(from interface {
|
|
GetCall() (value InputGroupCallClass)
|
|
GetParticipants() (value []GroupCallParticipant)
|
|
GetVersion() (value int)
|
|
}) {
|
|
u.Call = from.GetCall()
|
|
u.Participants = from.GetParticipants()
|
|
u.Version = from.GetVersion()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGroupCallParticipants) TypeID() uint32 {
|
|
return UpdateGroupCallParticipantsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGroupCallParticipants) TypeName() string {
|
|
return "updateGroupCallParticipants"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGroupCallParticipants) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGroupCallParticipants",
|
|
ID: UpdateGroupCallParticipantsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
{
|
|
Name: "Participants",
|
|
SchemaName: "participants",
|
|
},
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGroupCallParticipants) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallParticipants#f2ebdb4e as nil")
|
|
}
|
|
b.PutID(UpdateGroupCallParticipantsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGroupCallParticipants) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallParticipants#f2ebdb4e as nil")
|
|
}
|
|
if u.Call == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallParticipants#f2ebdb4e: field call is nil")
|
|
}
|
|
if err := u.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallParticipants#f2ebdb4e: field call: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Participants))
|
|
for idx, v := range u.Participants {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallParticipants#f2ebdb4e: field participants element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutInt(u.Version)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGroupCallParticipants) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallParticipants#f2ebdb4e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGroupCallParticipantsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallParticipants#f2ebdb4e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGroupCallParticipants) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallParticipants#f2ebdb4e to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallParticipants#f2ebdb4e: field call: %w", err)
|
|
}
|
|
u.Call = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallParticipants#f2ebdb4e: field participants: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Participants = make([]GroupCallParticipant, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value GroupCallParticipant
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallParticipants#f2ebdb4e: field participants: %w", err)
|
|
}
|
|
u.Participants = append(u.Participants, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallParticipants#f2ebdb4e: field version: %w", err)
|
|
}
|
|
u.Version = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (u *UpdateGroupCallParticipants) GetCall() (value InputGroupCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Call
|
|
}
|
|
|
|
// GetParticipants returns value of Participants field.
|
|
func (u *UpdateGroupCallParticipants) GetParticipants() (value []GroupCallParticipant) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Participants
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (u *UpdateGroupCallParticipants) GetVersion() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Version
|
|
}
|
|
|
|
// UpdateGroupCall represents TL type `updateGroupCall#9d2216e0`.
|
|
// A new groupcall was started
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGroupCall for reference.
|
|
type UpdateGroupCall struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// LiveStory field of UpdateGroupCall.
|
|
LiveStory bool
|
|
// Peer field of UpdateGroupCall.
|
|
//
|
|
// Use SetPeer and GetPeer helpers.
|
|
Peer PeerClass
|
|
// Info about the group call or livestream
|
|
Call GroupCallClass
|
|
}
|
|
|
|
// UpdateGroupCallTypeID is TL type id of UpdateGroupCall.
|
|
const UpdateGroupCallTypeID = 0x9d2216e0
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGroupCall) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGroupCall.
|
|
var (
|
|
_ bin.Encoder = &UpdateGroupCall{}
|
|
_ bin.Decoder = &UpdateGroupCall{}
|
|
_ bin.BareEncoder = &UpdateGroupCall{}
|
|
_ bin.BareDecoder = &UpdateGroupCall{}
|
|
|
|
_ UpdateClass = &UpdateGroupCall{}
|
|
)
|
|
|
|
func (u *UpdateGroupCall) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.LiveStory == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Call == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGroupCall) String() string {
|
|
if u == nil {
|
|
return "UpdateGroupCall(nil)"
|
|
}
|
|
type Alias UpdateGroupCall
|
|
return fmt.Sprintf("UpdateGroupCall%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGroupCall from given interface.
|
|
func (u *UpdateGroupCall) FillFrom(from interface {
|
|
GetLiveStory() (value bool)
|
|
GetPeer() (value PeerClass, ok bool)
|
|
GetCall() (value GroupCallClass)
|
|
}) {
|
|
u.LiveStory = from.GetLiveStory()
|
|
if val, ok := from.GetPeer(); ok {
|
|
u.Peer = val
|
|
}
|
|
|
|
u.Call = from.GetCall()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGroupCall) TypeID() uint32 {
|
|
return UpdateGroupCallTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGroupCall) TypeName() string {
|
|
return "updateGroupCall"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGroupCall) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGroupCall",
|
|
ID: UpdateGroupCallTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "LiveStory",
|
|
SchemaName: "live_story",
|
|
Null: !u.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateGroupCall) SetFlags() {
|
|
if !(u.LiveStory == false) {
|
|
u.Flags.Set(2)
|
|
}
|
|
if !(u.Peer == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGroupCall) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCall#9d2216e0 as nil")
|
|
}
|
|
b.PutID(UpdateGroupCallTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGroupCall) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCall#9d2216e0 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCall#9d2216e0: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCall#9d2216e0: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCall#9d2216e0: field peer: %w", err)
|
|
}
|
|
}
|
|
if u.Call == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCall#9d2216e0: field call is nil")
|
|
}
|
|
if err := u.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCall#9d2216e0: field call: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGroupCall) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCall#9d2216e0 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGroupCallTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCall#9d2216e0: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGroupCall) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCall#9d2216e0 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCall#9d2216e0: field flags: %w", err)
|
|
}
|
|
}
|
|
u.LiveStory = u.Flags.Has(2)
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCall#9d2216e0: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := DecodeGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCall#9d2216e0: field call: %w", err)
|
|
}
|
|
u.Call = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetLiveStory sets value of LiveStory conditional field.
|
|
func (u *UpdateGroupCall) SetLiveStory(value bool) {
|
|
if value {
|
|
u.Flags.Set(2)
|
|
u.LiveStory = true
|
|
} else {
|
|
u.Flags.Unset(2)
|
|
u.LiveStory = false
|
|
}
|
|
}
|
|
|
|
// GetLiveStory returns value of LiveStory conditional field.
|
|
func (u *UpdateGroupCall) GetLiveStory() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(2)
|
|
}
|
|
|
|
// SetPeer sets value of Peer conditional field.
|
|
func (u *UpdateGroupCall) SetPeer(value PeerClass) {
|
|
u.Flags.Set(1)
|
|
u.Peer = value
|
|
}
|
|
|
|
// GetPeer returns value of Peer conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateGroupCall) GetPeer() (value PeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.Peer, true
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (u *UpdateGroupCall) GetCall() (value GroupCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Call
|
|
}
|
|
|
|
// UpdatePeerHistoryTTL represents TL type `updatePeerHistoryTTL#bb9bb9a5`.
|
|
// The Time-To-Live for messages sent by the current user in a specific chat has changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePeerHistoryTTL for reference.
|
|
type UpdatePeerHistoryTTL struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// The chat
|
|
Peer PeerClass
|
|
// The new Time-To-Live
|
|
//
|
|
// Use SetTTLPeriod and GetTTLPeriod helpers.
|
|
TTLPeriod int
|
|
}
|
|
|
|
// UpdatePeerHistoryTTLTypeID is TL type id of UpdatePeerHistoryTTL.
|
|
const UpdatePeerHistoryTTLTypeID = 0xbb9bb9a5
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePeerHistoryTTL) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePeerHistoryTTL.
|
|
var (
|
|
_ bin.Encoder = &UpdatePeerHistoryTTL{}
|
|
_ bin.Decoder = &UpdatePeerHistoryTTL{}
|
|
_ bin.BareEncoder = &UpdatePeerHistoryTTL{}
|
|
_ bin.BareDecoder = &UpdatePeerHistoryTTL{}
|
|
|
|
_ UpdateClass = &UpdatePeerHistoryTTL{}
|
|
)
|
|
|
|
func (u *UpdatePeerHistoryTTL) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.TTLPeriod == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePeerHistoryTTL) String() string {
|
|
if u == nil {
|
|
return "UpdatePeerHistoryTTL(nil)"
|
|
}
|
|
type Alias UpdatePeerHistoryTTL
|
|
return fmt.Sprintf("UpdatePeerHistoryTTL%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePeerHistoryTTL from given interface.
|
|
func (u *UpdatePeerHistoryTTL) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetTTLPeriod() (value int, ok bool)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
if val, ok := from.GetTTLPeriod(); ok {
|
|
u.TTLPeriod = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePeerHistoryTTL) TypeID() uint32 {
|
|
return UpdatePeerHistoryTTLTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePeerHistoryTTL) TypeName() string {
|
|
return "updatePeerHistoryTTL"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePeerHistoryTTL) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePeerHistoryTTL",
|
|
ID: UpdatePeerHistoryTTLTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "TTLPeriod",
|
|
SchemaName: "ttl_period",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePeerHistoryTTL) SetFlags() {
|
|
if !(u.TTLPeriod == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePeerHistoryTTL) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerHistoryTTL#bb9bb9a5 as nil")
|
|
}
|
|
b.PutID(UpdatePeerHistoryTTLTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePeerHistoryTTL) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerHistoryTTL#bb9bb9a5 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerHistoryTTL#bb9bb9a5: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePeerHistoryTTL#bb9bb9a5: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerHistoryTTL#bb9bb9a5: field peer: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.TTLPeriod)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePeerHistoryTTL) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerHistoryTTL#bb9bb9a5 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePeerHistoryTTLTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerHistoryTTL#bb9bb9a5: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePeerHistoryTTL) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerHistoryTTL#bb9bb9a5 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerHistoryTTL#bb9bb9a5: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerHistoryTTL#bb9bb9a5: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerHistoryTTL#bb9bb9a5: field ttl_period: %w", err)
|
|
}
|
|
u.TTLPeriod = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePeerHistoryTTL) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// SetTTLPeriod sets value of TTLPeriod conditional field.
|
|
func (u *UpdatePeerHistoryTTL) SetTTLPeriod(value int) {
|
|
u.Flags.Set(0)
|
|
u.TTLPeriod = value
|
|
}
|
|
|
|
// GetTTLPeriod returns value of TTLPeriod conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdatePeerHistoryTTL) GetTTLPeriod() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.TTLPeriod, true
|
|
}
|
|
|
|
// UpdateChatParticipant represents TL type `updateChatParticipant#d087663a`.
|
|
// A user has joined or left a specific chat
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatParticipant for reference.
|
|
type UpdateChatParticipant struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Chat¹ ID
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
ChatID int64
|
|
// When did this event occur
|
|
Date int
|
|
// User that triggered the change (inviter, admin that kicked the user, or the even the
|
|
// user_id itself)
|
|
ActorID int64
|
|
// User that was affected by the change
|
|
UserID int64
|
|
// Previous participant info (empty if this participant just joined)
|
|
//
|
|
// Use SetPrevParticipant and GetPrevParticipant helpers.
|
|
PrevParticipant ChatParticipantClass
|
|
// New participant info (empty if this participant just left)
|
|
//
|
|
// Use SetNewParticipant and GetNewParticipant helpers.
|
|
NewParticipant ChatParticipantClass
|
|
// The invite that was used to join the group
|
|
//
|
|
// Use SetInvite and GetInvite helpers.
|
|
Invite ExportedChatInviteClass
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateChatParticipantTypeID is TL type id of UpdateChatParticipant.
|
|
const UpdateChatParticipantTypeID = 0xd087663a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatParticipant) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatParticipant.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatParticipant{}
|
|
_ bin.Decoder = &UpdateChatParticipant{}
|
|
_ bin.BareEncoder = &UpdateChatParticipant{}
|
|
_ bin.BareDecoder = &UpdateChatParticipant{}
|
|
|
|
_ UpdateClass = &UpdateChatParticipant{}
|
|
)
|
|
|
|
func (u *UpdateChatParticipant) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.ActorID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.PrevParticipant == nil) {
|
|
return false
|
|
}
|
|
if !(u.NewParticipant == nil) {
|
|
return false
|
|
}
|
|
if !(u.Invite == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatParticipant) String() string {
|
|
if u == nil {
|
|
return "UpdateChatParticipant(nil)"
|
|
}
|
|
type Alias UpdateChatParticipant
|
|
return fmt.Sprintf("UpdateChatParticipant%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatParticipant from given interface.
|
|
func (u *UpdateChatParticipant) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
GetDate() (value int)
|
|
GetActorID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetPrevParticipant() (value ChatParticipantClass, ok bool)
|
|
GetNewParticipant() (value ChatParticipantClass, ok bool)
|
|
GetInvite() (value ExportedChatInviteClass, ok bool)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.Date = from.GetDate()
|
|
u.ActorID = from.GetActorID()
|
|
u.UserID = from.GetUserID()
|
|
if val, ok := from.GetPrevParticipant(); ok {
|
|
u.PrevParticipant = val
|
|
}
|
|
|
|
if val, ok := from.GetNewParticipant(); ok {
|
|
u.NewParticipant = val
|
|
}
|
|
|
|
if val, ok := from.GetInvite(); ok {
|
|
u.Invite = val
|
|
}
|
|
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatParticipant) TypeID() uint32 {
|
|
return UpdateChatParticipantTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatParticipant) TypeName() string {
|
|
return "updateChatParticipant"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatParticipant) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatParticipant",
|
|
ID: UpdateChatParticipantTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "ActorID",
|
|
SchemaName: "actor_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "PrevParticipant",
|
|
SchemaName: "prev_participant",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "NewParticipant",
|
|
SchemaName: "new_participant",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Invite",
|
|
SchemaName: "invite",
|
|
Null: !u.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateChatParticipant) SetFlags() {
|
|
if !(u.PrevParticipant == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.NewParticipant == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
if !(u.Invite == nil) {
|
|
u.Flags.Set(2)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatParticipant) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipant#d087663a as nil")
|
|
}
|
|
b.PutID(UpdateChatParticipantTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatParticipant) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipant#d087663a as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
b.PutInt(u.Date)
|
|
b.PutLong(u.ActorID)
|
|
b.PutLong(u.UserID)
|
|
if u.Flags.Has(0) {
|
|
if u.PrevParticipant == nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field prev_participant is nil")
|
|
}
|
|
if err := u.PrevParticipant.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field prev_participant: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.NewParticipant == nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field new_participant is nil")
|
|
}
|
|
if err := u.NewParticipant.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field new_participant: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(2) {
|
|
if u.Invite == nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field invite is nil")
|
|
}
|
|
if err := u.Invite.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChatParticipant#d087663a: field invite: %w", err)
|
|
}
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatParticipant) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipant#d087663a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatParticipantTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatParticipant) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipant#d087663a to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field actor_id: %w", err)
|
|
}
|
|
u.ActorID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeChatParticipant(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field prev_participant: %w", err)
|
|
}
|
|
u.PrevParticipant = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodeChatParticipant(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field new_participant: %w", err)
|
|
}
|
|
u.NewParticipant = value
|
|
}
|
|
if u.Flags.Has(2) {
|
|
value, err := DecodeExportedChatInvite(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field invite: %w", err)
|
|
}
|
|
u.Invite = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipant#d087663a: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChatParticipant) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateChatParticipant) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetActorID returns value of ActorID field.
|
|
func (u *UpdateChatParticipant) GetActorID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ActorID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateChatParticipant) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// SetPrevParticipant sets value of PrevParticipant conditional field.
|
|
func (u *UpdateChatParticipant) SetPrevParticipant(value ChatParticipantClass) {
|
|
u.Flags.Set(0)
|
|
u.PrevParticipant = value
|
|
}
|
|
|
|
// GetPrevParticipant returns value of PrevParticipant conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChatParticipant) GetPrevParticipant() (value ChatParticipantClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.PrevParticipant, true
|
|
}
|
|
|
|
// SetNewParticipant sets value of NewParticipant conditional field.
|
|
func (u *UpdateChatParticipant) SetNewParticipant(value ChatParticipantClass) {
|
|
u.Flags.Set(1)
|
|
u.NewParticipant = value
|
|
}
|
|
|
|
// GetNewParticipant returns value of NewParticipant conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChatParticipant) GetNewParticipant() (value ChatParticipantClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.NewParticipant, true
|
|
}
|
|
|
|
// SetInvite sets value of Invite conditional field.
|
|
func (u *UpdateChatParticipant) SetInvite(value ExportedChatInviteClass) {
|
|
u.Flags.Set(2)
|
|
u.Invite = value
|
|
}
|
|
|
|
// GetInvite returns value of Invite conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChatParticipant) GetInvite() (value ExportedChatInviteClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(2) {
|
|
return value, false
|
|
}
|
|
return u.Invite, true
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateChatParticipant) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateChannelParticipant represents TL type `updateChannelParticipant#985d3abb`.
|
|
// A participant has left, joined, was banned or admined in a channel or supergroup¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelParticipant for reference.
|
|
type UpdateChannelParticipant struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the participant joined using a chat folder deep link »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/links#chat-folder-links
|
|
ViaChatlist bool
|
|
// Channel ID
|
|
ChannelID int64
|
|
// Date of the event
|
|
Date int
|
|
// User that triggered the change (inviter, admin that kicked the user, or the even the
|
|
// user_id itself)
|
|
ActorID int64
|
|
// User that was affected by the change
|
|
UserID int64
|
|
// Previous participant status
|
|
//
|
|
// Use SetPrevParticipant and GetPrevParticipant helpers.
|
|
PrevParticipant ChannelParticipantClass
|
|
// New participant status
|
|
//
|
|
// Use SetNewParticipant and GetNewParticipant helpers.
|
|
NewParticipant ChannelParticipantClass
|
|
// Chat invite used to join the channel/supergroup¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/channel
|
|
//
|
|
// Use SetInvite and GetInvite helpers.
|
|
Invite ExportedChatInviteClass
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateChannelParticipantTypeID is TL type id of UpdateChannelParticipant.
|
|
const UpdateChannelParticipantTypeID = 0x985d3abb
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelParticipant) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelParticipant.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelParticipant{}
|
|
_ bin.Decoder = &UpdateChannelParticipant{}
|
|
_ bin.BareEncoder = &UpdateChannelParticipant{}
|
|
_ bin.BareDecoder = &UpdateChannelParticipant{}
|
|
|
|
_ UpdateClass = &UpdateChannelParticipant{}
|
|
)
|
|
|
|
func (u *UpdateChannelParticipant) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ViaChatlist == false) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.ActorID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.PrevParticipant == nil) {
|
|
return false
|
|
}
|
|
if !(u.NewParticipant == nil) {
|
|
return false
|
|
}
|
|
if !(u.Invite == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelParticipant) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelParticipant(nil)"
|
|
}
|
|
type Alias UpdateChannelParticipant
|
|
return fmt.Sprintf("UpdateChannelParticipant%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelParticipant from given interface.
|
|
func (u *UpdateChannelParticipant) FillFrom(from interface {
|
|
GetViaChatlist() (value bool)
|
|
GetChannelID() (value int64)
|
|
GetDate() (value int)
|
|
GetActorID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetPrevParticipant() (value ChannelParticipantClass, ok bool)
|
|
GetNewParticipant() (value ChannelParticipantClass, ok bool)
|
|
GetInvite() (value ExportedChatInviteClass, ok bool)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.ViaChatlist = from.GetViaChatlist()
|
|
u.ChannelID = from.GetChannelID()
|
|
u.Date = from.GetDate()
|
|
u.ActorID = from.GetActorID()
|
|
u.UserID = from.GetUserID()
|
|
if val, ok := from.GetPrevParticipant(); ok {
|
|
u.PrevParticipant = val
|
|
}
|
|
|
|
if val, ok := from.GetNewParticipant(); ok {
|
|
u.NewParticipant = val
|
|
}
|
|
|
|
if val, ok := from.GetInvite(); ok {
|
|
u.Invite = val
|
|
}
|
|
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelParticipant) TypeID() uint32 {
|
|
return UpdateChannelParticipantTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelParticipant) TypeName() string {
|
|
return "updateChannelParticipant"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelParticipant) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelParticipant",
|
|
ID: UpdateChannelParticipantTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ViaChatlist",
|
|
SchemaName: "via_chatlist",
|
|
Null: !u.Flags.Has(3),
|
|
},
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "ActorID",
|
|
SchemaName: "actor_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "PrevParticipant",
|
|
SchemaName: "prev_participant",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "NewParticipant",
|
|
SchemaName: "new_participant",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Invite",
|
|
SchemaName: "invite",
|
|
Null: !u.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateChannelParticipant) SetFlags() {
|
|
if !(u.ViaChatlist == false) {
|
|
u.Flags.Set(3)
|
|
}
|
|
if !(u.PrevParticipant == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.NewParticipant == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
if !(u.Invite == nil) {
|
|
u.Flags.Set(2)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelParticipant) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelParticipant#985d3abb as nil")
|
|
}
|
|
b.PutID(UpdateChannelParticipantTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelParticipant) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelParticipant#985d3abb as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutInt(u.Date)
|
|
b.PutLong(u.ActorID)
|
|
b.PutLong(u.UserID)
|
|
if u.Flags.Has(0) {
|
|
if u.PrevParticipant == nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field prev_participant is nil")
|
|
}
|
|
if err := u.PrevParticipant.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field prev_participant: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.NewParticipant == nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field new_participant is nil")
|
|
}
|
|
if err := u.NewParticipant.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field new_participant: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(2) {
|
|
if u.Invite == nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field invite is nil")
|
|
}
|
|
if err := u.Invite.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateChannelParticipant#985d3abb: field invite: %w", err)
|
|
}
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelParticipant) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelParticipant#985d3abb to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelParticipantTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelParticipant) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelParticipant#985d3abb to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field flags: %w", err)
|
|
}
|
|
}
|
|
u.ViaChatlist = u.Flags.Has(3)
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field actor_id: %w", err)
|
|
}
|
|
u.ActorID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeChannelParticipant(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field prev_participant: %w", err)
|
|
}
|
|
u.PrevParticipant = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodeChannelParticipant(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field new_participant: %w", err)
|
|
}
|
|
u.NewParticipant = value
|
|
}
|
|
if u.Flags.Has(2) {
|
|
value, err := DecodeExportedChatInvite(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field invite: %w", err)
|
|
}
|
|
u.Invite = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelParticipant#985d3abb: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetViaChatlist sets value of ViaChatlist conditional field.
|
|
func (u *UpdateChannelParticipant) SetViaChatlist(value bool) {
|
|
if value {
|
|
u.Flags.Set(3)
|
|
u.ViaChatlist = true
|
|
} else {
|
|
u.Flags.Unset(3)
|
|
u.ViaChatlist = false
|
|
}
|
|
}
|
|
|
|
// GetViaChatlist returns value of ViaChatlist conditional field.
|
|
func (u *UpdateChannelParticipant) GetViaChatlist() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(3)
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelParticipant) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateChannelParticipant) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetActorID returns value of ActorID field.
|
|
func (u *UpdateChannelParticipant) GetActorID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ActorID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateChannelParticipant) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// SetPrevParticipant sets value of PrevParticipant conditional field.
|
|
func (u *UpdateChannelParticipant) SetPrevParticipant(value ChannelParticipantClass) {
|
|
u.Flags.Set(0)
|
|
u.PrevParticipant = value
|
|
}
|
|
|
|
// GetPrevParticipant returns value of PrevParticipant conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelParticipant) GetPrevParticipant() (value ChannelParticipantClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.PrevParticipant, true
|
|
}
|
|
|
|
// SetNewParticipant sets value of NewParticipant conditional field.
|
|
func (u *UpdateChannelParticipant) SetNewParticipant(value ChannelParticipantClass) {
|
|
u.Flags.Set(1)
|
|
u.NewParticipant = value
|
|
}
|
|
|
|
// GetNewParticipant returns value of NewParticipant conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelParticipant) GetNewParticipant() (value ChannelParticipantClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.NewParticipant, true
|
|
}
|
|
|
|
// SetInvite sets value of Invite conditional field.
|
|
func (u *UpdateChannelParticipant) SetInvite(value ExportedChatInviteClass) {
|
|
u.Flags.Set(2)
|
|
u.Invite = value
|
|
}
|
|
|
|
// GetInvite returns value of Invite conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateChannelParticipant) GetInvite() (value ExportedChatInviteClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(2) {
|
|
return value, false
|
|
}
|
|
return u.Invite, true
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateChannelParticipant) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateBotStopped represents TL type `updateBotStopped#c4870a49`.
|
|
// A bot was stopped or re-started.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotStopped for reference.
|
|
type UpdateBotStopped struct {
|
|
// The user ID
|
|
UserID int64
|
|
// When did this action occur
|
|
Date int
|
|
// Whether the bot was stopped or started
|
|
Stopped bool
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotStoppedTypeID is TL type id of UpdateBotStopped.
|
|
const UpdateBotStoppedTypeID = 0xc4870a49
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotStopped) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotStopped.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotStopped{}
|
|
_ bin.Decoder = &UpdateBotStopped{}
|
|
_ bin.BareEncoder = &UpdateBotStopped{}
|
|
_ bin.BareDecoder = &UpdateBotStopped{}
|
|
|
|
_ UpdateClass = &UpdateBotStopped{}
|
|
)
|
|
|
|
func (u *UpdateBotStopped) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.Stopped == false) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotStopped) String() string {
|
|
if u == nil {
|
|
return "UpdateBotStopped(nil)"
|
|
}
|
|
type Alias UpdateBotStopped
|
|
return fmt.Sprintf("UpdateBotStopped%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotStopped from given interface.
|
|
func (u *UpdateBotStopped) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetDate() (value int)
|
|
GetStopped() (value bool)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.Date = from.GetDate()
|
|
u.Stopped = from.GetStopped()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotStopped) TypeID() uint32 {
|
|
return UpdateBotStoppedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotStopped) TypeName() string {
|
|
return "updateBotStopped"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotStopped) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotStopped",
|
|
ID: UpdateBotStoppedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "Stopped",
|
|
SchemaName: "stopped",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotStopped) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotStopped#c4870a49 as nil")
|
|
}
|
|
b.PutID(UpdateBotStoppedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotStopped) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotStopped#c4870a49 as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
b.PutInt(u.Date)
|
|
b.PutBool(u.Stopped)
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotStopped) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotStopped#c4870a49 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotStoppedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotStopped#c4870a49: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotStopped) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotStopped#c4870a49 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotStopped#c4870a49: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotStopped#c4870a49: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotStopped#c4870a49: field stopped: %w", err)
|
|
}
|
|
u.Stopped = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotStopped#c4870a49: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotStopped) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateBotStopped) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetStopped returns value of Stopped field.
|
|
func (u *UpdateBotStopped) GetStopped() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Stopped
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotStopped) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateGroupCallConnection represents TL type `updateGroupCallConnection#b783982`.
|
|
// New WebRTC parameters
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGroupCallConnection for reference.
|
|
type UpdateGroupCallConnection struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Are these parameters related to the screen capture session currently in progress?
|
|
Presentation bool
|
|
// WebRTC parameters
|
|
Params DataJSON
|
|
}
|
|
|
|
// UpdateGroupCallConnectionTypeID is TL type id of UpdateGroupCallConnection.
|
|
const UpdateGroupCallConnectionTypeID = 0xb783982
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGroupCallConnection) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGroupCallConnection.
|
|
var (
|
|
_ bin.Encoder = &UpdateGroupCallConnection{}
|
|
_ bin.Decoder = &UpdateGroupCallConnection{}
|
|
_ bin.BareEncoder = &UpdateGroupCallConnection{}
|
|
_ bin.BareDecoder = &UpdateGroupCallConnection{}
|
|
|
|
_ UpdateClass = &UpdateGroupCallConnection{}
|
|
)
|
|
|
|
func (u *UpdateGroupCallConnection) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Presentation == false) {
|
|
return false
|
|
}
|
|
if !(u.Params.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGroupCallConnection) String() string {
|
|
if u == nil {
|
|
return "UpdateGroupCallConnection(nil)"
|
|
}
|
|
type Alias UpdateGroupCallConnection
|
|
return fmt.Sprintf("UpdateGroupCallConnection%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGroupCallConnection from given interface.
|
|
func (u *UpdateGroupCallConnection) FillFrom(from interface {
|
|
GetPresentation() (value bool)
|
|
GetParams() (value DataJSON)
|
|
}) {
|
|
u.Presentation = from.GetPresentation()
|
|
u.Params = from.GetParams()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGroupCallConnection) TypeID() uint32 {
|
|
return UpdateGroupCallConnectionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGroupCallConnection) TypeName() string {
|
|
return "updateGroupCallConnection"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGroupCallConnection) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGroupCallConnection",
|
|
ID: UpdateGroupCallConnectionTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Presentation",
|
|
SchemaName: "presentation",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Params",
|
|
SchemaName: "params",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateGroupCallConnection) SetFlags() {
|
|
if !(u.Presentation == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGroupCallConnection) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallConnection#b783982 as nil")
|
|
}
|
|
b.PutID(UpdateGroupCallConnectionTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGroupCallConnection) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallConnection#b783982 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallConnection#b783982: field flags: %w", err)
|
|
}
|
|
if err := u.Params.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallConnection#b783982: field params: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGroupCallConnection) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallConnection#b783982 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGroupCallConnectionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallConnection#b783982: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGroupCallConnection) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallConnection#b783982 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallConnection#b783982: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Presentation = u.Flags.Has(0)
|
|
{
|
|
if err := u.Params.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallConnection#b783982: field params: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPresentation sets value of Presentation conditional field.
|
|
func (u *UpdateGroupCallConnection) SetPresentation(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Presentation = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Presentation = false
|
|
}
|
|
}
|
|
|
|
// GetPresentation returns value of Presentation conditional field.
|
|
func (u *UpdateGroupCallConnection) GetPresentation() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetParams returns value of Params field.
|
|
func (u *UpdateGroupCallConnection) GetParams() (value DataJSON) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Params
|
|
}
|
|
|
|
// UpdateBotCommands represents TL type `updateBotCommands#4d712f2e`.
|
|
// The command set¹ of a certain bot in a certain chat has changed.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/commands
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotCommands for reference.
|
|
type UpdateBotCommands struct {
|
|
// The affected chat
|
|
Peer PeerClass
|
|
// ID of the bot that changed its command set
|
|
BotID int64
|
|
// New bot commands
|
|
Commands []BotCommand
|
|
}
|
|
|
|
// UpdateBotCommandsTypeID is TL type id of UpdateBotCommands.
|
|
const UpdateBotCommandsTypeID = 0x4d712f2e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotCommands) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotCommands.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotCommands{}
|
|
_ bin.Decoder = &UpdateBotCommands{}
|
|
_ bin.BareEncoder = &UpdateBotCommands{}
|
|
_ bin.BareDecoder = &UpdateBotCommands{}
|
|
|
|
_ UpdateClass = &UpdateBotCommands{}
|
|
)
|
|
|
|
func (u *UpdateBotCommands) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.BotID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Commands == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotCommands) String() string {
|
|
if u == nil {
|
|
return "UpdateBotCommands(nil)"
|
|
}
|
|
type Alias UpdateBotCommands
|
|
return fmt.Sprintf("UpdateBotCommands%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotCommands from given interface.
|
|
func (u *UpdateBotCommands) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetBotID() (value int64)
|
|
GetCommands() (value []BotCommand)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.BotID = from.GetBotID()
|
|
u.Commands = from.GetCommands()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotCommands) TypeID() uint32 {
|
|
return UpdateBotCommandsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotCommands) TypeName() string {
|
|
return "updateBotCommands"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotCommands) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotCommands",
|
|
ID: UpdateBotCommandsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "BotID",
|
|
SchemaName: "bot_id",
|
|
},
|
|
{
|
|
Name: "Commands",
|
|
SchemaName: "commands",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotCommands) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotCommands#4d712f2e as nil")
|
|
}
|
|
b.PutID(UpdateBotCommandsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotCommands) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotCommands#4d712f2e as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotCommands#4d712f2e: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotCommands#4d712f2e: field peer: %w", err)
|
|
}
|
|
b.PutLong(u.BotID)
|
|
b.PutVectorHeader(len(u.Commands))
|
|
for idx, v := range u.Commands {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotCommands#4d712f2e: field commands element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotCommands) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotCommands#4d712f2e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotCommandsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCommands#4d712f2e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotCommands) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotCommands#4d712f2e to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCommands#4d712f2e: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCommands#4d712f2e: field bot_id: %w", err)
|
|
}
|
|
u.BotID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCommands#4d712f2e: field commands: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Commands = make([]BotCommand, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value BotCommand
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotCommands#4d712f2e: field commands: %w", err)
|
|
}
|
|
u.Commands = append(u.Commands, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotCommands) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetBotID returns value of BotID field.
|
|
func (u *UpdateBotCommands) GetBotID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.BotID
|
|
}
|
|
|
|
// GetCommands returns value of Commands field.
|
|
func (u *UpdateBotCommands) GetCommands() (value []BotCommand) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Commands
|
|
}
|
|
|
|
// UpdatePendingJoinRequests represents TL type `updatePendingJoinRequests#7063c3db`.
|
|
// Someone has requested to join a chat or channel
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePendingJoinRequests for reference.
|
|
type UpdatePendingJoinRequests struct {
|
|
// Chat or channel
|
|
Peer PeerClass
|
|
// Number of pending join requests »¹ for the chat or channel
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/invites#join-requests
|
|
RequestsPending int
|
|
// IDs of users that have recently requested to join
|
|
RecentRequesters []int64
|
|
}
|
|
|
|
// UpdatePendingJoinRequestsTypeID is TL type id of UpdatePendingJoinRequests.
|
|
const UpdatePendingJoinRequestsTypeID = 0x7063c3db
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePendingJoinRequests) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePendingJoinRequests.
|
|
var (
|
|
_ bin.Encoder = &UpdatePendingJoinRequests{}
|
|
_ bin.Decoder = &UpdatePendingJoinRequests{}
|
|
_ bin.BareEncoder = &UpdatePendingJoinRequests{}
|
|
_ bin.BareDecoder = &UpdatePendingJoinRequests{}
|
|
|
|
_ UpdateClass = &UpdatePendingJoinRequests{}
|
|
)
|
|
|
|
func (u *UpdatePendingJoinRequests) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.RequestsPending == 0) {
|
|
return false
|
|
}
|
|
if !(u.RecentRequesters == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePendingJoinRequests) String() string {
|
|
if u == nil {
|
|
return "UpdatePendingJoinRequests(nil)"
|
|
}
|
|
type Alias UpdatePendingJoinRequests
|
|
return fmt.Sprintf("UpdatePendingJoinRequests%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePendingJoinRequests from given interface.
|
|
func (u *UpdatePendingJoinRequests) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetRequestsPending() (value int)
|
|
GetRecentRequesters() (value []int64)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.RequestsPending = from.GetRequestsPending()
|
|
u.RecentRequesters = from.GetRecentRequesters()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePendingJoinRequests) TypeID() uint32 {
|
|
return UpdatePendingJoinRequestsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePendingJoinRequests) TypeName() string {
|
|
return "updatePendingJoinRequests"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePendingJoinRequests) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePendingJoinRequests",
|
|
ID: UpdatePendingJoinRequestsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "RequestsPending",
|
|
SchemaName: "requests_pending",
|
|
},
|
|
{
|
|
Name: "RecentRequesters",
|
|
SchemaName: "recent_requesters",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePendingJoinRequests) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePendingJoinRequests#7063c3db as nil")
|
|
}
|
|
b.PutID(UpdatePendingJoinRequestsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePendingJoinRequests) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePendingJoinRequests#7063c3db as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePendingJoinRequests#7063c3db: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePendingJoinRequests#7063c3db: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.RequestsPending)
|
|
b.PutVectorHeader(len(u.RecentRequesters))
|
|
for _, v := range u.RecentRequesters {
|
|
b.PutLong(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePendingJoinRequests) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePendingJoinRequests#7063c3db to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePendingJoinRequestsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePendingJoinRequests#7063c3db: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePendingJoinRequests) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePendingJoinRequests#7063c3db to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePendingJoinRequests#7063c3db: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePendingJoinRequests#7063c3db: field requests_pending: %w", err)
|
|
}
|
|
u.RequestsPending = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePendingJoinRequests#7063c3db: field recent_requesters: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.RecentRequesters = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePendingJoinRequests#7063c3db: field recent_requesters: %w", err)
|
|
}
|
|
u.RecentRequesters = append(u.RecentRequesters, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePendingJoinRequests) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetRequestsPending returns value of RequestsPending field.
|
|
func (u *UpdatePendingJoinRequests) GetRequestsPending() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.RequestsPending
|
|
}
|
|
|
|
// GetRecentRequesters returns value of RecentRequesters field.
|
|
func (u *UpdatePendingJoinRequests) GetRecentRequesters() (value []int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.RecentRequesters
|
|
}
|
|
|
|
// UpdateBotChatInviteRequester represents TL type `updateBotChatInviteRequester#11dfa986`.
|
|
// Someone has requested to join a chat or channel (bots only, users will receive an
|
|
// updatePendingJoinRequests¹, instead)
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/constructor/updatePendingJoinRequests
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotChatInviteRequester for reference.
|
|
type UpdateBotChatInviteRequester struct {
|
|
// The chat or channel in question
|
|
Peer PeerClass
|
|
// When was the join request »¹ made
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/invites#join-requests
|
|
Date int
|
|
// The user ID that is asking to join the chat or channel
|
|
UserID int64
|
|
// Bio of the user
|
|
About string
|
|
// Chat invite link that was used by the user to send the join request »¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/invites#join-requests
|
|
Invite ExportedChatInviteClass
|
|
// QTS¹ event sequence identifier
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotChatInviteRequesterTypeID is TL type id of UpdateBotChatInviteRequester.
|
|
const UpdateBotChatInviteRequesterTypeID = 0x11dfa986
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotChatInviteRequester) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotChatInviteRequester.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotChatInviteRequester{}
|
|
_ bin.Decoder = &UpdateBotChatInviteRequester{}
|
|
_ bin.BareEncoder = &UpdateBotChatInviteRequester{}
|
|
_ bin.BareDecoder = &UpdateBotChatInviteRequester{}
|
|
|
|
_ UpdateClass = &UpdateBotChatInviteRequester{}
|
|
)
|
|
|
|
func (u *UpdateBotChatInviteRequester) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.About == "") {
|
|
return false
|
|
}
|
|
if !(u.Invite == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotChatInviteRequester) String() string {
|
|
if u == nil {
|
|
return "UpdateBotChatInviteRequester(nil)"
|
|
}
|
|
type Alias UpdateBotChatInviteRequester
|
|
return fmt.Sprintf("UpdateBotChatInviteRequester%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotChatInviteRequester from given interface.
|
|
func (u *UpdateBotChatInviteRequester) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetDate() (value int)
|
|
GetUserID() (value int64)
|
|
GetAbout() (value string)
|
|
GetInvite() (value ExportedChatInviteClass)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.Date = from.GetDate()
|
|
u.UserID = from.GetUserID()
|
|
u.About = from.GetAbout()
|
|
u.Invite = from.GetInvite()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotChatInviteRequester) TypeID() uint32 {
|
|
return UpdateBotChatInviteRequesterTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotChatInviteRequester) TypeName() string {
|
|
return "updateBotChatInviteRequester"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotChatInviteRequester) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotChatInviteRequester",
|
|
ID: UpdateBotChatInviteRequesterTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "About",
|
|
SchemaName: "about",
|
|
},
|
|
{
|
|
Name: "Invite",
|
|
SchemaName: "invite",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotChatInviteRequester) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotChatInviteRequester#11dfa986 as nil")
|
|
}
|
|
b.PutID(UpdateBotChatInviteRequesterTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotChatInviteRequester) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotChatInviteRequester#11dfa986 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotChatInviteRequester#11dfa986: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotChatInviteRequester#11dfa986: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.Date)
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.About)
|
|
if u.Invite == nil {
|
|
return fmt.Errorf("unable to encode updateBotChatInviteRequester#11dfa986: field invite is nil")
|
|
}
|
|
if err := u.Invite.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotChatInviteRequester#11dfa986: field invite: %w", err)
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotChatInviteRequester) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotChatInviteRequester#11dfa986 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotChatInviteRequesterTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotChatInviteRequester) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotChatInviteRequester#11dfa986 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: field about: %w", err)
|
|
}
|
|
u.About = value
|
|
}
|
|
{
|
|
value, err := DecodeExportedChatInvite(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: field invite: %w", err)
|
|
}
|
|
u.Invite = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatInviteRequester#11dfa986: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotChatInviteRequester) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateBotChatInviteRequester) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotChatInviteRequester) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetAbout returns value of About field.
|
|
func (u *UpdateBotChatInviteRequester) GetAbout() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.About
|
|
}
|
|
|
|
// GetInvite returns value of Invite field.
|
|
func (u *UpdateBotChatInviteRequester) GetInvite() (value ExportedChatInviteClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Invite
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotChatInviteRequester) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateMessageReactions represents TL type `updateMessageReactions#1e297bfa`.
|
|
// New message reactions »¹ are available
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/reactions
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMessageReactions for reference.
|
|
type UpdateMessageReactions struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Peer
|
|
Peer PeerClass
|
|
// Message ID
|
|
MsgID int
|
|
// Forum topic ID¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/forum#forum-topics
|
|
//
|
|
// Use SetTopMsgID and GetTopMsgID helpers.
|
|
TopMsgID int
|
|
// If set, the reactions are in the specified monoforum topic »¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/monoforum
|
|
//
|
|
// Use SetSavedPeerID and GetSavedPeerID helpers.
|
|
SavedPeerID PeerClass
|
|
// Reactions
|
|
Reactions MessageReactions
|
|
}
|
|
|
|
// UpdateMessageReactionsTypeID is TL type id of UpdateMessageReactions.
|
|
const UpdateMessageReactionsTypeID = 0x1e297bfa
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMessageReactions) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMessageReactions.
|
|
var (
|
|
_ bin.Encoder = &UpdateMessageReactions{}
|
|
_ bin.Decoder = &UpdateMessageReactions{}
|
|
_ bin.BareEncoder = &UpdateMessageReactions{}
|
|
_ bin.BareDecoder = &UpdateMessageReactions{}
|
|
|
|
_ UpdateClass = &UpdateMessageReactions{}
|
|
)
|
|
|
|
func (u *UpdateMessageReactions) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TopMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
if !(u.Reactions.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMessageReactions) String() string {
|
|
if u == nil {
|
|
return "UpdateMessageReactions(nil)"
|
|
}
|
|
type Alias UpdateMessageReactions
|
|
return fmt.Sprintf("UpdateMessageReactions%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMessageReactions from given interface.
|
|
func (u *UpdateMessageReactions) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
GetTopMsgID() (value int, ok bool)
|
|
GetSavedPeerID() (value PeerClass, ok bool)
|
|
GetReactions() (value MessageReactions)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
if val, ok := from.GetTopMsgID(); ok {
|
|
u.TopMsgID = val
|
|
}
|
|
|
|
if val, ok := from.GetSavedPeerID(); ok {
|
|
u.SavedPeerID = val
|
|
}
|
|
|
|
u.Reactions = from.GetReactions()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMessageReactions) TypeID() uint32 {
|
|
return UpdateMessageReactionsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMessageReactions) TypeName() string {
|
|
return "updateMessageReactions"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMessageReactions) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMessageReactions",
|
|
ID: UpdateMessageReactionsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "TopMsgID",
|
|
SchemaName: "top_msg_id",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Reactions",
|
|
SchemaName: "reactions",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateMessageReactions) SetFlags() {
|
|
if !(u.TopMsgID == 0) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMessageReactions) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessageReactions#1e297bfa as nil")
|
|
}
|
|
b.PutID(UpdateMessageReactionsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMessageReactions) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessageReactions#1e297bfa as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessageReactions#1e297bfa: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateMessageReactions#1e297bfa: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessageReactions#1e297bfa: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
if u.Flags.Has(0) {
|
|
b.PutInt(u.TopMsgID)
|
|
}
|
|
if u.Flags.Has(1) {
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateMessageReactions#1e297bfa: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessageReactions#1e297bfa: field saved_peer_id: %w", err)
|
|
}
|
|
}
|
|
if err := u.Reactions.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessageReactions#1e297bfa: field reactions: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMessageReactions) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessageReactions#1e297bfa to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMessageReactionsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMessageReactions) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessageReactions#1e297bfa to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: field top_msg_id: %w", err)
|
|
}
|
|
u.TopMsgID = value
|
|
}
|
|
if u.Flags.Has(1) {
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
{
|
|
if err := u.Reactions.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageReactions#1e297bfa: field reactions: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateMessageReactions) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateMessageReactions) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// SetTopMsgID sets value of TopMsgID conditional field.
|
|
func (u *UpdateMessageReactions) SetTopMsgID(value int) {
|
|
u.Flags.Set(0)
|
|
u.TopMsgID = value
|
|
}
|
|
|
|
// GetTopMsgID returns value of TopMsgID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateMessageReactions) GetTopMsgID() (value int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.TopMsgID, true
|
|
}
|
|
|
|
// SetSavedPeerID sets value of SavedPeerID conditional field.
|
|
func (u *UpdateMessageReactions) SetSavedPeerID(value PeerClass) {
|
|
u.Flags.Set(1)
|
|
u.SavedPeerID = value
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateMessageReactions) GetSavedPeerID() (value PeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(1) {
|
|
return value, false
|
|
}
|
|
return u.SavedPeerID, true
|
|
}
|
|
|
|
// GetReactions returns value of Reactions field.
|
|
func (u *UpdateMessageReactions) GetReactions() (value MessageReactions) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Reactions
|
|
}
|
|
|
|
// UpdateAttachMenuBots represents TL type `updateAttachMenuBots#17b7a20b`.
|
|
// The list of installed attachment menu entries »¹ has changed, use messages
|
|
// getAttachMenuBots² to fetch the updated list.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/attach
|
|
// 2. https://core.telegram.org/method/messages.getAttachMenuBots
|
|
//
|
|
// See https://core.telegram.org/constructor/updateAttachMenuBots for reference.
|
|
type UpdateAttachMenuBots struct {
|
|
}
|
|
|
|
// UpdateAttachMenuBotsTypeID is TL type id of UpdateAttachMenuBots.
|
|
const UpdateAttachMenuBotsTypeID = 0x17b7a20b
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateAttachMenuBots) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateAttachMenuBots.
|
|
var (
|
|
_ bin.Encoder = &UpdateAttachMenuBots{}
|
|
_ bin.Decoder = &UpdateAttachMenuBots{}
|
|
_ bin.BareEncoder = &UpdateAttachMenuBots{}
|
|
_ bin.BareDecoder = &UpdateAttachMenuBots{}
|
|
|
|
_ UpdateClass = &UpdateAttachMenuBots{}
|
|
)
|
|
|
|
func (u *UpdateAttachMenuBots) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateAttachMenuBots) String() string {
|
|
if u == nil {
|
|
return "UpdateAttachMenuBots(nil)"
|
|
}
|
|
type Alias UpdateAttachMenuBots
|
|
return fmt.Sprintf("UpdateAttachMenuBots%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateAttachMenuBots) TypeID() uint32 {
|
|
return UpdateAttachMenuBotsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateAttachMenuBots) TypeName() string {
|
|
return "updateAttachMenuBots"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateAttachMenuBots) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateAttachMenuBots",
|
|
ID: UpdateAttachMenuBotsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateAttachMenuBots) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateAttachMenuBots#17b7a20b as nil")
|
|
}
|
|
b.PutID(UpdateAttachMenuBotsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateAttachMenuBots) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateAttachMenuBots#17b7a20b as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateAttachMenuBots) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateAttachMenuBots#17b7a20b to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateAttachMenuBotsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateAttachMenuBots#17b7a20b: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateAttachMenuBots) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateAttachMenuBots#17b7a20b to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateWebViewResultSent represents TL type `updateWebViewResultSent#1592b79d`.
|
|
// Indicates to a bot that a webview was closed and an inline message was sent on behalf
|
|
// of the user using messages.sendWebViewResultMessage¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/messages.sendWebViewResultMessage
|
|
//
|
|
// See https://core.telegram.org/constructor/updateWebViewResultSent for reference.
|
|
type UpdateWebViewResultSent struct {
|
|
// Web app interaction ID
|
|
QueryID int64
|
|
}
|
|
|
|
// UpdateWebViewResultSentTypeID is TL type id of UpdateWebViewResultSent.
|
|
const UpdateWebViewResultSentTypeID = 0x1592b79d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateWebViewResultSent) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateWebViewResultSent.
|
|
var (
|
|
_ bin.Encoder = &UpdateWebViewResultSent{}
|
|
_ bin.Decoder = &UpdateWebViewResultSent{}
|
|
_ bin.BareEncoder = &UpdateWebViewResultSent{}
|
|
_ bin.BareDecoder = &UpdateWebViewResultSent{}
|
|
|
|
_ UpdateClass = &UpdateWebViewResultSent{}
|
|
)
|
|
|
|
func (u *UpdateWebViewResultSent) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateWebViewResultSent) String() string {
|
|
if u == nil {
|
|
return "UpdateWebViewResultSent(nil)"
|
|
}
|
|
type Alias UpdateWebViewResultSent
|
|
return fmt.Sprintf("UpdateWebViewResultSent%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateWebViewResultSent from given interface.
|
|
func (u *UpdateWebViewResultSent) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateWebViewResultSent) TypeID() uint32 {
|
|
return UpdateWebViewResultSentTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateWebViewResultSent) TypeName() string {
|
|
return "updateWebViewResultSent"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateWebViewResultSent) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateWebViewResultSent",
|
|
ID: UpdateWebViewResultSentTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateWebViewResultSent) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateWebViewResultSent#1592b79d as nil")
|
|
}
|
|
b.PutID(UpdateWebViewResultSentTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateWebViewResultSent) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateWebViewResultSent#1592b79d as nil")
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateWebViewResultSent) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateWebViewResultSent#1592b79d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateWebViewResultSentTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateWebViewResultSent#1592b79d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateWebViewResultSent) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateWebViewResultSent#1592b79d to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateWebViewResultSent#1592b79d: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateWebViewResultSent) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// UpdateBotMenuButton represents TL type `updateBotMenuButton#14b85813`.
|
|
// The menu button behavior for the specified bot has changed
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotMenuButton for reference.
|
|
type UpdateBotMenuButton struct {
|
|
// Bot ID
|
|
BotID int64
|
|
// New menu button
|
|
Button BotMenuButtonClass
|
|
}
|
|
|
|
// UpdateBotMenuButtonTypeID is TL type id of UpdateBotMenuButton.
|
|
const UpdateBotMenuButtonTypeID = 0x14b85813
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotMenuButton) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotMenuButton.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotMenuButton{}
|
|
_ bin.Decoder = &UpdateBotMenuButton{}
|
|
_ bin.BareEncoder = &UpdateBotMenuButton{}
|
|
_ bin.BareDecoder = &UpdateBotMenuButton{}
|
|
|
|
_ UpdateClass = &UpdateBotMenuButton{}
|
|
)
|
|
|
|
func (u *UpdateBotMenuButton) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.BotID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Button == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotMenuButton) String() string {
|
|
if u == nil {
|
|
return "UpdateBotMenuButton(nil)"
|
|
}
|
|
type Alias UpdateBotMenuButton
|
|
return fmt.Sprintf("UpdateBotMenuButton%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotMenuButton from given interface.
|
|
func (u *UpdateBotMenuButton) FillFrom(from interface {
|
|
GetBotID() (value int64)
|
|
GetButton() (value BotMenuButtonClass)
|
|
}) {
|
|
u.BotID = from.GetBotID()
|
|
u.Button = from.GetButton()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotMenuButton) TypeID() uint32 {
|
|
return UpdateBotMenuButtonTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotMenuButton) TypeName() string {
|
|
return "updateBotMenuButton"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotMenuButton) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotMenuButton",
|
|
ID: UpdateBotMenuButtonTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BotID",
|
|
SchemaName: "bot_id",
|
|
},
|
|
{
|
|
Name: "Button",
|
|
SchemaName: "button",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotMenuButton) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotMenuButton#14b85813 as nil")
|
|
}
|
|
b.PutID(UpdateBotMenuButtonTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotMenuButton) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotMenuButton#14b85813 as nil")
|
|
}
|
|
b.PutLong(u.BotID)
|
|
if u.Button == nil {
|
|
return fmt.Errorf("unable to encode updateBotMenuButton#14b85813: field button is nil")
|
|
}
|
|
if err := u.Button.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMenuButton#14b85813: field button: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotMenuButton) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotMenuButton#14b85813 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotMenuButtonTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMenuButton#14b85813: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotMenuButton) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotMenuButton#14b85813 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMenuButton#14b85813: field bot_id: %w", err)
|
|
}
|
|
u.BotID = value
|
|
}
|
|
{
|
|
value, err := DecodeBotMenuButton(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMenuButton#14b85813: field button: %w", err)
|
|
}
|
|
u.Button = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetBotID returns value of BotID field.
|
|
func (u *UpdateBotMenuButton) GetBotID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.BotID
|
|
}
|
|
|
|
// GetButton returns value of Button field.
|
|
func (u *UpdateBotMenuButton) GetButton() (value BotMenuButtonClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Button
|
|
}
|
|
|
|
// UpdateSavedRingtones represents TL type `updateSavedRingtones#74d8be99`.
|
|
// The list of saved notification sounds has changed, use account.getSavedRingtones¹ to
|
|
// fetch the new list.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/account.getSavedRingtones
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSavedRingtones for reference.
|
|
type UpdateSavedRingtones struct {
|
|
}
|
|
|
|
// UpdateSavedRingtonesTypeID is TL type id of UpdateSavedRingtones.
|
|
const UpdateSavedRingtonesTypeID = 0x74d8be99
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSavedRingtones) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSavedRingtones.
|
|
var (
|
|
_ bin.Encoder = &UpdateSavedRingtones{}
|
|
_ bin.Decoder = &UpdateSavedRingtones{}
|
|
_ bin.BareEncoder = &UpdateSavedRingtones{}
|
|
_ bin.BareDecoder = &UpdateSavedRingtones{}
|
|
|
|
_ UpdateClass = &UpdateSavedRingtones{}
|
|
)
|
|
|
|
func (u *UpdateSavedRingtones) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSavedRingtones) String() string {
|
|
if u == nil {
|
|
return "UpdateSavedRingtones(nil)"
|
|
}
|
|
type Alias UpdateSavedRingtones
|
|
return fmt.Sprintf("UpdateSavedRingtones%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSavedRingtones) TypeID() uint32 {
|
|
return UpdateSavedRingtonesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSavedRingtones) TypeName() string {
|
|
return "updateSavedRingtones"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSavedRingtones) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSavedRingtones",
|
|
ID: UpdateSavedRingtonesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSavedRingtones) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedRingtones#74d8be99 as nil")
|
|
}
|
|
b.PutID(UpdateSavedRingtonesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSavedRingtones) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedRingtones#74d8be99 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSavedRingtones) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedRingtones#74d8be99 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSavedRingtonesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSavedRingtones#74d8be99: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSavedRingtones) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedRingtones#74d8be99 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateTranscribedAudio represents TL type `updateTranscribedAudio#84cd5a`.
|
|
// A pending voice message transcription »¹ initiated with messages.transcribeAudio²
|
|
// was updated.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/transcribe
|
|
// 2. https://core.telegram.org/method/messages.transcribeAudio
|
|
//
|
|
// See https://core.telegram.org/constructor/updateTranscribedAudio for reference.
|
|
type UpdateTranscribedAudio struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether this transcription is still pending and further updateTranscribedAudio¹ about
|
|
// it will be sent in the future.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/updateTranscribedAudio
|
|
Pending bool
|
|
// Peer of the transcribed message
|
|
Peer PeerClass
|
|
// Transcribed message ID
|
|
MsgID int
|
|
// Transcription ID
|
|
TranscriptionID int64
|
|
// Transcribed text
|
|
Text string
|
|
}
|
|
|
|
// UpdateTranscribedAudioTypeID is TL type id of UpdateTranscribedAudio.
|
|
const UpdateTranscribedAudioTypeID = 0x84cd5a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateTranscribedAudio) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateTranscribedAudio.
|
|
var (
|
|
_ bin.Encoder = &UpdateTranscribedAudio{}
|
|
_ bin.Decoder = &UpdateTranscribedAudio{}
|
|
_ bin.BareEncoder = &UpdateTranscribedAudio{}
|
|
_ bin.BareDecoder = &UpdateTranscribedAudio{}
|
|
|
|
_ UpdateClass = &UpdateTranscribedAudio{}
|
|
)
|
|
|
|
func (u *UpdateTranscribedAudio) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Pending == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.TranscriptionID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Text == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateTranscribedAudio) String() string {
|
|
if u == nil {
|
|
return "UpdateTranscribedAudio(nil)"
|
|
}
|
|
type Alias UpdateTranscribedAudio
|
|
return fmt.Sprintf("UpdateTranscribedAudio%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateTranscribedAudio from given interface.
|
|
func (u *UpdateTranscribedAudio) FillFrom(from interface {
|
|
GetPending() (value bool)
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
GetTranscriptionID() (value int64)
|
|
GetText() (value string)
|
|
}) {
|
|
u.Pending = from.GetPending()
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
u.TranscriptionID = from.GetTranscriptionID()
|
|
u.Text = from.GetText()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateTranscribedAudio) TypeID() uint32 {
|
|
return UpdateTranscribedAudioTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateTranscribedAudio) TypeName() string {
|
|
return "updateTranscribedAudio"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateTranscribedAudio) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateTranscribedAudio",
|
|
ID: UpdateTranscribedAudioTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pending",
|
|
SchemaName: "pending",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "TranscriptionID",
|
|
SchemaName: "transcription_id",
|
|
},
|
|
{
|
|
Name: "Text",
|
|
SchemaName: "text",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateTranscribedAudio) SetFlags() {
|
|
if !(u.Pending == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateTranscribedAudio) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateTranscribedAudio#84cd5a as nil")
|
|
}
|
|
b.PutID(UpdateTranscribedAudioTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateTranscribedAudio) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateTranscribedAudio#84cd5a as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateTranscribedAudio#84cd5a: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateTranscribedAudio#84cd5a: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateTranscribedAudio#84cd5a: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
b.PutLong(u.TranscriptionID)
|
|
b.PutString(u.Text)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateTranscribedAudio) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateTranscribedAudio#84cd5a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateTranscribedAudioTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateTranscribedAudio#84cd5a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateTranscribedAudio) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateTranscribedAudio#84cd5a to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateTranscribedAudio#84cd5a: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Pending = u.Flags.Has(0)
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateTranscribedAudio#84cd5a: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateTranscribedAudio#84cd5a: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateTranscribedAudio#84cd5a: field transcription_id: %w", err)
|
|
}
|
|
u.TranscriptionID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateTranscribedAudio#84cd5a: field text: %w", err)
|
|
}
|
|
u.Text = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPending sets value of Pending conditional field.
|
|
func (u *UpdateTranscribedAudio) SetPending(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Pending = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Pending = false
|
|
}
|
|
}
|
|
|
|
// GetPending returns value of Pending conditional field.
|
|
func (u *UpdateTranscribedAudio) GetPending() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateTranscribedAudio) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateTranscribedAudio) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// GetTranscriptionID returns value of TranscriptionID field.
|
|
func (u *UpdateTranscribedAudio) GetTranscriptionID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.TranscriptionID
|
|
}
|
|
|
|
// GetText returns value of Text field.
|
|
func (u *UpdateTranscribedAudio) GetText() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Text
|
|
}
|
|
|
|
// UpdateReadFeaturedEmojiStickers represents TL type `updateReadFeaturedEmojiStickers#fb4c496c`.
|
|
// Some featured custom emoji stickers¹ were marked as read
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/custom-emoji
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadFeaturedEmojiStickers for reference.
|
|
type UpdateReadFeaturedEmojiStickers struct {
|
|
}
|
|
|
|
// UpdateReadFeaturedEmojiStickersTypeID is TL type id of UpdateReadFeaturedEmojiStickers.
|
|
const UpdateReadFeaturedEmojiStickersTypeID = 0xfb4c496c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadFeaturedEmojiStickers) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadFeaturedEmojiStickers.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadFeaturedEmojiStickers{}
|
|
_ bin.Decoder = &UpdateReadFeaturedEmojiStickers{}
|
|
_ bin.BareEncoder = &UpdateReadFeaturedEmojiStickers{}
|
|
_ bin.BareDecoder = &UpdateReadFeaturedEmojiStickers{}
|
|
|
|
_ UpdateClass = &UpdateReadFeaturedEmojiStickers{}
|
|
)
|
|
|
|
func (u *UpdateReadFeaturedEmojiStickers) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadFeaturedEmojiStickers) String() string {
|
|
if u == nil {
|
|
return "UpdateReadFeaturedEmojiStickers(nil)"
|
|
}
|
|
type Alias UpdateReadFeaturedEmojiStickers
|
|
return fmt.Sprintf("UpdateReadFeaturedEmojiStickers%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadFeaturedEmojiStickers) TypeID() uint32 {
|
|
return UpdateReadFeaturedEmojiStickersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadFeaturedEmojiStickers) TypeName() string {
|
|
return "updateReadFeaturedEmojiStickers"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadFeaturedEmojiStickers) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadFeaturedEmojiStickers",
|
|
ID: UpdateReadFeaturedEmojiStickersTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadFeaturedEmojiStickers) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadFeaturedEmojiStickers#fb4c496c as nil")
|
|
}
|
|
b.PutID(UpdateReadFeaturedEmojiStickersTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadFeaturedEmojiStickers) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadFeaturedEmojiStickers#fb4c496c as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadFeaturedEmojiStickers) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadFeaturedEmojiStickers#fb4c496c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadFeaturedEmojiStickersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadFeaturedEmojiStickers#fb4c496c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadFeaturedEmojiStickers) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadFeaturedEmojiStickers#fb4c496c to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateUserEmojiStatus represents TL type `updateUserEmojiStatus#28373599`.
|
|
// The emoji status¹ of a certain user has changed
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/emoji-status
|
|
//
|
|
// See https://core.telegram.org/constructor/updateUserEmojiStatus for reference.
|
|
type UpdateUserEmojiStatus struct {
|
|
// User ID
|
|
UserID int64
|
|
// New emoji status¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/emoji-status
|
|
EmojiStatus EmojiStatusClass
|
|
}
|
|
|
|
// UpdateUserEmojiStatusTypeID is TL type id of UpdateUserEmojiStatus.
|
|
const UpdateUserEmojiStatusTypeID = 0x28373599
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateUserEmojiStatus) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateUserEmojiStatus.
|
|
var (
|
|
_ bin.Encoder = &UpdateUserEmojiStatus{}
|
|
_ bin.Decoder = &UpdateUserEmojiStatus{}
|
|
_ bin.BareEncoder = &UpdateUserEmojiStatus{}
|
|
_ bin.BareDecoder = &UpdateUserEmojiStatus{}
|
|
|
|
_ UpdateClass = &UpdateUserEmojiStatus{}
|
|
)
|
|
|
|
func (u *UpdateUserEmojiStatus) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.EmojiStatus == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateUserEmojiStatus) String() string {
|
|
if u == nil {
|
|
return "UpdateUserEmojiStatus(nil)"
|
|
}
|
|
type Alias UpdateUserEmojiStatus
|
|
return fmt.Sprintf("UpdateUserEmojiStatus%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateUserEmojiStatus from given interface.
|
|
func (u *UpdateUserEmojiStatus) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetEmojiStatus() (value EmojiStatusClass)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.EmojiStatus = from.GetEmojiStatus()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateUserEmojiStatus) TypeID() uint32 {
|
|
return UpdateUserEmojiStatusTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateUserEmojiStatus) TypeName() string {
|
|
return "updateUserEmojiStatus"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateUserEmojiStatus) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateUserEmojiStatus",
|
|
ID: UpdateUserEmojiStatusTypeID,
|
|
}
|
|
if u == 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 (u *UpdateUserEmojiStatus) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserEmojiStatus#28373599 as nil")
|
|
}
|
|
b.PutID(UpdateUserEmojiStatusTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateUserEmojiStatus) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUserEmojiStatus#28373599 as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
if u.EmojiStatus == nil {
|
|
return fmt.Errorf("unable to encode updateUserEmojiStatus#28373599: field emoji_status is nil")
|
|
}
|
|
if err := u.EmojiStatus.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateUserEmojiStatus#28373599: field emoji_status: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateUserEmojiStatus) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserEmojiStatus#28373599 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateUserEmojiStatusTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateUserEmojiStatus#28373599: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateUserEmojiStatus) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUserEmojiStatus#28373599 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserEmojiStatus#28373599: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := DecodeEmojiStatus(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUserEmojiStatus#28373599: field emoji_status: %w", err)
|
|
}
|
|
u.EmojiStatus = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateUserEmojiStatus) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetEmojiStatus returns value of EmojiStatus field.
|
|
func (u *UpdateUserEmojiStatus) GetEmojiStatus() (value EmojiStatusClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.EmojiStatus
|
|
}
|
|
|
|
// UpdateRecentEmojiStatuses represents TL type `updateRecentEmojiStatuses#30f443db`.
|
|
// The list of recent emoji statuses¹ has changed
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/emoji-status
|
|
//
|
|
// See https://core.telegram.org/constructor/updateRecentEmojiStatuses for reference.
|
|
type UpdateRecentEmojiStatuses struct {
|
|
}
|
|
|
|
// UpdateRecentEmojiStatusesTypeID is TL type id of UpdateRecentEmojiStatuses.
|
|
const UpdateRecentEmojiStatusesTypeID = 0x30f443db
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateRecentEmojiStatuses) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateRecentEmojiStatuses.
|
|
var (
|
|
_ bin.Encoder = &UpdateRecentEmojiStatuses{}
|
|
_ bin.Decoder = &UpdateRecentEmojiStatuses{}
|
|
_ bin.BareEncoder = &UpdateRecentEmojiStatuses{}
|
|
_ bin.BareDecoder = &UpdateRecentEmojiStatuses{}
|
|
|
|
_ UpdateClass = &UpdateRecentEmojiStatuses{}
|
|
)
|
|
|
|
func (u *UpdateRecentEmojiStatuses) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateRecentEmojiStatuses) String() string {
|
|
if u == nil {
|
|
return "UpdateRecentEmojiStatuses(nil)"
|
|
}
|
|
type Alias UpdateRecentEmojiStatuses
|
|
return fmt.Sprintf("UpdateRecentEmojiStatuses%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateRecentEmojiStatuses) TypeID() uint32 {
|
|
return UpdateRecentEmojiStatusesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateRecentEmojiStatuses) TypeName() string {
|
|
return "updateRecentEmojiStatuses"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateRecentEmojiStatuses) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateRecentEmojiStatuses",
|
|
ID: UpdateRecentEmojiStatusesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateRecentEmojiStatuses) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateRecentEmojiStatuses#30f443db as nil")
|
|
}
|
|
b.PutID(UpdateRecentEmojiStatusesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateRecentEmojiStatuses) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateRecentEmojiStatuses#30f443db as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateRecentEmojiStatuses) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateRecentEmojiStatuses#30f443db to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateRecentEmojiStatusesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateRecentEmojiStatuses#30f443db: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateRecentEmojiStatuses) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateRecentEmojiStatuses#30f443db to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateRecentReactions represents TL type `updateRecentReactions#6f7863f4`.
|
|
// The list of recent message reactions¹ has changed
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/reactions
|
|
//
|
|
// See https://core.telegram.org/constructor/updateRecentReactions for reference.
|
|
type UpdateRecentReactions struct {
|
|
}
|
|
|
|
// UpdateRecentReactionsTypeID is TL type id of UpdateRecentReactions.
|
|
const UpdateRecentReactionsTypeID = 0x6f7863f4
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateRecentReactions) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateRecentReactions.
|
|
var (
|
|
_ bin.Encoder = &UpdateRecentReactions{}
|
|
_ bin.Decoder = &UpdateRecentReactions{}
|
|
_ bin.BareEncoder = &UpdateRecentReactions{}
|
|
_ bin.BareDecoder = &UpdateRecentReactions{}
|
|
|
|
_ UpdateClass = &UpdateRecentReactions{}
|
|
)
|
|
|
|
func (u *UpdateRecentReactions) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateRecentReactions) String() string {
|
|
if u == nil {
|
|
return "UpdateRecentReactions(nil)"
|
|
}
|
|
type Alias UpdateRecentReactions
|
|
return fmt.Sprintf("UpdateRecentReactions%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateRecentReactions) TypeID() uint32 {
|
|
return UpdateRecentReactionsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateRecentReactions) TypeName() string {
|
|
return "updateRecentReactions"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateRecentReactions) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateRecentReactions",
|
|
ID: UpdateRecentReactionsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateRecentReactions) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateRecentReactions#6f7863f4 as nil")
|
|
}
|
|
b.PutID(UpdateRecentReactionsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateRecentReactions) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateRecentReactions#6f7863f4 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateRecentReactions) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateRecentReactions#6f7863f4 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateRecentReactionsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateRecentReactions#6f7863f4: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateRecentReactions) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateRecentReactions#6f7863f4 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateMoveStickerSetToTop represents TL type `updateMoveStickerSetToTop#86fccf85`.
|
|
// A stickerset was just moved to top, see here for more info »¹
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stickers#recent-stickersets
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMoveStickerSetToTop for reference.
|
|
type UpdateMoveStickerSetToTop struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// This update is referring to a mask stickerset¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stickers#mask-stickers
|
|
Masks bool
|
|
// This update is referring to a custom emoji stickerset¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/custom-emoji
|
|
Emojis bool
|
|
// Stickerset¹ ID
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stickers
|
|
Stickerset int64
|
|
}
|
|
|
|
// UpdateMoveStickerSetToTopTypeID is TL type id of UpdateMoveStickerSetToTop.
|
|
const UpdateMoveStickerSetToTopTypeID = 0x86fccf85
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMoveStickerSetToTop) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMoveStickerSetToTop.
|
|
var (
|
|
_ bin.Encoder = &UpdateMoveStickerSetToTop{}
|
|
_ bin.Decoder = &UpdateMoveStickerSetToTop{}
|
|
_ bin.BareEncoder = &UpdateMoveStickerSetToTop{}
|
|
_ bin.BareDecoder = &UpdateMoveStickerSetToTop{}
|
|
|
|
_ UpdateClass = &UpdateMoveStickerSetToTop{}
|
|
)
|
|
|
|
func (u *UpdateMoveStickerSetToTop) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Masks == false) {
|
|
return false
|
|
}
|
|
if !(u.Emojis == false) {
|
|
return false
|
|
}
|
|
if !(u.Stickerset == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMoveStickerSetToTop) String() string {
|
|
if u == nil {
|
|
return "UpdateMoveStickerSetToTop(nil)"
|
|
}
|
|
type Alias UpdateMoveStickerSetToTop
|
|
return fmt.Sprintf("UpdateMoveStickerSetToTop%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMoveStickerSetToTop from given interface.
|
|
func (u *UpdateMoveStickerSetToTop) FillFrom(from interface {
|
|
GetMasks() (value bool)
|
|
GetEmojis() (value bool)
|
|
GetStickerset() (value int64)
|
|
}) {
|
|
u.Masks = from.GetMasks()
|
|
u.Emojis = from.GetEmojis()
|
|
u.Stickerset = from.GetStickerset()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMoveStickerSetToTop) TypeID() uint32 {
|
|
return UpdateMoveStickerSetToTopTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMoveStickerSetToTop) TypeName() string {
|
|
return "updateMoveStickerSetToTop"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMoveStickerSetToTop) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMoveStickerSetToTop",
|
|
ID: UpdateMoveStickerSetToTopTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Masks",
|
|
SchemaName: "masks",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Emojis",
|
|
SchemaName: "emojis",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Stickerset",
|
|
SchemaName: "stickerset",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateMoveStickerSetToTop) SetFlags() {
|
|
if !(u.Masks == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
if !(u.Emojis == false) {
|
|
u.Flags.Set(1)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMoveStickerSetToTop) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMoveStickerSetToTop#86fccf85 as nil")
|
|
}
|
|
b.PutID(UpdateMoveStickerSetToTopTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMoveStickerSetToTop) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMoveStickerSetToTop#86fccf85 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMoveStickerSetToTop#86fccf85: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.Stickerset)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMoveStickerSetToTop) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMoveStickerSetToTop#86fccf85 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMoveStickerSetToTopTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMoveStickerSetToTop#86fccf85: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMoveStickerSetToTop) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMoveStickerSetToTop#86fccf85 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMoveStickerSetToTop#86fccf85: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Masks = u.Flags.Has(0)
|
|
u.Emojis = u.Flags.Has(1)
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMoveStickerSetToTop#86fccf85: field stickerset: %w", err)
|
|
}
|
|
u.Stickerset = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetMasks sets value of Masks conditional field.
|
|
func (u *UpdateMoveStickerSetToTop) SetMasks(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Masks = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Masks = false
|
|
}
|
|
}
|
|
|
|
// GetMasks returns value of Masks conditional field.
|
|
func (u *UpdateMoveStickerSetToTop) GetMasks() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// SetEmojis sets value of Emojis conditional field.
|
|
func (u *UpdateMoveStickerSetToTop) SetEmojis(value bool) {
|
|
if value {
|
|
u.Flags.Set(1)
|
|
u.Emojis = true
|
|
} else {
|
|
u.Flags.Unset(1)
|
|
u.Emojis = false
|
|
}
|
|
}
|
|
|
|
// GetEmojis returns value of Emojis conditional field.
|
|
func (u *UpdateMoveStickerSetToTop) GetEmojis() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(1)
|
|
}
|
|
|
|
// GetStickerset returns value of Stickerset field.
|
|
func (u *UpdateMoveStickerSetToTop) GetStickerset() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Stickerset
|
|
}
|
|
|
|
// UpdateMessageExtendedMedia represents TL type `updateMessageExtendedMedia#d5a41724`.
|
|
// You bought a paid media »¹: this update contains the revealed media.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/paid-media
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMessageExtendedMedia for reference.
|
|
type UpdateMessageExtendedMedia struct {
|
|
// Peer where the paid media was posted
|
|
Peer PeerClass
|
|
// ID of the message containing the paid media
|
|
MsgID int
|
|
// Revealed media, contains only messageExtendedMedia¹ constructors.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/messageExtendedMedia
|
|
ExtendedMedia []MessageExtendedMediaClass
|
|
}
|
|
|
|
// UpdateMessageExtendedMediaTypeID is TL type id of UpdateMessageExtendedMedia.
|
|
const UpdateMessageExtendedMediaTypeID = 0xd5a41724
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMessageExtendedMedia) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMessageExtendedMedia.
|
|
var (
|
|
_ bin.Encoder = &UpdateMessageExtendedMedia{}
|
|
_ bin.Decoder = &UpdateMessageExtendedMedia{}
|
|
_ bin.BareEncoder = &UpdateMessageExtendedMedia{}
|
|
_ bin.BareDecoder = &UpdateMessageExtendedMedia{}
|
|
|
|
_ UpdateClass = &UpdateMessageExtendedMedia{}
|
|
)
|
|
|
|
func (u *UpdateMessageExtendedMedia) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ExtendedMedia == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMessageExtendedMedia) String() string {
|
|
if u == nil {
|
|
return "UpdateMessageExtendedMedia(nil)"
|
|
}
|
|
type Alias UpdateMessageExtendedMedia
|
|
return fmt.Sprintf("UpdateMessageExtendedMedia%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMessageExtendedMedia from given interface.
|
|
func (u *UpdateMessageExtendedMedia) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
GetExtendedMedia() (value []MessageExtendedMediaClass)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
u.ExtendedMedia = from.GetExtendedMedia()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMessageExtendedMedia) TypeID() uint32 {
|
|
return UpdateMessageExtendedMediaTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMessageExtendedMedia) TypeName() string {
|
|
return "updateMessageExtendedMedia"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMessageExtendedMedia) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMessageExtendedMedia",
|
|
ID: UpdateMessageExtendedMediaTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "ExtendedMedia",
|
|
SchemaName: "extended_media",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMessageExtendedMedia) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessageExtendedMedia#d5a41724 as nil")
|
|
}
|
|
b.PutID(UpdateMessageExtendedMediaTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMessageExtendedMedia) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMessageExtendedMedia#d5a41724 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
b.PutVectorHeader(len(u.ExtendedMedia))
|
|
for idx, v := range u.ExtendedMedia {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field extended_media element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMessageExtendedMedia#d5a41724: field extended_media element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMessageExtendedMedia) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessageExtendedMedia#d5a41724 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMessageExtendedMediaTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMessageExtendedMedia) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMessageExtendedMedia#d5a41724 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field extended_media: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.ExtendedMedia = make([]MessageExtendedMediaClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeMessageExtendedMedia(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMessageExtendedMedia#d5a41724: field extended_media: %w", err)
|
|
}
|
|
u.ExtendedMedia = append(u.ExtendedMedia, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateMessageExtendedMedia) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateMessageExtendedMedia) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// GetExtendedMedia returns value of ExtendedMedia field.
|
|
func (u *UpdateMessageExtendedMedia) GetExtendedMedia() (value []MessageExtendedMediaClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ExtendedMedia
|
|
}
|
|
|
|
// MapExtendedMedia returns field ExtendedMedia wrapped in MessageExtendedMediaClassArray helper.
|
|
func (u *UpdateMessageExtendedMedia) MapExtendedMedia() (value MessageExtendedMediaClassArray) {
|
|
return MessageExtendedMediaClassArray(u.ExtendedMedia)
|
|
}
|
|
|
|
// UpdateUser represents TL type `updateUser#20529438`.
|
|
// User (user¹ and/or userFull²) information was updated.
|
|
// This update can only be received through getDifference or in
|
|
// updates¹/updatesCombined² constructors, so it will always come bundled with the
|
|
// updated user³, that should be applied as usual »⁴, without re-fetching the info
|
|
// manually.
|
|
// However, full peer information will not come bundled in updates, so the full peer
|
|
// cache (userFull¹) must be invalidated for user_id when receiving this update.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/constructor/user
|
|
// 2. https://core.telegram.org/constructor/userFull
|
|
// 3. https://core.telegram.org/constructor/updates
|
|
// 4. https://core.telegram.org/constructor/updatesCombined
|
|
// 5. https://core.telegram.org/constructor/user
|
|
// 6. https://core.telegram.org/api/peers
|
|
// 7. https://core.telegram.org/constructor/userFull
|
|
//
|
|
// See https://core.telegram.org/constructor/updateUser for reference.
|
|
type UpdateUser struct {
|
|
// User ID
|
|
UserID int64
|
|
}
|
|
|
|
// UpdateUserTypeID is TL type id of UpdateUser.
|
|
const UpdateUserTypeID = 0x20529438
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateUser) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateUser.
|
|
var (
|
|
_ bin.Encoder = &UpdateUser{}
|
|
_ bin.Decoder = &UpdateUser{}
|
|
_ bin.BareEncoder = &UpdateUser{}
|
|
_ bin.BareDecoder = &UpdateUser{}
|
|
|
|
_ UpdateClass = &UpdateUser{}
|
|
)
|
|
|
|
func (u *UpdateUser) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateUser) String() string {
|
|
if u == nil {
|
|
return "UpdateUser(nil)"
|
|
}
|
|
type Alias UpdateUser
|
|
return fmt.Sprintf("UpdateUser%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateUser from given interface.
|
|
func (u *UpdateUser) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateUser) TypeID() uint32 {
|
|
return UpdateUserTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateUser) TypeName() string {
|
|
return "updateUser"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateUser) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateUser",
|
|
ID: UpdateUserTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateUser) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUser#20529438 as nil")
|
|
}
|
|
b.PutID(UpdateUserTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateUser) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateUser#20529438 as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateUser) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUser#20529438 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateUserTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateUser#20529438: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateUser) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateUser#20529438 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateUser#20529438: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateUser) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// UpdateAutoSaveSettings represents TL type `updateAutoSaveSettings#ec05b097`.
|
|
// Media autosave settings have changed and must be refetched using account
|
|
// getAutoSaveSettings¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/account.getAutoSaveSettings
|
|
//
|
|
// See https://core.telegram.org/constructor/updateAutoSaveSettings for reference.
|
|
type UpdateAutoSaveSettings struct {
|
|
}
|
|
|
|
// UpdateAutoSaveSettingsTypeID is TL type id of UpdateAutoSaveSettings.
|
|
const UpdateAutoSaveSettingsTypeID = 0xec05b097
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateAutoSaveSettings) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateAutoSaveSettings.
|
|
var (
|
|
_ bin.Encoder = &UpdateAutoSaveSettings{}
|
|
_ bin.Decoder = &UpdateAutoSaveSettings{}
|
|
_ bin.BareEncoder = &UpdateAutoSaveSettings{}
|
|
_ bin.BareDecoder = &UpdateAutoSaveSettings{}
|
|
|
|
_ UpdateClass = &UpdateAutoSaveSettings{}
|
|
)
|
|
|
|
func (u *UpdateAutoSaveSettings) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateAutoSaveSettings) String() string {
|
|
if u == nil {
|
|
return "UpdateAutoSaveSettings(nil)"
|
|
}
|
|
type Alias UpdateAutoSaveSettings
|
|
return fmt.Sprintf("UpdateAutoSaveSettings%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateAutoSaveSettings) TypeID() uint32 {
|
|
return UpdateAutoSaveSettingsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateAutoSaveSettings) TypeName() string {
|
|
return "updateAutoSaveSettings"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateAutoSaveSettings) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateAutoSaveSettings",
|
|
ID: UpdateAutoSaveSettingsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateAutoSaveSettings) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateAutoSaveSettings#ec05b097 as nil")
|
|
}
|
|
b.PutID(UpdateAutoSaveSettingsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateAutoSaveSettings) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateAutoSaveSettings#ec05b097 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateAutoSaveSettings) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateAutoSaveSettings#ec05b097 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateAutoSaveSettingsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateAutoSaveSettings#ec05b097: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateAutoSaveSettings) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateAutoSaveSettings#ec05b097 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateStory represents TL type `updateStory#75b3b798`.
|
|
// A new story was posted.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStory for reference.
|
|
type UpdateStory struct {
|
|
// ID of the poster.
|
|
Peer PeerClass
|
|
// The story that was posted.
|
|
Story StoryItemClass
|
|
}
|
|
|
|
// UpdateStoryTypeID is TL type id of UpdateStory.
|
|
const UpdateStoryTypeID = 0x75b3b798
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStory) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStory.
|
|
var (
|
|
_ bin.Encoder = &UpdateStory{}
|
|
_ bin.Decoder = &UpdateStory{}
|
|
_ bin.BareEncoder = &UpdateStory{}
|
|
_ bin.BareDecoder = &UpdateStory{}
|
|
|
|
_ UpdateClass = &UpdateStory{}
|
|
)
|
|
|
|
func (u *UpdateStory) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Story == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStory) String() string {
|
|
if u == nil {
|
|
return "UpdateStory(nil)"
|
|
}
|
|
type Alias UpdateStory
|
|
return fmt.Sprintf("UpdateStory%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStory from given interface.
|
|
func (u *UpdateStory) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetStory() (value StoryItemClass)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.Story = from.GetStory()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStory) TypeID() uint32 {
|
|
return UpdateStoryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStory) TypeName() string {
|
|
return "updateStory"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStory) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStory",
|
|
ID: UpdateStoryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Story",
|
|
SchemaName: "story",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStory) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStory#75b3b798 as nil")
|
|
}
|
|
b.PutID(UpdateStoryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStory) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStory#75b3b798 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateStory#75b3b798: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStory#75b3b798: field peer: %w", err)
|
|
}
|
|
if u.Story == nil {
|
|
return fmt.Errorf("unable to encode updateStory#75b3b798: field story is nil")
|
|
}
|
|
if err := u.Story.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStory#75b3b798: field story: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStory) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStory#75b3b798 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStoryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStory#75b3b798: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStory) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStory#75b3b798 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStory#75b3b798: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := DecodeStoryItem(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStory#75b3b798: field story: %w", err)
|
|
}
|
|
u.Story = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateStory) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetStory returns value of Story field.
|
|
func (u *UpdateStory) GetStory() (value StoryItemClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Story
|
|
}
|
|
|
|
// UpdateReadStories represents TL type `updateReadStories#f74e932b`.
|
|
// Stories of a specific peer were marked as read.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadStories for reference.
|
|
type UpdateReadStories struct {
|
|
// The peer
|
|
Peer PeerClass
|
|
// ID of the last story that was marked as read
|
|
MaxID int
|
|
}
|
|
|
|
// UpdateReadStoriesTypeID is TL type id of UpdateReadStories.
|
|
const UpdateReadStoriesTypeID = 0xf74e932b
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadStories) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadStories.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadStories{}
|
|
_ bin.Decoder = &UpdateReadStories{}
|
|
_ bin.BareEncoder = &UpdateReadStories{}
|
|
_ bin.BareDecoder = &UpdateReadStories{}
|
|
|
|
_ UpdateClass = &UpdateReadStories{}
|
|
)
|
|
|
|
func (u *UpdateReadStories) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MaxID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadStories) String() string {
|
|
if u == nil {
|
|
return "UpdateReadStories(nil)"
|
|
}
|
|
type Alias UpdateReadStories
|
|
return fmt.Sprintf("UpdateReadStories%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadStories from given interface.
|
|
func (u *UpdateReadStories) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMaxID() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MaxID = from.GetMaxID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadStories) TypeID() uint32 {
|
|
return UpdateReadStoriesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadStories) TypeName() string {
|
|
return "updateReadStories"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadStories) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadStories",
|
|
ID: UpdateReadStoriesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MaxID",
|
|
SchemaName: "max_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadStories) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadStories#f74e932b as nil")
|
|
}
|
|
b.PutID(UpdateReadStoriesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadStories) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadStories#f74e932b as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateReadStories#f74e932b: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadStories#f74e932b: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MaxID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadStories) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadStories#f74e932b to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadStoriesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadStories#f74e932b: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadStories) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadStories#f74e932b to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadStories#f74e932b: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadStories#f74e932b: field max_id: %w", err)
|
|
}
|
|
u.MaxID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateReadStories) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMaxID returns value of MaxID field.
|
|
func (u *UpdateReadStories) GetMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MaxID
|
|
}
|
|
|
|
// UpdateStoryID represents TL type `updateStoryID#1bf335b9`.
|
|
// A story was successfully uploaded.
|
|
// Once a story is successfully uploaded, an updateStoryID¹ will be returned, indicating
|
|
// the story ID (id) that was attributed to the story (like for messages, random_id
|
|
// indicates the random_id that was passed to stories.sendStory²: this way, you can tell
|
|
// which story was assigned a specific id by checking which stories.sendStory³ call has
|
|
// the returned random_id).
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/constructor/updateStoryID
|
|
// 2. https://core.telegram.org/method/stories.sendStory
|
|
// 3. https://core.telegram.org/method/stories.sendStory
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStoryID for reference.
|
|
type UpdateStoryID struct {
|
|
// The id that was attributed to the story.
|
|
ID int
|
|
// The random_id that was passed to stories.sendStory¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/method/stories.sendStory
|
|
RandomID int64
|
|
}
|
|
|
|
// UpdateStoryIDTypeID is TL type id of UpdateStoryID.
|
|
const UpdateStoryIDTypeID = 0x1bf335b9
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStoryID) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStoryID.
|
|
var (
|
|
_ bin.Encoder = &UpdateStoryID{}
|
|
_ bin.Decoder = &UpdateStoryID{}
|
|
_ bin.BareEncoder = &UpdateStoryID{}
|
|
_ bin.BareDecoder = &UpdateStoryID{}
|
|
|
|
_ UpdateClass = &UpdateStoryID{}
|
|
)
|
|
|
|
func (u *UpdateStoryID) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ID == 0) {
|
|
return false
|
|
}
|
|
if !(u.RandomID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStoryID) String() string {
|
|
if u == nil {
|
|
return "UpdateStoryID(nil)"
|
|
}
|
|
type Alias UpdateStoryID
|
|
return fmt.Sprintf("UpdateStoryID%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStoryID from given interface.
|
|
func (u *UpdateStoryID) FillFrom(from interface {
|
|
GetID() (value int)
|
|
GetRandomID() (value int64)
|
|
}) {
|
|
u.ID = from.GetID()
|
|
u.RandomID = from.GetRandomID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStoryID) TypeID() uint32 {
|
|
return UpdateStoryIDTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStoryID) TypeName() string {
|
|
return "updateStoryID"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStoryID) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStoryID",
|
|
ID: UpdateStoryIDTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "RandomID",
|
|
SchemaName: "random_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStoryID) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStoryID#1bf335b9 as nil")
|
|
}
|
|
b.PutID(UpdateStoryIDTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStoryID) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStoryID#1bf335b9 as nil")
|
|
}
|
|
b.PutInt(u.ID)
|
|
b.PutLong(u.RandomID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStoryID) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStoryID#1bf335b9 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStoryIDTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStoryID#1bf335b9: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStoryID) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStoryID#1bf335b9 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStoryID#1bf335b9: field id: %w", err)
|
|
}
|
|
u.ID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStoryID#1bf335b9: field random_id: %w", err)
|
|
}
|
|
u.RandomID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (u *UpdateStoryID) GetID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ID
|
|
}
|
|
|
|
// GetRandomID returns value of RandomID field.
|
|
func (u *UpdateStoryID) GetRandomID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.RandomID
|
|
}
|
|
|
|
// UpdateStoriesStealthMode represents TL type `updateStoriesStealthMode#2c084dc1`.
|
|
// Indicates that stories stealth mode¹ was activated.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories#stealth-mode
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStoriesStealthMode for reference.
|
|
type UpdateStoriesStealthMode struct {
|
|
// Information about the current stealth mode¹ session.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stories#stealth-mode
|
|
StealthMode StoriesStealthMode
|
|
}
|
|
|
|
// UpdateStoriesStealthModeTypeID is TL type id of UpdateStoriesStealthMode.
|
|
const UpdateStoriesStealthModeTypeID = 0x2c084dc1
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStoriesStealthMode) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStoriesStealthMode.
|
|
var (
|
|
_ bin.Encoder = &UpdateStoriesStealthMode{}
|
|
_ bin.Decoder = &UpdateStoriesStealthMode{}
|
|
_ bin.BareEncoder = &UpdateStoriesStealthMode{}
|
|
_ bin.BareDecoder = &UpdateStoriesStealthMode{}
|
|
|
|
_ UpdateClass = &UpdateStoriesStealthMode{}
|
|
)
|
|
|
|
func (u *UpdateStoriesStealthMode) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.StealthMode.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStoriesStealthMode) String() string {
|
|
if u == nil {
|
|
return "UpdateStoriesStealthMode(nil)"
|
|
}
|
|
type Alias UpdateStoriesStealthMode
|
|
return fmt.Sprintf("UpdateStoriesStealthMode%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStoriesStealthMode from given interface.
|
|
func (u *UpdateStoriesStealthMode) FillFrom(from interface {
|
|
GetStealthMode() (value StoriesStealthMode)
|
|
}) {
|
|
u.StealthMode = from.GetStealthMode()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStoriesStealthMode) TypeID() uint32 {
|
|
return UpdateStoriesStealthModeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStoriesStealthMode) TypeName() string {
|
|
return "updateStoriesStealthMode"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStoriesStealthMode) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStoriesStealthMode",
|
|
ID: UpdateStoriesStealthModeTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "StealthMode",
|
|
SchemaName: "stealth_mode",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStoriesStealthMode) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStoriesStealthMode#2c084dc1 as nil")
|
|
}
|
|
b.PutID(UpdateStoriesStealthModeTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStoriesStealthMode) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStoriesStealthMode#2c084dc1 as nil")
|
|
}
|
|
if err := u.StealthMode.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStoriesStealthMode#2c084dc1: field stealth_mode: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStoriesStealthMode) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStoriesStealthMode#2c084dc1 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStoriesStealthModeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStoriesStealthMode#2c084dc1: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStoriesStealthMode) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStoriesStealthMode#2c084dc1 to nil")
|
|
}
|
|
{
|
|
if err := u.StealthMode.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateStoriesStealthMode#2c084dc1: field stealth_mode: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetStealthMode returns value of StealthMode field.
|
|
func (u *UpdateStoriesStealthMode) GetStealthMode() (value StoriesStealthMode) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.StealthMode
|
|
}
|
|
|
|
// UpdateSentStoryReaction represents TL type `updateSentStoryReaction#7d627683`.
|
|
// Indicates we reacted to a story »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stories#reactions
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSentStoryReaction for reference.
|
|
type UpdateSentStoryReaction struct {
|
|
// The peer that sent the story
|
|
Peer PeerClass
|
|
// ID of the story we reacted to
|
|
StoryID int
|
|
// The reaction that was sent
|
|
Reaction ReactionClass
|
|
}
|
|
|
|
// UpdateSentStoryReactionTypeID is TL type id of UpdateSentStoryReaction.
|
|
const UpdateSentStoryReactionTypeID = 0x7d627683
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSentStoryReaction) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSentStoryReaction.
|
|
var (
|
|
_ bin.Encoder = &UpdateSentStoryReaction{}
|
|
_ bin.Decoder = &UpdateSentStoryReaction{}
|
|
_ bin.BareEncoder = &UpdateSentStoryReaction{}
|
|
_ bin.BareDecoder = &UpdateSentStoryReaction{}
|
|
|
|
_ UpdateClass = &UpdateSentStoryReaction{}
|
|
)
|
|
|
|
func (u *UpdateSentStoryReaction) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.StoryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Reaction == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSentStoryReaction) String() string {
|
|
if u == nil {
|
|
return "UpdateSentStoryReaction(nil)"
|
|
}
|
|
type Alias UpdateSentStoryReaction
|
|
return fmt.Sprintf("UpdateSentStoryReaction%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateSentStoryReaction from given interface.
|
|
func (u *UpdateSentStoryReaction) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetStoryID() (value int)
|
|
GetReaction() (value ReactionClass)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.StoryID = from.GetStoryID()
|
|
u.Reaction = from.GetReaction()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSentStoryReaction) TypeID() uint32 {
|
|
return UpdateSentStoryReactionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSentStoryReaction) TypeName() string {
|
|
return "updateSentStoryReaction"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSentStoryReaction) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSentStoryReaction",
|
|
ID: UpdateSentStoryReactionTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "StoryID",
|
|
SchemaName: "story_id",
|
|
},
|
|
{
|
|
Name: "Reaction",
|
|
SchemaName: "reaction",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSentStoryReaction) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSentStoryReaction#7d627683 as nil")
|
|
}
|
|
b.PutID(UpdateSentStoryReactionTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSentStoryReaction) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSentStoryReaction#7d627683 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateSentStoryReaction#7d627683: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateSentStoryReaction#7d627683: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.StoryID)
|
|
if u.Reaction == nil {
|
|
return fmt.Errorf("unable to encode updateSentStoryReaction#7d627683: field reaction is nil")
|
|
}
|
|
if err := u.Reaction.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateSentStoryReaction#7d627683: field reaction: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSentStoryReaction) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSentStoryReaction#7d627683 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSentStoryReactionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSentStoryReaction#7d627683: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSentStoryReaction) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSentStoryReaction#7d627683 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateSentStoryReaction#7d627683: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateSentStoryReaction#7d627683: field story_id: %w", err)
|
|
}
|
|
u.StoryID = value
|
|
}
|
|
{
|
|
value, err := DecodeReaction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateSentStoryReaction#7d627683: field reaction: %w", err)
|
|
}
|
|
u.Reaction = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateSentStoryReaction) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetStoryID returns value of StoryID field.
|
|
func (u *UpdateSentStoryReaction) GetStoryID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.StoryID
|
|
}
|
|
|
|
// GetReaction returns value of Reaction field.
|
|
func (u *UpdateSentStoryReaction) GetReaction() (value ReactionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Reaction
|
|
}
|
|
|
|
// UpdateBotChatBoost represents TL type `updateBotChatBoost#904dd49c`.
|
|
// A channel/supergroup boost¹ has changed (bots only)
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/boost
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotChatBoost for reference.
|
|
type UpdateBotChatBoost struct {
|
|
// Channel
|
|
Peer PeerClass
|
|
// New boost information
|
|
Boost Boost
|
|
// QTS¹ event sequence identifier
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotChatBoostTypeID is TL type id of UpdateBotChatBoost.
|
|
const UpdateBotChatBoostTypeID = 0x904dd49c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotChatBoost) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotChatBoost.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotChatBoost{}
|
|
_ bin.Decoder = &UpdateBotChatBoost{}
|
|
_ bin.BareEncoder = &UpdateBotChatBoost{}
|
|
_ bin.BareDecoder = &UpdateBotChatBoost{}
|
|
|
|
_ UpdateClass = &UpdateBotChatBoost{}
|
|
)
|
|
|
|
func (u *UpdateBotChatBoost) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Boost.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotChatBoost) String() string {
|
|
if u == nil {
|
|
return "UpdateBotChatBoost(nil)"
|
|
}
|
|
type Alias UpdateBotChatBoost
|
|
return fmt.Sprintf("UpdateBotChatBoost%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotChatBoost from given interface.
|
|
func (u *UpdateBotChatBoost) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetBoost() (value Boost)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.Boost = from.GetBoost()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotChatBoost) TypeID() uint32 {
|
|
return UpdateBotChatBoostTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotChatBoost) TypeName() string {
|
|
return "updateBotChatBoost"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotChatBoost) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotChatBoost",
|
|
ID: UpdateBotChatBoostTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Boost",
|
|
SchemaName: "boost",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotChatBoost) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotChatBoost#904dd49c as nil")
|
|
}
|
|
b.PutID(UpdateBotChatBoostTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotChatBoost) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotChatBoost#904dd49c as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotChatBoost#904dd49c: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotChatBoost#904dd49c: field peer: %w", err)
|
|
}
|
|
if err := u.Boost.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotChatBoost#904dd49c: field boost: %w", err)
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotChatBoost) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotChatBoost#904dd49c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotChatBoostTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotChatBoost) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotChatBoost#904dd49c to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
if err := u.Boost.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: field boost: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotChatBoost#904dd49c: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotChatBoost) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetBoost returns value of Boost field.
|
|
func (u *UpdateBotChatBoost) GetBoost() (value Boost) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Boost
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotChatBoost) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateChannelViewForumAsMessages represents TL type `updateChannelViewForumAsMessages#7b68920`.
|
|
// Users may also choose to display messages from all topics as if they were sent to a
|
|
// normal group, using a "View as messages" setting in the local client.
|
|
// This setting only affects the current account, and is synced to other logged in
|
|
// sessions using the channels.toggleViewForumAsMessages¹ method; invoking this method
|
|
// will update the value of the view_forum_as_messages flag of channelFull² or dialog³
|
|
// and emit an updateChannelViewForumAsMessages⁴.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/method/channels.toggleViewForumAsMessages
|
|
// 2. https://core.telegram.org/constructor/channelFull
|
|
// 3. https://core.telegram.org/constructor/dialog
|
|
// 4. https://core.telegram.org/constructor/updateChannelViewForumAsMessages
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChannelViewForumAsMessages for reference.
|
|
type UpdateChannelViewForumAsMessages struct {
|
|
// The forum ID
|
|
ChannelID int64
|
|
// The new value of the toggle.
|
|
Enabled bool
|
|
}
|
|
|
|
// UpdateChannelViewForumAsMessagesTypeID is TL type id of UpdateChannelViewForumAsMessages.
|
|
const UpdateChannelViewForumAsMessagesTypeID = 0x7b68920
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChannelViewForumAsMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChannelViewForumAsMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateChannelViewForumAsMessages{}
|
|
_ bin.Decoder = &UpdateChannelViewForumAsMessages{}
|
|
_ bin.BareEncoder = &UpdateChannelViewForumAsMessages{}
|
|
_ bin.BareDecoder = &UpdateChannelViewForumAsMessages{}
|
|
|
|
_ UpdateClass = &UpdateChannelViewForumAsMessages{}
|
|
)
|
|
|
|
func (u *UpdateChannelViewForumAsMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Enabled == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChannelViewForumAsMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateChannelViewForumAsMessages(nil)"
|
|
}
|
|
type Alias UpdateChannelViewForumAsMessages
|
|
return fmt.Sprintf("UpdateChannelViewForumAsMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChannelViewForumAsMessages from given interface.
|
|
func (u *UpdateChannelViewForumAsMessages) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetEnabled() (value bool)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.Enabled = from.GetEnabled()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChannelViewForumAsMessages) TypeID() uint32 {
|
|
return UpdateChannelViewForumAsMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChannelViewForumAsMessages) TypeName() string {
|
|
return "updateChannelViewForumAsMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChannelViewForumAsMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChannelViewForumAsMessages",
|
|
ID: UpdateChannelViewForumAsMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "Enabled",
|
|
SchemaName: "enabled",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChannelViewForumAsMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelViewForumAsMessages#7b68920 as nil")
|
|
}
|
|
b.PutID(UpdateChannelViewForumAsMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChannelViewForumAsMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChannelViewForumAsMessages#7b68920 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
b.PutBool(u.Enabled)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChannelViewForumAsMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelViewForumAsMessages#7b68920 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChannelViewForumAsMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelViewForumAsMessages#7b68920: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChannelViewForumAsMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChannelViewForumAsMessages#7b68920 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelViewForumAsMessages#7b68920: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChannelViewForumAsMessages#7b68920: field enabled: %w", err)
|
|
}
|
|
u.Enabled = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateChannelViewForumAsMessages) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetEnabled returns value of Enabled field.
|
|
func (u *UpdateChannelViewForumAsMessages) GetEnabled() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Enabled
|
|
}
|
|
|
|
// UpdatePeerWallpaper represents TL type `updatePeerWallpaper#ae3f101d`.
|
|
// The wallpaper »¹ of a given peer has changed.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/wallpapers
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePeerWallpaper for reference.
|
|
type UpdatePeerWallpaper struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the other user has chosen a custom wallpaper for us using messages
|
|
// setChatWallPaper¹ and the for_both flag, see here »² for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/method/messages.setChatWallPaper
|
|
// 2) https://core.telegram.org/api/wallpapers#installing-wallpapers-in-a-specific-chat-or-channel
|
|
WallpaperOverridden bool
|
|
// The peer where the wallpaper has changed.
|
|
Peer PeerClass
|
|
// The new wallpaper, if none the wallpaper was removed and the default wallpaper should
|
|
// be used.
|
|
//
|
|
// Use SetWallpaper and GetWallpaper helpers.
|
|
Wallpaper WallPaperClass
|
|
}
|
|
|
|
// UpdatePeerWallpaperTypeID is TL type id of UpdatePeerWallpaper.
|
|
const UpdatePeerWallpaperTypeID = 0xae3f101d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePeerWallpaper) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePeerWallpaper.
|
|
var (
|
|
_ bin.Encoder = &UpdatePeerWallpaper{}
|
|
_ bin.Decoder = &UpdatePeerWallpaper{}
|
|
_ bin.BareEncoder = &UpdatePeerWallpaper{}
|
|
_ bin.BareDecoder = &UpdatePeerWallpaper{}
|
|
|
|
_ UpdateClass = &UpdatePeerWallpaper{}
|
|
)
|
|
|
|
func (u *UpdatePeerWallpaper) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.WallpaperOverridden == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Wallpaper == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePeerWallpaper) String() string {
|
|
if u == nil {
|
|
return "UpdatePeerWallpaper(nil)"
|
|
}
|
|
type Alias UpdatePeerWallpaper
|
|
return fmt.Sprintf("UpdatePeerWallpaper%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePeerWallpaper from given interface.
|
|
func (u *UpdatePeerWallpaper) FillFrom(from interface {
|
|
GetWallpaperOverridden() (value bool)
|
|
GetPeer() (value PeerClass)
|
|
GetWallpaper() (value WallPaperClass, ok bool)
|
|
}) {
|
|
u.WallpaperOverridden = from.GetWallpaperOverridden()
|
|
u.Peer = from.GetPeer()
|
|
if val, ok := from.GetWallpaper(); ok {
|
|
u.Wallpaper = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePeerWallpaper) TypeID() uint32 {
|
|
return UpdatePeerWallpaperTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePeerWallpaper) TypeName() string {
|
|
return "updatePeerWallpaper"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePeerWallpaper) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePeerWallpaper",
|
|
ID: UpdatePeerWallpaperTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "WallpaperOverridden",
|
|
SchemaName: "wallpaper_overridden",
|
|
Null: !u.Flags.Has(1),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Wallpaper",
|
|
SchemaName: "wallpaper",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePeerWallpaper) SetFlags() {
|
|
if !(u.WallpaperOverridden == false) {
|
|
u.Flags.Set(1)
|
|
}
|
|
if !(u.Wallpaper == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePeerWallpaper) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerWallpaper#ae3f101d as nil")
|
|
}
|
|
b.PutID(UpdatePeerWallpaperTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePeerWallpaper) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePeerWallpaper#ae3f101d as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field peer: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
if u.Wallpaper == nil {
|
|
return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field wallpaper is nil")
|
|
}
|
|
if err := u.Wallpaper.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePeerWallpaper#ae3f101d: field wallpaper: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePeerWallpaper) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerWallpaper#ae3f101d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePeerWallpaperTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePeerWallpaper) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePeerWallpaper#ae3f101d to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: field flags: %w", err)
|
|
}
|
|
}
|
|
u.WallpaperOverridden = u.Flags.Has(1)
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeWallPaper(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePeerWallpaper#ae3f101d: field wallpaper: %w", err)
|
|
}
|
|
u.Wallpaper = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetWallpaperOverridden sets value of WallpaperOverridden conditional field.
|
|
func (u *UpdatePeerWallpaper) SetWallpaperOverridden(value bool) {
|
|
if value {
|
|
u.Flags.Set(1)
|
|
u.WallpaperOverridden = true
|
|
} else {
|
|
u.Flags.Unset(1)
|
|
u.WallpaperOverridden = false
|
|
}
|
|
}
|
|
|
|
// GetWallpaperOverridden returns value of WallpaperOverridden conditional field.
|
|
func (u *UpdatePeerWallpaper) GetWallpaperOverridden() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(1)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePeerWallpaper) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// SetWallpaper sets value of Wallpaper conditional field.
|
|
func (u *UpdatePeerWallpaper) SetWallpaper(value WallPaperClass) {
|
|
u.Flags.Set(0)
|
|
u.Wallpaper = value
|
|
}
|
|
|
|
// GetWallpaper returns value of Wallpaper conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdatePeerWallpaper) GetWallpaper() (value WallPaperClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Wallpaper, true
|
|
}
|
|
|
|
// UpdateBotMessageReaction represents TL type `updateBotMessageReaction#ac21d3ce`.
|
|
// Bots only: a user has changed their reactions on a message with public reactions.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotMessageReaction for reference.
|
|
type UpdateBotMessageReaction struct {
|
|
// Peer of the reacted-to message.
|
|
Peer PeerClass
|
|
// ID of the reacted-to message.
|
|
MsgID int
|
|
// Date of the change.
|
|
Date int
|
|
// The user that (un)reacted to the message.
|
|
Actor PeerClass
|
|
// Old reactions
|
|
OldReactions []ReactionClass
|
|
// New reactions
|
|
NewReactions []ReactionClass
|
|
// QTS¹ event sequence identifier
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotMessageReactionTypeID is TL type id of UpdateBotMessageReaction.
|
|
const UpdateBotMessageReactionTypeID = 0xac21d3ce
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotMessageReaction) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotMessageReaction.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotMessageReaction{}
|
|
_ bin.Decoder = &UpdateBotMessageReaction{}
|
|
_ bin.BareEncoder = &UpdateBotMessageReaction{}
|
|
_ bin.BareDecoder = &UpdateBotMessageReaction{}
|
|
|
|
_ UpdateClass = &UpdateBotMessageReaction{}
|
|
)
|
|
|
|
func (u *UpdateBotMessageReaction) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.Actor == nil) {
|
|
return false
|
|
}
|
|
if !(u.OldReactions == nil) {
|
|
return false
|
|
}
|
|
if !(u.NewReactions == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotMessageReaction) String() string {
|
|
if u == nil {
|
|
return "UpdateBotMessageReaction(nil)"
|
|
}
|
|
type Alias UpdateBotMessageReaction
|
|
return fmt.Sprintf("UpdateBotMessageReaction%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotMessageReaction from given interface.
|
|
func (u *UpdateBotMessageReaction) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
GetDate() (value int)
|
|
GetActor() (value PeerClass)
|
|
GetOldReactions() (value []ReactionClass)
|
|
GetNewReactions() (value []ReactionClass)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
u.Date = from.GetDate()
|
|
u.Actor = from.GetActor()
|
|
u.OldReactions = from.GetOldReactions()
|
|
u.NewReactions = from.GetNewReactions()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotMessageReaction) TypeID() uint32 {
|
|
return UpdateBotMessageReactionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotMessageReaction) TypeName() string {
|
|
return "updateBotMessageReaction"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotMessageReaction) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotMessageReaction",
|
|
ID: UpdateBotMessageReactionTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "Actor",
|
|
SchemaName: "actor",
|
|
},
|
|
{
|
|
Name: "OldReactions",
|
|
SchemaName: "old_reactions",
|
|
},
|
|
{
|
|
Name: "NewReactions",
|
|
SchemaName: "new_reactions",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotMessageReaction) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotMessageReaction#ac21d3ce as nil")
|
|
}
|
|
b.PutID(UpdateBotMessageReactionTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotMessageReaction) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotMessageReaction#ac21d3ce as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
b.PutInt(u.Date)
|
|
if u.Actor == nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field actor is nil")
|
|
}
|
|
if err := u.Actor.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field actor: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.OldReactions))
|
|
for idx, v := range u.OldReactions {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field old_reactions element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field old_reactions element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutVectorHeader(len(u.NewReactions))
|
|
for idx, v := range u.NewReactions {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field new_reactions element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReaction#ac21d3ce: field new_reactions element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotMessageReaction) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotMessageReaction#ac21d3ce to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotMessageReactionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotMessageReaction) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotMessageReaction#ac21d3ce to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field actor: %w", err)
|
|
}
|
|
u.Actor = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field old_reactions: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.OldReactions = make([]ReactionClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeReaction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field old_reactions: %w", err)
|
|
}
|
|
u.OldReactions = append(u.OldReactions, value)
|
|
}
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field new_reactions: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.NewReactions = make([]ReactionClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeReaction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field new_reactions: %w", err)
|
|
}
|
|
u.NewReactions = append(u.NewReactions, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReaction#ac21d3ce: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotMessageReaction) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateBotMessageReaction) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateBotMessageReaction) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetActor returns value of Actor field.
|
|
func (u *UpdateBotMessageReaction) GetActor() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Actor
|
|
}
|
|
|
|
// GetOldReactions returns value of OldReactions field.
|
|
func (u *UpdateBotMessageReaction) GetOldReactions() (value []ReactionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.OldReactions
|
|
}
|
|
|
|
// GetNewReactions returns value of NewReactions field.
|
|
func (u *UpdateBotMessageReaction) GetNewReactions() (value []ReactionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.NewReactions
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotMessageReaction) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// MapOldReactions returns field OldReactions wrapped in ReactionClassArray helper.
|
|
func (u *UpdateBotMessageReaction) MapOldReactions() (value ReactionClassArray) {
|
|
return ReactionClassArray(u.OldReactions)
|
|
}
|
|
|
|
// MapNewReactions returns field NewReactions wrapped in ReactionClassArray helper.
|
|
func (u *UpdateBotMessageReaction) MapNewReactions() (value ReactionClassArray) {
|
|
return ReactionClassArray(u.NewReactions)
|
|
}
|
|
|
|
// UpdateBotMessageReactions represents TL type `updateBotMessageReactions#9cb7759`.
|
|
// Bots only: the number of reactions on a message with anonymous reactions has changed.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotMessageReactions for reference.
|
|
type UpdateBotMessageReactions struct {
|
|
// Peer of the reacted-to message.
|
|
Peer PeerClass
|
|
// ID of the reacted-to message.
|
|
MsgID int
|
|
// Date of the change.
|
|
Date int
|
|
// New reaction counters.
|
|
Reactions []ReactionCount
|
|
// QTS¹ event sequence identifier
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotMessageReactionsTypeID is TL type id of UpdateBotMessageReactions.
|
|
const UpdateBotMessageReactionsTypeID = 0x9cb7759
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotMessageReactions) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotMessageReactions.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotMessageReactions{}
|
|
_ bin.Decoder = &UpdateBotMessageReactions{}
|
|
_ bin.BareEncoder = &UpdateBotMessageReactions{}
|
|
_ bin.BareDecoder = &UpdateBotMessageReactions{}
|
|
|
|
_ UpdateClass = &UpdateBotMessageReactions{}
|
|
)
|
|
|
|
func (u *UpdateBotMessageReactions) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.MsgID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Date == 0) {
|
|
return false
|
|
}
|
|
if !(u.Reactions == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotMessageReactions) String() string {
|
|
if u == nil {
|
|
return "UpdateBotMessageReactions(nil)"
|
|
}
|
|
type Alias UpdateBotMessageReactions
|
|
return fmt.Sprintf("UpdateBotMessageReactions%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotMessageReactions from given interface.
|
|
func (u *UpdateBotMessageReactions) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetMsgID() (value int)
|
|
GetDate() (value int)
|
|
GetReactions() (value []ReactionCount)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.MsgID = from.GetMsgID()
|
|
u.Date = from.GetDate()
|
|
u.Reactions = from.GetReactions()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotMessageReactions) TypeID() uint32 {
|
|
return UpdateBotMessageReactionsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotMessageReactions) TypeName() string {
|
|
return "updateBotMessageReactions"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotMessageReactions) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotMessageReactions",
|
|
ID: UpdateBotMessageReactionsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "MsgID",
|
|
SchemaName: "msg_id",
|
|
},
|
|
{
|
|
Name: "Date",
|
|
SchemaName: "date",
|
|
},
|
|
{
|
|
Name: "Reactions",
|
|
SchemaName: "reactions",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotMessageReactions) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotMessageReactions#9cb7759 as nil")
|
|
}
|
|
b.PutID(UpdateBotMessageReactionsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotMessageReactions) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotMessageReactions#9cb7759 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReactions#9cb7759: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReactions#9cb7759: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.MsgID)
|
|
b.PutInt(u.Date)
|
|
b.PutVectorHeader(len(u.Reactions))
|
|
for idx, v := range u.Reactions {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotMessageReactions#9cb7759: field reactions element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotMessageReactions) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotMessageReactions#9cb7759 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotMessageReactionsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotMessageReactions) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotMessageReactions#9cb7759 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field msg_id: %w", err)
|
|
}
|
|
u.MsgID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field date: %w", err)
|
|
}
|
|
u.Date = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field reactions: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Reactions = make([]ReactionCount, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value ReactionCount
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field reactions: %w", err)
|
|
}
|
|
u.Reactions = append(u.Reactions, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotMessageReactions#9cb7759: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotMessageReactions) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMsgID returns value of MsgID field.
|
|
func (u *UpdateBotMessageReactions) GetMsgID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.MsgID
|
|
}
|
|
|
|
// GetDate returns value of Date field.
|
|
func (u *UpdateBotMessageReactions) GetDate() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Date
|
|
}
|
|
|
|
// GetReactions returns value of Reactions field.
|
|
func (u *UpdateBotMessageReactions) GetReactions() (value []ReactionCount) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Reactions
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotMessageReactions) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateSavedDialogPinned represents TL type `updateSavedDialogPinned#aeaf9e74`.
|
|
// A saved message dialog¹ was pinned/unpinned
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/saved-messages
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSavedDialogPinned for reference.
|
|
type UpdateSavedDialogPinned struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Whether the dialog was pinned
|
|
Pinned bool
|
|
// The dialog
|
|
Peer DialogPeerClass
|
|
}
|
|
|
|
// UpdateSavedDialogPinnedTypeID is TL type id of UpdateSavedDialogPinned.
|
|
const UpdateSavedDialogPinnedTypeID = 0xaeaf9e74
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSavedDialogPinned) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSavedDialogPinned.
|
|
var (
|
|
_ bin.Encoder = &UpdateSavedDialogPinned{}
|
|
_ bin.Decoder = &UpdateSavedDialogPinned{}
|
|
_ bin.BareEncoder = &UpdateSavedDialogPinned{}
|
|
_ bin.BareDecoder = &UpdateSavedDialogPinned{}
|
|
|
|
_ UpdateClass = &UpdateSavedDialogPinned{}
|
|
)
|
|
|
|
func (u *UpdateSavedDialogPinned) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Pinned == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSavedDialogPinned) String() string {
|
|
if u == nil {
|
|
return "UpdateSavedDialogPinned(nil)"
|
|
}
|
|
type Alias UpdateSavedDialogPinned
|
|
return fmt.Sprintf("UpdateSavedDialogPinned%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateSavedDialogPinned from given interface.
|
|
func (u *UpdateSavedDialogPinned) FillFrom(from interface {
|
|
GetPinned() (value bool)
|
|
GetPeer() (value DialogPeerClass)
|
|
}) {
|
|
u.Pinned = from.GetPinned()
|
|
u.Peer = from.GetPeer()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSavedDialogPinned) TypeID() uint32 {
|
|
return UpdateSavedDialogPinnedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSavedDialogPinned) TypeName() string {
|
|
return "updateSavedDialogPinned"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSavedDialogPinned) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSavedDialogPinned",
|
|
ID: UpdateSavedDialogPinnedTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pinned",
|
|
SchemaName: "pinned",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateSavedDialogPinned) SetFlags() {
|
|
if !(u.Pinned == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSavedDialogPinned) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedDialogPinned#aeaf9e74 as nil")
|
|
}
|
|
b.PutID(UpdateSavedDialogPinnedTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSavedDialogPinned) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedDialogPinned#aeaf9e74 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateSavedDialogPinned#aeaf9e74: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateSavedDialogPinned#aeaf9e74: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateSavedDialogPinned#aeaf9e74: field peer: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSavedDialogPinned) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedDialogPinned#aeaf9e74 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSavedDialogPinnedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSavedDialogPinned#aeaf9e74: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSavedDialogPinned) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedDialogPinned#aeaf9e74 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateSavedDialogPinned#aeaf9e74: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Pinned = u.Flags.Has(0)
|
|
{
|
|
value, err := DecodeDialogPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateSavedDialogPinned#aeaf9e74: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPinned sets value of Pinned conditional field.
|
|
func (u *UpdateSavedDialogPinned) SetPinned(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Pinned = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Pinned = false
|
|
}
|
|
}
|
|
|
|
// GetPinned returns value of Pinned conditional field.
|
|
func (u *UpdateSavedDialogPinned) GetPinned() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateSavedDialogPinned) GetPeer() (value DialogPeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// UpdatePinnedSavedDialogs represents TL type `updatePinnedSavedDialogs#686c85a6`.
|
|
// Pinned saved dialogs »¹ were updated
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/saved-messages
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePinnedSavedDialogs for reference.
|
|
type UpdatePinnedSavedDialogs struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// New order of pinned saved dialogs
|
|
//
|
|
// Use SetOrder and GetOrder helpers.
|
|
Order []DialogPeerClass
|
|
}
|
|
|
|
// UpdatePinnedSavedDialogsTypeID is TL type id of UpdatePinnedSavedDialogs.
|
|
const UpdatePinnedSavedDialogsTypeID = 0x686c85a6
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePinnedSavedDialogs) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePinnedSavedDialogs.
|
|
var (
|
|
_ bin.Encoder = &UpdatePinnedSavedDialogs{}
|
|
_ bin.Decoder = &UpdatePinnedSavedDialogs{}
|
|
_ bin.BareEncoder = &UpdatePinnedSavedDialogs{}
|
|
_ bin.BareDecoder = &UpdatePinnedSavedDialogs{}
|
|
|
|
_ UpdateClass = &UpdatePinnedSavedDialogs{}
|
|
)
|
|
|
|
func (u *UpdatePinnedSavedDialogs) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Order == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePinnedSavedDialogs) String() string {
|
|
if u == nil {
|
|
return "UpdatePinnedSavedDialogs(nil)"
|
|
}
|
|
type Alias UpdatePinnedSavedDialogs
|
|
return fmt.Sprintf("UpdatePinnedSavedDialogs%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePinnedSavedDialogs from given interface.
|
|
func (u *UpdatePinnedSavedDialogs) FillFrom(from interface {
|
|
GetOrder() (value []DialogPeerClass, ok bool)
|
|
}) {
|
|
if val, ok := from.GetOrder(); ok {
|
|
u.Order = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePinnedSavedDialogs) TypeID() uint32 {
|
|
return UpdatePinnedSavedDialogsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePinnedSavedDialogs) TypeName() string {
|
|
return "updatePinnedSavedDialogs"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePinnedSavedDialogs) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePinnedSavedDialogs",
|
|
ID: UpdatePinnedSavedDialogsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Order",
|
|
SchemaName: "order",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePinnedSavedDialogs) SetFlags() {
|
|
if !(u.Order == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePinnedSavedDialogs) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedSavedDialogs#686c85a6 as nil")
|
|
}
|
|
b.PutID(UpdatePinnedSavedDialogsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePinnedSavedDialogs) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedSavedDialogs#686c85a6 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedSavedDialogs#686c85a6: field flags: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutVectorHeader(len(u.Order))
|
|
for idx, v := range u.Order {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode updatePinnedSavedDialogs#686c85a6: field order element with index %d is nil", idx)
|
|
}
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedSavedDialogs#686c85a6: field order element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePinnedSavedDialogs) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedSavedDialogs#686c85a6 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePinnedSavedDialogsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedSavedDialogs#686c85a6: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePinnedSavedDialogs) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedSavedDialogs#686c85a6 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedSavedDialogs#686c85a6: field flags: %w", err)
|
|
}
|
|
}
|
|
if u.Flags.Has(0) {
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedSavedDialogs#686c85a6: field order: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Order = make([]DialogPeerClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeDialogPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedSavedDialogs#686c85a6: field order: %w", err)
|
|
}
|
|
u.Order = append(u.Order, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetOrder sets value of Order conditional field.
|
|
func (u *UpdatePinnedSavedDialogs) SetOrder(value []DialogPeerClass) {
|
|
u.Flags.Set(0)
|
|
u.Order = value
|
|
}
|
|
|
|
// GetOrder returns value of Order conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdatePinnedSavedDialogs) GetOrder() (value []DialogPeerClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Order, true
|
|
}
|
|
|
|
// MapOrder returns field Order wrapped in DialogPeerClassArray helper.
|
|
func (u *UpdatePinnedSavedDialogs) MapOrder() (value DialogPeerClassArray, ok bool) {
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return DialogPeerClassArray(u.Order), true
|
|
}
|
|
|
|
// UpdateSavedReactionTags represents TL type `updateSavedReactionTags#39c67432`.
|
|
// The list of reaction tag »¹ names assigned by the user has changed and should be
|
|
// refetched using messages.getSavedReactionTags »².
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/saved-messages#tags
|
|
// 2. https://core.telegram.org/method/messages.getSavedReactionTags
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSavedReactionTags for reference.
|
|
type UpdateSavedReactionTags struct {
|
|
}
|
|
|
|
// UpdateSavedReactionTagsTypeID is TL type id of UpdateSavedReactionTags.
|
|
const UpdateSavedReactionTagsTypeID = 0x39c67432
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSavedReactionTags) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSavedReactionTags.
|
|
var (
|
|
_ bin.Encoder = &UpdateSavedReactionTags{}
|
|
_ bin.Decoder = &UpdateSavedReactionTags{}
|
|
_ bin.BareEncoder = &UpdateSavedReactionTags{}
|
|
_ bin.BareDecoder = &UpdateSavedReactionTags{}
|
|
|
|
_ UpdateClass = &UpdateSavedReactionTags{}
|
|
)
|
|
|
|
func (u *UpdateSavedReactionTags) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSavedReactionTags) String() string {
|
|
if u == nil {
|
|
return "UpdateSavedReactionTags(nil)"
|
|
}
|
|
type Alias UpdateSavedReactionTags
|
|
return fmt.Sprintf("UpdateSavedReactionTags%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSavedReactionTags) TypeID() uint32 {
|
|
return UpdateSavedReactionTagsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSavedReactionTags) TypeName() string {
|
|
return "updateSavedReactionTags"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSavedReactionTags) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSavedReactionTags",
|
|
ID: UpdateSavedReactionTagsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSavedReactionTags) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedReactionTags#39c67432 as nil")
|
|
}
|
|
b.PutID(UpdateSavedReactionTagsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSavedReactionTags) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSavedReactionTags#39c67432 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSavedReactionTags) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedReactionTags#39c67432 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSavedReactionTagsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSavedReactionTags#39c67432: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSavedReactionTags) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSavedReactionTags#39c67432 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateSMSJob represents TL type `updateSmsJob#f16269d4`.
|
|
// A new SMS job was received
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSmsJob for reference.
|
|
type UpdateSMSJob struct {
|
|
// SMS job ID
|
|
JobID string
|
|
}
|
|
|
|
// UpdateSMSJobTypeID is TL type id of UpdateSMSJob.
|
|
const UpdateSMSJobTypeID = 0xf16269d4
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSMSJob) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSMSJob.
|
|
var (
|
|
_ bin.Encoder = &UpdateSMSJob{}
|
|
_ bin.Decoder = &UpdateSMSJob{}
|
|
_ bin.BareEncoder = &UpdateSMSJob{}
|
|
_ bin.BareDecoder = &UpdateSMSJob{}
|
|
|
|
_ UpdateClass = &UpdateSMSJob{}
|
|
)
|
|
|
|
func (u *UpdateSMSJob) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.JobID == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSMSJob) String() string {
|
|
if u == nil {
|
|
return "UpdateSMSJob(nil)"
|
|
}
|
|
type Alias UpdateSMSJob
|
|
return fmt.Sprintf("UpdateSMSJob%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateSMSJob from given interface.
|
|
func (u *UpdateSMSJob) FillFrom(from interface {
|
|
GetJobID() (value string)
|
|
}) {
|
|
u.JobID = from.GetJobID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSMSJob) TypeID() uint32 {
|
|
return UpdateSMSJobTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSMSJob) TypeName() string {
|
|
return "updateSmsJob"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSMSJob) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSmsJob",
|
|
ID: UpdateSMSJobTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "JobID",
|
|
SchemaName: "job_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSMSJob) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSmsJob#f16269d4 as nil")
|
|
}
|
|
b.PutID(UpdateSMSJobTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSMSJob) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSmsJob#f16269d4 as nil")
|
|
}
|
|
b.PutString(u.JobID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSMSJob) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSmsJob#f16269d4 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSMSJobTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSmsJob#f16269d4: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSMSJob) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSmsJob#f16269d4 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateSmsJob#f16269d4: field job_id: %w", err)
|
|
}
|
|
u.JobID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetJobID returns value of JobID field.
|
|
func (u *UpdateSMSJob) GetJobID() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.JobID
|
|
}
|
|
|
|
// UpdateQuickReplies represents TL type `updateQuickReplies#f9470ab2`.
|
|
// Info about or the order of quick reply shortcuts »¹ was changed.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/business#quick-reply-shortcuts
|
|
//
|
|
// See https://core.telegram.org/constructor/updateQuickReplies for reference.
|
|
type UpdateQuickReplies struct {
|
|
// New quick reply shortcut order and information.
|
|
QuickReplies []QuickReply
|
|
}
|
|
|
|
// UpdateQuickRepliesTypeID is TL type id of UpdateQuickReplies.
|
|
const UpdateQuickRepliesTypeID = 0xf9470ab2
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateQuickReplies) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateQuickReplies.
|
|
var (
|
|
_ bin.Encoder = &UpdateQuickReplies{}
|
|
_ bin.Decoder = &UpdateQuickReplies{}
|
|
_ bin.BareEncoder = &UpdateQuickReplies{}
|
|
_ bin.BareDecoder = &UpdateQuickReplies{}
|
|
|
|
_ UpdateClass = &UpdateQuickReplies{}
|
|
)
|
|
|
|
func (u *UpdateQuickReplies) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.QuickReplies == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateQuickReplies) String() string {
|
|
if u == nil {
|
|
return "UpdateQuickReplies(nil)"
|
|
}
|
|
type Alias UpdateQuickReplies
|
|
return fmt.Sprintf("UpdateQuickReplies%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateQuickReplies from given interface.
|
|
func (u *UpdateQuickReplies) FillFrom(from interface {
|
|
GetQuickReplies() (value []QuickReply)
|
|
}) {
|
|
u.QuickReplies = from.GetQuickReplies()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateQuickReplies) TypeID() uint32 {
|
|
return UpdateQuickRepliesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateQuickReplies) TypeName() string {
|
|
return "updateQuickReplies"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateQuickReplies) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateQuickReplies",
|
|
ID: UpdateQuickRepliesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QuickReplies",
|
|
SchemaName: "quick_replies",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateQuickReplies) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateQuickReplies#f9470ab2 as nil")
|
|
}
|
|
b.PutID(UpdateQuickRepliesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateQuickReplies) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateQuickReplies#f9470ab2 as nil")
|
|
}
|
|
b.PutVectorHeader(len(u.QuickReplies))
|
|
for idx, v := range u.QuickReplies {
|
|
if err := v.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateQuickReplies#f9470ab2: field quick_replies element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateQuickReplies) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateQuickReplies#f9470ab2 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateQuickRepliesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateQuickReplies#f9470ab2: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateQuickReplies) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateQuickReplies#f9470ab2 to nil")
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateQuickReplies#f9470ab2: field quick_replies: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.QuickReplies = make([]QuickReply, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value QuickReply
|
|
if err := value.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateQuickReplies#f9470ab2: field quick_replies: %w", err)
|
|
}
|
|
u.QuickReplies = append(u.QuickReplies, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQuickReplies returns value of QuickReplies field.
|
|
func (u *UpdateQuickReplies) GetQuickReplies() (value []QuickReply) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QuickReplies
|
|
}
|
|
|
|
// UpdateNewQuickReply represents TL type `updateNewQuickReply#f53da717`.
|
|
// A new quick reply shortcut »¹ was created.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/business#quick-reply-shortcuts
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewQuickReply for reference.
|
|
type UpdateNewQuickReply struct {
|
|
// Quick reply shortcut.
|
|
QuickReply QuickReply
|
|
}
|
|
|
|
// UpdateNewQuickReplyTypeID is TL type id of UpdateNewQuickReply.
|
|
const UpdateNewQuickReplyTypeID = 0xf53da717
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewQuickReply) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewQuickReply.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewQuickReply{}
|
|
_ bin.Decoder = &UpdateNewQuickReply{}
|
|
_ bin.BareEncoder = &UpdateNewQuickReply{}
|
|
_ bin.BareDecoder = &UpdateNewQuickReply{}
|
|
|
|
_ UpdateClass = &UpdateNewQuickReply{}
|
|
)
|
|
|
|
func (u *UpdateNewQuickReply) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.QuickReply.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewQuickReply) String() string {
|
|
if u == nil {
|
|
return "UpdateNewQuickReply(nil)"
|
|
}
|
|
type Alias UpdateNewQuickReply
|
|
return fmt.Sprintf("UpdateNewQuickReply%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewQuickReply from given interface.
|
|
func (u *UpdateNewQuickReply) FillFrom(from interface {
|
|
GetQuickReply() (value QuickReply)
|
|
}) {
|
|
u.QuickReply = from.GetQuickReply()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewQuickReply) TypeID() uint32 {
|
|
return UpdateNewQuickReplyTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewQuickReply) TypeName() string {
|
|
return "updateNewQuickReply"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewQuickReply) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewQuickReply",
|
|
ID: UpdateNewQuickReplyTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QuickReply",
|
|
SchemaName: "quick_reply",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewQuickReply) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewQuickReply#f53da717 as nil")
|
|
}
|
|
b.PutID(UpdateNewQuickReplyTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewQuickReply) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewQuickReply#f53da717 as nil")
|
|
}
|
|
if err := u.QuickReply.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewQuickReply#f53da717: field quick_reply: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewQuickReply) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewQuickReply#f53da717 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewQuickReplyTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewQuickReply#f53da717: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewQuickReply) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewQuickReply#f53da717 to nil")
|
|
}
|
|
{
|
|
if err := u.QuickReply.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewQuickReply#f53da717: field quick_reply: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQuickReply returns value of QuickReply field.
|
|
func (u *UpdateNewQuickReply) GetQuickReply() (value QuickReply) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QuickReply
|
|
}
|
|
|
|
// UpdateDeleteQuickReply represents TL type `updateDeleteQuickReply#53e6f1ec`.
|
|
// A quick reply shortcut »¹ was deleted. This will not emit
|
|
// updateDeleteQuickReplyMessages² updates, even if all the messages in the shortcut are
|
|
// also deleted by this update.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/business#quick-reply-shortcuts
|
|
// 2. https://core.telegram.org/constructor/updateDeleteQuickReplyMessages
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDeleteQuickReply for reference.
|
|
type UpdateDeleteQuickReply struct {
|
|
// ID of the quick reply shortcut that was deleted.
|
|
ShortcutID int
|
|
}
|
|
|
|
// UpdateDeleteQuickReplyTypeID is TL type id of UpdateDeleteQuickReply.
|
|
const UpdateDeleteQuickReplyTypeID = 0x53e6f1ec
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDeleteQuickReply) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDeleteQuickReply.
|
|
var (
|
|
_ bin.Encoder = &UpdateDeleteQuickReply{}
|
|
_ bin.Decoder = &UpdateDeleteQuickReply{}
|
|
_ bin.BareEncoder = &UpdateDeleteQuickReply{}
|
|
_ bin.BareDecoder = &UpdateDeleteQuickReply{}
|
|
|
|
_ UpdateClass = &UpdateDeleteQuickReply{}
|
|
)
|
|
|
|
func (u *UpdateDeleteQuickReply) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ShortcutID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDeleteQuickReply) String() string {
|
|
if u == nil {
|
|
return "UpdateDeleteQuickReply(nil)"
|
|
}
|
|
type Alias UpdateDeleteQuickReply
|
|
return fmt.Sprintf("UpdateDeleteQuickReply%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDeleteQuickReply from given interface.
|
|
func (u *UpdateDeleteQuickReply) FillFrom(from interface {
|
|
GetShortcutID() (value int)
|
|
}) {
|
|
u.ShortcutID = from.GetShortcutID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDeleteQuickReply) TypeID() uint32 {
|
|
return UpdateDeleteQuickReplyTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDeleteQuickReply) TypeName() string {
|
|
return "updateDeleteQuickReply"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDeleteQuickReply) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDeleteQuickReply",
|
|
ID: UpdateDeleteQuickReplyTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ShortcutID",
|
|
SchemaName: "shortcut_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDeleteQuickReply) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteQuickReply#53e6f1ec as nil")
|
|
}
|
|
b.PutID(UpdateDeleteQuickReplyTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDeleteQuickReply) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteQuickReply#53e6f1ec as nil")
|
|
}
|
|
b.PutInt(u.ShortcutID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDeleteQuickReply) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteQuickReply#53e6f1ec to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDeleteQuickReplyTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteQuickReply#53e6f1ec: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDeleteQuickReply) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteQuickReply#53e6f1ec to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteQuickReply#53e6f1ec: field shortcut_id: %w", err)
|
|
}
|
|
u.ShortcutID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetShortcutID returns value of ShortcutID field.
|
|
func (u *UpdateDeleteQuickReply) GetShortcutID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ShortcutID
|
|
}
|
|
|
|
// UpdateQuickReplyMessage represents TL type `updateQuickReplyMessage#3e050d0f`.
|
|
// A new message was added to a quick reply shortcut »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/business#quick-reply-shortcuts
|
|
//
|
|
// See https://core.telegram.org/constructor/updateQuickReplyMessage for reference.
|
|
type UpdateQuickReplyMessage struct {
|
|
// The message that was added (the message¹.quick_reply_shortcut_id field will contain
|
|
// the shortcut ID).
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/message
|
|
Message MessageClass
|
|
}
|
|
|
|
// UpdateQuickReplyMessageTypeID is TL type id of UpdateQuickReplyMessage.
|
|
const UpdateQuickReplyMessageTypeID = 0x3e050d0f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateQuickReplyMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateQuickReplyMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateQuickReplyMessage{}
|
|
_ bin.Decoder = &UpdateQuickReplyMessage{}
|
|
_ bin.BareEncoder = &UpdateQuickReplyMessage{}
|
|
_ bin.BareDecoder = &UpdateQuickReplyMessage{}
|
|
|
|
_ UpdateClass = &UpdateQuickReplyMessage{}
|
|
)
|
|
|
|
func (u *UpdateQuickReplyMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateQuickReplyMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateQuickReplyMessage(nil)"
|
|
}
|
|
type Alias UpdateQuickReplyMessage
|
|
return fmt.Sprintf("UpdateQuickReplyMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateQuickReplyMessage from given interface.
|
|
func (u *UpdateQuickReplyMessage) FillFrom(from interface {
|
|
GetMessage() (value MessageClass)
|
|
}) {
|
|
u.Message = from.GetMessage()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateQuickReplyMessage) TypeID() uint32 {
|
|
return UpdateQuickReplyMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateQuickReplyMessage) TypeName() string {
|
|
return "updateQuickReplyMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateQuickReplyMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateQuickReplyMessage",
|
|
ID: UpdateQuickReplyMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateQuickReplyMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateQuickReplyMessage#3e050d0f as nil")
|
|
}
|
|
b.PutID(UpdateQuickReplyMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateQuickReplyMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateQuickReplyMessage#3e050d0f as nil")
|
|
}
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateQuickReplyMessage#3e050d0f: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateQuickReplyMessage#3e050d0f: field message: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateQuickReplyMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateQuickReplyMessage#3e050d0f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateQuickReplyMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateQuickReplyMessage#3e050d0f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateQuickReplyMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateQuickReplyMessage#3e050d0f to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateQuickReplyMessage#3e050d0f: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateQuickReplyMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// UpdateDeleteQuickReplyMessages represents TL type `updateDeleteQuickReplyMessages#566fe7cd`.
|
|
// One or more messages in a quick reply shortcut »¹ were deleted.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/business#quick-reply-shortcuts
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDeleteQuickReplyMessages for reference.
|
|
type UpdateDeleteQuickReplyMessages struct {
|
|
// Quick reply shortcut ID.
|
|
ShortcutID int
|
|
// IDs of the deleted messages.
|
|
Messages []int
|
|
}
|
|
|
|
// UpdateDeleteQuickReplyMessagesTypeID is TL type id of UpdateDeleteQuickReplyMessages.
|
|
const UpdateDeleteQuickReplyMessagesTypeID = 0x566fe7cd
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDeleteQuickReplyMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDeleteQuickReplyMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateDeleteQuickReplyMessages{}
|
|
_ bin.Decoder = &UpdateDeleteQuickReplyMessages{}
|
|
_ bin.BareEncoder = &UpdateDeleteQuickReplyMessages{}
|
|
_ bin.BareDecoder = &UpdateDeleteQuickReplyMessages{}
|
|
|
|
_ UpdateClass = &UpdateDeleteQuickReplyMessages{}
|
|
)
|
|
|
|
func (u *UpdateDeleteQuickReplyMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ShortcutID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDeleteQuickReplyMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateDeleteQuickReplyMessages(nil)"
|
|
}
|
|
type Alias UpdateDeleteQuickReplyMessages
|
|
return fmt.Sprintf("UpdateDeleteQuickReplyMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDeleteQuickReplyMessages from given interface.
|
|
func (u *UpdateDeleteQuickReplyMessages) FillFrom(from interface {
|
|
GetShortcutID() (value int)
|
|
GetMessages() (value []int)
|
|
}) {
|
|
u.ShortcutID = from.GetShortcutID()
|
|
u.Messages = from.GetMessages()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDeleteQuickReplyMessages) TypeID() uint32 {
|
|
return UpdateDeleteQuickReplyMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDeleteQuickReplyMessages) TypeName() string {
|
|
return "updateDeleteQuickReplyMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDeleteQuickReplyMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDeleteQuickReplyMessages",
|
|
ID: UpdateDeleteQuickReplyMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ShortcutID",
|
|
SchemaName: "shortcut_id",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDeleteQuickReplyMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteQuickReplyMessages#566fe7cd as nil")
|
|
}
|
|
b.PutID(UpdateDeleteQuickReplyMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDeleteQuickReplyMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteQuickReplyMessages#566fe7cd as nil")
|
|
}
|
|
b.PutInt(u.ShortcutID)
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDeleteQuickReplyMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteQuickReplyMessages#566fe7cd to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDeleteQuickReplyMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDeleteQuickReplyMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteQuickReplyMessages#566fe7cd to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: field shortcut_id: %w", err)
|
|
}
|
|
u.ShortcutID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteQuickReplyMessages#566fe7cd: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetShortcutID returns value of ShortcutID field.
|
|
func (u *UpdateDeleteQuickReplyMessages) GetShortcutID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ShortcutID
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateDeleteQuickReplyMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// UpdateBotBusinessConnect represents TL type `updateBotBusinessConnect#8ae5c97a`.
|
|
// Connecting or disconnecting a business bot¹ or changing the connection settings will
|
|
// emit an updateBotBusinessConnect² update to the bot, with the new settings and a
|
|
// connection_id that will be used by the bot to handle updates from and send messages as
|
|
// the user.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/connected-business-bots
|
|
// 2. https://core.telegram.org/constructor/updateBotBusinessConnect
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotBusinessConnect for reference.
|
|
type UpdateBotBusinessConnect struct {
|
|
// Business connection settings
|
|
Connection BotBusinessConnection
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotBusinessConnectTypeID is TL type id of UpdateBotBusinessConnect.
|
|
const UpdateBotBusinessConnectTypeID = 0x8ae5c97a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotBusinessConnect) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotBusinessConnect.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotBusinessConnect{}
|
|
_ bin.Decoder = &UpdateBotBusinessConnect{}
|
|
_ bin.BareEncoder = &UpdateBotBusinessConnect{}
|
|
_ bin.BareDecoder = &UpdateBotBusinessConnect{}
|
|
|
|
_ UpdateClass = &UpdateBotBusinessConnect{}
|
|
)
|
|
|
|
func (u *UpdateBotBusinessConnect) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Connection.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotBusinessConnect) String() string {
|
|
if u == nil {
|
|
return "UpdateBotBusinessConnect(nil)"
|
|
}
|
|
type Alias UpdateBotBusinessConnect
|
|
return fmt.Sprintf("UpdateBotBusinessConnect%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotBusinessConnect from given interface.
|
|
func (u *UpdateBotBusinessConnect) FillFrom(from interface {
|
|
GetConnection() (value BotBusinessConnection)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.Connection = from.GetConnection()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotBusinessConnect) TypeID() uint32 {
|
|
return UpdateBotBusinessConnectTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotBusinessConnect) TypeName() string {
|
|
return "updateBotBusinessConnect"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotBusinessConnect) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotBusinessConnect",
|
|
ID: UpdateBotBusinessConnectTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Connection",
|
|
SchemaName: "connection",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotBusinessConnect) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotBusinessConnect#8ae5c97a as nil")
|
|
}
|
|
b.PutID(UpdateBotBusinessConnectTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotBusinessConnect) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotBusinessConnect#8ae5c97a as nil")
|
|
}
|
|
if err := u.Connection.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotBusinessConnect#8ae5c97a: field connection: %w", err)
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotBusinessConnect) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotBusinessConnect#8ae5c97a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotBusinessConnectTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotBusinessConnect#8ae5c97a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotBusinessConnect) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotBusinessConnect#8ae5c97a to nil")
|
|
}
|
|
{
|
|
if err := u.Connection.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotBusinessConnect#8ae5c97a: field connection: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotBusinessConnect#8ae5c97a: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetConnection returns value of Connection field.
|
|
func (u *UpdateBotBusinessConnect) GetConnection() (value BotBusinessConnection) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Connection
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotBusinessConnect) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateBotNewBusinessMessage represents TL type `updateBotNewBusinessMessage#9ddb347c`.
|
|
// A message was received via a connected business chat »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/connected-business-bots
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotNewBusinessMessage for reference.
|
|
type UpdateBotNewBusinessMessage struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Connection ID.
|
|
ConnectionID string
|
|
// New message.
|
|
Message MessageClass
|
|
// The message that message is replying to.
|
|
//
|
|
// Use SetReplyToMessage and GetReplyToMessage helpers.
|
|
ReplyToMessage MessageClass
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotNewBusinessMessageTypeID is TL type id of UpdateBotNewBusinessMessage.
|
|
const UpdateBotNewBusinessMessageTypeID = 0x9ddb347c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotNewBusinessMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotNewBusinessMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotNewBusinessMessage{}
|
|
_ bin.Decoder = &UpdateBotNewBusinessMessage{}
|
|
_ bin.BareEncoder = &UpdateBotNewBusinessMessage{}
|
|
_ bin.BareDecoder = &UpdateBotNewBusinessMessage{}
|
|
|
|
_ UpdateClass = &UpdateBotNewBusinessMessage{}
|
|
)
|
|
|
|
func (u *UpdateBotNewBusinessMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ConnectionID == "") {
|
|
return false
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.ReplyToMessage == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotNewBusinessMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateBotNewBusinessMessage(nil)"
|
|
}
|
|
type Alias UpdateBotNewBusinessMessage
|
|
return fmt.Sprintf("UpdateBotNewBusinessMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotNewBusinessMessage from given interface.
|
|
func (u *UpdateBotNewBusinessMessage) FillFrom(from interface {
|
|
GetConnectionID() (value string)
|
|
GetMessage() (value MessageClass)
|
|
GetReplyToMessage() (value MessageClass, ok bool)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.ConnectionID = from.GetConnectionID()
|
|
u.Message = from.GetMessage()
|
|
if val, ok := from.GetReplyToMessage(); ok {
|
|
u.ReplyToMessage = val
|
|
}
|
|
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotNewBusinessMessage) TypeID() uint32 {
|
|
return UpdateBotNewBusinessMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotNewBusinessMessage) TypeName() string {
|
|
return "updateBotNewBusinessMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotNewBusinessMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotNewBusinessMessage",
|
|
ID: UpdateBotNewBusinessMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ConnectionID",
|
|
SchemaName: "connection_id",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "ReplyToMessage",
|
|
SchemaName: "reply_to_message",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBotNewBusinessMessage) SetFlags() {
|
|
if !(u.ReplyToMessage == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotNewBusinessMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotNewBusinessMessage#9ddb347c as nil")
|
|
}
|
|
b.PutID(UpdateBotNewBusinessMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotNewBusinessMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotNewBusinessMessage#9ddb347c as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotNewBusinessMessage#9ddb347c: field flags: %w", err)
|
|
}
|
|
b.PutString(u.ConnectionID)
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateBotNewBusinessMessage#9ddb347c: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotNewBusinessMessage#9ddb347c: field message: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
if u.ReplyToMessage == nil {
|
|
return fmt.Errorf("unable to encode updateBotNewBusinessMessage#9ddb347c: field reply_to_message is nil")
|
|
}
|
|
if err := u.ReplyToMessage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotNewBusinessMessage#9ddb347c: field reply_to_message: %w", err)
|
|
}
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotNewBusinessMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotNewBusinessMessage#9ddb347c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotNewBusinessMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotNewBusinessMessage#9ddb347c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotNewBusinessMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotNewBusinessMessage#9ddb347c to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotNewBusinessMessage#9ddb347c: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotNewBusinessMessage#9ddb347c: field connection_id: %w", err)
|
|
}
|
|
u.ConnectionID = value
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotNewBusinessMessage#9ddb347c: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotNewBusinessMessage#9ddb347c: field reply_to_message: %w", err)
|
|
}
|
|
u.ReplyToMessage = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotNewBusinessMessage#9ddb347c: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetConnectionID returns value of ConnectionID field.
|
|
func (u *UpdateBotNewBusinessMessage) GetConnectionID() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ConnectionID
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateBotNewBusinessMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// SetReplyToMessage sets value of ReplyToMessage conditional field.
|
|
func (u *UpdateBotNewBusinessMessage) SetReplyToMessage(value MessageClass) {
|
|
u.Flags.Set(0)
|
|
u.ReplyToMessage = value
|
|
}
|
|
|
|
// GetReplyToMessage returns value of ReplyToMessage conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotNewBusinessMessage) GetReplyToMessage() (value MessageClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.ReplyToMessage, true
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotNewBusinessMessage) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateBotEditBusinessMessage represents TL type `updateBotEditBusinessMessage#7df587c`.
|
|
// A message was edited in a connected business chat »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/connected-business-bots
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotEditBusinessMessage for reference.
|
|
type UpdateBotEditBusinessMessage struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Business connection ID
|
|
ConnectionID string
|
|
// New message.
|
|
Message MessageClass
|
|
// The message that message is replying to.
|
|
//
|
|
// Use SetReplyToMessage and GetReplyToMessage helpers.
|
|
ReplyToMessage MessageClass
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotEditBusinessMessageTypeID is TL type id of UpdateBotEditBusinessMessage.
|
|
const UpdateBotEditBusinessMessageTypeID = 0x7df587c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotEditBusinessMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotEditBusinessMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotEditBusinessMessage{}
|
|
_ bin.Decoder = &UpdateBotEditBusinessMessage{}
|
|
_ bin.BareEncoder = &UpdateBotEditBusinessMessage{}
|
|
_ bin.BareDecoder = &UpdateBotEditBusinessMessage{}
|
|
|
|
_ UpdateClass = &UpdateBotEditBusinessMessage{}
|
|
)
|
|
|
|
func (u *UpdateBotEditBusinessMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.ConnectionID == "") {
|
|
return false
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.ReplyToMessage == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotEditBusinessMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateBotEditBusinessMessage(nil)"
|
|
}
|
|
type Alias UpdateBotEditBusinessMessage
|
|
return fmt.Sprintf("UpdateBotEditBusinessMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotEditBusinessMessage from given interface.
|
|
func (u *UpdateBotEditBusinessMessage) FillFrom(from interface {
|
|
GetConnectionID() (value string)
|
|
GetMessage() (value MessageClass)
|
|
GetReplyToMessage() (value MessageClass, ok bool)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.ConnectionID = from.GetConnectionID()
|
|
u.Message = from.GetMessage()
|
|
if val, ok := from.GetReplyToMessage(); ok {
|
|
u.ReplyToMessage = val
|
|
}
|
|
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotEditBusinessMessage) TypeID() uint32 {
|
|
return UpdateBotEditBusinessMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotEditBusinessMessage) TypeName() string {
|
|
return "updateBotEditBusinessMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotEditBusinessMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotEditBusinessMessage",
|
|
ID: UpdateBotEditBusinessMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ConnectionID",
|
|
SchemaName: "connection_id",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "ReplyToMessage",
|
|
SchemaName: "reply_to_message",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBotEditBusinessMessage) SetFlags() {
|
|
if !(u.ReplyToMessage == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotEditBusinessMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotEditBusinessMessage#7df587c as nil")
|
|
}
|
|
b.PutID(UpdateBotEditBusinessMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotEditBusinessMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotEditBusinessMessage#7df587c as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotEditBusinessMessage#7df587c: field flags: %w", err)
|
|
}
|
|
b.PutString(u.ConnectionID)
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateBotEditBusinessMessage#7df587c: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotEditBusinessMessage#7df587c: field message: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
if u.ReplyToMessage == nil {
|
|
return fmt.Errorf("unable to encode updateBotEditBusinessMessage#7df587c: field reply_to_message is nil")
|
|
}
|
|
if err := u.ReplyToMessage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotEditBusinessMessage#7df587c: field reply_to_message: %w", err)
|
|
}
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotEditBusinessMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotEditBusinessMessage#7df587c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotEditBusinessMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotEditBusinessMessage#7df587c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotEditBusinessMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotEditBusinessMessage#7df587c to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotEditBusinessMessage#7df587c: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotEditBusinessMessage#7df587c: field connection_id: %w", err)
|
|
}
|
|
u.ConnectionID = value
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotEditBusinessMessage#7df587c: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotEditBusinessMessage#7df587c: field reply_to_message: %w", err)
|
|
}
|
|
u.ReplyToMessage = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotEditBusinessMessage#7df587c: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetConnectionID returns value of ConnectionID field.
|
|
func (u *UpdateBotEditBusinessMessage) GetConnectionID() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ConnectionID
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateBotEditBusinessMessage) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// SetReplyToMessage sets value of ReplyToMessage conditional field.
|
|
func (u *UpdateBotEditBusinessMessage) SetReplyToMessage(value MessageClass) {
|
|
u.Flags.Set(0)
|
|
u.ReplyToMessage = value
|
|
}
|
|
|
|
// GetReplyToMessage returns value of ReplyToMessage conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBotEditBusinessMessage) GetReplyToMessage() (value MessageClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.ReplyToMessage, true
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotEditBusinessMessage) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateBotDeleteBusinessMessage represents TL type `updateBotDeleteBusinessMessage#a02a982e`.
|
|
// A message was deleted in a connected business chat »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/connected-business-bots
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotDeleteBusinessMessage for reference.
|
|
type UpdateBotDeleteBusinessMessage struct {
|
|
// Business connection ID.
|
|
ConnectionID string
|
|
// Peer¹ where the messages were deleted.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/peers
|
|
Peer PeerClass
|
|
// IDs of the messages that were deleted.
|
|
Messages []int
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotDeleteBusinessMessageTypeID is TL type id of UpdateBotDeleteBusinessMessage.
|
|
const UpdateBotDeleteBusinessMessageTypeID = 0xa02a982e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotDeleteBusinessMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotDeleteBusinessMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotDeleteBusinessMessage{}
|
|
_ bin.Decoder = &UpdateBotDeleteBusinessMessage{}
|
|
_ bin.BareEncoder = &UpdateBotDeleteBusinessMessage{}
|
|
_ bin.BareDecoder = &UpdateBotDeleteBusinessMessage{}
|
|
|
|
_ UpdateClass = &UpdateBotDeleteBusinessMessage{}
|
|
)
|
|
|
|
func (u *UpdateBotDeleteBusinessMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ConnectionID == "") {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotDeleteBusinessMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateBotDeleteBusinessMessage(nil)"
|
|
}
|
|
type Alias UpdateBotDeleteBusinessMessage
|
|
return fmt.Sprintf("UpdateBotDeleteBusinessMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotDeleteBusinessMessage from given interface.
|
|
func (u *UpdateBotDeleteBusinessMessage) FillFrom(from interface {
|
|
GetConnectionID() (value string)
|
|
GetPeer() (value PeerClass)
|
|
GetMessages() (value []int)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.ConnectionID = from.GetConnectionID()
|
|
u.Peer = from.GetPeer()
|
|
u.Messages = from.GetMessages()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotDeleteBusinessMessage) TypeID() uint32 {
|
|
return UpdateBotDeleteBusinessMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotDeleteBusinessMessage) TypeName() string {
|
|
return "updateBotDeleteBusinessMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotDeleteBusinessMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotDeleteBusinessMessage",
|
|
ID: UpdateBotDeleteBusinessMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ConnectionID",
|
|
SchemaName: "connection_id",
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotDeleteBusinessMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotDeleteBusinessMessage#a02a982e as nil")
|
|
}
|
|
b.PutID(UpdateBotDeleteBusinessMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotDeleteBusinessMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotDeleteBusinessMessage#a02a982e as nil")
|
|
}
|
|
b.PutString(u.ConnectionID)
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateBotDeleteBusinessMessage#a02a982e: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBotDeleteBusinessMessage#a02a982e: field peer: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotDeleteBusinessMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotDeleteBusinessMessage#a02a982e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotDeleteBusinessMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotDeleteBusinessMessage#a02a982e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotDeleteBusinessMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotDeleteBusinessMessage#a02a982e to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotDeleteBusinessMessage#a02a982e: field connection_id: %w", err)
|
|
}
|
|
u.ConnectionID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotDeleteBusinessMessage#a02a982e: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotDeleteBusinessMessage#a02a982e: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotDeleteBusinessMessage#a02a982e: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotDeleteBusinessMessage#a02a982e: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetConnectionID returns value of ConnectionID field.
|
|
func (u *UpdateBotDeleteBusinessMessage) GetConnectionID() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ConnectionID
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateBotDeleteBusinessMessage) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateBotDeleteBusinessMessage) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotDeleteBusinessMessage) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateNewStoryReaction represents TL type `updateNewStoryReaction#1824e40b`.
|
|
// Represents a new reaction to a story¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/reactions#notifications-about-reactions
|
|
//
|
|
// See https://core.telegram.org/constructor/updateNewStoryReaction for reference.
|
|
type UpdateNewStoryReaction struct {
|
|
// Story ID¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/stories
|
|
StoryID int
|
|
// The peer where the story was posted.
|
|
Peer PeerClass
|
|
// The reaction¹.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/reactions
|
|
Reaction ReactionClass
|
|
}
|
|
|
|
// UpdateNewStoryReactionTypeID is TL type id of UpdateNewStoryReaction.
|
|
const UpdateNewStoryReactionTypeID = 0x1824e40b
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateNewStoryReaction) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateNewStoryReaction.
|
|
var (
|
|
_ bin.Encoder = &UpdateNewStoryReaction{}
|
|
_ bin.Decoder = &UpdateNewStoryReaction{}
|
|
_ bin.BareEncoder = &UpdateNewStoryReaction{}
|
|
_ bin.BareDecoder = &UpdateNewStoryReaction{}
|
|
|
|
_ UpdateClass = &UpdateNewStoryReaction{}
|
|
)
|
|
|
|
func (u *UpdateNewStoryReaction) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.StoryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Reaction == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateNewStoryReaction) String() string {
|
|
if u == nil {
|
|
return "UpdateNewStoryReaction(nil)"
|
|
}
|
|
type Alias UpdateNewStoryReaction
|
|
return fmt.Sprintf("UpdateNewStoryReaction%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateNewStoryReaction from given interface.
|
|
func (u *UpdateNewStoryReaction) FillFrom(from interface {
|
|
GetStoryID() (value int)
|
|
GetPeer() (value PeerClass)
|
|
GetReaction() (value ReactionClass)
|
|
}) {
|
|
u.StoryID = from.GetStoryID()
|
|
u.Peer = from.GetPeer()
|
|
u.Reaction = from.GetReaction()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateNewStoryReaction) TypeID() uint32 {
|
|
return UpdateNewStoryReactionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateNewStoryReaction) TypeName() string {
|
|
return "updateNewStoryReaction"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateNewStoryReaction) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateNewStoryReaction",
|
|
ID: UpdateNewStoryReactionTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "StoryID",
|
|
SchemaName: "story_id",
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Reaction",
|
|
SchemaName: "reaction",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateNewStoryReaction) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewStoryReaction#1824e40b as nil")
|
|
}
|
|
b.PutID(UpdateNewStoryReactionTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateNewStoryReaction) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateNewStoryReaction#1824e40b as nil")
|
|
}
|
|
b.PutInt(u.StoryID)
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateNewStoryReaction#1824e40b: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewStoryReaction#1824e40b: field peer: %w", err)
|
|
}
|
|
if u.Reaction == nil {
|
|
return fmt.Errorf("unable to encode updateNewStoryReaction#1824e40b: field reaction is nil")
|
|
}
|
|
if err := u.Reaction.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateNewStoryReaction#1824e40b: field reaction: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateNewStoryReaction) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewStoryReaction#1824e40b to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateNewStoryReactionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateNewStoryReaction#1824e40b: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateNewStoryReaction) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateNewStoryReaction#1824e40b to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewStoryReaction#1824e40b: field story_id: %w", err)
|
|
}
|
|
u.StoryID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewStoryReaction#1824e40b: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := DecodeReaction(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateNewStoryReaction#1824e40b: field reaction: %w", err)
|
|
}
|
|
u.Reaction = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetStoryID returns value of StoryID field.
|
|
func (u *UpdateNewStoryReaction) GetStoryID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.StoryID
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateNewStoryReaction) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetReaction returns value of Reaction field.
|
|
func (u *UpdateNewStoryReaction) GetReaction() (value ReactionClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Reaction
|
|
}
|
|
|
|
// UpdateStarsBalance represents TL type `updateStarsBalance#4e80a379`.
|
|
// The current account's Telegram Stars balance »¹ has changed.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stars
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStarsBalance for reference.
|
|
type UpdateStarsBalance struct {
|
|
// New balance.
|
|
Balance StarsAmountClass
|
|
}
|
|
|
|
// UpdateStarsBalanceTypeID is TL type id of UpdateStarsBalance.
|
|
const UpdateStarsBalanceTypeID = 0x4e80a379
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStarsBalance) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStarsBalance.
|
|
var (
|
|
_ bin.Encoder = &UpdateStarsBalance{}
|
|
_ bin.Decoder = &UpdateStarsBalance{}
|
|
_ bin.BareEncoder = &UpdateStarsBalance{}
|
|
_ bin.BareDecoder = &UpdateStarsBalance{}
|
|
|
|
_ UpdateClass = &UpdateStarsBalance{}
|
|
)
|
|
|
|
func (u *UpdateStarsBalance) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Balance == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStarsBalance) String() string {
|
|
if u == nil {
|
|
return "UpdateStarsBalance(nil)"
|
|
}
|
|
type Alias UpdateStarsBalance
|
|
return fmt.Sprintf("UpdateStarsBalance%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStarsBalance from given interface.
|
|
func (u *UpdateStarsBalance) FillFrom(from interface {
|
|
GetBalance() (value StarsAmountClass)
|
|
}) {
|
|
u.Balance = from.GetBalance()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStarsBalance) TypeID() uint32 {
|
|
return UpdateStarsBalanceTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStarsBalance) TypeName() string {
|
|
return "updateStarsBalance"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStarsBalance) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStarsBalance",
|
|
ID: UpdateStarsBalanceTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Balance",
|
|
SchemaName: "balance",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStarsBalance) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarsBalance#4e80a379 as nil")
|
|
}
|
|
b.PutID(UpdateStarsBalanceTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStarsBalance) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarsBalance#4e80a379 as nil")
|
|
}
|
|
if u.Balance == nil {
|
|
return fmt.Errorf("unable to encode updateStarsBalance#4e80a379: field balance is nil")
|
|
}
|
|
if err := u.Balance.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStarsBalance#4e80a379: field balance: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStarsBalance) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarsBalance#4e80a379 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStarsBalanceTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarsBalance#4e80a379: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStarsBalance) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarsBalance#4e80a379 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeStarsAmount(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStarsBalance#4e80a379: field balance: %w", err)
|
|
}
|
|
u.Balance = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetBalance returns value of Balance field.
|
|
func (u *UpdateStarsBalance) GetBalance() (value StarsAmountClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Balance
|
|
}
|
|
|
|
// UpdateBusinessBotCallbackQuery represents TL type `updateBusinessBotCallbackQuery#1ea2fda7`.
|
|
// A callback button sent via a business connection¹ was pressed, and the button data
|
|
// was sent to the bot that created the button.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/bots/connected-business-bots
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBusinessBotCallbackQuery for reference.
|
|
type UpdateBusinessBotCallbackQuery struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// Query ID
|
|
QueryID int64
|
|
// ID of the user that pressed the button
|
|
UserID int64
|
|
// Business connection ID¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/bots/connected-business-bots
|
|
ConnectionID string
|
|
// Message that contains the keyboard (also contains info about the chat where the
|
|
// message was sent).
|
|
Message MessageClass
|
|
// The message that message is replying to.
|
|
//
|
|
// Use SetReplyToMessage and GetReplyToMessage helpers.
|
|
ReplyToMessage MessageClass
|
|
// Global identifier, uniquely corresponding to the chat to which the message with the
|
|
// callback button was sent. Useful for high scores in games.
|
|
ChatInstance int64
|
|
// Callback data
|
|
//
|
|
// Use SetData and GetData helpers.
|
|
Data []byte
|
|
}
|
|
|
|
// UpdateBusinessBotCallbackQueryTypeID is TL type id of UpdateBusinessBotCallbackQuery.
|
|
const UpdateBusinessBotCallbackQueryTypeID = 0x1ea2fda7
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBusinessBotCallbackQuery) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBusinessBotCallbackQuery.
|
|
var (
|
|
_ bin.Encoder = &UpdateBusinessBotCallbackQuery{}
|
|
_ bin.Decoder = &UpdateBusinessBotCallbackQuery{}
|
|
_ bin.BareEncoder = &UpdateBusinessBotCallbackQuery{}
|
|
_ bin.BareDecoder = &UpdateBusinessBotCallbackQuery{}
|
|
|
|
_ UpdateClass = &UpdateBusinessBotCallbackQuery{}
|
|
)
|
|
|
|
func (u *UpdateBusinessBotCallbackQuery) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.QueryID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.ConnectionID == "") {
|
|
return false
|
|
}
|
|
if !(u.Message == nil) {
|
|
return false
|
|
}
|
|
if !(u.ReplyToMessage == nil) {
|
|
return false
|
|
}
|
|
if !(u.ChatInstance == 0) {
|
|
return false
|
|
}
|
|
if !(u.Data == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBusinessBotCallbackQuery) String() string {
|
|
if u == nil {
|
|
return "UpdateBusinessBotCallbackQuery(nil)"
|
|
}
|
|
type Alias UpdateBusinessBotCallbackQuery
|
|
return fmt.Sprintf("UpdateBusinessBotCallbackQuery%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBusinessBotCallbackQuery from given interface.
|
|
func (u *UpdateBusinessBotCallbackQuery) FillFrom(from interface {
|
|
GetQueryID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetConnectionID() (value string)
|
|
GetMessage() (value MessageClass)
|
|
GetReplyToMessage() (value MessageClass, ok bool)
|
|
GetChatInstance() (value int64)
|
|
GetData() (value []byte, ok bool)
|
|
}) {
|
|
u.QueryID = from.GetQueryID()
|
|
u.UserID = from.GetUserID()
|
|
u.ConnectionID = from.GetConnectionID()
|
|
u.Message = from.GetMessage()
|
|
if val, ok := from.GetReplyToMessage(); ok {
|
|
u.ReplyToMessage = val
|
|
}
|
|
|
|
u.ChatInstance = from.GetChatInstance()
|
|
if val, ok := from.GetData(); ok {
|
|
u.Data = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBusinessBotCallbackQuery) TypeID() uint32 {
|
|
return UpdateBusinessBotCallbackQueryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBusinessBotCallbackQuery) TypeName() string {
|
|
return "updateBusinessBotCallbackQuery"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBusinessBotCallbackQuery) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBusinessBotCallbackQuery",
|
|
ID: UpdateBusinessBotCallbackQueryTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "QueryID",
|
|
SchemaName: "query_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "ConnectionID",
|
|
SchemaName: "connection_id",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
{
|
|
Name: "ReplyToMessage",
|
|
SchemaName: "reply_to_message",
|
|
Null: !u.Flags.Has(2),
|
|
},
|
|
{
|
|
Name: "ChatInstance",
|
|
SchemaName: "chat_instance",
|
|
},
|
|
{
|
|
Name: "Data",
|
|
SchemaName: "data",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateBusinessBotCallbackQuery) SetFlags() {
|
|
if !(u.ReplyToMessage == nil) {
|
|
u.Flags.Set(2)
|
|
}
|
|
if !(u.Data == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBusinessBotCallbackQuery) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBusinessBotCallbackQuery#1ea2fda7 as nil")
|
|
}
|
|
b.PutID(UpdateBusinessBotCallbackQueryTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBusinessBotCallbackQuery) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBusinessBotCallbackQuery#1ea2fda7 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.QueryID)
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.ConnectionID)
|
|
if u.Message == nil {
|
|
return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field message is nil")
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field message: %w", err)
|
|
}
|
|
if u.Flags.Has(2) {
|
|
if u.ReplyToMessage == nil {
|
|
return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field reply_to_message is nil")
|
|
}
|
|
if err := u.ReplyToMessage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateBusinessBotCallbackQuery#1ea2fda7: field reply_to_message: %w", err)
|
|
}
|
|
}
|
|
b.PutLong(u.ChatInstance)
|
|
if u.Flags.Has(0) {
|
|
b.PutBytes(u.Data)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBusinessBotCallbackQuery) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBusinessBotCallbackQuery#1ea2fda7 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBusinessBotCallbackQueryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBusinessBotCallbackQuery) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBusinessBotCallbackQuery#1ea2fda7 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field query_id: %w", err)
|
|
}
|
|
u.QueryID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field connection_id: %w", err)
|
|
}
|
|
u.ConnectionID = value
|
|
}
|
|
{
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field message: %w", err)
|
|
}
|
|
u.Message = value
|
|
}
|
|
if u.Flags.Has(2) {
|
|
value, err := DecodeMessage(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field reply_to_message: %w", err)
|
|
}
|
|
u.ReplyToMessage = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field chat_instance: %w", err)
|
|
}
|
|
u.ChatInstance = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBusinessBotCallbackQuery#1ea2fda7: field data: %w", err)
|
|
}
|
|
u.Data = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetQueryID returns value of QueryID field.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetQueryID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.QueryID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetConnectionID returns value of ConnectionID field.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetConnectionID() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ConnectionID
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetMessage() (value MessageClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// SetReplyToMessage sets value of ReplyToMessage conditional field.
|
|
func (u *UpdateBusinessBotCallbackQuery) SetReplyToMessage(value MessageClass) {
|
|
u.Flags.Set(2)
|
|
u.ReplyToMessage = value
|
|
}
|
|
|
|
// GetReplyToMessage returns value of ReplyToMessage conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetReplyToMessage() (value MessageClass, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(2) {
|
|
return value, false
|
|
}
|
|
return u.ReplyToMessage, true
|
|
}
|
|
|
|
// GetChatInstance returns value of ChatInstance field.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetChatInstance() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatInstance
|
|
}
|
|
|
|
// SetData sets value of Data conditional field.
|
|
func (u *UpdateBusinessBotCallbackQuery) SetData(value []byte) {
|
|
u.Flags.Set(0)
|
|
u.Data = value
|
|
}
|
|
|
|
// GetData returns value of Data conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdateBusinessBotCallbackQuery) GetData() (value []byte, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Data, true
|
|
}
|
|
|
|
// UpdateStarsRevenueStatus represents TL type `updateStarsRevenueStatus#a584b019`.
|
|
// The Telegram Star balance of a channel/bot we own has changed »¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/stars#revenue-statistics
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStarsRevenueStatus for reference.
|
|
type UpdateStarsRevenueStatus struct {
|
|
// Channel/bot
|
|
Peer PeerClass
|
|
// New Telegram Star balance.
|
|
Status StarsRevenueStatus
|
|
}
|
|
|
|
// UpdateStarsRevenueStatusTypeID is TL type id of UpdateStarsRevenueStatus.
|
|
const UpdateStarsRevenueStatusTypeID = 0xa584b019
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStarsRevenueStatus) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStarsRevenueStatus.
|
|
var (
|
|
_ bin.Encoder = &UpdateStarsRevenueStatus{}
|
|
_ bin.Decoder = &UpdateStarsRevenueStatus{}
|
|
_ bin.BareEncoder = &UpdateStarsRevenueStatus{}
|
|
_ bin.BareDecoder = &UpdateStarsRevenueStatus{}
|
|
|
|
_ UpdateClass = &UpdateStarsRevenueStatus{}
|
|
)
|
|
|
|
func (u *UpdateStarsRevenueStatus) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Status.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStarsRevenueStatus) String() string {
|
|
if u == nil {
|
|
return "UpdateStarsRevenueStatus(nil)"
|
|
}
|
|
type Alias UpdateStarsRevenueStatus
|
|
return fmt.Sprintf("UpdateStarsRevenueStatus%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStarsRevenueStatus from given interface.
|
|
func (u *UpdateStarsRevenueStatus) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetStatus() (value StarsRevenueStatus)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
u.Status = from.GetStatus()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStarsRevenueStatus) TypeID() uint32 {
|
|
return UpdateStarsRevenueStatusTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStarsRevenueStatus) TypeName() string {
|
|
return "updateStarsRevenueStatus"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStarsRevenueStatus) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStarsRevenueStatus",
|
|
ID: UpdateStarsRevenueStatusTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Status",
|
|
SchemaName: "status",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStarsRevenueStatus) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarsRevenueStatus#a584b019 as nil")
|
|
}
|
|
b.PutID(UpdateStarsRevenueStatusTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStarsRevenueStatus) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarsRevenueStatus#a584b019 as nil")
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updateStarsRevenueStatus#a584b019: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStarsRevenueStatus#a584b019: field peer: %w", err)
|
|
}
|
|
if err := u.Status.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStarsRevenueStatus#a584b019: field status: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStarsRevenueStatus) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarsRevenueStatus#a584b019 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStarsRevenueStatusTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarsRevenueStatus#a584b019: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStarsRevenueStatus) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarsRevenueStatus#a584b019 to nil")
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStarsRevenueStatus#a584b019: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
if err := u.Status.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarsRevenueStatus#a584b019: field status: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdateStarsRevenueStatus) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetStatus returns value of Status field.
|
|
func (u *UpdateStarsRevenueStatus) GetStatus() (value StarsRevenueStatus) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Status
|
|
}
|
|
|
|
// UpdateBotPurchasedPaidMedia represents TL type `updateBotPurchasedPaidMedia#283bd312`.
|
|
// Bots only: a user has purchased a paid media¹.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/paid-media
|
|
//
|
|
// See https://core.telegram.org/constructor/updateBotPurchasedPaidMedia for reference.
|
|
type UpdateBotPurchasedPaidMedia struct {
|
|
// The user that bought the media
|
|
UserID int64
|
|
// Payload passed by the bot in inputMediaPaidMedia¹.payload
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/constructor/inputMediaPaidMedia
|
|
Payload string
|
|
// New qts value, see updates »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/api/updates
|
|
Qts int
|
|
}
|
|
|
|
// UpdateBotPurchasedPaidMediaTypeID is TL type id of UpdateBotPurchasedPaidMedia.
|
|
const UpdateBotPurchasedPaidMediaTypeID = 0x283bd312
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateBotPurchasedPaidMedia) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateBotPurchasedPaidMedia.
|
|
var (
|
|
_ bin.Encoder = &UpdateBotPurchasedPaidMedia{}
|
|
_ bin.Decoder = &UpdateBotPurchasedPaidMedia{}
|
|
_ bin.BareEncoder = &UpdateBotPurchasedPaidMedia{}
|
|
_ bin.BareDecoder = &UpdateBotPurchasedPaidMedia{}
|
|
|
|
_ UpdateClass = &UpdateBotPurchasedPaidMedia{}
|
|
)
|
|
|
|
func (u *UpdateBotPurchasedPaidMedia) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Payload == "") {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateBotPurchasedPaidMedia) String() string {
|
|
if u == nil {
|
|
return "UpdateBotPurchasedPaidMedia(nil)"
|
|
}
|
|
type Alias UpdateBotPurchasedPaidMedia
|
|
return fmt.Sprintf("UpdateBotPurchasedPaidMedia%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateBotPurchasedPaidMedia from given interface.
|
|
func (u *UpdateBotPurchasedPaidMedia) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetPayload() (value string)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.Payload = from.GetPayload()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateBotPurchasedPaidMedia) TypeID() uint32 {
|
|
return UpdateBotPurchasedPaidMediaTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateBotPurchasedPaidMedia) TypeName() string {
|
|
return "updateBotPurchasedPaidMedia"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateBotPurchasedPaidMedia) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateBotPurchasedPaidMedia",
|
|
ID: UpdateBotPurchasedPaidMediaTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Payload",
|
|
SchemaName: "payload",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateBotPurchasedPaidMedia) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotPurchasedPaidMedia#283bd312 as nil")
|
|
}
|
|
b.PutID(UpdateBotPurchasedPaidMediaTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateBotPurchasedPaidMedia) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateBotPurchasedPaidMedia#283bd312 as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.Payload)
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateBotPurchasedPaidMedia) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotPurchasedPaidMedia#283bd312 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateBotPurchasedPaidMediaTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateBotPurchasedPaidMedia) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateBotPurchasedPaidMedia#283bd312 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: field payload: %w", err)
|
|
}
|
|
u.Payload = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateBotPurchasedPaidMedia#283bd312: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateBotPurchasedPaidMedia) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetPayload returns value of Payload field.
|
|
func (u *UpdateBotPurchasedPaidMedia) GetPayload() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Payload
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateBotPurchasedPaidMedia) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdatePaidReactionPrivacy represents TL type `updatePaidReactionPrivacy#8b725fce`.
|
|
// Contains the current default paid reaction privacy, see here »¹ for more info.
|
|
// Clients should invoke messages.getPaidReactionPrivacy¹ on startup to fetch the
|
|
// current default reaction privacy because this update is only sent to currently online
|
|
// sessions and cannot be fetched using getDifference on client startup.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/reactions#paid-reactions
|
|
// 2. https://core.telegram.org/method/messages.getPaidReactionPrivacy
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePaidReactionPrivacy for reference.
|
|
type UpdatePaidReactionPrivacy struct {
|
|
// Paid reaction privacy settings.
|
|
Private PaidReactionPrivacyClass
|
|
}
|
|
|
|
// UpdatePaidReactionPrivacyTypeID is TL type id of UpdatePaidReactionPrivacy.
|
|
const UpdatePaidReactionPrivacyTypeID = 0x8b725fce
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePaidReactionPrivacy) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePaidReactionPrivacy.
|
|
var (
|
|
_ bin.Encoder = &UpdatePaidReactionPrivacy{}
|
|
_ bin.Decoder = &UpdatePaidReactionPrivacy{}
|
|
_ bin.BareEncoder = &UpdatePaidReactionPrivacy{}
|
|
_ bin.BareDecoder = &UpdatePaidReactionPrivacy{}
|
|
|
|
_ UpdateClass = &UpdatePaidReactionPrivacy{}
|
|
)
|
|
|
|
func (u *UpdatePaidReactionPrivacy) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Private == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePaidReactionPrivacy) String() string {
|
|
if u == nil {
|
|
return "UpdatePaidReactionPrivacy(nil)"
|
|
}
|
|
type Alias UpdatePaidReactionPrivacy
|
|
return fmt.Sprintf("UpdatePaidReactionPrivacy%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePaidReactionPrivacy from given interface.
|
|
func (u *UpdatePaidReactionPrivacy) FillFrom(from interface {
|
|
GetPrivate() (value PaidReactionPrivacyClass)
|
|
}) {
|
|
u.Private = from.GetPrivate()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePaidReactionPrivacy) TypeID() uint32 {
|
|
return UpdatePaidReactionPrivacyTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePaidReactionPrivacy) TypeName() string {
|
|
return "updatePaidReactionPrivacy"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePaidReactionPrivacy) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePaidReactionPrivacy",
|
|
ID: UpdatePaidReactionPrivacyTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Private",
|
|
SchemaName: "private",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePaidReactionPrivacy) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePaidReactionPrivacy#8b725fce as nil")
|
|
}
|
|
b.PutID(UpdatePaidReactionPrivacyTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePaidReactionPrivacy) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePaidReactionPrivacy#8b725fce as nil")
|
|
}
|
|
if u.Private == nil {
|
|
return fmt.Errorf("unable to encode updatePaidReactionPrivacy#8b725fce: field private is nil")
|
|
}
|
|
if err := u.Private.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePaidReactionPrivacy#8b725fce: field private: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePaidReactionPrivacy) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePaidReactionPrivacy#8b725fce to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePaidReactionPrivacyTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePaidReactionPrivacy#8b725fce: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePaidReactionPrivacy) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePaidReactionPrivacy#8b725fce to nil")
|
|
}
|
|
{
|
|
value, err := DecodePaidReactionPrivacy(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePaidReactionPrivacy#8b725fce: field private: %w", err)
|
|
}
|
|
u.Private = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPrivate returns value of Private field.
|
|
func (u *UpdatePaidReactionPrivacy) GetPrivate() (value PaidReactionPrivacyClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Private
|
|
}
|
|
|
|
// UpdateSentPhoneCode represents TL type `updateSentPhoneCode#504aa18f`.
|
|
// A paid login SMS code was successfully sent.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateSentPhoneCode for reference.
|
|
type UpdateSentPhoneCode struct {
|
|
// Info about the sent code.
|
|
SentCode AuthSentCodeClass
|
|
}
|
|
|
|
// UpdateSentPhoneCodeTypeID is TL type id of UpdateSentPhoneCode.
|
|
const UpdateSentPhoneCodeTypeID = 0x504aa18f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateSentPhoneCode) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateSentPhoneCode.
|
|
var (
|
|
_ bin.Encoder = &UpdateSentPhoneCode{}
|
|
_ bin.Decoder = &UpdateSentPhoneCode{}
|
|
_ bin.BareEncoder = &UpdateSentPhoneCode{}
|
|
_ bin.BareDecoder = &UpdateSentPhoneCode{}
|
|
|
|
_ UpdateClass = &UpdateSentPhoneCode{}
|
|
)
|
|
|
|
func (u *UpdateSentPhoneCode) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.SentCode == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateSentPhoneCode) String() string {
|
|
if u == nil {
|
|
return "UpdateSentPhoneCode(nil)"
|
|
}
|
|
type Alias UpdateSentPhoneCode
|
|
return fmt.Sprintf("UpdateSentPhoneCode%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateSentPhoneCode from given interface.
|
|
func (u *UpdateSentPhoneCode) FillFrom(from interface {
|
|
GetSentCode() (value AuthSentCodeClass)
|
|
}) {
|
|
u.SentCode = from.GetSentCode()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateSentPhoneCode) TypeID() uint32 {
|
|
return UpdateSentPhoneCodeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateSentPhoneCode) TypeName() string {
|
|
return "updateSentPhoneCode"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateSentPhoneCode) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateSentPhoneCode",
|
|
ID: UpdateSentPhoneCodeTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "SentCode",
|
|
SchemaName: "sent_code",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateSentPhoneCode) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSentPhoneCode#504aa18f as nil")
|
|
}
|
|
b.PutID(UpdateSentPhoneCodeTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateSentPhoneCode) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateSentPhoneCode#504aa18f as nil")
|
|
}
|
|
if u.SentCode == nil {
|
|
return fmt.Errorf("unable to encode updateSentPhoneCode#504aa18f: field sent_code is nil")
|
|
}
|
|
if err := u.SentCode.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateSentPhoneCode#504aa18f: field sent_code: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateSentPhoneCode) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSentPhoneCode#504aa18f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateSentPhoneCodeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateSentPhoneCode#504aa18f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateSentPhoneCode) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateSentPhoneCode#504aa18f to nil")
|
|
}
|
|
{
|
|
value, err := DecodeAuthSentCode(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateSentPhoneCode#504aa18f: field sent_code: %w", err)
|
|
}
|
|
u.SentCode = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetSentCode returns value of SentCode field.
|
|
func (u *UpdateSentPhoneCode) GetSentCode() (value AuthSentCodeClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.SentCode
|
|
}
|
|
|
|
// UpdateGroupCallChainBlocks represents TL type `updateGroupCallChainBlocks#a477288f`.
|
|
// Contains updates to the blockchain of a conference call, see here »¹ for more info.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/end-to-end/group-calls
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGroupCallChainBlocks for reference.
|
|
type UpdateGroupCallChainBlocks struct {
|
|
// The conference call.
|
|
Call InputGroupCallClass
|
|
// Subchain ID.
|
|
SubChainID int
|
|
// Blocks.
|
|
Blocks [][]byte
|
|
// Offset of the next block.
|
|
NextOffset int
|
|
}
|
|
|
|
// UpdateGroupCallChainBlocksTypeID is TL type id of UpdateGroupCallChainBlocks.
|
|
const UpdateGroupCallChainBlocksTypeID = 0xa477288f
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGroupCallChainBlocks) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGroupCallChainBlocks.
|
|
var (
|
|
_ bin.Encoder = &UpdateGroupCallChainBlocks{}
|
|
_ bin.Decoder = &UpdateGroupCallChainBlocks{}
|
|
_ bin.BareEncoder = &UpdateGroupCallChainBlocks{}
|
|
_ bin.BareDecoder = &UpdateGroupCallChainBlocks{}
|
|
|
|
_ UpdateClass = &UpdateGroupCallChainBlocks{}
|
|
)
|
|
|
|
func (u *UpdateGroupCallChainBlocks) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Call == nil) {
|
|
return false
|
|
}
|
|
if !(u.SubChainID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Blocks == nil) {
|
|
return false
|
|
}
|
|
if !(u.NextOffset == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGroupCallChainBlocks) String() string {
|
|
if u == nil {
|
|
return "UpdateGroupCallChainBlocks(nil)"
|
|
}
|
|
type Alias UpdateGroupCallChainBlocks
|
|
return fmt.Sprintf("UpdateGroupCallChainBlocks%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGroupCallChainBlocks from given interface.
|
|
func (u *UpdateGroupCallChainBlocks) FillFrom(from interface {
|
|
GetCall() (value InputGroupCallClass)
|
|
GetSubChainID() (value int)
|
|
GetBlocks() (value [][]byte)
|
|
GetNextOffset() (value int)
|
|
}) {
|
|
u.Call = from.GetCall()
|
|
u.SubChainID = from.GetSubChainID()
|
|
u.Blocks = from.GetBlocks()
|
|
u.NextOffset = from.GetNextOffset()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGroupCallChainBlocks) TypeID() uint32 {
|
|
return UpdateGroupCallChainBlocksTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGroupCallChainBlocks) TypeName() string {
|
|
return "updateGroupCallChainBlocks"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGroupCallChainBlocks) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGroupCallChainBlocks",
|
|
ID: UpdateGroupCallChainBlocksTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
{
|
|
Name: "SubChainID",
|
|
SchemaName: "sub_chain_id",
|
|
},
|
|
{
|
|
Name: "Blocks",
|
|
SchemaName: "blocks",
|
|
},
|
|
{
|
|
Name: "NextOffset",
|
|
SchemaName: "next_offset",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGroupCallChainBlocks) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallChainBlocks#a477288f as nil")
|
|
}
|
|
b.PutID(UpdateGroupCallChainBlocksTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGroupCallChainBlocks) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallChainBlocks#a477288f as nil")
|
|
}
|
|
if u.Call == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallChainBlocks#a477288f: field call is nil")
|
|
}
|
|
if err := u.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallChainBlocks#a477288f: field call: %w", err)
|
|
}
|
|
b.PutInt(u.SubChainID)
|
|
b.PutVectorHeader(len(u.Blocks))
|
|
for _, v := range u.Blocks {
|
|
b.PutBytes(v)
|
|
}
|
|
b.PutInt(u.NextOffset)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGroupCallChainBlocks) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallChainBlocks#a477288f to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGroupCallChainBlocksTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallChainBlocks#a477288f: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGroupCallChainBlocks) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallChainBlocks#a477288f to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallChainBlocks#a477288f: field call: %w", err)
|
|
}
|
|
u.Call = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallChainBlocks#a477288f: field sub_chain_id: %w", err)
|
|
}
|
|
u.SubChainID = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallChainBlocks#a477288f: field blocks: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Blocks = make([][]byte, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallChainBlocks#a477288f: field blocks: %w", err)
|
|
}
|
|
u.Blocks = append(u.Blocks, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallChainBlocks#a477288f: field next_offset: %w", err)
|
|
}
|
|
u.NextOffset = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (u *UpdateGroupCallChainBlocks) GetCall() (value InputGroupCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Call
|
|
}
|
|
|
|
// GetSubChainID returns value of SubChainID field.
|
|
func (u *UpdateGroupCallChainBlocks) GetSubChainID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.SubChainID
|
|
}
|
|
|
|
// GetBlocks returns value of Blocks field.
|
|
func (u *UpdateGroupCallChainBlocks) GetBlocks() (value [][]byte) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Blocks
|
|
}
|
|
|
|
// GetNextOffset returns value of NextOffset field.
|
|
func (u *UpdateGroupCallChainBlocks) GetNextOffset() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.NextOffset
|
|
}
|
|
|
|
// UpdateReadMonoForumInbox represents TL type `updateReadMonoForumInbox#77b0e372`.
|
|
// Incoming messages in a monoforum topic¹ were read
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/monoforum
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadMonoForumInbox for reference.
|
|
type UpdateReadMonoForumInbox struct {
|
|
// ID of the monoforum.
|
|
ChannelID int64
|
|
// Topic ID.
|
|
SavedPeerID PeerClass
|
|
// Position up to which all incoming messages are read.
|
|
ReadMaxID int
|
|
}
|
|
|
|
// UpdateReadMonoForumInboxTypeID is TL type id of UpdateReadMonoForumInbox.
|
|
const UpdateReadMonoForumInboxTypeID = 0x77b0e372
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadMonoForumInbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadMonoForumInbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadMonoForumInbox{}
|
|
_ bin.Decoder = &UpdateReadMonoForumInbox{}
|
|
_ bin.BareEncoder = &UpdateReadMonoForumInbox{}
|
|
_ bin.BareDecoder = &UpdateReadMonoForumInbox{}
|
|
|
|
_ UpdateClass = &UpdateReadMonoForumInbox{}
|
|
)
|
|
|
|
func (u *UpdateReadMonoForumInbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
if !(u.ReadMaxID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadMonoForumInbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadMonoForumInbox(nil)"
|
|
}
|
|
type Alias UpdateReadMonoForumInbox
|
|
return fmt.Sprintf("UpdateReadMonoForumInbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadMonoForumInbox from given interface.
|
|
func (u *UpdateReadMonoForumInbox) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetSavedPeerID() (value PeerClass)
|
|
GetReadMaxID() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.SavedPeerID = from.GetSavedPeerID()
|
|
u.ReadMaxID = from.GetReadMaxID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadMonoForumInbox) TypeID() uint32 {
|
|
return UpdateReadMonoForumInboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadMonoForumInbox) TypeName() string {
|
|
return "updateReadMonoForumInbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadMonoForumInbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadMonoForumInbox",
|
|
ID: UpdateReadMonoForumInboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
},
|
|
{
|
|
Name: "ReadMaxID",
|
|
SchemaName: "read_max_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadMonoForumInbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadMonoForumInbox#77b0e372 as nil")
|
|
}
|
|
b.PutID(UpdateReadMonoForumInboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadMonoForumInbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadMonoForumInbox#77b0e372 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateReadMonoForumInbox#77b0e372: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadMonoForumInbox#77b0e372: field saved_peer_id: %w", err)
|
|
}
|
|
b.PutInt(u.ReadMaxID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadMonoForumInbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadMonoForumInbox#77b0e372 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadMonoForumInboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumInbox#77b0e372: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadMonoForumInbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadMonoForumInbox#77b0e372 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumInbox#77b0e372: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumInbox#77b0e372: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumInbox#77b0e372: field read_max_id: %w", err)
|
|
}
|
|
u.ReadMaxID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateReadMonoForumInbox) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID field.
|
|
func (u *UpdateReadMonoForumInbox) GetSavedPeerID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.SavedPeerID
|
|
}
|
|
|
|
// GetReadMaxID returns value of ReadMaxID field.
|
|
func (u *UpdateReadMonoForumInbox) GetReadMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ReadMaxID
|
|
}
|
|
|
|
// UpdateReadMonoForumOutbox represents TL type `updateReadMonoForumOutbox#a4a79376`.
|
|
// Outgoing messages in a monoforum¹ were read.
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/monoforum
|
|
//
|
|
// See https://core.telegram.org/constructor/updateReadMonoForumOutbox for reference.
|
|
type UpdateReadMonoForumOutbox struct {
|
|
// ID of the monoforum.
|
|
ChannelID int64
|
|
// Topic ID.
|
|
SavedPeerID PeerClass
|
|
// Position up to which all outgoing messages are read.
|
|
ReadMaxID int
|
|
}
|
|
|
|
// UpdateReadMonoForumOutboxTypeID is TL type id of UpdateReadMonoForumOutbox.
|
|
const UpdateReadMonoForumOutboxTypeID = 0xa4a79376
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateReadMonoForumOutbox) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateReadMonoForumOutbox.
|
|
var (
|
|
_ bin.Encoder = &UpdateReadMonoForumOutbox{}
|
|
_ bin.Decoder = &UpdateReadMonoForumOutbox{}
|
|
_ bin.BareEncoder = &UpdateReadMonoForumOutbox{}
|
|
_ bin.BareDecoder = &UpdateReadMonoForumOutbox{}
|
|
|
|
_ UpdateClass = &UpdateReadMonoForumOutbox{}
|
|
)
|
|
|
|
func (u *UpdateReadMonoForumOutbox) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
if !(u.ReadMaxID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateReadMonoForumOutbox) String() string {
|
|
if u == nil {
|
|
return "UpdateReadMonoForumOutbox(nil)"
|
|
}
|
|
type Alias UpdateReadMonoForumOutbox
|
|
return fmt.Sprintf("UpdateReadMonoForumOutbox%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateReadMonoForumOutbox from given interface.
|
|
func (u *UpdateReadMonoForumOutbox) FillFrom(from interface {
|
|
GetChannelID() (value int64)
|
|
GetSavedPeerID() (value PeerClass)
|
|
GetReadMaxID() (value int)
|
|
}) {
|
|
u.ChannelID = from.GetChannelID()
|
|
u.SavedPeerID = from.GetSavedPeerID()
|
|
u.ReadMaxID = from.GetReadMaxID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateReadMonoForumOutbox) TypeID() uint32 {
|
|
return UpdateReadMonoForumOutboxTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateReadMonoForumOutbox) TypeName() string {
|
|
return "updateReadMonoForumOutbox"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateReadMonoForumOutbox) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateReadMonoForumOutbox",
|
|
ID: UpdateReadMonoForumOutboxTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
},
|
|
{
|
|
Name: "ReadMaxID",
|
|
SchemaName: "read_max_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateReadMonoForumOutbox) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadMonoForumOutbox#a4a79376 as nil")
|
|
}
|
|
b.PutID(UpdateReadMonoForumOutboxTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateReadMonoForumOutbox) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateReadMonoForumOutbox#a4a79376 as nil")
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateReadMonoForumOutbox#a4a79376: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateReadMonoForumOutbox#a4a79376: field saved_peer_id: %w", err)
|
|
}
|
|
b.PutInt(u.ReadMaxID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateReadMonoForumOutbox) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadMonoForumOutbox#a4a79376 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateReadMonoForumOutboxTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumOutbox#a4a79376: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateReadMonoForumOutbox) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateReadMonoForumOutbox#a4a79376 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumOutbox#a4a79376: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumOutbox#a4a79376: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateReadMonoForumOutbox#a4a79376: field read_max_id: %w", err)
|
|
}
|
|
u.ReadMaxID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateReadMonoForumOutbox) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID field.
|
|
func (u *UpdateReadMonoForumOutbox) GetSavedPeerID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.SavedPeerID
|
|
}
|
|
|
|
// GetReadMaxID returns value of ReadMaxID field.
|
|
func (u *UpdateReadMonoForumOutbox) GetReadMaxID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ReadMaxID
|
|
}
|
|
|
|
// UpdateMonoForumNoPaidException represents TL type `updateMonoForumNoPaidException#9f812b08`.
|
|
// An admin has (un)exempted this monoforum topic »¹ from payment to send messages
|
|
// using account.toggleNoPaidMessagesException².
|
|
//
|
|
// Links:
|
|
// 1. https://core.telegram.org/api/monoforum
|
|
// 2. https://core.telegram.org/method/account.toggleNoPaidMessagesException
|
|
//
|
|
// See https://core.telegram.org/constructor/updateMonoForumNoPaidException for reference.
|
|
type UpdateMonoForumNoPaidException struct {
|
|
// Flags, see TL conditional fields¹
|
|
//
|
|
// Links:
|
|
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
|
Flags bin.Fields
|
|
// If set, an admin has exempted this peer, otherwise the peer was unexempted.
|
|
Exception bool
|
|
// The monoforum ID.
|
|
ChannelID int64
|
|
// The peer/topic ID.
|
|
SavedPeerID PeerClass
|
|
}
|
|
|
|
// UpdateMonoForumNoPaidExceptionTypeID is TL type id of UpdateMonoForumNoPaidException.
|
|
const UpdateMonoForumNoPaidExceptionTypeID = 0x9f812b08
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateMonoForumNoPaidException) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateMonoForumNoPaidException.
|
|
var (
|
|
_ bin.Encoder = &UpdateMonoForumNoPaidException{}
|
|
_ bin.Decoder = &UpdateMonoForumNoPaidException{}
|
|
_ bin.BareEncoder = &UpdateMonoForumNoPaidException{}
|
|
_ bin.BareDecoder = &UpdateMonoForumNoPaidException{}
|
|
|
|
_ UpdateClass = &UpdateMonoForumNoPaidException{}
|
|
)
|
|
|
|
func (u *UpdateMonoForumNoPaidException) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Exception == false) {
|
|
return false
|
|
}
|
|
if !(u.ChannelID == 0) {
|
|
return false
|
|
}
|
|
if !(u.SavedPeerID == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateMonoForumNoPaidException) String() string {
|
|
if u == nil {
|
|
return "UpdateMonoForumNoPaidException(nil)"
|
|
}
|
|
type Alias UpdateMonoForumNoPaidException
|
|
return fmt.Sprintf("UpdateMonoForumNoPaidException%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateMonoForumNoPaidException from given interface.
|
|
func (u *UpdateMonoForumNoPaidException) FillFrom(from interface {
|
|
GetException() (value bool)
|
|
GetChannelID() (value int64)
|
|
GetSavedPeerID() (value PeerClass)
|
|
}) {
|
|
u.Exception = from.GetException()
|
|
u.ChannelID = from.GetChannelID()
|
|
u.SavedPeerID = from.GetSavedPeerID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateMonoForumNoPaidException) TypeID() uint32 {
|
|
return UpdateMonoForumNoPaidExceptionTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateMonoForumNoPaidException) TypeName() string {
|
|
return "updateMonoForumNoPaidException"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateMonoForumNoPaidException) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateMonoForumNoPaidException",
|
|
ID: UpdateMonoForumNoPaidExceptionTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Exception",
|
|
SchemaName: "exception",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "ChannelID",
|
|
SchemaName: "channel_id",
|
|
},
|
|
{
|
|
Name: "SavedPeerID",
|
|
SchemaName: "saved_peer_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdateMonoForumNoPaidException) SetFlags() {
|
|
if !(u.Exception == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateMonoForumNoPaidException) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMonoForumNoPaidException#9f812b08 as nil")
|
|
}
|
|
b.PutID(UpdateMonoForumNoPaidExceptionTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateMonoForumNoPaidException) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateMonoForumNoPaidException#9f812b08 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMonoForumNoPaidException#9f812b08: field flags: %w", err)
|
|
}
|
|
b.PutLong(u.ChannelID)
|
|
if u.SavedPeerID == nil {
|
|
return fmt.Errorf("unable to encode updateMonoForumNoPaidException#9f812b08: field saved_peer_id is nil")
|
|
}
|
|
if err := u.SavedPeerID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateMonoForumNoPaidException#9f812b08: field saved_peer_id: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateMonoForumNoPaidException) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMonoForumNoPaidException#9f812b08 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateMonoForumNoPaidExceptionTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateMonoForumNoPaidException#9f812b08: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateMonoForumNoPaidException) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateMonoForumNoPaidException#9f812b08 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateMonoForumNoPaidException#9f812b08: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Exception = u.Flags.Has(0)
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMonoForumNoPaidException#9f812b08: field channel_id: %w", err)
|
|
}
|
|
u.ChannelID = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateMonoForumNoPaidException#9f812b08: field saved_peer_id: %w", err)
|
|
}
|
|
u.SavedPeerID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetException sets value of Exception conditional field.
|
|
func (u *UpdateMonoForumNoPaidException) SetException(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Exception = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Exception = false
|
|
}
|
|
}
|
|
|
|
// GetException returns value of Exception conditional field.
|
|
func (u *UpdateMonoForumNoPaidException) GetException() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetChannelID returns value of ChannelID field.
|
|
func (u *UpdateMonoForumNoPaidException) GetChannelID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChannelID
|
|
}
|
|
|
|
// GetSavedPeerID returns value of SavedPeerID field.
|
|
func (u *UpdateMonoForumNoPaidException) GetSavedPeerID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.SavedPeerID
|
|
}
|
|
|
|
// UpdateGroupCallMessage represents TL type `updateGroupCallMessage#d8326f0d`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGroupCallMessage for reference.
|
|
type UpdateGroupCallMessage struct {
|
|
// Call field of UpdateGroupCallMessage.
|
|
Call InputGroupCallClass
|
|
// Message field of UpdateGroupCallMessage.
|
|
Message GroupCallMessage
|
|
}
|
|
|
|
// UpdateGroupCallMessageTypeID is TL type id of UpdateGroupCallMessage.
|
|
const UpdateGroupCallMessageTypeID = 0xd8326f0d
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGroupCallMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGroupCallMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateGroupCallMessage{}
|
|
_ bin.Decoder = &UpdateGroupCallMessage{}
|
|
_ bin.BareEncoder = &UpdateGroupCallMessage{}
|
|
_ bin.BareDecoder = &UpdateGroupCallMessage{}
|
|
|
|
_ UpdateClass = &UpdateGroupCallMessage{}
|
|
)
|
|
|
|
func (u *UpdateGroupCallMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Call == nil) {
|
|
return false
|
|
}
|
|
if !(u.Message.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGroupCallMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateGroupCallMessage(nil)"
|
|
}
|
|
type Alias UpdateGroupCallMessage
|
|
return fmt.Sprintf("UpdateGroupCallMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGroupCallMessage from given interface.
|
|
func (u *UpdateGroupCallMessage) FillFrom(from interface {
|
|
GetCall() (value InputGroupCallClass)
|
|
GetMessage() (value GroupCallMessage)
|
|
}) {
|
|
u.Call = from.GetCall()
|
|
u.Message = from.GetMessage()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGroupCallMessage) TypeID() uint32 {
|
|
return UpdateGroupCallMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGroupCallMessage) TypeName() string {
|
|
return "updateGroupCallMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGroupCallMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGroupCallMessage",
|
|
ID: UpdateGroupCallMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
{
|
|
Name: "Message",
|
|
SchemaName: "message",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGroupCallMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallMessage#d8326f0d as nil")
|
|
}
|
|
b.PutID(UpdateGroupCallMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGroupCallMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallMessage#d8326f0d as nil")
|
|
}
|
|
if u.Call == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallMessage#d8326f0d: field call is nil")
|
|
}
|
|
if err := u.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallMessage#d8326f0d: field call: %w", err)
|
|
}
|
|
if err := u.Message.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallMessage#d8326f0d: field message: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGroupCallMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallMessage#d8326f0d to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGroupCallMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallMessage#d8326f0d: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGroupCallMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallMessage#d8326f0d to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallMessage#d8326f0d: field call: %w", err)
|
|
}
|
|
u.Call = value
|
|
}
|
|
{
|
|
if err := u.Message.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallMessage#d8326f0d: field message: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (u *UpdateGroupCallMessage) GetCall() (value InputGroupCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Call
|
|
}
|
|
|
|
// GetMessage returns value of Message field.
|
|
func (u *UpdateGroupCallMessage) GetMessage() (value GroupCallMessage) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Message
|
|
}
|
|
|
|
// UpdateGroupCallEncryptedMessage represents TL type `updateGroupCallEncryptedMessage#c957a766`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateGroupCallEncryptedMessage for reference.
|
|
type UpdateGroupCallEncryptedMessage struct {
|
|
// Call field of UpdateGroupCallEncryptedMessage.
|
|
Call InputGroupCallClass
|
|
// FromID field of UpdateGroupCallEncryptedMessage.
|
|
FromID PeerClass
|
|
// EncryptedMessage field of UpdateGroupCallEncryptedMessage.
|
|
EncryptedMessage []byte
|
|
}
|
|
|
|
// UpdateGroupCallEncryptedMessageTypeID is TL type id of UpdateGroupCallEncryptedMessage.
|
|
const UpdateGroupCallEncryptedMessageTypeID = 0xc957a766
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateGroupCallEncryptedMessage) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateGroupCallEncryptedMessage.
|
|
var (
|
|
_ bin.Encoder = &UpdateGroupCallEncryptedMessage{}
|
|
_ bin.Decoder = &UpdateGroupCallEncryptedMessage{}
|
|
_ bin.BareEncoder = &UpdateGroupCallEncryptedMessage{}
|
|
_ bin.BareDecoder = &UpdateGroupCallEncryptedMessage{}
|
|
|
|
_ UpdateClass = &UpdateGroupCallEncryptedMessage{}
|
|
)
|
|
|
|
func (u *UpdateGroupCallEncryptedMessage) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Call == nil) {
|
|
return false
|
|
}
|
|
if !(u.FromID == nil) {
|
|
return false
|
|
}
|
|
if !(u.EncryptedMessage == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateGroupCallEncryptedMessage) String() string {
|
|
if u == nil {
|
|
return "UpdateGroupCallEncryptedMessage(nil)"
|
|
}
|
|
type Alias UpdateGroupCallEncryptedMessage
|
|
return fmt.Sprintf("UpdateGroupCallEncryptedMessage%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateGroupCallEncryptedMessage from given interface.
|
|
func (u *UpdateGroupCallEncryptedMessage) FillFrom(from interface {
|
|
GetCall() (value InputGroupCallClass)
|
|
GetFromID() (value PeerClass)
|
|
GetEncryptedMessage() (value []byte)
|
|
}) {
|
|
u.Call = from.GetCall()
|
|
u.FromID = from.GetFromID()
|
|
u.EncryptedMessage = from.GetEncryptedMessage()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateGroupCallEncryptedMessage) TypeID() uint32 {
|
|
return UpdateGroupCallEncryptedMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateGroupCallEncryptedMessage) TypeName() string {
|
|
return "updateGroupCallEncryptedMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateGroupCallEncryptedMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateGroupCallEncryptedMessage",
|
|
ID: UpdateGroupCallEncryptedMessageTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
{
|
|
Name: "FromID",
|
|
SchemaName: "from_id",
|
|
},
|
|
{
|
|
Name: "EncryptedMessage",
|
|
SchemaName: "encrypted_message",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateGroupCallEncryptedMessage) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallEncryptedMessage#c957a766 as nil")
|
|
}
|
|
b.PutID(UpdateGroupCallEncryptedMessageTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateGroupCallEncryptedMessage) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateGroupCallEncryptedMessage#c957a766 as nil")
|
|
}
|
|
if u.Call == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallEncryptedMessage#c957a766: field call is nil")
|
|
}
|
|
if err := u.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallEncryptedMessage#c957a766: field call: %w", err)
|
|
}
|
|
if u.FromID == nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallEncryptedMessage#c957a766: field from_id is nil")
|
|
}
|
|
if err := u.FromID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateGroupCallEncryptedMessage#c957a766: field from_id: %w", err)
|
|
}
|
|
b.PutBytes(u.EncryptedMessage)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateGroupCallEncryptedMessage) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallEncryptedMessage#c957a766 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateGroupCallEncryptedMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallEncryptedMessage#c957a766: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateGroupCallEncryptedMessage) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateGroupCallEncryptedMessage#c957a766 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallEncryptedMessage#c957a766: field call: %w", err)
|
|
}
|
|
u.Call = value
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallEncryptedMessage#c957a766: field from_id: %w", err)
|
|
}
|
|
u.FromID = value
|
|
}
|
|
{
|
|
value, err := b.Bytes()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateGroupCallEncryptedMessage#c957a766: field encrypted_message: %w", err)
|
|
}
|
|
u.EncryptedMessage = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (u *UpdateGroupCallEncryptedMessage) GetCall() (value InputGroupCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Call
|
|
}
|
|
|
|
// GetFromID returns value of FromID field.
|
|
func (u *UpdateGroupCallEncryptedMessage) GetFromID() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.FromID
|
|
}
|
|
|
|
// GetEncryptedMessage returns value of EncryptedMessage field.
|
|
func (u *UpdateGroupCallEncryptedMessage) GetEncryptedMessage() (value []byte) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.EncryptedMessage
|
|
}
|
|
|
|
// UpdatePinnedForumTopic represents TL type `updatePinnedForumTopic#683b2c52`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePinnedForumTopic for reference.
|
|
type UpdatePinnedForumTopic struct {
|
|
// Flags field of UpdatePinnedForumTopic.
|
|
Flags bin.Fields
|
|
// Pinned field of UpdatePinnedForumTopic.
|
|
Pinned bool
|
|
// Peer field of UpdatePinnedForumTopic.
|
|
Peer PeerClass
|
|
// TopicID field of UpdatePinnedForumTopic.
|
|
TopicID int
|
|
}
|
|
|
|
// UpdatePinnedForumTopicTypeID is TL type id of UpdatePinnedForumTopic.
|
|
const UpdatePinnedForumTopicTypeID = 0x683b2c52
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePinnedForumTopic) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePinnedForumTopic.
|
|
var (
|
|
_ bin.Encoder = &UpdatePinnedForumTopic{}
|
|
_ bin.Decoder = &UpdatePinnedForumTopic{}
|
|
_ bin.BareEncoder = &UpdatePinnedForumTopic{}
|
|
_ bin.BareDecoder = &UpdatePinnedForumTopic{}
|
|
|
|
_ UpdateClass = &UpdatePinnedForumTopic{}
|
|
)
|
|
|
|
func (u *UpdatePinnedForumTopic) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Pinned == false) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.TopicID == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePinnedForumTopic) String() string {
|
|
if u == nil {
|
|
return "UpdatePinnedForumTopic(nil)"
|
|
}
|
|
type Alias UpdatePinnedForumTopic
|
|
return fmt.Sprintf("UpdatePinnedForumTopic%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePinnedForumTopic from given interface.
|
|
func (u *UpdatePinnedForumTopic) FillFrom(from interface {
|
|
GetPinned() (value bool)
|
|
GetPeer() (value PeerClass)
|
|
GetTopicID() (value int)
|
|
}) {
|
|
u.Pinned = from.GetPinned()
|
|
u.Peer = from.GetPeer()
|
|
u.TopicID = from.GetTopicID()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePinnedForumTopic) TypeID() uint32 {
|
|
return UpdatePinnedForumTopicTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePinnedForumTopic) TypeName() string {
|
|
return "updatePinnedForumTopic"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePinnedForumTopic) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePinnedForumTopic",
|
|
ID: UpdatePinnedForumTopicTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Pinned",
|
|
SchemaName: "pinned",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "TopicID",
|
|
SchemaName: "topic_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePinnedForumTopic) SetFlags() {
|
|
if !(u.Pinned == false) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePinnedForumTopic) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedForumTopic#683b2c52 as nil")
|
|
}
|
|
b.PutID(UpdatePinnedForumTopicTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePinnedForumTopic) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedForumTopic#683b2c52 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedForumTopic#683b2c52: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePinnedForumTopic#683b2c52: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedForumTopic#683b2c52: field peer: %w", err)
|
|
}
|
|
b.PutInt(u.TopicID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePinnedForumTopic) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedForumTopic#683b2c52 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePinnedForumTopicTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopic#683b2c52: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePinnedForumTopic) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedForumTopic#683b2c52 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopic#683b2c52: field flags: %w", err)
|
|
}
|
|
}
|
|
u.Pinned = u.Flags.Has(0)
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopic#683b2c52: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopic#683b2c52: field topic_id: %w", err)
|
|
}
|
|
u.TopicID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// SetPinned sets value of Pinned conditional field.
|
|
func (u *UpdatePinnedForumTopic) SetPinned(value bool) {
|
|
if value {
|
|
u.Flags.Set(0)
|
|
u.Pinned = true
|
|
} else {
|
|
u.Flags.Unset(0)
|
|
u.Pinned = false
|
|
}
|
|
}
|
|
|
|
// GetPinned returns value of Pinned conditional field.
|
|
func (u *UpdatePinnedForumTopic) GetPinned() (value bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Flags.Has(0)
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePinnedForumTopic) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// GetTopicID returns value of TopicID field.
|
|
func (u *UpdatePinnedForumTopic) GetTopicID() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.TopicID
|
|
}
|
|
|
|
// UpdatePinnedForumTopics represents TL type `updatePinnedForumTopics#def143d0`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updatePinnedForumTopics for reference.
|
|
type UpdatePinnedForumTopics struct {
|
|
// Flags field of UpdatePinnedForumTopics.
|
|
Flags bin.Fields
|
|
// Peer field of UpdatePinnedForumTopics.
|
|
Peer PeerClass
|
|
// Order field of UpdatePinnedForumTopics.
|
|
//
|
|
// Use SetOrder and GetOrder helpers.
|
|
Order []int
|
|
}
|
|
|
|
// UpdatePinnedForumTopicsTypeID is TL type id of UpdatePinnedForumTopics.
|
|
const UpdatePinnedForumTopicsTypeID = 0xdef143d0
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdatePinnedForumTopics) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdatePinnedForumTopics.
|
|
var (
|
|
_ bin.Encoder = &UpdatePinnedForumTopics{}
|
|
_ bin.Decoder = &UpdatePinnedForumTopics{}
|
|
_ bin.BareEncoder = &UpdatePinnedForumTopics{}
|
|
_ bin.BareDecoder = &UpdatePinnedForumTopics{}
|
|
|
|
_ UpdateClass = &UpdatePinnedForumTopics{}
|
|
)
|
|
|
|
func (u *UpdatePinnedForumTopics) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Flags.Zero()) {
|
|
return false
|
|
}
|
|
if !(u.Peer == nil) {
|
|
return false
|
|
}
|
|
if !(u.Order == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdatePinnedForumTopics) String() string {
|
|
if u == nil {
|
|
return "UpdatePinnedForumTopics(nil)"
|
|
}
|
|
type Alias UpdatePinnedForumTopics
|
|
return fmt.Sprintf("UpdatePinnedForumTopics%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdatePinnedForumTopics from given interface.
|
|
func (u *UpdatePinnedForumTopics) FillFrom(from interface {
|
|
GetPeer() (value PeerClass)
|
|
GetOrder() (value []int, ok bool)
|
|
}) {
|
|
u.Peer = from.GetPeer()
|
|
if val, ok := from.GetOrder(); ok {
|
|
u.Order = val
|
|
}
|
|
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdatePinnedForumTopics) TypeID() uint32 {
|
|
return UpdatePinnedForumTopicsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdatePinnedForumTopics) TypeName() string {
|
|
return "updatePinnedForumTopics"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdatePinnedForumTopics) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updatePinnedForumTopics",
|
|
ID: UpdatePinnedForumTopicsTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
{
|
|
Name: "Order",
|
|
SchemaName: "order",
|
|
Null: !u.Flags.Has(0),
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// SetFlags sets flags for non-zero fields.
|
|
func (u *UpdatePinnedForumTopics) SetFlags() {
|
|
if !(u.Order == nil) {
|
|
u.Flags.Set(0)
|
|
}
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdatePinnedForumTopics) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedForumTopics#def143d0 as nil")
|
|
}
|
|
b.PutID(UpdatePinnedForumTopicsTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdatePinnedForumTopics) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updatePinnedForumTopics#def143d0 as nil")
|
|
}
|
|
u.SetFlags()
|
|
if err := u.Flags.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedForumTopics#def143d0: field flags: %w", err)
|
|
}
|
|
if u.Peer == nil {
|
|
return fmt.Errorf("unable to encode updatePinnedForumTopics#def143d0: field peer is nil")
|
|
}
|
|
if err := u.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updatePinnedForumTopics#def143d0: field peer: %w", err)
|
|
}
|
|
if u.Flags.Has(0) {
|
|
b.PutVectorHeader(len(u.Order))
|
|
for _, v := range u.Order {
|
|
b.PutInt(v)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdatePinnedForumTopics) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedForumTopics#def143d0 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdatePinnedForumTopicsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopics#def143d0: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdatePinnedForumTopics) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updatePinnedForumTopics#def143d0 to nil")
|
|
}
|
|
{
|
|
if err := u.Flags.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopics#def143d0: field flags: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodePeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopics#def143d0: field peer: %w", err)
|
|
}
|
|
u.Peer = value
|
|
}
|
|
if u.Flags.Has(0) {
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopics#def143d0: field order: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Order = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updatePinnedForumTopics#def143d0: field order: %w", err)
|
|
}
|
|
u.Order = append(u.Order, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (u *UpdatePinnedForumTopics) GetPeer() (value PeerClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Peer
|
|
}
|
|
|
|
// SetOrder sets value of Order conditional field.
|
|
func (u *UpdatePinnedForumTopics) SetOrder(value []int) {
|
|
u.Flags.Set(0)
|
|
u.Order = value
|
|
}
|
|
|
|
// GetOrder returns value of Order conditional field and
|
|
// boolean which is true if field was set.
|
|
func (u *UpdatePinnedForumTopics) GetOrder() (value []int, ok bool) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
if !u.Flags.Has(0) {
|
|
return value, false
|
|
}
|
|
return u.Order, true
|
|
}
|
|
|
|
// UpdateDeleteGroupCallMessages represents TL type `updateDeleteGroupCallMessages#3e85e92c`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateDeleteGroupCallMessages for reference.
|
|
type UpdateDeleteGroupCallMessages struct {
|
|
// Call field of UpdateDeleteGroupCallMessages.
|
|
Call InputGroupCallClass
|
|
// Messages field of UpdateDeleteGroupCallMessages.
|
|
Messages []int
|
|
}
|
|
|
|
// UpdateDeleteGroupCallMessagesTypeID is TL type id of UpdateDeleteGroupCallMessages.
|
|
const UpdateDeleteGroupCallMessagesTypeID = 0x3e85e92c
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateDeleteGroupCallMessages) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateDeleteGroupCallMessages.
|
|
var (
|
|
_ bin.Encoder = &UpdateDeleteGroupCallMessages{}
|
|
_ bin.Decoder = &UpdateDeleteGroupCallMessages{}
|
|
_ bin.BareEncoder = &UpdateDeleteGroupCallMessages{}
|
|
_ bin.BareDecoder = &UpdateDeleteGroupCallMessages{}
|
|
|
|
_ UpdateClass = &UpdateDeleteGroupCallMessages{}
|
|
)
|
|
|
|
func (u *UpdateDeleteGroupCallMessages) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Call == nil) {
|
|
return false
|
|
}
|
|
if !(u.Messages == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateDeleteGroupCallMessages) String() string {
|
|
if u == nil {
|
|
return "UpdateDeleteGroupCallMessages(nil)"
|
|
}
|
|
type Alias UpdateDeleteGroupCallMessages
|
|
return fmt.Sprintf("UpdateDeleteGroupCallMessages%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateDeleteGroupCallMessages from given interface.
|
|
func (u *UpdateDeleteGroupCallMessages) FillFrom(from interface {
|
|
GetCall() (value InputGroupCallClass)
|
|
GetMessages() (value []int)
|
|
}) {
|
|
u.Call = from.GetCall()
|
|
u.Messages = from.GetMessages()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateDeleteGroupCallMessages) TypeID() uint32 {
|
|
return UpdateDeleteGroupCallMessagesTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateDeleteGroupCallMessages) TypeName() string {
|
|
return "updateDeleteGroupCallMessages"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateDeleteGroupCallMessages) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateDeleteGroupCallMessages",
|
|
ID: UpdateDeleteGroupCallMessagesTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Call",
|
|
SchemaName: "call",
|
|
},
|
|
{
|
|
Name: "Messages",
|
|
SchemaName: "messages",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateDeleteGroupCallMessages) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteGroupCallMessages#3e85e92c as nil")
|
|
}
|
|
b.PutID(UpdateDeleteGroupCallMessagesTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateDeleteGroupCallMessages) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateDeleteGroupCallMessages#3e85e92c as nil")
|
|
}
|
|
if u.Call == nil {
|
|
return fmt.Errorf("unable to encode updateDeleteGroupCallMessages#3e85e92c: field call is nil")
|
|
}
|
|
if err := u.Call.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateDeleteGroupCallMessages#3e85e92c: field call: %w", err)
|
|
}
|
|
b.PutVectorHeader(len(u.Messages))
|
|
for _, v := range u.Messages {
|
|
b.PutInt(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateDeleteGroupCallMessages) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteGroupCallMessages#3e85e92c to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateDeleteGroupCallMessagesTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteGroupCallMessages#3e85e92c: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateDeleteGroupCallMessages) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateDeleteGroupCallMessages#3e85e92c to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputGroupCall(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteGroupCallMessages#3e85e92c: field call: %w", err)
|
|
}
|
|
u.Call = value
|
|
}
|
|
{
|
|
headerLen, err := b.VectorHeader()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteGroupCallMessages#3e85e92c: field messages: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
u.Messages = make([]int, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateDeleteGroupCallMessages#3e85e92c: field messages: %w", err)
|
|
}
|
|
u.Messages = append(u.Messages, value)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetCall returns value of Call field.
|
|
func (u *UpdateDeleteGroupCallMessages) GetCall() (value InputGroupCallClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Call
|
|
}
|
|
|
|
// GetMessages returns value of Messages field.
|
|
func (u *UpdateDeleteGroupCallMessages) GetMessages() (value []int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Messages
|
|
}
|
|
|
|
// UpdateStarGiftAuctionState represents TL type `updateStarGiftAuctionState#48e246c2`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStarGiftAuctionState for reference.
|
|
type UpdateStarGiftAuctionState struct {
|
|
// GiftID field of UpdateStarGiftAuctionState.
|
|
GiftID int64
|
|
// State field of UpdateStarGiftAuctionState.
|
|
State StarGiftAuctionStateClass
|
|
}
|
|
|
|
// UpdateStarGiftAuctionStateTypeID is TL type id of UpdateStarGiftAuctionState.
|
|
const UpdateStarGiftAuctionStateTypeID = 0x48e246c2
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStarGiftAuctionState) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStarGiftAuctionState.
|
|
var (
|
|
_ bin.Encoder = &UpdateStarGiftAuctionState{}
|
|
_ bin.Decoder = &UpdateStarGiftAuctionState{}
|
|
_ bin.BareEncoder = &UpdateStarGiftAuctionState{}
|
|
_ bin.BareDecoder = &UpdateStarGiftAuctionState{}
|
|
|
|
_ UpdateClass = &UpdateStarGiftAuctionState{}
|
|
)
|
|
|
|
func (u *UpdateStarGiftAuctionState) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.GiftID == 0) {
|
|
return false
|
|
}
|
|
if !(u.State == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStarGiftAuctionState) String() string {
|
|
if u == nil {
|
|
return "UpdateStarGiftAuctionState(nil)"
|
|
}
|
|
type Alias UpdateStarGiftAuctionState
|
|
return fmt.Sprintf("UpdateStarGiftAuctionState%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStarGiftAuctionState from given interface.
|
|
func (u *UpdateStarGiftAuctionState) FillFrom(from interface {
|
|
GetGiftID() (value int64)
|
|
GetState() (value StarGiftAuctionStateClass)
|
|
}) {
|
|
u.GiftID = from.GetGiftID()
|
|
u.State = from.GetState()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStarGiftAuctionState) TypeID() uint32 {
|
|
return UpdateStarGiftAuctionStateTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStarGiftAuctionState) TypeName() string {
|
|
return "updateStarGiftAuctionState"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStarGiftAuctionState) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStarGiftAuctionState",
|
|
ID: UpdateStarGiftAuctionStateTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "GiftID",
|
|
SchemaName: "gift_id",
|
|
},
|
|
{
|
|
Name: "State",
|
|
SchemaName: "state",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStarGiftAuctionState) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarGiftAuctionState#48e246c2 as nil")
|
|
}
|
|
b.PutID(UpdateStarGiftAuctionStateTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStarGiftAuctionState) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarGiftAuctionState#48e246c2 as nil")
|
|
}
|
|
b.PutLong(u.GiftID)
|
|
if u.State == nil {
|
|
return fmt.Errorf("unable to encode updateStarGiftAuctionState#48e246c2: field state is nil")
|
|
}
|
|
if err := u.State.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStarGiftAuctionState#48e246c2: field state: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStarGiftAuctionState) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarGiftAuctionState#48e246c2 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStarGiftAuctionStateTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftAuctionState#48e246c2: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStarGiftAuctionState) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarGiftAuctionState#48e246c2 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftAuctionState#48e246c2: field gift_id: %w", err)
|
|
}
|
|
u.GiftID = value
|
|
}
|
|
{
|
|
value, err := DecodeStarGiftAuctionState(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftAuctionState#48e246c2: field state: %w", err)
|
|
}
|
|
u.State = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetGiftID returns value of GiftID field.
|
|
func (u *UpdateStarGiftAuctionState) GetGiftID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.GiftID
|
|
}
|
|
|
|
// GetState returns value of State field.
|
|
func (u *UpdateStarGiftAuctionState) GetState() (value StarGiftAuctionStateClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.State
|
|
}
|
|
|
|
// UpdateStarGiftAuctionUserState represents TL type `updateStarGiftAuctionUserState#dc58f31e`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStarGiftAuctionUserState for reference.
|
|
type UpdateStarGiftAuctionUserState struct {
|
|
// GiftID field of UpdateStarGiftAuctionUserState.
|
|
GiftID int64
|
|
// UserState field of UpdateStarGiftAuctionUserState.
|
|
UserState StarGiftAuctionUserState
|
|
}
|
|
|
|
// UpdateStarGiftAuctionUserStateTypeID is TL type id of UpdateStarGiftAuctionUserState.
|
|
const UpdateStarGiftAuctionUserStateTypeID = 0xdc58f31e
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStarGiftAuctionUserState) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStarGiftAuctionUserState.
|
|
var (
|
|
_ bin.Encoder = &UpdateStarGiftAuctionUserState{}
|
|
_ bin.Decoder = &UpdateStarGiftAuctionUserState{}
|
|
_ bin.BareEncoder = &UpdateStarGiftAuctionUserState{}
|
|
_ bin.BareDecoder = &UpdateStarGiftAuctionUserState{}
|
|
|
|
_ UpdateClass = &UpdateStarGiftAuctionUserState{}
|
|
)
|
|
|
|
func (u *UpdateStarGiftAuctionUserState) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.GiftID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserState.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStarGiftAuctionUserState) String() string {
|
|
if u == nil {
|
|
return "UpdateStarGiftAuctionUserState(nil)"
|
|
}
|
|
type Alias UpdateStarGiftAuctionUserState
|
|
return fmt.Sprintf("UpdateStarGiftAuctionUserState%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateStarGiftAuctionUserState from given interface.
|
|
func (u *UpdateStarGiftAuctionUserState) FillFrom(from interface {
|
|
GetGiftID() (value int64)
|
|
GetUserState() (value StarGiftAuctionUserState)
|
|
}) {
|
|
u.GiftID = from.GetGiftID()
|
|
u.UserState = from.GetUserState()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStarGiftAuctionUserState) TypeID() uint32 {
|
|
return UpdateStarGiftAuctionUserStateTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStarGiftAuctionUserState) TypeName() string {
|
|
return "updateStarGiftAuctionUserState"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStarGiftAuctionUserState) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStarGiftAuctionUserState",
|
|
ID: UpdateStarGiftAuctionUserStateTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "GiftID",
|
|
SchemaName: "gift_id",
|
|
},
|
|
{
|
|
Name: "UserState",
|
|
SchemaName: "user_state",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStarGiftAuctionUserState) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarGiftAuctionUserState#dc58f31e as nil")
|
|
}
|
|
b.PutID(UpdateStarGiftAuctionUserStateTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStarGiftAuctionUserState) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarGiftAuctionUserState#dc58f31e as nil")
|
|
}
|
|
b.PutLong(u.GiftID)
|
|
if err := u.UserState.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateStarGiftAuctionUserState#dc58f31e: field user_state: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStarGiftAuctionUserState) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarGiftAuctionUserState#dc58f31e to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStarGiftAuctionUserStateTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftAuctionUserState#dc58f31e: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStarGiftAuctionUserState) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarGiftAuctionUserState#dc58f31e to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftAuctionUserState#dc58f31e: field gift_id: %w", err)
|
|
}
|
|
u.GiftID = value
|
|
}
|
|
{
|
|
if err := u.UserState.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftAuctionUserState#dc58f31e: field user_state: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetGiftID returns value of GiftID field.
|
|
func (u *UpdateStarGiftAuctionUserState) GetGiftID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.GiftID
|
|
}
|
|
|
|
// GetUserState returns value of UserState field.
|
|
func (u *UpdateStarGiftAuctionUserState) GetUserState() (value StarGiftAuctionUserState) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserState
|
|
}
|
|
|
|
// UpdateEmojiGameInfo represents TL type `updateEmojiGameInfo#fb9c547a`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateEmojiGameInfo for reference.
|
|
type UpdateEmojiGameInfo struct {
|
|
// Info field of UpdateEmojiGameInfo.
|
|
Info MessagesEmojiGameInfoClass
|
|
}
|
|
|
|
// UpdateEmojiGameInfoTypeID is TL type id of UpdateEmojiGameInfo.
|
|
const UpdateEmojiGameInfoTypeID = 0xfb9c547a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateEmojiGameInfo) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateEmojiGameInfo.
|
|
var (
|
|
_ bin.Encoder = &UpdateEmojiGameInfo{}
|
|
_ bin.Decoder = &UpdateEmojiGameInfo{}
|
|
_ bin.BareEncoder = &UpdateEmojiGameInfo{}
|
|
_ bin.BareDecoder = &UpdateEmojiGameInfo{}
|
|
|
|
_ UpdateClass = &UpdateEmojiGameInfo{}
|
|
)
|
|
|
|
func (u *UpdateEmojiGameInfo) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.Info == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateEmojiGameInfo) String() string {
|
|
if u == nil {
|
|
return "UpdateEmojiGameInfo(nil)"
|
|
}
|
|
type Alias UpdateEmojiGameInfo
|
|
return fmt.Sprintf("UpdateEmojiGameInfo%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateEmojiGameInfo from given interface.
|
|
func (u *UpdateEmojiGameInfo) FillFrom(from interface {
|
|
GetInfo() (value MessagesEmojiGameInfoClass)
|
|
}) {
|
|
u.Info = from.GetInfo()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateEmojiGameInfo) TypeID() uint32 {
|
|
return UpdateEmojiGameInfoTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateEmojiGameInfo) TypeName() string {
|
|
return "updateEmojiGameInfo"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateEmojiGameInfo) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateEmojiGameInfo",
|
|
ID: UpdateEmojiGameInfoTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Info",
|
|
SchemaName: "info",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateEmojiGameInfo) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEmojiGameInfo#fb9c547a as nil")
|
|
}
|
|
b.PutID(UpdateEmojiGameInfoTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateEmojiGameInfo) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateEmojiGameInfo#fb9c547a as nil")
|
|
}
|
|
if u.Info == nil {
|
|
return fmt.Errorf("unable to encode updateEmojiGameInfo#fb9c547a: field info is nil")
|
|
}
|
|
if err := u.Info.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode updateEmojiGameInfo#fb9c547a: field info: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateEmojiGameInfo) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEmojiGameInfo#fb9c547a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateEmojiGameInfoTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateEmojiGameInfo#fb9c547a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateEmojiGameInfo) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateEmojiGameInfo#fb9c547a to nil")
|
|
}
|
|
{
|
|
value, err := DecodeMessagesEmojiGameInfo(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateEmojiGameInfo#fb9c547a: field info: %w", err)
|
|
}
|
|
u.Info = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetInfo returns value of Info field.
|
|
func (u *UpdateEmojiGameInfo) GetInfo() (value MessagesEmojiGameInfoClass) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Info
|
|
}
|
|
|
|
// UpdateStarGiftCraftFail represents TL type `updateStarGiftCraftFail#ac072444`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateStarGiftCraftFail for reference.
|
|
type UpdateStarGiftCraftFail struct {
|
|
}
|
|
|
|
// UpdateStarGiftCraftFailTypeID is TL type id of UpdateStarGiftCraftFail.
|
|
const UpdateStarGiftCraftFailTypeID = 0xac072444
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateStarGiftCraftFail) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateStarGiftCraftFail.
|
|
var (
|
|
_ bin.Encoder = &UpdateStarGiftCraftFail{}
|
|
_ bin.Decoder = &UpdateStarGiftCraftFail{}
|
|
_ bin.BareEncoder = &UpdateStarGiftCraftFail{}
|
|
_ bin.BareDecoder = &UpdateStarGiftCraftFail{}
|
|
|
|
_ UpdateClass = &UpdateStarGiftCraftFail{}
|
|
)
|
|
|
|
func (u *UpdateStarGiftCraftFail) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateStarGiftCraftFail) String() string {
|
|
if u == nil {
|
|
return "UpdateStarGiftCraftFail(nil)"
|
|
}
|
|
type Alias UpdateStarGiftCraftFail
|
|
return fmt.Sprintf("UpdateStarGiftCraftFail%+v", Alias(*u))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateStarGiftCraftFail) TypeID() uint32 {
|
|
return UpdateStarGiftCraftFailTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateStarGiftCraftFail) TypeName() string {
|
|
return "updateStarGiftCraftFail"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateStarGiftCraftFail) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateStarGiftCraftFail",
|
|
ID: UpdateStarGiftCraftFailTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateStarGiftCraftFail) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarGiftCraftFail#ac072444 as nil")
|
|
}
|
|
b.PutID(UpdateStarGiftCraftFailTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateStarGiftCraftFail) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateStarGiftCraftFail#ac072444 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateStarGiftCraftFail) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarGiftCraftFail#ac072444 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateStarGiftCraftFailTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateStarGiftCraftFail#ac072444: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateStarGiftCraftFail) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateStarGiftCraftFail#ac072444 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpdateChatParticipantRank represents TL type `updateChatParticipantRank#bd8367b9`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateChatParticipantRank for reference.
|
|
type UpdateChatParticipantRank struct {
|
|
// ChatID field of UpdateChatParticipantRank.
|
|
ChatID int64
|
|
// UserID field of UpdateChatParticipantRank.
|
|
UserID int64
|
|
// Rank field of UpdateChatParticipantRank.
|
|
Rank string
|
|
// Version field of UpdateChatParticipantRank.
|
|
Version int
|
|
}
|
|
|
|
// UpdateChatParticipantRankTypeID is TL type id of UpdateChatParticipantRank.
|
|
const UpdateChatParticipantRankTypeID = 0xbd8367b9
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateChatParticipantRank) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateChatParticipantRank.
|
|
var (
|
|
_ bin.Encoder = &UpdateChatParticipantRank{}
|
|
_ bin.Decoder = &UpdateChatParticipantRank{}
|
|
_ bin.BareEncoder = &UpdateChatParticipantRank{}
|
|
_ bin.BareDecoder = &UpdateChatParticipantRank{}
|
|
|
|
_ UpdateClass = &UpdateChatParticipantRank{}
|
|
)
|
|
|
|
func (u *UpdateChatParticipantRank) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.ChatID == 0) {
|
|
return false
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Rank == "") {
|
|
return false
|
|
}
|
|
if !(u.Version == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateChatParticipantRank) String() string {
|
|
if u == nil {
|
|
return "UpdateChatParticipantRank(nil)"
|
|
}
|
|
type Alias UpdateChatParticipantRank
|
|
return fmt.Sprintf("UpdateChatParticipantRank%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateChatParticipantRank from given interface.
|
|
func (u *UpdateChatParticipantRank) FillFrom(from interface {
|
|
GetChatID() (value int64)
|
|
GetUserID() (value int64)
|
|
GetRank() (value string)
|
|
GetVersion() (value int)
|
|
}) {
|
|
u.ChatID = from.GetChatID()
|
|
u.UserID = from.GetUserID()
|
|
u.Rank = from.GetRank()
|
|
u.Version = from.GetVersion()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateChatParticipantRank) TypeID() uint32 {
|
|
return UpdateChatParticipantRankTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateChatParticipantRank) TypeName() string {
|
|
return "updateChatParticipantRank"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateChatParticipantRank) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateChatParticipantRank",
|
|
ID: UpdateChatParticipantRankTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ChatID",
|
|
SchemaName: "chat_id",
|
|
},
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "Rank",
|
|
SchemaName: "rank",
|
|
},
|
|
{
|
|
Name: "Version",
|
|
SchemaName: "version",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateChatParticipantRank) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantRank#bd8367b9 as nil")
|
|
}
|
|
b.PutID(UpdateChatParticipantRankTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateChatParticipantRank) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateChatParticipantRank#bd8367b9 as nil")
|
|
}
|
|
b.PutLong(u.ChatID)
|
|
b.PutLong(u.UserID)
|
|
b.PutString(u.Rank)
|
|
b.PutInt(u.Version)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateChatParticipantRank) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantRank#bd8367b9 to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateChatParticipantRankTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateChatParticipantRank) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateChatParticipantRank#bd8367b9 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field chat_id: %w", err)
|
|
}
|
|
u.ChatID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field rank: %w", err)
|
|
}
|
|
u.Rank = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateChatParticipantRank#bd8367b9: field version: %w", err)
|
|
}
|
|
u.Version = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetChatID returns value of ChatID field.
|
|
func (u *UpdateChatParticipantRank) GetChatID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.ChatID
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateChatParticipantRank) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetRank returns value of Rank field.
|
|
func (u *UpdateChatParticipantRank) GetRank() (value string) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Rank
|
|
}
|
|
|
|
// GetVersion returns value of Version field.
|
|
func (u *UpdateChatParticipantRank) GetVersion() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Version
|
|
}
|
|
|
|
// UpdateManagedBot represents TL type `updateManagedBot#4880ed9a`.
|
|
//
|
|
// See https://core.telegram.org/constructor/updateManagedBot for reference.
|
|
type UpdateManagedBot struct {
|
|
// UserID field of UpdateManagedBot.
|
|
UserID int64
|
|
// BotID field of UpdateManagedBot.
|
|
BotID int64
|
|
// Qts field of UpdateManagedBot.
|
|
Qts int
|
|
}
|
|
|
|
// UpdateManagedBotTypeID is TL type id of UpdateManagedBot.
|
|
const UpdateManagedBotTypeID = 0x4880ed9a
|
|
|
|
// construct implements constructor of UpdateClass.
|
|
func (u UpdateManagedBot) construct() UpdateClass { return &u }
|
|
|
|
// Ensuring interfaces in compile-time for UpdateManagedBot.
|
|
var (
|
|
_ bin.Encoder = &UpdateManagedBot{}
|
|
_ bin.Decoder = &UpdateManagedBot{}
|
|
_ bin.BareEncoder = &UpdateManagedBot{}
|
|
_ bin.BareDecoder = &UpdateManagedBot{}
|
|
|
|
_ UpdateClass = &UpdateManagedBot{}
|
|
)
|
|
|
|
func (u *UpdateManagedBot) Zero() bool {
|
|
if u == nil {
|
|
return true
|
|
}
|
|
if !(u.UserID == 0) {
|
|
return false
|
|
}
|
|
if !(u.BotID == 0) {
|
|
return false
|
|
}
|
|
if !(u.Qts == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (u *UpdateManagedBot) String() string {
|
|
if u == nil {
|
|
return "UpdateManagedBot(nil)"
|
|
}
|
|
type Alias UpdateManagedBot
|
|
return fmt.Sprintf("UpdateManagedBot%+v", Alias(*u))
|
|
}
|
|
|
|
// FillFrom fills UpdateManagedBot from given interface.
|
|
func (u *UpdateManagedBot) FillFrom(from interface {
|
|
GetUserID() (value int64)
|
|
GetBotID() (value int64)
|
|
GetQts() (value int)
|
|
}) {
|
|
u.UserID = from.GetUserID()
|
|
u.BotID = from.GetBotID()
|
|
u.Qts = from.GetQts()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*UpdateManagedBot) TypeID() uint32 {
|
|
return UpdateManagedBotTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*UpdateManagedBot) TypeName() string {
|
|
return "updateManagedBot"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (u *UpdateManagedBot) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "updateManagedBot",
|
|
ID: UpdateManagedBotTypeID,
|
|
}
|
|
if u == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UserID",
|
|
SchemaName: "user_id",
|
|
},
|
|
{
|
|
Name: "BotID",
|
|
SchemaName: "bot_id",
|
|
},
|
|
{
|
|
Name: "Qts",
|
|
SchemaName: "qts",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (u *UpdateManagedBot) Encode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateManagedBot#4880ed9a as nil")
|
|
}
|
|
b.PutID(UpdateManagedBotTypeID)
|
|
return u.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (u *UpdateManagedBot) EncodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't encode updateManagedBot#4880ed9a as nil")
|
|
}
|
|
b.PutLong(u.UserID)
|
|
b.PutLong(u.BotID)
|
|
b.PutInt(u.Qts)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (u *UpdateManagedBot) Decode(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateManagedBot#4880ed9a to nil")
|
|
}
|
|
if err := b.ConsumeID(UpdateManagedBotTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: %w", err)
|
|
}
|
|
return u.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (u *UpdateManagedBot) DecodeBare(b *bin.Buffer) error {
|
|
if u == nil {
|
|
return fmt.Errorf("can't decode updateManagedBot#4880ed9a to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: field user_id: %w", err)
|
|
}
|
|
u.UserID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: field bot_id: %w", err)
|
|
}
|
|
u.BotID = value
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode updateManagedBot#4880ed9a: field qts: %w", err)
|
|
}
|
|
u.Qts = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetUserID returns value of UserID field.
|
|
func (u *UpdateManagedBot) GetUserID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.UserID
|
|
}
|
|
|
|
// GetBotID returns value of BotID field.
|
|
func (u *UpdateManagedBot) GetBotID() (value int64) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.BotID
|
|
}
|
|
|
|
// GetQts returns value of Qts field.
|
|
func (u *UpdateManagedBot) GetQts() (value int) {
|
|
if u == nil {
|
|
return
|
|
}
|
|
return u.Qts
|
|
}
|
|
|
|
// UpdateClassName is schema name of UpdateClass.
|
|
const UpdateClassName = "Update"
|
|
|
|
// UpdateClass represents Update generic type.
|
|
//
|
|
// See https://core.telegram.org/type/Update for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodeUpdate(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.UpdateNewMessage: // updateNewMessage#1f2b0afd
|
|
// case *tg.UpdateMessageID: // updateMessageID#4e90bfd6
|
|
// case *tg.UpdateDeleteMessages: // updateDeleteMessages#a20db0e5
|
|
// case *tg.UpdateUserTyping: // updateUserTyping#2a17bf5c
|
|
// case *tg.UpdateChatUserTyping: // updateChatUserTyping#83487af0
|
|
// case *tg.UpdateChatParticipants: // updateChatParticipants#7761198
|
|
// case *tg.UpdateUserStatus: // updateUserStatus#e5bdf8de
|
|
// case *tg.UpdateUserName: // updateUserName#a7848924
|
|
// case *tg.UpdateNewAuthorization: // updateNewAuthorization#8951abef
|
|
// case *tg.UpdateNewEncryptedMessage: // updateNewEncryptedMessage#12bcbd9a
|
|
// case *tg.UpdateEncryptedChatTyping: // updateEncryptedChatTyping#1710f156
|
|
// case *tg.UpdateEncryption: // updateEncryption#b4a2e88d
|
|
// case *tg.UpdateEncryptedMessagesRead: // updateEncryptedMessagesRead#38fe25b7
|
|
// case *tg.UpdateChatParticipantAdd: // updateChatParticipantAdd#3dda5451
|
|
// case *tg.UpdateChatParticipantDelete: // updateChatParticipantDelete#e32f3d77
|
|
// case *tg.UpdateDCOptions: // updateDcOptions#8e5e9873
|
|
// case *tg.UpdateNotifySettings: // updateNotifySettings#bec268ef
|
|
// case *tg.UpdateServiceNotification: // updateServiceNotification#ebe46819
|
|
// case *tg.UpdatePrivacy: // updatePrivacy#ee3b272a
|
|
// case *tg.UpdateUserPhone: // updateUserPhone#5492a13
|
|
// case *tg.UpdateReadHistoryInbox: // updateReadHistoryInbox#9e84bc99
|
|
// case *tg.UpdateReadHistoryOutbox: // updateReadHistoryOutbox#2f2f21bf
|
|
// case *tg.UpdateWebPage: // updateWebPage#7f891213
|
|
// case *tg.UpdateReadMessagesContents: // updateReadMessagesContents#f8227181
|
|
// case *tg.UpdateChannelTooLong: // updateChannelTooLong#108d941f
|
|
// case *tg.UpdateChannel: // updateChannel#635b4c09
|
|
// case *tg.UpdateNewChannelMessage: // updateNewChannelMessage#62ba04d9
|
|
// case *tg.UpdateReadChannelInbox: // updateReadChannelInbox#922e6e10
|
|
// case *tg.UpdateDeleteChannelMessages: // updateDeleteChannelMessages#c32d5b12
|
|
// case *tg.UpdateChannelMessageViews: // updateChannelMessageViews#f226ac08
|
|
// case *tg.UpdateChatParticipantAdmin: // updateChatParticipantAdmin#d7ca61a2
|
|
// case *tg.UpdateNewStickerSet: // updateNewStickerSet#688a30aa
|
|
// case *tg.UpdateStickerSetsOrder: // updateStickerSetsOrder#bb2d201
|
|
// case *tg.UpdateStickerSets: // updateStickerSets#31c24808
|
|
// case *tg.UpdateSavedGifs: // updateSavedGifs#9375341e
|
|
// case *tg.UpdateBotInlineQuery: // updateBotInlineQuery#496f379c
|
|
// case *tg.UpdateBotInlineSend: // updateBotInlineSend#12f12a07
|
|
// case *tg.UpdateEditChannelMessage: // updateEditChannelMessage#1b3f4df7
|
|
// case *tg.UpdateBotCallbackQuery: // updateBotCallbackQuery#b9cfc48d
|
|
// case *tg.UpdateEditMessage: // updateEditMessage#e40370a3
|
|
// case *tg.UpdateInlineBotCallbackQuery: // updateInlineBotCallbackQuery#691e9052
|
|
// case *tg.UpdateReadChannelOutbox: // updateReadChannelOutbox#b75f99a9
|
|
// case *tg.UpdateDraftMessage: // updateDraftMessage#edfc111e
|
|
// case *tg.UpdateReadFeaturedStickers: // updateReadFeaturedStickers#571d2742
|
|
// case *tg.UpdateRecentStickers: // updateRecentStickers#9a422c20
|
|
// case *tg.UpdateConfig: // updateConfig#a229dd06
|
|
// case *tg.UpdatePtsChanged: // updatePtsChanged#3354678f
|
|
// case *tg.UpdateChannelWebPage: // updateChannelWebPage#2f2ba99f
|
|
// case *tg.UpdateDialogPinned: // updateDialogPinned#6e6fe51c
|
|
// case *tg.UpdatePinnedDialogs: // updatePinnedDialogs#fa0f3ca2
|
|
// case *tg.UpdateBotWebhookJSON: // updateBotWebhookJSON#8317c0c3
|
|
// case *tg.UpdateBotWebhookJSONQuery: // updateBotWebhookJSONQuery#9b9240a6
|
|
// case *tg.UpdateBotShippingQuery: // updateBotShippingQuery#b5aefd7d
|
|
// case *tg.UpdateBotPrecheckoutQuery: // updateBotPrecheckoutQuery#8caa9a96
|
|
// case *tg.UpdatePhoneCall: // updatePhoneCall#ab0f6b1e
|
|
// case *tg.UpdateLangPackTooLong: // updateLangPackTooLong#46560264
|
|
// case *tg.UpdateLangPack: // updateLangPack#56022f4d
|
|
// case *tg.UpdateFavedStickers: // updateFavedStickers#e511996d
|
|
// case *tg.UpdateChannelReadMessagesContents: // updateChannelReadMessagesContents#25f324f7
|
|
// case *tg.UpdateContactsReset: // updateContactsReset#7084a7be
|
|
// case *tg.UpdateChannelAvailableMessages: // updateChannelAvailableMessages#b23fc698
|
|
// case *tg.UpdateDialogUnreadMark: // updateDialogUnreadMark#b658f23e
|
|
// case *tg.UpdateMessagePoll: // updateMessagePoll#d64c522b
|
|
// case *tg.UpdateChatDefaultBannedRights: // updateChatDefaultBannedRights#54c01850
|
|
// case *tg.UpdateFolderPeers: // updateFolderPeers#19360dc0
|
|
// case *tg.UpdatePeerSettings: // updatePeerSettings#6a7e7366
|
|
// case *tg.UpdatePeerLocated: // updatePeerLocated#b4afcfb0
|
|
// case *tg.UpdateNewScheduledMessage: // updateNewScheduledMessage#39a51dfb
|
|
// case *tg.UpdateDeleteScheduledMessages: // updateDeleteScheduledMessages#f2a71983
|
|
// case *tg.UpdateTheme: // updateTheme#8216fba3
|
|
// case *tg.UpdateGeoLiveViewed: // updateGeoLiveViewed#871fb939
|
|
// case *tg.UpdateLoginToken: // updateLoginToken#564fe691
|
|
// case *tg.UpdateMessagePollVote: // updateMessagePollVote#7699f014
|
|
// case *tg.UpdateDialogFilter: // updateDialogFilter#26ffde7d
|
|
// case *tg.UpdateDialogFilterOrder: // updateDialogFilterOrder#a5d72105
|
|
// case *tg.UpdateDialogFilters: // updateDialogFilters#3504914f
|
|
// case *tg.UpdatePhoneCallSignalingData: // updatePhoneCallSignalingData#2661bf09
|
|
// case *tg.UpdateChannelMessageForwards: // updateChannelMessageForwards#d29a27f4
|
|
// case *tg.UpdateReadChannelDiscussionInbox: // updateReadChannelDiscussionInbox#d6b19546
|
|
// case *tg.UpdateReadChannelDiscussionOutbox: // updateReadChannelDiscussionOutbox#695c9e7c
|
|
// case *tg.UpdatePeerBlocked: // updatePeerBlocked#ebe07752
|
|
// case *tg.UpdateChannelUserTyping: // updateChannelUserTyping#8c88c923
|
|
// case *tg.UpdatePinnedMessages: // updatePinnedMessages#ed85eab5
|
|
// case *tg.UpdatePinnedChannelMessages: // updatePinnedChannelMessages#5bb98608
|
|
// case *tg.UpdateChat: // updateChat#f89a6a4e
|
|
// case *tg.UpdateGroupCallParticipants: // updateGroupCallParticipants#f2ebdb4e
|
|
// case *tg.UpdateGroupCall: // updateGroupCall#9d2216e0
|
|
// case *tg.UpdatePeerHistoryTTL: // updatePeerHistoryTTL#bb9bb9a5
|
|
// case *tg.UpdateChatParticipant: // updateChatParticipant#d087663a
|
|
// case *tg.UpdateChannelParticipant: // updateChannelParticipant#985d3abb
|
|
// case *tg.UpdateBotStopped: // updateBotStopped#c4870a49
|
|
// case *tg.UpdateGroupCallConnection: // updateGroupCallConnection#b783982
|
|
// case *tg.UpdateBotCommands: // updateBotCommands#4d712f2e
|
|
// case *tg.UpdatePendingJoinRequests: // updatePendingJoinRequests#7063c3db
|
|
// case *tg.UpdateBotChatInviteRequester: // updateBotChatInviteRequester#11dfa986
|
|
// case *tg.UpdateMessageReactions: // updateMessageReactions#1e297bfa
|
|
// case *tg.UpdateAttachMenuBots: // updateAttachMenuBots#17b7a20b
|
|
// case *tg.UpdateWebViewResultSent: // updateWebViewResultSent#1592b79d
|
|
// case *tg.UpdateBotMenuButton: // updateBotMenuButton#14b85813
|
|
// case *tg.UpdateSavedRingtones: // updateSavedRingtones#74d8be99
|
|
// case *tg.UpdateTranscribedAudio: // updateTranscribedAudio#84cd5a
|
|
// case *tg.UpdateReadFeaturedEmojiStickers: // updateReadFeaturedEmojiStickers#fb4c496c
|
|
// case *tg.UpdateUserEmojiStatus: // updateUserEmojiStatus#28373599
|
|
// case *tg.UpdateRecentEmojiStatuses: // updateRecentEmojiStatuses#30f443db
|
|
// case *tg.UpdateRecentReactions: // updateRecentReactions#6f7863f4
|
|
// case *tg.UpdateMoveStickerSetToTop: // updateMoveStickerSetToTop#86fccf85
|
|
// case *tg.UpdateMessageExtendedMedia: // updateMessageExtendedMedia#d5a41724
|
|
// case *tg.UpdateUser: // updateUser#20529438
|
|
// case *tg.UpdateAutoSaveSettings: // updateAutoSaveSettings#ec05b097
|
|
// case *tg.UpdateStory: // updateStory#75b3b798
|
|
// case *tg.UpdateReadStories: // updateReadStories#f74e932b
|
|
// case *tg.UpdateStoryID: // updateStoryID#1bf335b9
|
|
// case *tg.UpdateStoriesStealthMode: // updateStoriesStealthMode#2c084dc1
|
|
// case *tg.UpdateSentStoryReaction: // updateSentStoryReaction#7d627683
|
|
// case *tg.UpdateBotChatBoost: // updateBotChatBoost#904dd49c
|
|
// case *tg.UpdateChannelViewForumAsMessages: // updateChannelViewForumAsMessages#7b68920
|
|
// case *tg.UpdatePeerWallpaper: // updatePeerWallpaper#ae3f101d
|
|
// case *tg.UpdateBotMessageReaction: // updateBotMessageReaction#ac21d3ce
|
|
// case *tg.UpdateBotMessageReactions: // updateBotMessageReactions#9cb7759
|
|
// case *tg.UpdateSavedDialogPinned: // updateSavedDialogPinned#aeaf9e74
|
|
// case *tg.UpdatePinnedSavedDialogs: // updatePinnedSavedDialogs#686c85a6
|
|
// case *tg.UpdateSavedReactionTags: // updateSavedReactionTags#39c67432
|
|
// case *tg.UpdateSMSJob: // updateSmsJob#f16269d4
|
|
// case *tg.UpdateQuickReplies: // updateQuickReplies#f9470ab2
|
|
// case *tg.UpdateNewQuickReply: // updateNewQuickReply#f53da717
|
|
// case *tg.UpdateDeleteQuickReply: // updateDeleteQuickReply#53e6f1ec
|
|
// case *tg.UpdateQuickReplyMessage: // updateQuickReplyMessage#3e050d0f
|
|
// case *tg.UpdateDeleteQuickReplyMessages: // updateDeleteQuickReplyMessages#566fe7cd
|
|
// case *tg.UpdateBotBusinessConnect: // updateBotBusinessConnect#8ae5c97a
|
|
// case *tg.UpdateBotNewBusinessMessage: // updateBotNewBusinessMessage#9ddb347c
|
|
// case *tg.UpdateBotEditBusinessMessage: // updateBotEditBusinessMessage#7df587c
|
|
// case *tg.UpdateBotDeleteBusinessMessage: // updateBotDeleteBusinessMessage#a02a982e
|
|
// case *tg.UpdateNewStoryReaction: // updateNewStoryReaction#1824e40b
|
|
// case *tg.UpdateStarsBalance: // updateStarsBalance#4e80a379
|
|
// case *tg.UpdateBusinessBotCallbackQuery: // updateBusinessBotCallbackQuery#1ea2fda7
|
|
// case *tg.UpdateStarsRevenueStatus: // updateStarsRevenueStatus#a584b019
|
|
// case *tg.UpdateBotPurchasedPaidMedia: // updateBotPurchasedPaidMedia#283bd312
|
|
// case *tg.UpdatePaidReactionPrivacy: // updatePaidReactionPrivacy#8b725fce
|
|
// case *tg.UpdateSentPhoneCode: // updateSentPhoneCode#504aa18f
|
|
// case *tg.UpdateGroupCallChainBlocks: // updateGroupCallChainBlocks#a477288f
|
|
// case *tg.UpdateReadMonoForumInbox: // updateReadMonoForumInbox#77b0e372
|
|
// case *tg.UpdateReadMonoForumOutbox: // updateReadMonoForumOutbox#a4a79376
|
|
// case *tg.UpdateMonoForumNoPaidException: // updateMonoForumNoPaidException#9f812b08
|
|
// case *tg.UpdateGroupCallMessage: // updateGroupCallMessage#d8326f0d
|
|
// case *tg.UpdateGroupCallEncryptedMessage: // updateGroupCallEncryptedMessage#c957a766
|
|
// case *tg.UpdatePinnedForumTopic: // updatePinnedForumTopic#683b2c52
|
|
// case *tg.UpdatePinnedForumTopics: // updatePinnedForumTopics#def143d0
|
|
// case *tg.UpdateDeleteGroupCallMessages: // updateDeleteGroupCallMessages#3e85e92c
|
|
// case *tg.UpdateStarGiftAuctionState: // updateStarGiftAuctionState#48e246c2
|
|
// case *tg.UpdateStarGiftAuctionUserState: // updateStarGiftAuctionUserState#dc58f31e
|
|
// case *tg.UpdateEmojiGameInfo: // updateEmojiGameInfo#fb9c547a
|
|
// case *tg.UpdateStarGiftCraftFail: // updateStarGiftCraftFail#ac072444
|
|
// case *tg.UpdateChatParticipantRank: // updateChatParticipantRank#bd8367b9
|
|
// case *tg.UpdateManagedBot: // updateManagedBot#4880ed9a
|
|
// default: panic(v)
|
|
// }
|
|
type UpdateClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() UpdateClass
|
|
|
|
// 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
|
|
}
|
|
|
|
// DecodeUpdate implements binary de-serialization for UpdateClass.
|
|
func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case UpdateNewMessageTypeID:
|
|
// Decoding updateNewMessage#1f2b0afd.
|
|
v := UpdateNewMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMessageIDTypeID:
|
|
// Decoding updateMessageID#4e90bfd6.
|
|
v := UpdateMessageID{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDeleteMessagesTypeID:
|
|
// Decoding updateDeleteMessages#a20db0e5.
|
|
v := UpdateDeleteMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateUserTypingTypeID:
|
|
// Decoding updateUserTyping#2a17bf5c.
|
|
v := UpdateUserTyping{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatUserTypingTypeID:
|
|
// Decoding updateChatUserTyping#83487af0.
|
|
v := UpdateChatUserTyping{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatParticipantsTypeID:
|
|
// Decoding updateChatParticipants#7761198.
|
|
v := UpdateChatParticipants{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateUserStatusTypeID:
|
|
// Decoding updateUserStatus#e5bdf8de.
|
|
v := UpdateUserStatus{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateUserNameTypeID:
|
|
// Decoding updateUserName#a7848924.
|
|
v := UpdateUserName{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewAuthorizationTypeID:
|
|
// Decoding updateNewAuthorization#8951abef.
|
|
v := UpdateNewAuthorization{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewEncryptedMessageTypeID:
|
|
// Decoding updateNewEncryptedMessage#12bcbd9a.
|
|
v := UpdateNewEncryptedMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateEncryptedChatTypingTypeID:
|
|
// Decoding updateEncryptedChatTyping#1710f156.
|
|
v := UpdateEncryptedChatTyping{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateEncryptionTypeID:
|
|
// Decoding updateEncryption#b4a2e88d.
|
|
v := UpdateEncryption{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateEncryptedMessagesReadTypeID:
|
|
// Decoding updateEncryptedMessagesRead#38fe25b7.
|
|
v := UpdateEncryptedMessagesRead{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatParticipantAddTypeID:
|
|
// Decoding updateChatParticipantAdd#3dda5451.
|
|
v := UpdateChatParticipantAdd{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatParticipantDeleteTypeID:
|
|
// Decoding updateChatParticipantDelete#e32f3d77.
|
|
v := UpdateChatParticipantDelete{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDCOptionsTypeID:
|
|
// Decoding updateDcOptions#8e5e9873.
|
|
v := UpdateDCOptions{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNotifySettingsTypeID:
|
|
// Decoding updateNotifySettings#bec268ef.
|
|
v := UpdateNotifySettings{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateServiceNotificationTypeID:
|
|
// Decoding updateServiceNotification#ebe46819.
|
|
v := UpdateServiceNotification{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePrivacyTypeID:
|
|
// Decoding updatePrivacy#ee3b272a.
|
|
v := UpdatePrivacy{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateUserPhoneTypeID:
|
|
// Decoding updateUserPhone#5492a13.
|
|
v := UpdateUserPhone{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadHistoryInboxTypeID:
|
|
// Decoding updateReadHistoryInbox#9e84bc99.
|
|
v := UpdateReadHistoryInbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadHistoryOutboxTypeID:
|
|
// Decoding updateReadHistoryOutbox#2f2f21bf.
|
|
v := UpdateReadHistoryOutbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateWebPageTypeID:
|
|
// Decoding updateWebPage#7f891213.
|
|
v := UpdateWebPage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadMessagesContentsTypeID:
|
|
// Decoding updateReadMessagesContents#f8227181.
|
|
v := UpdateReadMessagesContents{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelTooLongTypeID:
|
|
// Decoding updateChannelTooLong#108d941f.
|
|
v := UpdateChannelTooLong{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelTypeID:
|
|
// Decoding updateChannel#635b4c09.
|
|
v := UpdateChannel{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewChannelMessageTypeID:
|
|
// Decoding updateNewChannelMessage#62ba04d9.
|
|
v := UpdateNewChannelMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadChannelInboxTypeID:
|
|
// Decoding updateReadChannelInbox#922e6e10.
|
|
v := UpdateReadChannelInbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDeleteChannelMessagesTypeID:
|
|
// Decoding updateDeleteChannelMessages#c32d5b12.
|
|
v := UpdateDeleteChannelMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelMessageViewsTypeID:
|
|
// Decoding updateChannelMessageViews#f226ac08.
|
|
v := UpdateChannelMessageViews{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatParticipantAdminTypeID:
|
|
// Decoding updateChatParticipantAdmin#d7ca61a2.
|
|
v := UpdateChatParticipantAdmin{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewStickerSetTypeID:
|
|
// Decoding updateNewStickerSet#688a30aa.
|
|
v := UpdateNewStickerSet{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStickerSetsOrderTypeID:
|
|
// Decoding updateStickerSetsOrder#bb2d201.
|
|
v := UpdateStickerSetsOrder{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStickerSetsTypeID:
|
|
// Decoding updateStickerSets#31c24808.
|
|
v := UpdateStickerSets{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSavedGifsTypeID:
|
|
// Decoding updateSavedGifs#9375341e.
|
|
v := UpdateSavedGifs{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotInlineQueryTypeID:
|
|
// Decoding updateBotInlineQuery#496f379c.
|
|
v := UpdateBotInlineQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotInlineSendTypeID:
|
|
// Decoding updateBotInlineSend#12f12a07.
|
|
v := UpdateBotInlineSend{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateEditChannelMessageTypeID:
|
|
// Decoding updateEditChannelMessage#1b3f4df7.
|
|
v := UpdateEditChannelMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotCallbackQueryTypeID:
|
|
// Decoding updateBotCallbackQuery#b9cfc48d.
|
|
v := UpdateBotCallbackQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateEditMessageTypeID:
|
|
// Decoding updateEditMessage#e40370a3.
|
|
v := UpdateEditMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateInlineBotCallbackQueryTypeID:
|
|
// Decoding updateInlineBotCallbackQuery#691e9052.
|
|
v := UpdateInlineBotCallbackQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadChannelOutboxTypeID:
|
|
// Decoding updateReadChannelOutbox#b75f99a9.
|
|
v := UpdateReadChannelOutbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDraftMessageTypeID:
|
|
// Decoding updateDraftMessage#edfc111e.
|
|
v := UpdateDraftMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadFeaturedStickersTypeID:
|
|
// Decoding updateReadFeaturedStickers#571d2742.
|
|
v := UpdateReadFeaturedStickers{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateRecentStickersTypeID:
|
|
// Decoding updateRecentStickers#9a422c20.
|
|
v := UpdateRecentStickers{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateConfigTypeID:
|
|
// Decoding updateConfig#a229dd06.
|
|
v := UpdateConfig{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePtsChangedTypeID:
|
|
// Decoding updatePtsChanged#3354678f.
|
|
v := UpdatePtsChanged{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelWebPageTypeID:
|
|
// Decoding updateChannelWebPage#2f2ba99f.
|
|
v := UpdateChannelWebPage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDialogPinnedTypeID:
|
|
// Decoding updateDialogPinned#6e6fe51c.
|
|
v := UpdateDialogPinned{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePinnedDialogsTypeID:
|
|
// Decoding updatePinnedDialogs#fa0f3ca2.
|
|
v := UpdatePinnedDialogs{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotWebhookJSONTypeID:
|
|
// Decoding updateBotWebhookJSON#8317c0c3.
|
|
v := UpdateBotWebhookJSON{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotWebhookJSONQueryTypeID:
|
|
// Decoding updateBotWebhookJSONQuery#9b9240a6.
|
|
v := UpdateBotWebhookJSONQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotShippingQueryTypeID:
|
|
// Decoding updateBotShippingQuery#b5aefd7d.
|
|
v := UpdateBotShippingQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotPrecheckoutQueryTypeID:
|
|
// Decoding updateBotPrecheckoutQuery#8caa9a96.
|
|
v := UpdateBotPrecheckoutQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePhoneCallTypeID:
|
|
// Decoding updatePhoneCall#ab0f6b1e.
|
|
v := UpdatePhoneCall{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateLangPackTooLongTypeID:
|
|
// Decoding updateLangPackTooLong#46560264.
|
|
v := UpdateLangPackTooLong{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateLangPackTypeID:
|
|
// Decoding updateLangPack#56022f4d.
|
|
v := UpdateLangPack{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateFavedStickersTypeID:
|
|
// Decoding updateFavedStickers#e511996d.
|
|
v := UpdateFavedStickers{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelReadMessagesContentsTypeID:
|
|
// Decoding updateChannelReadMessagesContents#25f324f7.
|
|
v := UpdateChannelReadMessagesContents{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateContactsResetTypeID:
|
|
// Decoding updateContactsReset#7084a7be.
|
|
v := UpdateContactsReset{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelAvailableMessagesTypeID:
|
|
// Decoding updateChannelAvailableMessages#b23fc698.
|
|
v := UpdateChannelAvailableMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDialogUnreadMarkTypeID:
|
|
// Decoding updateDialogUnreadMark#b658f23e.
|
|
v := UpdateDialogUnreadMark{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMessagePollTypeID:
|
|
// Decoding updateMessagePoll#d64c522b.
|
|
v := UpdateMessagePoll{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatDefaultBannedRightsTypeID:
|
|
// Decoding updateChatDefaultBannedRights#54c01850.
|
|
v := UpdateChatDefaultBannedRights{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateFolderPeersTypeID:
|
|
// Decoding updateFolderPeers#19360dc0.
|
|
v := UpdateFolderPeers{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePeerSettingsTypeID:
|
|
// Decoding updatePeerSettings#6a7e7366.
|
|
v := UpdatePeerSettings{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePeerLocatedTypeID:
|
|
// Decoding updatePeerLocated#b4afcfb0.
|
|
v := UpdatePeerLocated{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewScheduledMessageTypeID:
|
|
// Decoding updateNewScheduledMessage#39a51dfb.
|
|
v := UpdateNewScheduledMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDeleteScheduledMessagesTypeID:
|
|
// Decoding updateDeleteScheduledMessages#f2a71983.
|
|
v := UpdateDeleteScheduledMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateThemeTypeID:
|
|
// Decoding updateTheme#8216fba3.
|
|
v := UpdateTheme{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGeoLiveViewedTypeID:
|
|
// Decoding updateGeoLiveViewed#871fb939.
|
|
v := UpdateGeoLiveViewed{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateLoginTokenTypeID:
|
|
// Decoding updateLoginToken#564fe691.
|
|
v := UpdateLoginToken{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMessagePollVoteTypeID:
|
|
// Decoding updateMessagePollVote#7699f014.
|
|
v := UpdateMessagePollVote{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDialogFilterTypeID:
|
|
// Decoding updateDialogFilter#26ffde7d.
|
|
v := UpdateDialogFilter{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDialogFilterOrderTypeID:
|
|
// Decoding updateDialogFilterOrder#a5d72105.
|
|
v := UpdateDialogFilterOrder{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDialogFiltersTypeID:
|
|
// Decoding updateDialogFilters#3504914f.
|
|
v := UpdateDialogFilters{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePhoneCallSignalingDataTypeID:
|
|
// Decoding updatePhoneCallSignalingData#2661bf09.
|
|
v := UpdatePhoneCallSignalingData{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelMessageForwardsTypeID:
|
|
// Decoding updateChannelMessageForwards#d29a27f4.
|
|
v := UpdateChannelMessageForwards{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadChannelDiscussionInboxTypeID:
|
|
// Decoding updateReadChannelDiscussionInbox#d6b19546.
|
|
v := UpdateReadChannelDiscussionInbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadChannelDiscussionOutboxTypeID:
|
|
// Decoding updateReadChannelDiscussionOutbox#695c9e7c.
|
|
v := UpdateReadChannelDiscussionOutbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePeerBlockedTypeID:
|
|
// Decoding updatePeerBlocked#ebe07752.
|
|
v := UpdatePeerBlocked{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelUserTypingTypeID:
|
|
// Decoding updateChannelUserTyping#8c88c923.
|
|
v := UpdateChannelUserTyping{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePinnedMessagesTypeID:
|
|
// Decoding updatePinnedMessages#ed85eab5.
|
|
v := UpdatePinnedMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePinnedChannelMessagesTypeID:
|
|
// Decoding updatePinnedChannelMessages#5bb98608.
|
|
v := UpdatePinnedChannelMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatTypeID:
|
|
// Decoding updateChat#f89a6a4e.
|
|
v := UpdateChat{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGroupCallParticipantsTypeID:
|
|
// Decoding updateGroupCallParticipants#f2ebdb4e.
|
|
v := UpdateGroupCallParticipants{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGroupCallTypeID:
|
|
// Decoding updateGroupCall#9d2216e0.
|
|
v := UpdateGroupCall{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePeerHistoryTTLTypeID:
|
|
// Decoding updatePeerHistoryTTL#bb9bb9a5.
|
|
v := UpdatePeerHistoryTTL{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatParticipantTypeID:
|
|
// Decoding updateChatParticipant#d087663a.
|
|
v := UpdateChatParticipant{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelParticipantTypeID:
|
|
// Decoding updateChannelParticipant#985d3abb.
|
|
v := UpdateChannelParticipant{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotStoppedTypeID:
|
|
// Decoding updateBotStopped#c4870a49.
|
|
v := UpdateBotStopped{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGroupCallConnectionTypeID:
|
|
// Decoding updateGroupCallConnection#b783982.
|
|
v := UpdateGroupCallConnection{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotCommandsTypeID:
|
|
// Decoding updateBotCommands#4d712f2e.
|
|
v := UpdateBotCommands{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePendingJoinRequestsTypeID:
|
|
// Decoding updatePendingJoinRequests#7063c3db.
|
|
v := UpdatePendingJoinRequests{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotChatInviteRequesterTypeID:
|
|
// Decoding updateBotChatInviteRequester#11dfa986.
|
|
v := UpdateBotChatInviteRequester{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMessageReactionsTypeID:
|
|
// Decoding updateMessageReactions#1e297bfa.
|
|
v := UpdateMessageReactions{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateAttachMenuBotsTypeID:
|
|
// Decoding updateAttachMenuBots#17b7a20b.
|
|
v := UpdateAttachMenuBots{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateWebViewResultSentTypeID:
|
|
// Decoding updateWebViewResultSent#1592b79d.
|
|
v := UpdateWebViewResultSent{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotMenuButtonTypeID:
|
|
// Decoding updateBotMenuButton#14b85813.
|
|
v := UpdateBotMenuButton{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSavedRingtonesTypeID:
|
|
// Decoding updateSavedRingtones#74d8be99.
|
|
v := UpdateSavedRingtones{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateTranscribedAudioTypeID:
|
|
// Decoding updateTranscribedAudio#84cd5a.
|
|
v := UpdateTranscribedAudio{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadFeaturedEmojiStickersTypeID:
|
|
// Decoding updateReadFeaturedEmojiStickers#fb4c496c.
|
|
v := UpdateReadFeaturedEmojiStickers{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateUserEmojiStatusTypeID:
|
|
// Decoding updateUserEmojiStatus#28373599.
|
|
v := UpdateUserEmojiStatus{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateRecentEmojiStatusesTypeID:
|
|
// Decoding updateRecentEmojiStatuses#30f443db.
|
|
v := UpdateRecentEmojiStatuses{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateRecentReactionsTypeID:
|
|
// Decoding updateRecentReactions#6f7863f4.
|
|
v := UpdateRecentReactions{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMoveStickerSetToTopTypeID:
|
|
// Decoding updateMoveStickerSetToTop#86fccf85.
|
|
v := UpdateMoveStickerSetToTop{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMessageExtendedMediaTypeID:
|
|
// Decoding updateMessageExtendedMedia#d5a41724.
|
|
v := UpdateMessageExtendedMedia{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateUserTypeID:
|
|
// Decoding updateUser#20529438.
|
|
v := UpdateUser{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateAutoSaveSettingsTypeID:
|
|
// Decoding updateAutoSaveSettings#ec05b097.
|
|
v := UpdateAutoSaveSettings{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStoryTypeID:
|
|
// Decoding updateStory#75b3b798.
|
|
v := UpdateStory{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadStoriesTypeID:
|
|
// Decoding updateReadStories#f74e932b.
|
|
v := UpdateReadStories{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStoryIDTypeID:
|
|
// Decoding updateStoryID#1bf335b9.
|
|
v := UpdateStoryID{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStoriesStealthModeTypeID:
|
|
// Decoding updateStoriesStealthMode#2c084dc1.
|
|
v := UpdateStoriesStealthMode{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSentStoryReactionTypeID:
|
|
// Decoding updateSentStoryReaction#7d627683.
|
|
v := UpdateSentStoryReaction{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotChatBoostTypeID:
|
|
// Decoding updateBotChatBoost#904dd49c.
|
|
v := UpdateBotChatBoost{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChannelViewForumAsMessagesTypeID:
|
|
// Decoding updateChannelViewForumAsMessages#7b68920.
|
|
v := UpdateChannelViewForumAsMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePeerWallpaperTypeID:
|
|
// Decoding updatePeerWallpaper#ae3f101d.
|
|
v := UpdatePeerWallpaper{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotMessageReactionTypeID:
|
|
// Decoding updateBotMessageReaction#ac21d3ce.
|
|
v := UpdateBotMessageReaction{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotMessageReactionsTypeID:
|
|
// Decoding updateBotMessageReactions#9cb7759.
|
|
v := UpdateBotMessageReactions{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSavedDialogPinnedTypeID:
|
|
// Decoding updateSavedDialogPinned#aeaf9e74.
|
|
v := UpdateSavedDialogPinned{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePinnedSavedDialogsTypeID:
|
|
// Decoding updatePinnedSavedDialogs#686c85a6.
|
|
v := UpdatePinnedSavedDialogs{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSavedReactionTagsTypeID:
|
|
// Decoding updateSavedReactionTags#39c67432.
|
|
v := UpdateSavedReactionTags{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSMSJobTypeID:
|
|
// Decoding updateSmsJob#f16269d4.
|
|
v := UpdateSMSJob{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateQuickRepliesTypeID:
|
|
// Decoding updateQuickReplies#f9470ab2.
|
|
v := UpdateQuickReplies{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewQuickReplyTypeID:
|
|
// Decoding updateNewQuickReply#f53da717.
|
|
v := UpdateNewQuickReply{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDeleteQuickReplyTypeID:
|
|
// Decoding updateDeleteQuickReply#53e6f1ec.
|
|
v := UpdateDeleteQuickReply{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateQuickReplyMessageTypeID:
|
|
// Decoding updateQuickReplyMessage#3e050d0f.
|
|
v := UpdateQuickReplyMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDeleteQuickReplyMessagesTypeID:
|
|
// Decoding updateDeleteQuickReplyMessages#566fe7cd.
|
|
v := UpdateDeleteQuickReplyMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotBusinessConnectTypeID:
|
|
// Decoding updateBotBusinessConnect#8ae5c97a.
|
|
v := UpdateBotBusinessConnect{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotNewBusinessMessageTypeID:
|
|
// Decoding updateBotNewBusinessMessage#9ddb347c.
|
|
v := UpdateBotNewBusinessMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotEditBusinessMessageTypeID:
|
|
// Decoding updateBotEditBusinessMessage#7df587c.
|
|
v := UpdateBotEditBusinessMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotDeleteBusinessMessageTypeID:
|
|
// Decoding updateBotDeleteBusinessMessage#a02a982e.
|
|
v := UpdateBotDeleteBusinessMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateNewStoryReactionTypeID:
|
|
// Decoding updateNewStoryReaction#1824e40b.
|
|
v := UpdateNewStoryReaction{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStarsBalanceTypeID:
|
|
// Decoding updateStarsBalance#4e80a379.
|
|
v := UpdateStarsBalance{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBusinessBotCallbackQueryTypeID:
|
|
// Decoding updateBusinessBotCallbackQuery#1ea2fda7.
|
|
v := UpdateBusinessBotCallbackQuery{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStarsRevenueStatusTypeID:
|
|
// Decoding updateStarsRevenueStatus#a584b019.
|
|
v := UpdateStarsRevenueStatus{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateBotPurchasedPaidMediaTypeID:
|
|
// Decoding updateBotPurchasedPaidMedia#283bd312.
|
|
v := UpdateBotPurchasedPaidMedia{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePaidReactionPrivacyTypeID:
|
|
// Decoding updatePaidReactionPrivacy#8b725fce.
|
|
v := UpdatePaidReactionPrivacy{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateSentPhoneCodeTypeID:
|
|
// Decoding updateSentPhoneCode#504aa18f.
|
|
v := UpdateSentPhoneCode{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGroupCallChainBlocksTypeID:
|
|
// Decoding updateGroupCallChainBlocks#a477288f.
|
|
v := UpdateGroupCallChainBlocks{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadMonoForumInboxTypeID:
|
|
// Decoding updateReadMonoForumInbox#77b0e372.
|
|
v := UpdateReadMonoForumInbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateReadMonoForumOutboxTypeID:
|
|
// Decoding updateReadMonoForumOutbox#a4a79376.
|
|
v := UpdateReadMonoForumOutbox{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateMonoForumNoPaidExceptionTypeID:
|
|
// Decoding updateMonoForumNoPaidException#9f812b08.
|
|
v := UpdateMonoForumNoPaidException{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGroupCallMessageTypeID:
|
|
// Decoding updateGroupCallMessage#d8326f0d.
|
|
v := UpdateGroupCallMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateGroupCallEncryptedMessageTypeID:
|
|
// Decoding updateGroupCallEncryptedMessage#c957a766.
|
|
v := UpdateGroupCallEncryptedMessage{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePinnedForumTopicTypeID:
|
|
// Decoding updatePinnedForumTopic#683b2c52.
|
|
v := UpdatePinnedForumTopic{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdatePinnedForumTopicsTypeID:
|
|
// Decoding updatePinnedForumTopics#def143d0.
|
|
v := UpdatePinnedForumTopics{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateDeleteGroupCallMessagesTypeID:
|
|
// Decoding updateDeleteGroupCallMessages#3e85e92c.
|
|
v := UpdateDeleteGroupCallMessages{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStarGiftAuctionStateTypeID:
|
|
// Decoding updateStarGiftAuctionState#48e246c2.
|
|
v := UpdateStarGiftAuctionState{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStarGiftAuctionUserStateTypeID:
|
|
// Decoding updateStarGiftAuctionUserState#dc58f31e.
|
|
v := UpdateStarGiftAuctionUserState{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateEmojiGameInfoTypeID:
|
|
// Decoding updateEmojiGameInfo#fb9c547a.
|
|
v := UpdateEmojiGameInfo{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateStarGiftCraftFailTypeID:
|
|
// Decoding updateStarGiftCraftFail#ac072444.
|
|
v := UpdateStarGiftCraftFail{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateChatParticipantRankTypeID:
|
|
// Decoding updateChatParticipantRank#bd8367b9.
|
|
v := UpdateChatParticipantRank{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case UpdateManagedBotTypeID:
|
|
// Decoding updateManagedBot#4880ed9a.
|
|
v := UpdateManagedBot{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode UpdateClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// Update boxes the UpdateClass providing a helper.
|
|
type UpdateBox struct {
|
|
Update UpdateClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for UpdateBox.
|
|
func (b *UpdateBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode UpdateBox to nil")
|
|
}
|
|
v, err := DecodeUpdate(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.Update = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for UpdateBox.
|
|
func (b *UpdateBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.Update == nil {
|
|
return fmt.Errorf("unable to encode UpdateClass as nil")
|
|
}
|
|
return b.Update.Encode(buf)
|
|
}
|