mirror of
https://github.com/c0re100/gotdlib.git
synced 2026-02-21 20:20:17 +01:00
Update to TDLib 1.8.37
This commit is contained in:
parent
ec1fb9c5e2
commit
8454bd8c86
4 changed files with 1392 additions and 152 deletions
|
|
@ -1304,7 +1304,7 @@ type GetMessageRequest struct {
|
|||
MessageId int64 `json:"message_id"`
|
||||
}
|
||||
|
||||
// Returns information about a message
|
||||
// Returns information about a message. Returns a 404 error if the message doesn't exist
|
||||
func (client *Client) GetMessage(req *GetMessageRequest) (*Message, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -1333,7 +1333,7 @@ type GetMessageLocallyRequest struct {
|
|||
MessageId int64 `json:"message_id"`
|
||||
}
|
||||
|
||||
// Returns information about a message, if it is available without sending network request. This is an offline request
|
||||
// Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request
|
||||
func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -1362,7 +1362,7 @@ type GetRepliedMessageRequest struct {
|
|||
MessageId int64 `json:"message_id"`
|
||||
}
|
||||
|
||||
// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively
|
||||
// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist
|
||||
func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -1389,7 +1389,7 @@ type GetChatPinnedMessageRequest struct {
|
|||
ChatId int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// Returns information about a newest pinned message in the chat
|
||||
// Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist
|
||||
func (client *Client) GetChatPinnedMessage(req *GetChatPinnedMessageRequest) (*Message, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -1833,7 +1833,7 @@ type SearchChatsNearbyRequest struct {
|
|||
Location *Location `json:"location"`
|
||||
}
|
||||
|
||||
// Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request must be sent again every 25 seconds with adjusted location to not miss new chats
|
||||
// Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now
|
||||
func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNearby, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -3180,7 +3180,7 @@ type GetChatMessageByDateRequest struct {
|
|||
Date int32 `json:"date"`
|
||||
}
|
||||
|
||||
// Returns the last message sent in a chat no later than the specified date
|
||||
// Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist
|
||||
func (client *Client) GetChatMessageByDate(req *GetChatMessageByDateRequest) (*Message, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -3405,9 +3405,13 @@ type ClickChatSponsoredMessageRequest struct {
|
|||
ChatId int64 `json:"chat_id"`
|
||||
// Identifier of the sponsored message
|
||||
MessageId int64 `json:"message_id"`
|
||||
// Pass true if the media was clicked in the sponsored message
|
||||
IsMediaClick bool `json:"is_media_click"`
|
||||
// Pass true if the user expanded the video from the sponsored message fullscreen before the click
|
||||
FromFullscreen bool `json:"from_fullscreen"`
|
||||
}
|
||||
|
||||
// Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention in the sponsored message
|
||||
// Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message
|
||||
func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRequest) (*Ok, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -3416,6 +3420,8 @@ func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRe
|
|||
Data: map[string]interface{}{
|
||||
"chat_id": req.ChatId,
|
||||
"message_id": req.MessageId,
|
||||
"is_media_click": req.IsMediaClick,
|
||||
"from_fullscreen": req.FromFullscreen,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -4356,7 +4362,7 @@ type EditMessageCaptionRequest struct {
|
|||
ReplyMarkup ReplyMarkup `json:"reply_markup"`
|
||||
// New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption
|
||||
Caption *FormattedText `json:"caption"`
|
||||
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages
|
||||
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
|
||||
}
|
||||
|
||||
|
|
@ -4529,7 +4535,7 @@ type EditInlineMessageCaptionRequest struct {
|
|||
ReplyMarkup ReplyMarkup `json:"reply_markup"`
|
||||
// New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters
|
||||
Caption *FormattedText `json:"caption"`
|
||||
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages
|
||||
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
|
||||
}
|
||||
|
||||
|
|
@ -4875,7 +4881,7 @@ type EditBusinessMessageCaptionRequest struct {
|
|||
ReplyMarkup ReplyMarkup `json:"reply_markup"`
|
||||
// New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters
|
||||
Caption *FormattedText `json:"caption"`
|
||||
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages
|
||||
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
|
||||
}
|
||||
|
||||
|
|
@ -6466,7 +6472,7 @@ type CleanFileNameRequest struct {
|
|||
FileName string `json:"file_name"`
|
||||
}
|
||||
|
||||
// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously
|
||||
// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously
|
||||
func CleanFileName(req *CleanFileNameRequest) (*Text, error) {
|
||||
result, err := Execute(Request{
|
||||
meta: meta{
|
||||
|
|
@ -6488,7 +6494,7 @@ func CleanFileName(req *CleanFileNameRequest) (*Text, error) {
|
|||
}
|
||||
|
||||
// deprecated
|
||||
// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously
|
||||
// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously
|
||||
func (client *Client) CleanFileName(req *CleanFileNameRequest) (*Text, error) {
|
||||
return CleanFileName(req)}
|
||||
|
||||
|
|
@ -11296,14 +11302,14 @@ type ReportStoryRequest struct {
|
|||
StorySenderChatId int64 `json:"story_sender_chat_id"`
|
||||
// The identifier of the story to report
|
||||
StoryId int32 `json:"story_id"`
|
||||
// The reason for reporting the story
|
||||
Reason ReportReason `json:"reason"`
|
||||
// Additional report details; 0-1024 characters
|
||||
// Option identifier chosen by the user; leave empty for the initial request
|
||||
OptionId []byte `json:"option_id"`
|
||||
// Additional report details; 0-1024 characters; leave empty for the initial request
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
// Reports a story to the Telegram moderators
|
||||
func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) {
|
||||
func (client *Client) ReportStory(req *ReportStoryRequest) (ReportStoryResult, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "reportStory",
|
||||
|
|
@ -11311,7 +11317,7 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) {
|
|||
Data: map[string]interface{}{
|
||||
"story_sender_chat_id": req.StorySenderChatId,
|
||||
"story_id": req.StoryId,
|
||||
"reason": req.Reason,
|
||||
"option_id": req.OptionId,
|
||||
"text": req.Text,
|
||||
},
|
||||
})
|
||||
|
|
@ -11323,7 +11329,19 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) {
|
|||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalOk(result.Data)
|
||||
switch result.Type {
|
||||
case TypeReportStoryResultOk:
|
||||
return UnmarshalReportStoryResultOk(result.Data)
|
||||
|
||||
case TypeReportStoryResultOptionRequired:
|
||||
return UnmarshalReportStoryResultOptionRequired(result.Data)
|
||||
|
||||
case TypeReportStoryResultTextRequired:
|
||||
return UnmarshalReportStoryResultTextRequired(result.Data)
|
||||
|
||||
default:
|
||||
return nil, errors.New("invalid type")
|
||||
}
|
||||
}
|
||||
|
||||
// Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only
|
||||
|
|
@ -11915,7 +11933,7 @@ func (client *Client) CancelDownloadFile(req *CancelDownloadFileRequest) (*Ok, e
|
|||
type GetSuggestedFileNameRequest struct {
|
||||
// Identifier of the file
|
||||
FileId int32 `json:"file_id"`
|
||||
// Directory in which the file is supposed to be saved
|
||||
// Directory in which the file is expected to be saved
|
||||
Directory string `json:"directory"`
|
||||
}
|
||||
|
||||
|
|
@ -11978,7 +11996,7 @@ type CancelPreliminaryUploadFileRequest struct {
|
|||
FileId int32 `json:"file_id"`
|
||||
}
|
||||
|
||||
// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined
|
||||
// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile
|
||||
func (client *Client) CancelPreliminaryUploadFile(req *CancelPreliminaryUploadFileRequest) (*Ok, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -13289,7 +13307,7 @@ type CreateVideoChatRequest struct {
|
|||
ChatId int64 `json:"chat_id"`
|
||||
// Group call title; if empty, chat title will be used
|
||||
Title string `json:"title"`
|
||||
// Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future
|
||||
// Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future
|
||||
StartDate int32 `json:"start_date"`
|
||||
// Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges
|
||||
IsRtmpStream bool `json:"is_rtmp_stream"`
|
||||
|
|
@ -18101,7 +18119,7 @@ func (client *Client) ToggleSupergroupIsBroadcastGroup(req *ToggleSupergroupIsBr
|
|||
type ReportSupergroupSpamRequest struct {
|
||||
// Supergroup identifier
|
||||
SupergroupId int64 `json:"supergroup_id"`
|
||||
// Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported
|
||||
// Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported
|
||||
MessageIds []int64 `json:"message_ids"`
|
||||
}
|
||||
|
||||
|
|
@ -18465,6 +18483,153 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) {
|
|||
return UnmarshalOk(result.Data)
|
||||
}
|
||||
|
||||
// Returns gifts that can be sent to other users
|
||||
func (client *Client) GetAvailableGifts() (*Gifts, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "getAvailableGifts",
|
||||
},
|
||||
Data: map[string]interface{}{},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.Type == "error" {
|
||||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalGifts(result.Data)
|
||||
}
|
||||
|
||||
type SendGiftRequest struct {
|
||||
// Identifier of the gift to send
|
||||
GiftId JsonInt64 `json:"gift_id"`
|
||||
// Identifier of the user that will receive the gift
|
||||
UserId int64 `json:"user_id"`
|
||||
// Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed
|
||||
Text *FormattedText `json:"text"`
|
||||
// Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them
|
||||
IsPrivate bool `json:"is_private"`
|
||||
}
|
||||
|
||||
// Send a gift to another user
|
||||
func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "sendGift",
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"gift_id": req.GiftId,
|
||||
"user_id": req.UserId,
|
||||
"text": req.Text,
|
||||
"is_private": req.IsPrivate,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.Type == "error" {
|
||||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalOk(result.Data)
|
||||
}
|
||||
|
||||
type SellGiftRequest struct {
|
||||
// Identifier of the user that sent the gift
|
||||
SenderUserId int64 `json:"sender_user_id"`
|
||||
// Identifier of the message with the gift in the chat with the user
|
||||
MessageId int64 `json:"message_id"`
|
||||
}
|
||||
|
||||
// Sells a gift received by the current user for Telegram Stars
|
||||
func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "sellGift",
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"sender_user_id": req.SenderUserId,
|
||||
"message_id": req.MessageId,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.Type == "error" {
|
||||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalOk(result.Data)
|
||||
}
|
||||
|
||||
type ToggleGiftIsSavedRequest struct {
|
||||
// Identifier of the user that sent the gift
|
||||
SenderUserId int64 `json:"sender_user_id"`
|
||||
// Identifier of the message with the gift in the chat with the user
|
||||
MessageId int64 `json:"message_id"`
|
||||
// Pass true to display the gift on the user's profile page; pass false to remove it from the profile page
|
||||
IsSaved bool `json:"is_saved"`
|
||||
}
|
||||
|
||||
// Toggles whether a gift is shown on the current user's profile page
|
||||
func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "toggleGiftIsSaved",
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"sender_user_id": req.SenderUserId,
|
||||
"message_id": req.MessageId,
|
||||
"is_saved": req.IsSaved,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.Type == "error" {
|
||||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalOk(result.Data)
|
||||
}
|
||||
|
||||
type GetUserGiftsRequest struct {
|
||||
// Identifier of the user
|
||||
UserId int64 `json:"user_id"`
|
||||
// Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
|
||||
Offset string `json:"offset"`
|
||||
// The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit
|
||||
Limit int32 `json:"limit"`
|
||||
}
|
||||
|
||||
// Returns gifts saved to profile by the given user
|
||||
func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "getUserGifts",
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"user_id": req.UserId,
|
||||
"offset": req.Offset,
|
||||
"limit": req.Limit,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.Type == "error" {
|
||||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalUserGifts(result.Data)
|
||||
}
|
||||
|
||||
type CreateInvoiceLinkRequest struct {
|
||||
// Information about the invoice of the type inputMessageInvoice
|
||||
Invoice InputMessageContent `json:"invoice"`
|
||||
|
|
@ -18498,7 +18663,7 @@ type RefundStarPaymentRequest struct {
|
|||
TelegramPaymentChargeId string `json:"telegram_payment_charge_id"`
|
||||
}
|
||||
|
||||
// Refunds a previously done payment in Telegram Stars
|
||||
// Refunds a previously done payment in Telegram Stars; for bots only
|
||||
func (client *Client) RefundStarPayment(req *RefundStarPaymentRequest) (*Ok, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
|
|
@ -19487,24 +19652,24 @@ func (client *Client) RemoveChatActionBar(req *RemoveChatActionBarRequest) (*Ok,
|
|||
type ReportChatRequest struct {
|
||||
// Chat identifier
|
||||
ChatId int64 `json:"chat_id"`
|
||||
// Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported
|
||||
// Option identifier chosen by the user; leave empty for the initial request
|
||||
OptionId []byte `json:"option_id"`
|
||||
// Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported
|
||||
MessageIds []int64 `json:"message_ids"`
|
||||
// The reason for reporting the chat
|
||||
Reason ReportReason `json:"reason"`
|
||||
// Additional report details; 0-1024 characters
|
||||
// Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
// Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported
|
||||
func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) {
|
||||
func (client *Client) ReportChat(req *ReportChatRequest) (ReportChatResult, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "reportChat",
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"chat_id": req.ChatId,
|
||||
"option_id": req.OptionId,
|
||||
"message_ids": req.MessageIds,
|
||||
"reason": req.Reason,
|
||||
"text": req.Text,
|
||||
},
|
||||
})
|
||||
|
|
@ -19516,7 +19681,22 @@ func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) {
|
|||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalOk(result.Data)
|
||||
switch result.Type {
|
||||
case TypeReportChatResultOk:
|
||||
return UnmarshalReportChatResultOk(result.Data)
|
||||
|
||||
case TypeReportChatResultOptionRequired:
|
||||
return UnmarshalReportChatResultOptionRequired(result.Data)
|
||||
|
||||
case TypeReportChatResultTextRequired:
|
||||
return UnmarshalReportChatResultTextRequired(result.Data)
|
||||
|
||||
case TypeReportChatResultMessagesRequired:
|
||||
return UnmarshalReportChatResultMessagesRequired(result.Data)
|
||||
|
||||
default:
|
||||
return nil, errors.New("invalid type")
|
||||
}
|
||||
}
|
||||
|
||||
type ReportChatPhotoRequest struct {
|
||||
|
|
@ -21347,6 +21527,32 @@ func (client *Client) GetPremiumStickerExamples() (*Stickers, error) {
|
|||
return UnmarshalStickers(result.Data)
|
||||
}
|
||||
|
||||
type GetPremiumInfoStickerRequest struct {
|
||||
// Number of months the Telegram Premium subscription will be active
|
||||
MonthCount int32 `json:"month_count"`
|
||||
}
|
||||
|
||||
// Returns the sticker to be used as representation of the Telegram Premium subscription
|
||||
func (client *Client) GetPremiumInfoSticker(req *GetPremiumInfoStickerRequest) (*Sticker, error) {
|
||||
result, err := client.Send(Request{
|
||||
meta: meta{
|
||||
Type: "getPremiumInfoSticker",
|
||||
},
|
||||
Data: map[string]interface{}{
|
||||
"month_count": req.MonthCount,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if result.Type == "error" {
|
||||
return nil, buildResponseError(result.Data)
|
||||
}
|
||||
|
||||
return UnmarshalSticker(result.Data)
|
||||
}
|
||||
|
||||
type ViewPremiumFeatureRequest struct {
|
||||
// The viewed premium feature
|
||||
Feature PremiumFeature `json:"feature"`
|
||||
|
|
|
|||
678
client/type.go
678
client/type.go
File diff suppressed because it is too large
Load diff
|
|
@ -767,6 +767,43 @@ func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTr
|
|||
return list, nil
|
||||
}
|
||||
|
||||
func UnmarshalUserTransactionPurpose(data json.RawMessage) (UserTransactionPurpose, error) {
|
||||
var meta meta
|
||||
|
||||
err := json.Unmarshal(data, &meta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch meta.Type {
|
||||
case TypeUserTransactionPurposeGiftedStars:
|
||||
return UnmarshalUserTransactionPurposeGiftedStars(data)
|
||||
|
||||
case TypeUserTransactionPurposeGiftSell:
|
||||
return UnmarshalUserTransactionPurposeGiftSell(data)
|
||||
|
||||
case TypeUserTransactionPurposeGiftSend:
|
||||
return UnmarshalUserTransactionPurposeGiftSend(data)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
|
||||
}
|
||||
}
|
||||
|
||||
func UnmarshalListOfUserTransactionPurpose(dataList []json.RawMessage) ([]UserTransactionPurpose, error) {
|
||||
list := []UserTransactionPurpose{}
|
||||
|
||||
for _, data := range dataList {
|
||||
entity, err := UnmarshalUserTransactionPurpose(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list = append(list, entity)
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) {
|
||||
var meta meta
|
||||
|
||||
|
|
@ -1938,6 +1975,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt
|
|||
case TypeInlineKeyboardButtonTypeUser:
|
||||
return UnmarshalInlineKeyboardButtonTypeUser(data)
|
||||
|
||||
case TypeInlineKeyboardButtonTypeCopyText:
|
||||
return UnmarshalInlineKeyboardButtonTypeCopyText(data)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
|
||||
}
|
||||
|
|
@ -3256,6 +3296,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) {
|
|||
case TypeMessageGiveawayPrizeStars:
|
||||
return UnmarshalMessageGiveawayPrizeStars(data)
|
||||
|
||||
case TypeMessageGift:
|
||||
return UnmarshalMessageGift(data)
|
||||
|
||||
case TypeMessageContactRegistered:
|
||||
return UnmarshalMessageContactRegistered(data)
|
||||
|
||||
|
|
@ -5956,6 +5999,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro
|
|||
case TypePushMessageContentGiveaway:
|
||||
return UnmarshalPushMessageContentGiveaway(data)
|
||||
|
||||
case TypePushMessageContentGift:
|
||||
return UnmarshalPushMessageContentGift(data)
|
||||
|
||||
case TypePushMessageContentScreenshotTaken:
|
||||
return UnmarshalPushMessageContentScreenshotTaken(data)
|
||||
|
||||
|
|
@ -6531,6 +6577,83 @@ func UnmarshalListOfReportReason(dataList []json.RawMessage) ([]ReportReason, er
|
|||
return list, nil
|
||||
}
|
||||
|
||||
func UnmarshalReportChatResult(data json.RawMessage) (ReportChatResult, error) {
|
||||
var meta meta
|
||||
|
||||
err := json.Unmarshal(data, &meta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch meta.Type {
|
||||
case TypeReportChatResultOk:
|
||||
return UnmarshalReportChatResultOk(data)
|
||||
|
||||
case TypeReportChatResultOptionRequired:
|
||||
return UnmarshalReportChatResultOptionRequired(data)
|
||||
|
||||
case TypeReportChatResultTextRequired:
|
||||
return UnmarshalReportChatResultTextRequired(data)
|
||||
|
||||
case TypeReportChatResultMessagesRequired:
|
||||
return UnmarshalReportChatResultMessagesRequired(data)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
|
||||
}
|
||||
}
|
||||
|
||||
func UnmarshalListOfReportChatResult(dataList []json.RawMessage) ([]ReportChatResult, error) {
|
||||
list := []ReportChatResult{}
|
||||
|
||||
for _, data := range dataList {
|
||||
entity, err := UnmarshalReportChatResult(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list = append(list, entity)
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func UnmarshalReportStoryResult(data json.RawMessage) (ReportStoryResult, error) {
|
||||
var meta meta
|
||||
|
||||
err := json.Unmarshal(data, &meta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch meta.Type {
|
||||
case TypeReportStoryResultOk:
|
||||
return UnmarshalReportStoryResultOk(data)
|
||||
|
||||
case TypeReportStoryResultOptionRequired:
|
||||
return UnmarshalReportStoryResultOptionRequired(data)
|
||||
|
||||
case TypeReportStoryResultTextRequired:
|
||||
return UnmarshalReportStoryResultTextRequired(data)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
|
||||
}
|
||||
}
|
||||
|
||||
func UnmarshalListOfReportStoryResult(dataList []json.RawMessage) ([]ReportStoryResult, error) {
|
||||
list := []ReportStoryResult{}
|
||||
|
||||
for _, data := range dataList {
|
||||
entity, err := UnmarshalReportStoryResult(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list = append(list, entity)
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) {
|
||||
var meta meta
|
||||
|
||||
|
|
@ -8777,6 +8900,14 @@ func UnmarshalPoll(data json.RawMessage) (*Poll, error) {
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) {
|
||||
var resp AlternativeVideo
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalBackground(data json.RawMessage) (*Background, error) {
|
||||
var resp Background
|
||||
|
||||
|
|
@ -9241,6 +9372,38 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalGift(data json.RawMessage) (*Gift, error) {
|
||||
var resp Gift
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalGifts(data json.RawMessage) (*Gifts, error) {
|
||||
var resp Gifts
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) {
|
||||
var resp UserGift
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) {
|
||||
var resp UserGifts
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) {
|
||||
var resp StarTransactionDirectionIncoming
|
||||
|
||||
|
|
@ -9305,6 +9468,30 @@ func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransac
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalUserTransactionPurposeGiftedStars(data json.RawMessage) (*UserTransactionPurposeGiftedStars, error) {
|
||||
var resp UserTransactionPurposeGiftedStars
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalUserTransactionPurposeGiftSell(data json.RawMessage) (*UserTransactionPurposeGiftSell, error) {
|
||||
var resp UserTransactionPurposeGiftSell
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalUserTransactionPurposeGiftSend(data json.RawMessage) (*UserTransactionPurposeGiftSend, error) {
|
||||
var resp UserTransactionPurposeGiftSend
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) {
|
||||
var resp StarTransactionPartnerTelegram
|
||||
|
||||
|
|
@ -10449,8 +10636,8 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportChatSponsoredMessageOption(data json.RawMessage) (*ReportChatSponsoredMessageOption, error) {
|
||||
var resp ReportChatSponsoredMessageOption
|
||||
func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) {
|
||||
var resp ReportOption
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
|
|
@ -11073,6 +11260,14 @@ func UnmarshalInlineKeyboardButtonTypeUser(data json.RawMessage) (*InlineKeyboar
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalInlineKeyboardButtonTypeCopyText(data json.RawMessage) (*InlineKeyboardButtonTypeCopyText, error) {
|
||||
var resp InlineKeyboardButtonTypeCopyText
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalInlineKeyboardButton(data json.RawMessage) (*InlineKeyboardButton, error) {
|
||||
var resp InlineKeyboardButton
|
||||
|
||||
|
|
@ -13393,6 +13588,14 @@ func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayP
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalMessageGift(data json.RawMessage) (*MessageGift, error) {
|
||||
var resp MessageGift
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) {
|
||||
var resp MessageContactRegistered
|
||||
|
||||
|
|
@ -17337,6 +17540,14 @@ func UnmarshalPushMessageContentGiveaway(data json.RawMessage) (*PushMessageCont
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalPushMessageContentGift(data json.RawMessage) (*PushMessageContentGift, error) {
|
||||
var resp PushMessageContentGift
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) {
|
||||
var resp PushMessageContentScreenshotTaken
|
||||
|
||||
|
|
@ -18193,6 +18404,62 @@ func UnmarshalReportReasonCustom(data json.RawMessage) (*ReportReasonCustom, err
|
|||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportChatResultOk(data json.RawMessage) (*ReportChatResultOk, error) {
|
||||
var resp ReportChatResultOk
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportChatResultOptionRequired(data json.RawMessage) (*ReportChatResultOptionRequired, error) {
|
||||
var resp ReportChatResultOptionRequired
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportChatResultTextRequired(data json.RawMessage) (*ReportChatResultTextRequired, error) {
|
||||
var resp ReportChatResultTextRequired
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportChatResultMessagesRequired(data json.RawMessage) (*ReportChatResultMessagesRequired, error) {
|
||||
var resp ReportChatResultMessagesRequired
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportStoryResultOk(data json.RawMessage) (*ReportStoryResultOk, error) {
|
||||
var resp ReportStoryResultOk
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportStoryResultOptionRequired(data json.RawMessage) (*ReportStoryResultOptionRequired, error) {
|
||||
var resp ReportStoryResultOptionRequired
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalReportStoryResultTextRequired(data json.RawMessage) (*ReportStoryResultTextRequired, error) {
|
||||
var resp ReportStoryResultTextRequired
|
||||
|
||||
err := json.Unmarshal(data, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) {
|
||||
var resp TargetChatCurrent
|
||||
|
||||
|
|
@ -21256,6 +21523,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypePoll:
|
||||
return UnmarshalPoll(data)
|
||||
|
||||
case TypeAlternativeVideo:
|
||||
return UnmarshalAlternativeVideo(data)
|
||||
|
||||
case TypeBackground:
|
||||
return UnmarshalBackground(data)
|
||||
|
||||
|
|
@ -21430,6 +21700,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypeStarGiveawayPaymentOptions:
|
||||
return UnmarshalStarGiveawayPaymentOptions(data)
|
||||
|
||||
case TypeGift:
|
||||
return UnmarshalGift(data)
|
||||
|
||||
case TypeGifts:
|
||||
return UnmarshalGifts(data)
|
||||
|
||||
case TypeUserGift:
|
||||
return UnmarshalUserGift(data)
|
||||
|
||||
case TypeUserGifts:
|
||||
return UnmarshalUserGifts(data)
|
||||
|
||||
case TypeStarTransactionDirectionIncoming:
|
||||
return UnmarshalStarTransactionDirectionIncoming(data)
|
||||
|
||||
|
|
@ -21454,6 +21736,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypeChatTransactionPurposeGiveaway:
|
||||
return UnmarshalChatTransactionPurposeGiveaway(data)
|
||||
|
||||
case TypeUserTransactionPurposeGiftedStars:
|
||||
return UnmarshalUserTransactionPurposeGiftedStars(data)
|
||||
|
||||
case TypeUserTransactionPurposeGiftSell:
|
||||
return UnmarshalUserTransactionPurposeGiftSell(data)
|
||||
|
||||
case TypeUserTransactionPurposeGiftSend:
|
||||
return UnmarshalUserTransactionPurposeGiftSend(data)
|
||||
|
||||
case TypeStarTransactionPartnerTelegram:
|
||||
return UnmarshalStarTransactionPartnerTelegram(data)
|
||||
|
||||
|
|
@ -21883,8 +22174,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypeSponsoredMessages:
|
||||
return UnmarshalSponsoredMessages(data)
|
||||
|
||||
case TypeReportChatSponsoredMessageOption:
|
||||
return UnmarshalReportChatSponsoredMessageOption(data)
|
||||
case TypeReportOption:
|
||||
return UnmarshalReportOption(data)
|
||||
|
||||
case TypeReportChatSponsoredMessageResultOk:
|
||||
return UnmarshalReportChatSponsoredMessageResultOk(data)
|
||||
|
|
@ -22117,6 +22408,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypeInlineKeyboardButtonTypeUser:
|
||||
return UnmarshalInlineKeyboardButtonTypeUser(data)
|
||||
|
||||
case TypeInlineKeyboardButtonTypeCopyText:
|
||||
return UnmarshalInlineKeyboardButtonTypeCopyText(data)
|
||||
|
||||
case TypeInlineKeyboardButton:
|
||||
return UnmarshalInlineKeyboardButton(data)
|
||||
|
||||
|
|
@ -22987,6 +23281,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypeMessageGiveawayPrizeStars:
|
||||
return UnmarshalMessageGiveawayPrizeStars(data)
|
||||
|
||||
case TypeMessageGift:
|
||||
return UnmarshalMessageGift(data)
|
||||
|
||||
case TypeMessageContactRegistered:
|
||||
return UnmarshalMessageContactRegistered(data)
|
||||
|
||||
|
|
@ -24466,6 +24763,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypePushMessageContentGiveaway:
|
||||
return UnmarshalPushMessageContentGiveaway(data)
|
||||
|
||||
case TypePushMessageContentGift:
|
||||
return UnmarshalPushMessageContentGift(data)
|
||||
|
||||
case TypePushMessageContentScreenshotTaken:
|
||||
return UnmarshalPushMessageContentScreenshotTaken(data)
|
||||
|
||||
|
|
@ -24787,6 +25087,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
|
|||
case TypeReportReasonCustom:
|
||||
return UnmarshalReportReasonCustom(data)
|
||||
|
||||
case TypeReportChatResultOk:
|
||||
return UnmarshalReportChatResultOk(data)
|
||||
|
||||
case TypeReportChatResultOptionRequired:
|
||||
return UnmarshalReportChatResultOptionRequired(data)
|
||||
|
||||
case TypeReportChatResultTextRequired:
|
||||
return UnmarshalReportChatResultTextRequired(data)
|
||||
|
||||
case TypeReportChatResultMessagesRequired:
|
||||
return UnmarshalReportChatResultMessagesRequired(data)
|
||||
|
||||
case TypeReportStoryResultOk:
|
||||
return UnmarshalReportStoryResultOk(data)
|
||||
|
||||
case TypeReportStoryResultOptionRequired:
|
||||
return UnmarshalReportStoryResultOptionRequired(data)
|
||||
|
||||
case TypeReportStoryResultTextRequired:
|
||||
return UnmarshalReportStoryResultTextRequired(data)
|
||||
|
||||
case TypeTargetChatCurrent:
|
||||
return UnmarshalTargetChatCurrent(data)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue