From 26f72d96cedf19ed4608e5643fcb5e01816491c0 Mon Sep 17 00:00:00 2001 From: c0re100 Date: Wed, 30 Aug 2023 03:53:53 +0800 Subject: [PATCH] Restore sendChatScreenshotTakenNotification --- client/function.go | 28 +- client/type.go | 1904 ++++++++++++++++++++--------------------- client/unmarshaler.go | 880 +++++++++---------- data/td_api.tl | 317 +++---- 4 files changed, 1579 insertions(+), 1550 deletions(-) diff --git a/client/function.go b/client/function.go index 3fde614..ff812ee 100755 --- a/client/function.go +++ b/client/function.go @@ -1736,7 +1736,7 @@ type GetTopChatsRequest struct { Limit int32 `json:"limit"` } -// Returns a list of frequently used chats. Supported only if the chat info database is enabled +// Returns a list of frequently used chats func (client *Client) GetTopChats(req *GetTopChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -3327,6 +3327,32 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err return UnmarshalMessages(result.Data) } +type SendChatScreenshotTakenNotificationRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats +func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreenshotTakenNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendChatScreenshotTakenNotification", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type AddLocalMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` diff --git a/client/type.go b/client/type.go index b618326..3b74865 100755 --- a/client/type.go +++ b/client/type.go @@ -64,6 +64,11 @@ const ( ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" ClassEmojiCategoryType = "EmojiCategoryType" + ClassStoryAreaType = "StoryAreaType" + ClassInputStoryAreaType = "InputStoryAreaType" + ClassStoryContent = "StoryContent" + ClassInputStoryContent = "InputStoryContent" + ClassStoryList = "StoryList" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" ClassCallState = "CallState" @@ -105,11 +110,6 @@ const ( ClassReportReason = "ReportReason" ClassTargetChat = "TargetChat" ClassInternalLinkType = "InternalLinkType" - ClassStoryAreaType = "StoryAreaType" - ClassInputStoryAreaType = "InputStoryAreaType" - ClassStoryContent = "StoryContent" - ClassInputStoryContent = "InputStoryContent" - ClassStoryList = "StoryList" ClassBlockList = "BlockList" ClassFileType = "FileType" ClassNetworkType = "NetworkType" @@ -307,6 +307,18 @@ const ( ClassTrendingStickerSets = "TrendingStickerSets" ClassEmojiCategory = "EmojiCategory" ClassEmojiCategories = "EmojiCategories" + ClassStoryViewer = "StoryViewer" + ClassStoryViewers = "StoryViewers" + ClassStoryAreaPosition = "StoryAreaPosition" + ClassStoryArea = "StoryArea" + ClassInputStoryArea = "InputStoryArea" + ClassInputStoryAreas = "InputStoryAreas" + ClassStoryVideo = "StoryVideo" + ClassStoryInteractionInfo = "StoryInteractionInfo" + ClassStory = "Story" + ClassStories = "Stories" + ClassStoryInfo = "StoryInfo" + ClassChatActiveStories = "ChatActiveStories" ClassCallProtocol = "CallProtocol" ClassCallServer = "CallServer" ClassCallId = "CallId" @@ -368,18 +380,6 @@ const ( ClassConnectedWebsites = "ConnectedWebsites" ClassMessageLink = "MessageLink" ClassMessageLinkInfo = "MessageLinkInfo" - ClassStoryViewer = "StoryViewer" - ClassStoryViewers = "StoryViewers" - ClassStoryAreaPosition = "StoryAreaPosition" - ClassStoryArea = "StoryArea" - ClassInputStoryArea = "InputStoryArea" - ClassInputStoryAreas = "InputStoryAreas" - ClassStoryVideo = "StoryVideo" - ClassStoryInteractionInfo = "StoryInteractionInfo" - ClassStory = "Story" - ClassStories = "Stories" - ClassStoryInfo = "StoryInfo" - ClassChatActiveStories = "ChatActiveStories" ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" @@ -1026,6 +1026,30 @@ const ( TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" + TypeStoryViewer = "storyViewer" + TypeStoryViewers = "storyViewers" + TypeStoryAreaPosition = "storyAreaPosition" + TypeStoryAreaTypeLocation = "storyAreaTypeLocation" + TypeStoryAreaTypeVenue = "storyAreaTypeVenue" + TypeStoryArea = "storyArea" + TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" + TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" + TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" + TypeInputStoryArea = "inputStoryArea" + TypeInputStoryAreas = "inputStoryAreas" + TypeStoryVideo = "storyVideo" + TypeStoryContentPhoto = "storyContentPhoto" + TypeStoryContentVideo = "storyContentVideo" + TypeStoryContentUnsupported = "storyContentUnsupported" + TypeInputStoryContentPhoto = "inputStoryContentPhoto" + TypeInputStoryContentVideo = "inputStoryContentVideo" + TypeStoryListMain = "storyListMain" + TypeStoryListArchive = "storyListArchive" + TypeStoryInteractionInfo = "storyInteractionInfo" + TypeStory = "story" + TypeStories = "stories" + TypeStoryInfo = "storyInfo" + TypeChatActiveStories = "chatActiveStories" TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" TypeCallDiscardReasonMissed = "callDiscardReasonMissed" TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" @@ -1426,30 +1450,6 @@ const ( TypeInternalLinkTypeWebApp = "internalLinkTypeWebApp" TypeMessageLink = "messageLink" TypeMessageLinkInfo = "messageLinkInfo" - TypeStoryViewer = "storyViewer" - TypeStoryViewers = "storyViewers" - TypeStoryAreaPosition = "storyAreaPosition" - TypeStoryAreaTypeLocation = "storyAreaTypeLocation" - TypeStoryAreaTypeVenue = "storyAreaTypeVenue" - TypeStoryArea = "storyArea" - TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" - TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" - TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" - TypeInputStoryArea = "inputStoryArea" - TypeInputStoryAreas = "inputStoryAreas" - TypeStoryVideo = "storyVideo" - TypeStoryContentPhoto = "storyContentPhoto" - TypeStoryContentVideo = "storyContentVideo" - TypeStoryContentUnsupported = "storyContentUnsupported" - TypeInputStoryContentPhoto = "inputStoryContentPhoto" - TypeInputStoryContentVideo = "inputStoryContentVideo" - TypeStoryListMain = "storyListMain" - TypeStoryListArchive = "storyListArchive" - TypeStoryInteractionInfo = "storyInteractionInfo" - TypeStory = "story" - TypeStories = "stories" - TypeStoryInfo = "storyInfo" - TypeChatActiveStories = "chatActiveStories" TypeBlockListMain = "blockListMain" TypeBlockListStories = "blockListStories" TypeFilePart = "filePart" @@ -1973,6 +1973,31 @@ type EmojiCategoryType interface { EmojiCategoryTypeType() string } +// Describes type of a clickable rectangle area on a story media +type StoryAreaType interface { + StoryAreaTypeType() string +} + +// Describes type of a clickable rectangle area on a story media to be added +type InputStoryAreaType interface { + InputStoryAreaTypeType() string +} + +// Contains the content of a story +type StoryContent interface { + StoryContentType() string +} + +// The content of a story to send +type InputStoryContent interface { + InputStoryContentType() string +} + +// Describes a list of stories +type StoryList interface { + StoryListType() string +} + // Describes the reason why a call was discarded type CallDiscardReason interface { CallDiscardReasonType() string @@ -2178,31 +2203,6 @@ type InternalLinkType interface { InternalLinkTypeType() string } -// Describes type of a clickable rectangle area on a story media -type StoryAreaType interface { - StoryAreaTypeType() string -} - -// Describes type of a clickable rectangle area on a story media to be added -type InputStoryAreaType interface { - InputStoryAreaTypeType() string -} - -// Contains the content of a story -type StoryContent interface { - StoryContentType() string -} - -// The content of a story to send -type InputStoryContent interface { - InputStoryContentType() string -} - -// Describes a list of stories -type StoryList interface { - StoryListType() string -} - // Describes a type of a block list type BlockList interface { BlockListType() string @@ -9597,7 +9597,7 @@ type ChatNotificationSettings struct { ShowPreview bool `json:"show_preview"` // If true, mute_stories is ignored and the value for the relevant type of chat is used instead UseDefaultMuteStories bool `json:"use_default_mute_stories"` - // True, if story notifications are received without sound + // True, if story notifications are disabled for the chat MuteStories bool `json:"mute_stories"` // If true, the value for the relevant type of chat is used instead of story_sound_id UseDefaultStorySound bool `json:"use_default_story_sound"` @@ -9642,9 +9642,9 @@ type ScopeNotificationSettings struct { SoundId JsonInt64 `json:"sound_id"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` - // If true, mute_stories is ignored and stories are unmuted only for the first 5 chats from topChatCategoryUsers + // If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers UseDefaultMuteStories bool `json:"use_default_mute_stories"` - // True, if story notifications are received without sound + // True, if story notifications are disabled for the chat MuteStories bool `json:"mute_stories"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` @@ -22288,6 +22288,889 @@ func (*EmojiCategoryTypeChatPhoto) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeChatPhoto } +// Represents a viewer of a story +type StoryViewer struct { + meta + // User identifier of the viewer + UserId int64 `json:"user_id"` + // Approximate point in time (Unix timestamp) when the story was viewed + ViewDate int32 `json:"view_date"` + // Block list to which the user is added; may be null if none + BlockList BlockList `json:"block_list"` + // Type of the reaction that was chosen by the user; may be null if none + ChosenReactionType ReactionType `json:"chosen_reaction_type"` +} + +func (entity *StoryViewer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryViewer + + return json.Marshal((*stub)(entity)) +} + +func (*StoryViewer) GetClass() string { + return ClassStoryViewer +} + +func (*StoryViewer) GetType() string { + return TypeStoryViewer +} + +func (storyViewer *StoryViewer) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + ViewDate int32 `json:"view_date"` + BlockList json.RawMessage `json:"block_list"` + ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyViewer.UserId = tmp.UserId + storyViewer.ViewDate = tmp.ViewDate + + fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) + storyViewer.BlockList = fieldBlockList + + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) + storyViewer.ChosenReactionType = fieldChosenReactionType + + return nil +} + +// Represents a list of story viewers +type StoryViewers struct { + meta + // Approximate total number of story viewers found + TotalCount int32 `json:"total_count"` + // List of story viewers + Viewers []*StoryViewer `json:"viewers"` + // The offset for the next request. If empty, there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StoryViewers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryViewers + + return json.Marshal((*stub)(entity)) +} + +func (*StoryViewers) GetClass() string { + return ClassStoryViewers +} + +func (*StoryViewers) GetType() string { + return TypeStoryViewers +} + +// Describes position of a clickable rectangle area on a story media +type StoryAreaPosition struct { + meta + // The abscissa of the rectangle's center, as a percentage of the media width + XPercentage float64 `json:"x_percentage"` + // The ordinate of the rectangle's center, as a percentage of the media height + YPercentage float64 `json:"y_percentage"` + // The width of the rectangle, as a percentage of the media width + WidthPercentage float64 `json:"width_percentage"` + // The ordinate of the rectangle's center, as a percentage of the media height + HeightPercentage float64 `json:"height_percentage"` + // Clockwise rotation angle of the rectangle, in degrees; 0-360 + RotationAngle float64 `json:"rotation_angle"` +} + +func (entity *StoryAreaPosition) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaPosition + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaPosition) GetClass() string { + return ClassStoryAreaPosition +} + +func (*StoryAreaPosition) GetType() string { + return TypeStoryAreaPosition +} + +// An area pointing to a location +type StoryAreaTypeLocation struct { + meta + // The location + Location *Location `json:"location"` +} + +func (entity *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeLocation + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeLocation) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeLocation) GetType() string { + return TypeStoryAreaTypeLocation +} + +func (*StoryAreaTypeLocation) StoryAreaTypeType() string { + return TypeStoryAreaTypeLocation +} + +// An area pointing to a venue +type StoryAreaTypeVenue struct { + meta + // Information about the venue + Venue *Venue `json:"venue"` +} + +func (entity *StoryAreaTypeVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeVenue + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeVenue) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeVenue) GetType() string { + return TypeStoryAreaTypeVenue +} + +func (*StoryAreaTypeVenue) StoryAreaTypeType() string { + return TypeStoryAreaTypeVenue +} + +// Describes a clickable rectangle area on a story media +type StoryArea struct { + meta + // Position of the area + Position *StoryAreaPosition `json:"position"` + // Type of the area + Type StoryAreaType `json:"type"` +} + +func (entity *StoryArea) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryArea + + return json.Marshal((*stub)(entity)) +} + +func (*StoryArea) GetClass() string { + return ClassStoryArea +} + +func (*StoryArea) GetType() string { + return TypeStoryArea +} + +func (storyArea *StoryArea) UnmarshalJSON(data []byte) error { + var tmp struct { + Position *StoryAreaPosition `json:"position"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyArea.Position = tmp.Position + + fieldType, _ := UnmarshalStoryAreaType(tmp.Type) + storyArea.Type = fieldType + + return nil +} + +// An area pointing to a location +type InputStoryAreaTypeLocation struct { + meta + // The location + Location *Location `json:"location"` +} + +func (entity *InputStoryAreaTypeLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeLocation + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeLocation) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeLocation) GetType() string { + return TypeInputStoryAreaTypeLocation +} + +func (*InputStoryAreaTypeLocation) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeLocation +} + +// An area pointing to a venue found by the bot getOption("venue_search_bot_username") +type InputStoryAreaTypeFoundVenue struct { + meta + // Identifier of the inline query, used to found the venue + QueryId JsonInt64 `json:"query_id"` + // Identifier of the inline query result + ResultId string `json:"result_id"` +} + +func (entity *InputStoryAreaTypeFoundVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeFoundVenue + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeFoundVenue) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeFoundVenue) GetType() string { + return TypeInputStoryAreaTypeFoundVenue +} + +func (*InputStoryAreaTypeFoundVenue) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeFoundVenue +} + +// An area pointing to a venue already added to the story +type InputStoryAreaTypePreviousVenue struct { + meta + // Provider of the venue + VenueProvider string `json:"venue_provider"` + // Identifier of the venue in the provider database + VenueId string `json:"venue_id"` +} + +func (entity *InputStoryAreaTypePreviousVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypePreviousVenue + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypePreviousVenue) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypePreviousVenue) GetType() string { + return TypeInputStoryAreaTypePreviousVenue +} + +func (*InputStoryAreaTypePreviousVenue) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypePreviousVenue +} + +// Describes a clickable rectangle area on a story media to be added +type InputStoryArea struct { + meta + // Position of the area + Position *StoryAreaPosition `json:"position"` + // Type of the area + Type InputStoryAreaType `json:"type"` +} + +func (entity *InputStoryArea) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryArea + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryArea) GetClass() string { + return ClassInputStoryArea +} + +func (*InputStoryArea) GetType() string { + return TypeInputStoryArea +} + +func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { + var tmp struct { + Position *StoryAreaPosition `json:"position"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryArea.Position = tmp.Position + + fieldType, _ := UnmarshalInputStoryAreaType(tmp.Type) + inputStoryArea.Type = fieldType + + return nil +} + +// Contains a list of story areas to be added +type InputStoryAreas struct { + meta + // List of 0-10 input story areas + Areas []*InputStoryArea `json:"areas"` +} + +func (entity *InputStoryAreas) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreas + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreas) GetClass() string { + return ClassInputStoryAreas +} + +func (*InputStoryAreas) GetType() string { + return TypeInputStoryAreas +} + +// Describes a video file sent in a story +type StoryVideo struct { + meta + // Duration of the video, in seconds + Duration float64 `json:"duration"` + // Video width + Width int32 `json:"width"` + // Video height + Height int32 `json:"height"` + // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // True, if the video has no sound + IsAnimation bool `json:"is_animation"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Video thumbnail in JPEG or MPEG4 format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // Size of file prefix, which is supposed to be preloaded, in bytes + PreloadPrefixSize int32 `json:"preload_prefix_size"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *StoryVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryVideo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryVideo) GetClass() string { + return ClassStoryVideo +} + +func (*StoryVideo) GetType() string { + return TypeStoryVideo +} + +// A photo story +type StoryContentPhoto struct { + meta + // The photo + Photo *Photo `json:"photo"` +} + +func (entity *StoryContentPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentPhoto) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentPhoto) GetType() string { + return TypeStoryContentPhoto +} + +func (*StoryContentPhoto) StoryContentType() string { + return TypeStoryContentPhoto +} + +// A video story +type StoryContentVideo struct { + meta + // The video in MPEG4 format + Video *StoryVideo `json:"video"` + // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null + AlternativeVideo *StoryVideo `json:"alternative_video"` +} + +func (entity *StoryContentVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentVideo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentVideo) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentVideo) GetType() string { + return TypeStoryContentVideo +} + +func (*StoryContentVideo) StoryContentType() string { + return TypeStoryContentVideo +} + +// A story content that is not supported in the current TDLib version +type StoryContentUnsupported struct{ + meta +} + +func (entity *StoryContentUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentUnsupported) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentUnsupported) GetType() string { + return TypeStoryContentUnsupported +} + +func (*StoryContentUnsupported) StoryContentType() string { + return TypeStoryContentUnsupported +} + +// A photo story +type InputStoryContentPhoto struct { + meta + // Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 + Photo InputFile `json:"photo"` + // File identifiers of the stickers added to the photo, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` +} + +func (entity *InputStoryContentPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryContentPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryContentPhoto) GetClass() string { + return ClassInputStoryContent +} + +func (*InputStoryContentPhoto) GetType() string { + return TypeInputStoryContentPhoto +} + +func (*InputStoryContentPhoto) InputStoryContentType() string { + return TypeInputStoryContentPhoto +} + +func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo json.RawMessage `json:"photo"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryContentPhoto.AddedStickerFileIds = tmp.AddedStickerFileIds + + fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) + inputStoryContentPhoto.Photo = fieldPhoto + + return nil +} + +// A video story +type InputStoryContentVideo struct { + meta + // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second + Video InputFile `json:"video"` + // File identifiers of the stickers added to the video, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + // Precise duration of the video, in seconds; 0-60 + Duration float64 `json:"duration"` + // True, if the video has no sound + IsAnimation bool `json:"is_animation"` +} + +func (entity *InputStoryContentVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryContentVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryContentVideo) GetClass() string { + return ClassInputStoryContent +} + +func (*InputStoryContentVideo) GetType() string { + return TypeInputStoryContentVideo +} + +func (*InputStoryContentVideo) InputStoryContentType() string { + return TypeInputStoryContentVideo +} + +func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) error { + var tmp struct { + Video json.RawMessage `json:"video"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + Duration float64 `json:"duration"` + IsAnimation bool `json:"is_animation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStoryContentVideo.AddedStickerFileIds = tmp.AddedStickerFileIds + inputStoryContentVideo.Duration = tmp.Duration + inputStoryContentVideo.IsAnimation = tmp.IsAnimation + + fieldVideo, _ := UnmarshalInputFile(tmp.Video) + inputStoryContentVideo.Video = fieldVideo + + return nil +} + +// The list of stories, shown in the main chat list and folder chat lists +type StoryListMain struct{ + meta +} + +func (entity *StoryListMain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryListMain + + return json.Marshal((*stub)(entity)) +} + +func (*StoryListMain) GetClass() string { + return ClassStoryList +} + +func (*StoryListMain) GetType() string { + return TypeStoryListMain +} + +func (*StoryListMain) StoryListType() string { + return TypeStoryListMain +} + +// The list of stories, shown in the Arvhive chat list +type StoryListArchive struct{ + meta +} + +func (entity *StoryListArchive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryListArchive + + return json.Marshal((*stub)(entity)) +} + +func (*StoryListArchive) GetClass() string { + return ClassStoryList +} + +func (*StoryListArchive) GetType() string { + return TypeStoryListArchive +} + +func (*StoryListArchive) StoryListType() string { + return TypeStoryListArchive +} + +// Contains information about interactions with a story +type StoryInteractionInfo struct { + meta + // Number of times the story was viewed + ViewCount int32 `json:"view_count"` + // Number of reactions added to the story + ReactionCount int32 `json:"reaction_count"` + // Identifiers of at most 3 recent viewers of the story + RecentViewerUserIds []int64 `json:"recent_viewer_user_ids"` +} + +func (entity *StoryInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractionInfo) GetClass() string { + return ClassStoryInteractionInfo +} + +func (*StoryInteractionInfo) GetType() string { + return TypeStoryInteractionInfo +} + +// Represents a story +type Story struct { + meta + // Unique story identifier among stories of the given sender + Id int32 `json:"id"` + // Identifier of the chat that posted the story + SenderChatId int64 `json:"sender_chat_id"` + // Point in time (Unix timestamp) when the story was published + Date int32 `json:"date"` + // True, if the story is being sent by the current user + IsBeingSent bool `json:"is_being_sent"` + // True, if the story is being edited by the current user + IsBeingEdited bool `json:"is_being_edited"` + // True, if the story was edited + IsEdited bool `json:"is_edited"` + // True, if the story is saved in the sender's profile and will be available there after expiration + IsPinned bool `json:"is_pinned"` + // True, if the story is visible only for the current user + IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden + CanBeForwarded bool `json:"can_be_forwarded"` + // True, if the story can be replied in the chat with the story sender + CanBeReplied bool `json:"can_be_replied"` + // True, if users viewed the story can be received through getStoryViewers + CanGetViewers bool `json:"can_get_viewers"` + // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago + HasExpiredViewers bool `json:"has_expired_viewers"` + // Information about interactions with the story; may be null if the story isn't owned or there were no interactions + InteractionInfo *StoryInteractionInfo `json:"interaction_info"` + // Type of the chosen reaction; may be null if none + ChosenReactionType ReactionType `json:"chosen_reaction_type"` + // Privacy rules affecting story visibility; may be approximate for non-owned stories + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Content of the story + Content StoryContent `json:"content"` + // Clickable areas to be shown on the story content + Areas []*StoryArea `json:"areas"` + // Caption of the story + Caption *FormattedText `json:"caption"` +} + +func (entity *Story) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Story + + return json.Marshal((*stub)(entity)) +} + +func (*Story) GetClass() string { + return ClassStory +} + +func (*Story) GetType() string { + return TypeStory +} + +func (story *Story) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + SenderChatId int64 `json:"sender_chat_id"` + Date int32 `json:"date"` + IsBeingSent bool `json:"is_being_sent"` + IsBeingEdited bool `json:"is_being_edited"` + IsEdited bool `json:"is_edited"` + IsPinned bool `json:"is_pinned"` + IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeForwarded bool `json:"can_be_forwarded"` + CanBeReplied bool `json:"can_be_replied"` + CanGetViewers bool `json:"can_get_viewers"` + HasExpiredViewers bool `json:"has_expired_viewers"` + InteractionInfo *StoryInteractionInfo `json:"interaction_info"` + ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` + PrivacySettings json.RawMessage `json:"privacy_settings"` + Content json.RawMessage `json:"content"` + Areas []*StoryArea `json:"areas"` + Caption *FormattedText `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + story.Id = tmp.Id + story.SenderChatId = tmp.SenderChatId + story.Date = tmp.Date + story.IsBeingSent = tmp.IsBeingSent + story.IsBeingEdited = tmp.IsBeingEdited + story.IsEdited = tmp.IsEdited + story.IsPinned = tmp.IsPinned + story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeForwarded = tmp.CanBeForwarded + story.CanBeReplied = tmp.CanBeReplied + story.CanGetViewers = tmp.CanGetViewers + story.HasExpiredViewers = tmp.HasExpiredViewers + story.InteractionInfo = tmp.InteractionInfo + story.Areas = tmp.Areas + story.Caption = tmp.Caption + + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) + story.ChosenReactionType = fieldChosenReactionType + + fieldPrivacySettings, _ := UnmarshalStoryPrivacySettings(tmp.PrivacySettings) + story.PrivacySettings = fieldPrivacySettings + + fieldContent, _ := UnmarshalStoryContent(tmp.Content) + story.Content = fieldContent + + return nil +} + +// Represents a list of stories +type Stories struct { + meta + // Approximate total number of stories found + TotalCount int32 `json:"total_count"` + // The list of stories + Stories []*Story `json:"stories"` +} + +func (entity *Stories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Stories + + return json.Marshal((*stub)(entity)) +} + +func (*Stories) GetClass() string { + return ClassStories +} + +func (*Stories) GetType() string { + return TypeStories +} + +// Contains basic information about a story +type StoryInfo struct { + meta + // Unique story identifier among stories of the given sender + StoryId int32 `json:"story_id"` + // Point in time (Unix timestamp) when the story was published + Date int32 `json:"date"` + // True, if the story is available only to close friends + IsForCloseFriends bool `json:"is_for_close_friends"` +} + +func (entity *StoryInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInfo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInfo) GetClass() string { + return ClassStoryInfo +} + +func (*StoryInfo) GetType() string { + return TypeStoryInfo +} + +// Describes active stories posted by a chat +type ChatActiveStories struct { + meta + // Identifier of the chat that posted the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list + List StoryList `json:"list"` + // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order + Order int64 `json:"order"` + // Identifier of the last read active story + MaxReadStoryId int32 `json:"max_read_story_id"` + // Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) + Stories []*StoryInfo `json:"stories"` +} + +func (entity *ChatActiveStories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActiveStories + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActiveStories) GetClass() string { + return ClassChatActiveStories +} + +func (*ChatActiveStories) GetType() string { + return TypeChatActiveStories +} + +func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + List json.RawMessage `json:"list"` + Order int64 `json:"order"` + MaxReadStoryId int32 `json:"max_read_story_id"` + Stories []*StoryInfo `json:"stories"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatActiveStories.ChatId = tmp.ChatId + chatActiveStories.Order = tmp.Order + chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId + chatActiveStories.Stories = tmp.Stories + + fieldList, _ := UnmarshalStoryList(tmp.List) + chatActiveStories.List = fieldList + + return nil +} + // The call wasn't discarded, or the reason is unknown type CallDiscardReasonEmpty struct{ meta @@ -34658,889 +35541,6 @@ func (*MessageLinkInfo) GetType() string { return TypeMessageLinkInfo } -// Represents a viewer of a story -type StoryViewer struct { - meta - // User identifier of the viewer - UserId int64 `json:"user_id"` - // Approximate point in time (Unix timestamp) when the story was viewed - ViewDate int32 `json:"view_date"` - // Block list to which the user is added; may be null if none - BlockList BlockList `json:"block_list"` - // Type of the reaction that was chosen by the user; may be null if none - ChosenReactionType ReactionType `json:"chosen_reaction_type"` -} - -func (entity *StoryViewer) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewer - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewer) GetClass() string { - return ClassStoryViewer -} - -func (*StoryViewer) GetType() string { - return TypeStoryViewer -} - -func (storyViewer *StoryViewer) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int64 `json:"user_id"` - ViewDate int32 `json:"view_date"` - BlockList json.RawMessage `json:"block_list"` - ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - storyViewer.UserId = tmp.UserId - storyViewer.ViewDate = tmp.ViewDate - - fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) - storyViewer.BlockList = fieldBlockList - - fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) - storyViewer.ChosenReactionType = fieldChosenReactionType - - return nil -} - -// Represents a list of story viewers -type StoryViewers struct { - meta - // Approximate total number of story viewers found - TotalCount int32 `json:"total_count"` - // List of story viewers - Viewers []*StoryViewer `json:"viewers"` - // The offset for the next request. If empty, there are no more results - NextOffset string `json:"next_offset"` -} - -func (entity *StoryViewers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewers - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewers) GetClass() string { - return ClassStoryViewers -} - -func (*StoryViewers) GetType() string { - return TypeStoryViewers -} - -// Describes position of a clickable rectangle area on a story media -type StoryAreaPosition struct { - meta - // The abscissa of the rectangle's center, as a percentage of the media width - XPercentage float64 `json:"x_percentage"` - // The ordinate of the rectangle's center, as a percentage of the media height - YPercentage float64 `json:"y_percentage"` - // The width of the rectangle, as a percentage of the media width - WidthPercentage float64 `json:"width_percentage"` - // The ordinate of the rectangle's center, as a percentage of the media height - HeightPercentage float64 `json:"height_percentage"` - // Clockwise rotation angle of the rectangle, in degrees; 0-360 - RotationAngle float64 `json:"rotation_angle"` -} - -func (entity *StoryAreaPosition) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryAreaPosition - - return json.Marshal((*stub)(entity)) -} - -func (*StoryAreaPosition) GetClass() string { - return ClassStoryAreaPosition -} - -func (*StoryAreaPosition) GetType() string { - return TypeStoryAreaPosition -} - -// An area pointing to a location -type StoryAreaTypeLocation struct { - meta - // The location - Location *Location `json:"location"` -} - -func (entity *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryAreaTypeLocation - - return json.Marshal((*stub)(entity)) -} - -func (*StoryAreaTypeLocation) GetClass() string { - return ClassStoryAreaType -} - -func (*StoryAreaTypeLocation) GetType() string { - return TypeStoryAreaTypeLocation -} - -func (*StoryAreaTypeLocation) StoryAreaTypeType() string { - return TypeStoryAreaTypeLocation -} - -// An area pointing to a venue -type StoryAreaTypeVenue struct { - meta - // Information about the venue - Venue *Venue `json:"venue"` -} - -func (entity *StoryAreaTypeVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryAreaTypeVenue - - return json.Marshal((*stub)(entity)) -} - -func (*StoryAreaTypeVenue) GetClass() string { - return ClassStoryAreaType -} - -func (*StoryAreaTypeVenue) GetType() string { - return TypeStoryAreaTypeVenue -} - -func (*StoryAreaTypeVenue) StoryAreaTypeType() string { - return TypeStoryAreaTypeVenue -} - -// Describes a clickable rectangle area on a story media -type StoryArea struct { - meta - // Position of the area - Position *StoryAreaPosition `json:"position"` - // Type of the area - Type StoryAreaType `json:"type"` -} - -func (entity *StoryArea) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryArea - - return json.Marshal((*stub)(entity)) -} - -func (*StoryArea) GetClass() string { - return ClassStoryArea -} - -func (*StoryArea) GetType() string { - return TypeStoryArea -} - -func (storyArea *StoryArea) UnmarshalJSON(data []byte) error { - var tmp struct { - Position *StoryAreaPosition `json:"position"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - storyArea.Position = tmp.Position - - fieldType, _ := UnmarshalStoryAreaType(tmp.Type) - storyArea.Type = fieldType - - return nil -} - -// An area pointing to a location -type InputStoryAreaTypeLocation struct { - meta - // The location - Location *Location `json:"location"` -} - -func (entity *InputStoryAreaTypeLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreaTypeLocation - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreaTypeLocation) GetClass() string { - return ClassInputStoryAreaType -} - -func (*InputStoryAreaTypeLocation) GetType() string { - return TypeInputStoryAreaTypeLocation -} - -func (*InputStoryAreaTypeLocation) InputStoryAreaTypeType() string { - return TypeInputStoryAreaTypeLocation -} - -// An area pointing to a venue found by the bot getOption("venue_search_bot_username") -type InputStoryAreaTypeFoundVenue struct { - meta - // Identifier of the inline query, used to found the venue - QueryId JsonInt64 `json:"query_id"` - // Identifier of the inline query result - ResultId string `json:"result_id"` -} - -func (entity *InputStoryAreaTypeFoundVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreaTypeFoundVenue - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreaTypeFoundVenue) GetClass() string { - return ClassInputStoryAreaType -} - -func (*InputStoryAreaTypeFoundVenue) GetType() string { - return TypeInputStoryAreaTypeFoundVenue -} - -func (*InputStoryAreaTypeFoundVenue) InputStoryAreaTypeType() string { - return TypeInputStoryAreaTypeFoundVenue -} - -// An area pointing to a venue already added to the story -type InputStoryAreaTypePreviousVenue struct { - meta - // Provider of the venue - VenueProvider string `json:"venue_provider"` - // Identifier of the venue in the provider database - VenueId string `json:"venue_id"` -} - -func (entity *InputStoryAreaTypePreviousVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreaTypePreviousVenue - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreaTypePreviousVenue) GetClass() string { - return ClassInputStoryAreaType -} - -func (*InputStoryAreaTypePreviousVenue) GetType() string { - return TypeInputStoryAreaTypePreviousVenue -} - -func (*InputStoryAreaTypePreviousVenue) InputStoryAreaTypeType() string { - return TypeInputStoryAreaTypePreviousVenue -} - -// Describes a clickable rectangle area on a story media to be added -type InputStoryArea struct { - meta - // Position of the area - Position *StoryAreaPosition `json:"position"` - // Type of the area - Type InputStoryAreaType `json:"type"` -} - -func (entity *InputStoryArea) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryArea - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryArea) GetClass() string { - return ClassInputStoryArea -} - -func (*InputStoryArea) GetType() string { - return TypeInputStoryArea -} - -func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { - var tmp struct { - Position *StoryAreaPosition `json:"position"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputStoryArea.Position = tmp.Position - - fieldType, _ := UnmarshalInputStoryAreaType(tmp.Type) - inputStoryArea.Type = fieldType - - return nil -} - -// Contains a list of story areas to be added -type InputStoryAreas struct { - meta - // List of 0-10 input story areas - Areas []*InputStoryArea `json:"areas"` -} - -func (entity *InputStoryAreas) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryAreas - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryAreas) GetClass() string { - return ClassInputStoryAreas -} - -func (*InputStoryAreas) GetType() string { - return TypeInputStoryAreas -} - -// Describes a video file sent in a story -type StoryVideo struct { - meta - // Duration of the video, in seconds - Duration float64 `json:"duration"` - // Video width - Width int32 `json:"width"` - // Video height - Height int32 `json:"height"` - // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets - HasStickers bool `json:"has_stickers"` - // True, if the video has no sound - IsAnimation bool `json:"is_animation"` - // Video minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Video thumbnail in JPEG or MPEG4 format; may be null - Thumbnail *Thumbnail `json:"thumbnail"` - // Size of file prefix, which is supposed to be preloaded, in bytes - PreloadPrefixSize int32 `json:"preload_prefix_size"` - // File containing the video - Video *File `json:"video"` -} - -func (entity *StoryVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryVideo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryVideo) GetClass() string { - return ClassStoryVideo -} - -func (*StoryVideo) GetType() string { - return TypeStoryVideo -} - -// A photo story -type StoryContentPhoto struct { - meta - // The photo - Photo *Photo `json:"photo"` -} - -func (entity *StoryContentPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryContentPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*StoryContentPhoto) GetClass() string { - return ClassStoryContent -} - -func (*StoryContentPhoto) GetType() string { - return TypeStoryContentPhoto -} - -func (*StoryContentPhoto) StoryContentType() string { - return TypeStoryContentPhoto -} - -// A video story -type StoryContentVideo struct { - meta - // The video in MPEG4 format - Video *StoryVideo `json:"video"` - // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null - AlternativeVideo *StoryVideo `json:"alternative_video"` -} - -func (entity *StoryContentVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryContentVideo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryContentVideo) GetClass() string { - return ClassStoryContent -} - -func (*StoryContentVideo) GetType() string { - return TypeStoryContentVideo -} - -func (*StoryContentVideo) StoryContentType() string { - return TypeStoryContentVideo -} - -// A story content that is not supported in the current TDLib version -type StoryContentUnsupported struct{ - meta -} - -func (entity *StoryContentUnsupported) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryContentUnsupported - - return json.Marshal((*stub)(entity)) -} - -func (*StoryContentUnsupported) GetClass() string { - return ClassStoryContent -} - -func (*StoryContentUnsupported) GetType() string { - return TypeStoryContentUnsupported -} - -func (*StoryContentUnsupported) StoryContentType() string { - return TypeStoryContentUnsupported -} - -// A photo story -type InputStoryContentPhoto struct { - meta - // Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 - Photo InputFile `json:"photo"` - // File identifiers of the stickers added to the photo, if applicable - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` -} - -func (entity *InputStoryContentPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryContentPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryContentPhoto) GetClass() string { - return ClassInputStoryContent -} - -func (*InputStoryContentPhoto) GetType() string { - return TypeInputStoryContentPhoto -} - -func (*InputStoryContentPhoto) InputStoryContentType() string { - return TypeInputStoryContentPhoto -} - -func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) error { - var tmp struct { - Photo json.RawMessage `json:"photo"` - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputStoryContentPhoto.AddedStickerFileIds = tmp.AddedStickerFileIds - - fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) - inputStoryContentPhoto.Photo = fieldPhoto - - return nil -} - -// A video story -type InputStoryContentVideo struct { - meta - // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second - Video InputFile `json:"video"` - // File identifiers of the stickers added to the video, if applicable - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` - // Precise duration of the video, in seconds; 0-60 - Duration float64 `json:"duration"` - // True, if the video has no sound - IsAnimation bool `json:"is_animation"` -} - -func (entity *InputStoryContentVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputStoryContentVideo - - return json.Marshal((*stub)(entity)) -} - -func (*InputStoryContentVideo) GetClass() string { - return ClassInputStoryContent -} - -func (*InputStoryContentVideo) GetType() string { - return TypeInputStoryContentVideo -} - -func (*InputStoryContentVideo) InputStoryContentType() string { - return TypeInputStoryContentVideo -} - -func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) error { - var tmp struct { - Video json.RawMessage `json:"video"` - AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` - Duration float64 `json:"duration"` - IsAnimation bool `json:"is_animation"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputStoryContentVideo.AddedStickerFileIds = tmp.AddedStickerFileIds - inputStoryContentVideo.Duration = tmp.Duration - inputStoryContentVideo.IsAnimation = tmp.IsAnimation - - fieldVideo, _ := UnmarshalInputFile(tmp.Video) - inputStoryContentVideo.Video = fieldVideo - - return nil -} - -// The list of stories, shown in the main chat list and folder chat lists -type StoryListMain struct{ - meta -} - -func (entity *StoryListMain) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryListMain - - return json.Marshal((*stub)(entity)) -} - -func (*StoryListMain) GetClass() string { - return ClassStoryList -} - -func (*StoryListMain) GetType() string { - return TypeStoryListMain -} - -func (*StoryListMain) StoryListType() string { - return TypeStoryListMain -} - -// The list of stories, shown in the Arvhive chat list -type StoryListArchive struct{ - meta -} - -func (entity *StoryListArchive) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryListArchive - - return json.Marshal((*stub)(entity)) -} - -func (*StoryListArchive) GetClass() string { - return ClassStoryList -} - -func (*StoryListArchive) GetType() string { - return TypeStoryListArchive -} - -func (*StoryListArchive) StoryListType() string { - return TypeStoryListArchive -} - -// Contains information about interactions with a story -type StoryInteractionInfo struct { - meta - // Number of times the story was viewed - ViewCount int32 `json:"view_count"` - // Number of reactions added to the story - ReactionCount int32 `json:"reaction_count"` - // Identifiers of at most 3 recent viewers of the story - RecentViewerUserIds []int64 `json:"recent_viewer_user_ids"` -} - -func (entity *StoryInteractionInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryInteractionInfo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryInteractionInfo) GetClass() string { - return ClassStoryInteractionInfo -} - -func (*StoryInteractionInfo) GetType() string { - return TypeStoryInteractionInfo -} - -// Represents a story -type Story struct { - meta - // Unique story identifier among stories of the given sender - Id int32 `json:"id"` - // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` - // Point in time (Unix timestamp) when the story was published - Date int32 `json:"date"` - // True, if the story is being sent by the current user - IsBeingSent bool `json:"is_being_sent"` - // True, if the story is being edited by the current user - IsBeingEdited bool `json:"is_being_edited"` - // True, if the story was edited - IsEdited bool `json:"is_edited"` - // True, if the story is saved in the sender's profile and will be available there after expiration - IsPinned bool `json:"is_pinned"` - // True, if the story is visible only for the current user - IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` - // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden - CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the story can be replied in the chat with the story sender - CanBeReplied bool `json:"can_be_replied"` - // True, if users viewed the story can be received through getStoryViewers - CanGetViewers bool `json:"can_get_viewers"` - // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago - HasExpiredViewers bool `json:"has_expired_viewers"` - // Information about interactions with the story; may be null if the story isn't owned or there were no interactions - InteractionInfo *StoryInteractionInfo `json:"interaction_info"` - // Type of the chosen reaction; may be null if none - ChosenReactionType ReactionType `json:"chosen_reaction_type"` - // Privacy rules affecting story visibility; may be approximate for non-owned stories - PrivacySettings StoryPrivacySettings `json:"privacy_settings"` - // Content of the story - Content StoryContent `json:"content"` - // Clickable areas to be shown on the story content - Areas []*StoryArea `json:"areas"` - // Caption of the story - Caption *FormattedText `json:"caption"` -} - -func (entity *Story) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Story - - return json.Marshal((*stub)(entity)) -} - -func (*Story) GetClass() string { - return ClassStory -} - -func (*Story) GetType() string { - return TypeStory -} - -func (story *Story) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int32 `json:"id"` - SenderChatId int64 `json:"sender_chat_id"` - Date int32 `json:"date"` - IsBeingSent bool `json:"is_being_sent"` - IsBeingEdited bool `json:"is_being_edited"` - IsEdited bool `json:"is_edited"` - IsPinned bool `json:"is_pinned"` - IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` - CanBeForwarded bool `json:"can_be_forwarded"` - CanBeReplied bool `json:"can_be_replied"` - CanGetViewers bool `json:"can_get_viewers"` - HasExpiredViewers bool `json:"has_expired_viewers"` - InteractionInfo *StoryInteractionInfo `json:"interaction_info"` - ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` - PrivacySettings json.RawMessage `json:"privacy_settings"` - Content json.RawMessage `json:"content"` - Areas []*StoryArea `json:"areas"` - Caption *FormattedText `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - story.Id = tmp.Id - story.SenderChatId = tmp.SenderChatId - story.Date = tmp.Date - story.IsBeingSent = tmp.IsBeingSent - story.IsBeingEdited = tmp.IsBeingEdited - story.IsEdited = tmp.IsEdited - story.IsPinned = tmp.IsPinned - story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf - story.CanBeForwarded = tmp.CanBeForwarded - story.CanBeReplied = tmp.CanBeReplied - story.CanGetViewers = tmp.CanGetViewers - story.HasExpiredViewers = tmp.HasExpiredViewers - story.InteractionInfo = tmp.InteractionInfo - story.Areas = tmp.Areas - story.Caption = tmp.Caption - - fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) - story.ChosenReactionType = fieldChosenReactionType - - fieldPrivacySettings, _ := UnmarshalStoryPrivacySettings(tmp.PrivacySettings) - story.PrivacySettings = fieldPrivacySettings - - fieldContent, _ := UnmarshalStoryContent(tmp.Content) - story.Content = fieldContent - - return nil -} - -// Represents a list of stories -type Stories struct { - meta - // Approximate total number of stories found - TotalCount int32 `json:"total_count"` - // The list of stories - Stories []*Story `json:"stories"` -} - -func (entity *Stories) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Stories - - return json.Marshal((*stub)(entity)) -} - -func (*Stories) GetClass() string { - return ClassStories -} - -func (*Stories) GetType() string { - return TypeStories -} - -// Contains basic information about a story -type StoryInfo struct { - meta - // Unique story identifier among stories of the given sender - StoryId int32 `json:"story_id"` - // Point in time (Unix timestamp) when the story was published - Date int32 `json:"date"` - // True, if the story is available only to close friends - IsForCloseFriends bool `json:"is_for_close_friends"` -} - -func (entity *StoryInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryInfo - - return json.Marshal((*stub)(entity)) -} - -func (*StoryInfo) GetClass() string { - return ClassStoryInfo -} - -func (*StoryInfo) GetType() string { - return TypeStoryInfo -} - -// Describes active stories posted by a chat -type ChatActiveStories struct { - meta - // Identifier of the chat that posted the stories - ChatId int64 `json:"chat_id"` - // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list - List StoryList `json:"list"` - // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order - Order int64 `json:"order"` - // Identifier of the last read active story - MaxReadStoryId int32 `json:"max_read_story_id"` - // Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) - Stories []*StoryInfo `json:"stories"` -} - -func (entity *ChatActiveStories) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActiveStories - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActiveStories) GetClass() string { - return ClassChatActiveStories -} - -func (*ChatActiveStories) GetType() string { - return TypeChatActiveStories -} - -func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - List json.RawMessage `json:"list"` - Order int64 `json:"order"` - MaxReadStoryId int32 `json:"max_read_story_id"` - Stories []*StoryInfo `json:"stories"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatActiveStories.ChatId = tmp.ChatId - chatActiveStories.Order = tmp.Order - chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId - chatActiveStories.Stories = tmp.Stories - - fieldList, _ := UnmarshalStoryList(tmp.List) - chatActiveStories.List = fieldList - - return nil -} - // The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions type BlockListMain struct{ meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ced4391..695a3d7 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -2869,6 +2869,182 @@ func UnmarshalListOfEmojiCategoryType(dataList []json.RawMessage) ([]EmojiCatego return list, nil } +func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryAreaTypeLocation: + return UnmarshalStoryAreaTypeLocation(data) + + case TypeStoryAreaTypeVenue: + return UnmarshalStoryAreaTypeVenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryAreaType(dataList []json.RawMessage) ([]StoryAreaType, error) { + list := []StoryAreaType{} + + for _, data := range dataList { + entity, err := UnmarshalStoryAreaType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputStoryAreaTypeLocation: + return UnmarshalInputStoryAreaTypeLocation(data) + + case TypeInputStoryAreaTypeFoundVenue: + return UnmarshalInputStoryAreaTypeFoundVenue(data) + + case TypeInputStoryAreaTypePreviousVenue: + return UnmarshalInputStoryAreaTypePreviousVenue(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputStoryAreaType(dataList []json.RawMessage) ([]InputStoryAreaType, error) { + list := []InputStoryAreaType{} + + for _, data := range dataList { + entity, err := UnmarshalInputStoryAreaType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStoryContent(data json.RawMessage) (StoryContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryContentPhoto: + return UnmarshalStoryContentPhoto(data) + + case TypeStoryContentVideo: + return UnmarshalStoryContentVideo(data) + + case TypeStoryContentUnsupported: + return UnmarshalStoryContentUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryContent(dataList []json.RawMessage) ([]StoryContent, error) { + list := []StoryContent{} + + for _, data := range dataList { + entity, err := UnmarshalStoryContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputStoryContent(data json.RawMessage) (InputStoryContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputStoryContentPhoto: + return UnmarshalInputStoryContentPhoto(data) + + case TypeInputStoryContentVideo: + return UnmarshalInputStoryContentVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputStoryContent(dataList []json.RawMessage) ([]InputStoryContent, error) { + list := []InputStoryContent{} + + for _, data := range dataList { + entity, err := UnmarshalInputStoryContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStoryList(data json.RawMessage) (StoryList, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryListMain: + return UnmarshalStoryListMain(data) + + case TypeStoryListArchive: + return UnmarshalStoryListArchive(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { + list := []StoryList{} + + for _, data := range dataList { + entity, err := UnmarshalStoryList(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { var meta meta @@ -5034,182 +5210,6 @@ func UnmarshalListOfInternalLinkType(dataList []json.RawMessage) ([]InternalLink return list, nil } -func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStoryAreaTypeLocation: - return UnmarshalStoryAreaTypeLocation(data) - - case TypeStoryAreaTypeVenue: - return UnmarshalStoryAreaTypeVenue(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStoryAreaType(dataList []json.RawMessage) ([]StoryAreaType, error) { - list := []StoryAreaType{} - - for _, data := range dataList { - entity, err := UnmarshalStoryAreaType(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeInputStoryAreaTypeLocation: - return UnmarshalInputStoryAreaTypeLocation(data) - - case TypeInputStoryAreaTypeFoundVenue: - return UnmarshalInputStoryAreaTypeFoundVenue(data) - - case TypeInputStoryAreaTypePreviousVenue: - return UnmarshalInputStoryAreaTypePreviousVenue(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfInputStoryAreaType(dataList []json.RawMessage) ([]InputStoryAreaType, error) { - list := []InputStoryAreaType{} - - for _, data := range dataList { - entity, err := UnmarshalInputStoryAreaType(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalStoryContent(data json.RawMessage) (StoryContent, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStoryContentPhoto: - return UnmarshalStoryContentPhoto(data) - - case TypeStoryContentVideo: - return UnmarshalStoryContentVideo(data) - - case TypeStoryContentUnsupported: - return UnmarshalStoryContentUnsupported(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStoryContent(dataList []json.RawMessage) ([]StoryContent, error) { - list := []StoryContent{} - - for _, data := range dataList { - entity, err := UnmarshalStoryContent(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalInputStoryContent(data json.RawMessage) (InputStoryContent, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeInputStoryContentPhoto: - return UnmarshalInputStoryContentPhoto(data) - - case TypeInputStoryContentVideo: - return UnmarshalInputStoryContentVideo(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfInputStoryContent(dataList []json.RawMessage) ([]InputStoryContent, error) { - list := []InputStoryContent{} - - for _, data := range dataList { - entity, err := UnmarshalInputStoryContent(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - -func UnmarshalStoryList(data json.RawMessage) (StoryList, error) { - var meta meta - - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } - - switch meta.Type { - case TypeStoryListMain: - return UnmarshalStoryListMain(data) - - case TypeStoryListArchive: - return UnmarshalStoryListArchive(data) - - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } -} - -func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { - list := []StoryList{} - - for _, data := range dataList { - entity, err := UnmarshalStoryList(data) - if err != nil { - return nil, err - } - list = append(list, entity) - } - - return list, nil -} - func UnmarshalBlockList(data json.RawMessage) (BlockList, error) { var meta meta @@ -11087,6 +11087,198 @@ func UnmarshalEmojiCategoryTypeChatPhoto(data json.RawMessage) (*EmojiCategoryTy return &resp, err } +func UnmarshalStoryViewer(data json.RawMessage) (*StoryViewer, error) { + var resp StoryViewer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryViewers(data json.RawMessage) (*StoryViewers, error) { + var resp StoryViewers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaPosition(data json.RawMessage) (*StoryAreaPosition, error) { + var resp StoryAreaPosition + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeLocation(data json.RawMessage) (*StoryAreaTypeLocation, error) { + var resp StoryAreaTypeLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeVenue(data json.RawMessage) (*StoryAreaTypeVenue, error) { + var resp StoryAreaTypeVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { + var resp StoryArea + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeLocation(data json.RawMessage) (*InputStoryAreaTypeLocation, error) { + var resp InputStoryAreaTypeLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeFoundVenue(data json.RawMessage) (*InputStoryAreaTypeFoundVenue, error) { + var resp InputStoryAreaTypeFoundVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypePreviousVenue(data json.RawMessage) (*InputStoryAreaTypePreviousVenue, error) { + var resp InputStoryAreaTypePreviousVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { + var resp InputStoryArea + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreas(data json.RawMessage) (*InputStoryAreas, error) { + var resp InputStoryAreas + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryVideo(data json.RawMessage) (*StoryVideo, error) { + var resp StoryVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentPhoto(data json.RawMessage) (*StoryContentPhoto, error) { + var resp StoryContentPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentVideo(data json.RawMessage) (*StoryContentVideo, error) { + var resp StoryContentVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentUnsupported(data json.RawMessage) (*StoryContentUnsupported, error) { + var resp StoryContentUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryContentPhoto(data json.RawMessage) (*InputStoryContentPhoto, error) { + var resp InputStoryContentPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryContentVideo(data json.RawMessage) (*InputStoryContentVideo, error) { + var resp InputStoryContentVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryListMain(data json.RawMessage) (*StoryListMain, error) { + var resp StoryListMain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryListArchive(data json.RawMessage) (*StoryListArchive, error) { + var resp StoryListArchive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteractionInfo(data json.RawMessage) (*StoryInteractionInfo, error) { + var resp StoryInteractionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStory(data json.RawMessage) (*Story, error) { + var resp Story + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStories(data json.RawMessage) (*Stories, error) { + var resp Stories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInfo(data json.RawMessage) (*StoryInfo, error) { + var resp StoryInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error) { + var resp ChatActiveStories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { var resp CallDiscardReasonEmpty @@ -14287,198 +14479,6 @@ func UnmarshalMessageLinkInfo(data json.RawMessage) (*MessageLinkInfo, error) { return &resp, err } -func UnmarshalStoryViewer(data json.RawMessage) (*StoryViewer, error) { - var resp StoryViewer - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryViewers(data json.RawMessage) (*StoryViewers, error) { - var resp StoryViewers - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryAreaPosition(data json.RawMessage) (*StoryAreaPosition, error) { - var resp StoryAreaPosition - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryAreaTypeLocation(data json.RawMessage) (*StoryAreaTypeLocation, error) { - var resp StoryAreaTypeLocation - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryAreaTypeVenue(data json.RawMessage) (*StoryAreaTypeVenue, error) { - var resp StoryAreaTypeVenue - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { - var resp StoryArea - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreaTypeLocation(data json.RawMessage) (*InputStoryAreaTypeLocation, error) { - var resp InputStoryAreaTypeLocation - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreaTypeFoundVenue(data json.RawMessage) (*InputStoryAreaTypeFoundVenue, error) { - var resp InputStoryAreaTypeFoundVenue - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreaTypePreviousVenue(data json.RawMessage) (*InputStoryAreaTypePreviousVenue, error) { - var resp InputStoryAreaTypePreviousVenue - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { - var resp InputStoryArea - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryAreas(data json.RawMessage) (*InputStoryAreas, error) { - var resp InputStoryAreas - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryVideo(data json.RawMessage) (*StoryVideo, error) { - var resp StoryVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryContentPhoto(data json.RawMessage) (*StoryContentPhoto, error) { - var resp StoryContentPhoto - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryContentVideo(data json.RawMessage) (*StoryContentVideo, error) { - var resp StoryContentVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryContentUnsupported(data json.RawMessage) (*StoryContentUnsupported, error) { - var resp StoryContentUnsupported - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryContentPhoto(data json.RawMessage) (*InputStoryContentPhoto, error) { - var resp InputStoryContentPhoto - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalInputStoryContentVideo(data json.RawMessage) (*InputStoryContentVideo, error) { - var resp InputStoryContentVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryListMain(data json.RawMessage) (*StoryListMain, error) { - var resp StoryListMain - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryListArchive(data json.RawMessage) (*StoryListArchive, error) { - var resp StoryListArchive - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryInteractionInfo(data json.RawMessage) (*StoryInteractionInfo, error) { - var resp StoryInteractionInfo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStory(data json.RawMessage) (*Story, error) { - var resp Story - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStories(data json.RawMessage) (*Stories, error) { - var resp Stories - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryInfo(data json.RawMessage) (*StoryInfo, error) { - var resp StoryInfo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error) { - var resp ChatActiveStories - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalBlockListMain(data json.RawMessage) (*BlockListMain, error) { var resp BlockListMain @@ -18182,6 +18182,78 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiCategoryTypeChatPhoto: return UnmarshalEmojiCategoryTypeChatPhoto(data) + case TypeStoryViewer: + return UnmarshalStoryViewer(data) + + case TypeStoryViewers: + return UnmarshalStoryViewers(data) + + case TypeStoryAreaPosition: + return UnmarshalStoryAreaPosition(data) + + case TypeStoryAreaTypeLocation: + return UnmarshalStoryAreaTypeLocation(data) + + case TypeStoryAreaTypeVenue: + return UnmarshalStoryAreaTypeVenue(data) + + case TypeStoryArea: + return UnmarshalStoryArea(data) + + case TypeInputStoryAreaTypeLocation: + return UnmarshalInputStoryAreaTypeLocation(data) + + case TypeInputStoryAreaTypeFoundVenue: + return UnmarshalInputStoryAreaTypeFoundVenue(data) + + case TypeInputStoryAreaTypePreviousVenue: + return UnmarshalInputStoryAreaTypePreviousVenue(data) + + case TypeInputStoryArea: + return UnmarshalInputStoryArea(data) + + case TypeInputStoryAreas: + return UnmarshalInputStoryAreas(data) + + case TypeStoryVideo: + return UnmarshalStoryVideo(data) + + case TypeStoryContentPhoto: + return UnmarshalStoryContentPhoto(data) + + case TypeStoryContentVideo: + return UnmarshalStoryContentVideo(data) + + case TypeStoryContentUnsupported: + return UnmarshalStoryContentUnsupported(data) + + case TypeInputStoryContentPhoto: + return UnmarshalInputStoryContentPhoto(data) + + case TypeInputStoryContentVideo: + return UnmarshalInputStoryContentVideo(data) + + case TypeStoryListMain: + return UnmarshalStoryListMain(data) + + case TypeStoryListArchive: + return UnmarshalStoryListArchive(data) + + case TypeStoryInteractionInfo: + return UnmarshalStoryInteractionInfo(data) + + case TypeStory: + return UnmarshalStory(data) + + case TypeStories: + return UnmarshalStories(data) + + case TypeStoryInfo: + return UnmarshalStoryInfo(data) + + case TypeChatActiveStories: + return UnmarshalChatActiveStories(data) + case TypeCallDiscardReasonEmpty: return UnmarshalCallDiscardReasonEmpty(data) @@ -19382,78 +19454,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageLinkInfo: return UnmarshalMessageLinkInfo(data) - case TypeStoryViewer: - return UnmarshalStoryViewer(data) - - case TypeStoryViewers: - return UnmarshalStoryViewers(data) - - case TypeStoryAreaPosition: - return UnmarshalStoryAreaPosition(data) - - case TypeStoryAreaTypeLocation: - return UnmarshalStoryAreaTypeLocation(data) - - case TypeStoryAreaTypeVenue: - return UnmarshalStoryAreaTypeVenue(data) - - case TypeStoryArea: - return UnmarshalStoryArea(data) - - case TypeInputStoryAreaTypeLocation: - return UnmarshalInputStoryAreaTypeLocation(data) - - case TypeInputStoryAreaTypeFoundVenue: - return UnmarshalInputStoryAreaTypeFoundVenue(data) - - case TypeInputStoryAreaTypePreviousVenue: - return UnmarshalInputStoryAreaTypePreviousVenue(data) - - case TypeInputStoryArea: - return UnmarshalInputStoryArea(data) - - case TypeInputStoryAreas: - return UnmarshalInputStoryAreas(data) - - case TypeStoryVideo: - return UnmarshalStoryVideo(data) - - case TypeStoryContentPhoto: - return UnmarshalStoryContentPhoto(data) - - case TypeStoryContentVideo: - return UnmarshalStoryContentVideo(data) - - case TypeStoryContentUnsupported: - return UnmarshalStoryContentUnsupported(data) - - case TypeInputStoryContentPhoto: - return UnmarshalInputStoryContentPhoto(data) - - case TypeInputStoryContentVideo: - return UnmarshalInputStoryContentVideo(data) - - case TypeStoryListMain: - return UnmarshalStoryListMain(data) - - case TypeStoryListArchive: - return UnmarshalStoryListArchive(data) - - case TypeStoryInteractionInfo: - return UnmarshalStoryInteractionInfo(data) - - case TypeStory: - return UnmarshalStory(data) - - case TypeStories: - return UnmarshalStories(data) - - case TypeStoryInfo: - return UnmarshalStoryInfo(data) - - case TypeChatActiveStories: - return UnmarshalChatActiveStories(data) - case TypeBlockListMain: return UnmarshalBlockListMain(data) diff --git a/data/td_api.tl b/data/td_api.tl index d69567b..9f2eec0 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -1320,7 +1320,7 @@ notificationSettingsScopeChannelChats = NotificationSettingsScope; //@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead //@show_preview True, if message content must be displayed in notifications //@use_default_mute_stories If true, mute_stories is ignored and the value for the relevant type of chat is used instead -//@mute_stories True, if story notifications are received without sound +//@mute_stories True, if story notifications are disabled for the chat //@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled //@use_default_show_story_sender If true, show_story_sender is ignored and the value for the relevant type of chat is used instead @@ -1335,8 +1335,8 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so //@mute_for Time left before notifications will be unmuted, in seconds //@sound_id Identifier of the notification sound to be played; 0 if sound is disabled //@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, mute_stories is ignored and stories are unmuted only for the first 5 chats from topChatCategoryUsers -//@mute_stories True, if story notifications are received without sound +//@use_default_mute_stories If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers +//@mute_stories True, if story notifications are disabled for the chat //@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled //@show_story_sender True, if the sender of stories must be displayed in notifications //@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message @@ -3153,6 +3153,159 @@ emojiCategoryTypeEmojiStatus = EmojiCategoryType; emojiCategoryTypeChatPhoto = EmojiCategoryType; +//@description Represents a viewer of a story +//@user_id User identifier of the viewer +//@view_date Approximate point in time (Unix timestamp) when the story was viewed +//@block_list Block list to which the user is added; may be null if none +//@chosen_reaction_type Type of the reaction that was chosen by the user; may be null if none +storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer; + +//@description Represents a list of story viewers +//@total_count Approximate total number of story viewers found +//@viewers List of story viewers +//@next_offset The offset for the next request. If empty, there are no more results +storyViewers total_count:int32 viewers:vector next_offset:string = StoryViewers; + + +//@description Describes position of a clickable rectangle area on a story media +//@x_percentage The abscissa of the rectangle's center, as a percentage of the media width +//@y_percentage The ordinate of the rectangle's center, as a percentage of the media height +//@width_percentage The width of the rectangle, as a percentage of the media width +//@height_percentage The ordinate of the rectangle's center, as a percentage of the media height +//@rotation_angle Clockwise rotation angle of the rectangle, in degrees; 0-360 +storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double = StoryAreaPosition; + + +//@class StoryAreaType @description Describes type of a clickable rectangle area on a story media + +//@description An area pointing to a location @location The location +storyAreaTypeLocation location:location = StoryAreaType; + +//@description An area pointing to a venue @venue Information about the venue +storyAreaTypeVenue venue:venue = StoryAreaType; + + +//@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area +storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; + + +//@class InputStoryAreaType @description Describes type of a clickable rectangle area on a story media to be added + +//@description An area pointing to a location @location The location +inputStoryAreaTypeLocation location:location = InputStoryAreaType; + +//@description An area pointing to a venue found by the bot getOption("venue_search_bot_username") +//@query_id Identifier of the inline query, used to found the venue +//@result_id Identifier of the inline query result +inputStoryAreaTypeFoundVenue query_id:int64 result_id:string = InputStoryAreaType; + +//@description An area pointing to a venue already added to the story +//@venue_provider Provider of the venue +//@venue_id Identifier of the venue in the provider database +inputStoryAreaTypePreviousVenue venue_provider:string venue_id:string = InputStoryAreaType; + + +//@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area +inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; + +//@description Contains a list of story areas to be added @areas List of 0-10 input story areas +inputStoryAreas areas:vector = InputStoryAreas; + + +//@description Describes a video file sent in a story +//@duration Duration of the video, in seconds +//@width Video width +//@height Video height +//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets +//@is_animation True, if the video has no sound +//@minithumbnail Video minithumbnail; may be null +//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null +//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@video File containing the video +storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; + + +//@class StoryContent @description Contains the content of a story + +//@description A photo story @photo The photo +storyContentPhoto photo:photo = StoryContent; + +//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null +storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; + +//@description A story content that is not supported in the current TDLib version +storyContentUnsupported = StoryContent; + + +//@class InputStoryContent @description The content of a story to send + +//@description A photo story +//@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 +//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable +inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = InputStoryContent; + +//@description A video story +//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second +//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable +//@duration Precise duration of the video, in seconds; 0-60 +//@is_animation True, if the video has no sound +inputStoryContentVideo video:InputFile added_sticker_file_ids:vector duration:double is_animation:Bool = InputStoryContent; + + +//@class StoryList @description Describes a list of stories + +//@description The list of stories, shown in the main chat list and folder chat lists +storyListMain = StoryList; + +//@description The list of stories, shown in the Arvhive chat list +storyListArchive = StoryList; + + +//@description Contains information about interactions with a story +//@view_count Number of times the story was viewed +//@reaction_count Number of reactions added to the story +//@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story +storyInteractionInfo view_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; + +//@description Represents a story +//@id Unique story identifier among stories of the given sender +//@sender_chat_id Identifier of the chat that posted the story +//@date Point in time (Unix timestamp) when the story was published +//@is_being_sent True, if the story is being sent by the current user +//@is_being_edited True, if the story is being edited by the current user +//@is_edited True, if the story was edited +//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration +//@is_visible_only_for_self True, if the story is visible only for the current user +//@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden +//@can_be_replied True, if the story can be replied in the chat with the story sender +//@can_get_viewers True, if users viewed the story can be received through getStoryViewers +//@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago +//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions +//@chosen_reaction_type Type of the chosen reaction; may be null if none +//@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories +//@content Content of the story +//@areas Clickable areas to be shown on the story content +//@caption Caption of the story +story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; + +//@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories +stories total_count:int32 stories:vector = Stories; + +//@description Contains basic information about a story +//@story_id Unique story identifier among stories of the given sender +//@date Point in time (Unix timestamp) when the story was published +//@is_for_close_friends True, if the story is available only to close friends +storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; + +//@description Describes active stories posted by a chat +//@chat_id Identifier of the chat that posted the stories +//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list +//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order +//@max_read_story_id Identifier of the last read active story +//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) +chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; + + //@class CallDiscardReason @description Describes the reason why a call was discarded //@description The call wasn't discarded, or the reason is unknown @@ -4961,159 +5114,6 @@ messageLink link:string is_public:Bool = MessageLink; messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; -//@description Represents a viewer of a story -//@user_id User identifier of the viewer -//@view_date Approximate point in time (Unix timestamp) when the story was viewed -//@block_list Block list to which the user is added; may be null if none -//@chosen_reaction_type Type of the reaction that was chosen by the user; may be null if none -storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer; - -//@description Represents a list of story viewers -//@total_count Approximate total number of story viewers found -//@viewers List of story viewers -//@next_offset The offset for the next request. If empty, there are no more results -storyViewers total_count:int32 viewers:vector next_offset:string = StoryViewers; - - -//@description Describes position of a clickable rectangle area on a story media -//@x_percentage The abscissa of the rectangle's center, as a percentage of the media width -//@y_percentage The ordinate of the rectangle's center, as a percentage of the media height -//@width_percentage The width of the rectangle, as a percentage of the media width -//@height_percentage The ordinate of the rectangle's center, as a percentage of the media height -//@rotation_angle Clockwise rotation angle of the rectangle, in degrees; 0-360 -storyAreaPosition x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double = StoryAreaPosition; - - -//@class StoryAreaType @description Describes type of a clickable rectangle area on a story media - -//@description An area pointing to a location @location The location -storyAreaTypeLocation location:location = StoryAreaType; - -//@description An area pointing to a venue @venue Information about the venue -storyAreaTypeVenue venue:venue = StoryAreaType; - - -//@description Describes a clickable rectangle area on a story media @position Position of the area @type Type of the area -storyArea position:storyAreaPosition type:StoryAreaType = StoryArea; - - -//@class InputStoryAreaType @description Describes type of a clickable rectangle area on a story media to be added - -//@description An area pointing to a location @location The location -inputStoryAreaTypeLocation location:location = InputStoryAreaType; - -//@description An area pointing to a venue found by the bot getOption("venue_search_bot_username") -//@query_id Identifier of the inline query, used to found the venue -//@result_id Identifier of the inline query result -inputStoryAreaTypeFoundVenue query_id:int64 result_id:string = InputStoryAreaType; - -//@description An area pointing to a venue already added to the story -//@venue_provider Provider of the venue -//@venue_id Identifier of the venue in the provider database -inputStoryAreaTypePreviousVenue venue_provider:string venue_id:string = InputStoryAreaType; - - -//@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area -inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; - -//@description Contains a list of story areas to be added @areas List of 0-10 input story areas -inputStoryAreas areas:vector = InputStoryAreas; - - -//@description Describes a video file sent in a story -//@duration Duration of the video, in seconds -//@width Video width -//@height Video height -//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@is_animation True, if the video has no sound -//@minithumbnail Video minithumbnail; may be null -//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null -//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes -//@video File containing the video -storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; - - -//@class StoryContent @description Contains the content of a story - -//@description A photo story @photo The photo -storyContentPhoto photo:photo = StoryContent; - -//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null -storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; - -//@description A story content that is not supported in the current TDLib version -storyContentUnsupported = StoryContent; - - -//@class InputStoryContent @description The content of a story to send - -//@description A photo story -//@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 -//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable -inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = InputStoryContent; - -//@description A video story -//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second -//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable -//@duration Precise duration of the video, in seconds; 0-60 -//@is_animation True, if the video has no sound -inputStoryContentVideo video:InputFile added_sticker_file_ids:vector duration:double is_animation:Bool = InputStoryContent; - - -//@class StoryList @description Describes a list of stories - -//@description The list of stories, shown in the main chat list and folder chat lists -storyListMain = StoryList; - -//@description The list of stories, shown in the Arvhive chat list -storyListArchive = StoryList; - - -//@description Contains information about interactions with a story -//@view_count Number of times the story was viewed -//@reaction_count Number of reactions added to the story -//@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story -storyInteractionInfo view_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; - -//@description Represents a story -//@id Unique story identifier among stories of the given sender -//@sender_chat_id Identifier of the chat that posted the story -//@date Point in time (Unix timestamp) when the story was published -//@is_being_sent True, if the story is being sent by the current user -//@is_being_edited True, if the story is being edited by the current user -//@is_edited True, if the story was edited -//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration -//@is_visible_only_for_self True, if the story is visible only for the current user -//@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden -//@can_be_replied True, if the story can be replied in the chat with the story sender -//@can_get_viewers True, if users viewed the story can be received through getStoryViewers -//@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago -//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions -//@chosen_reaction_type Type of the chosen reaction; may be null if none -//@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories -//@content Content of the story -//@areas Clickable areas to be shown on the story content -//@caption Caption of the story -story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; - -//@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories -stories total_count:int32 stories:vector = Stories; - -//@description Contains basic information about a story -//@story_id Unique story identifier among stories of the given sender -//@date Point in time (Unix timestamp) when the story was published -//@is_for_close_friends True, if the story is available only to close friends -storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; - -//@description Describes active stories posted by a chat -//@chat_id Identifier of the chat that posted the stories -//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list -//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order -//@max_read_story_id Identifier of the last read active story -//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) -chatActiveStories chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; - - //@class BlockList @description Describes a type of a block list //@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions @@ -6377,7 +6377,7 @@ searchChatsOnServer query:string limit:int32 = Chats; //@location Current user location searchChatsNearby location:location = ChatsNearby; -//@description Returns a list of frequently used chats. Supported only if the chat info database is enabled @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 +//@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 getTopChats category:TopChatCategory limit:int32 = Chats; //@description Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled @category Category of frequently used chats @chat_id Chat identifier @@ -6667,6 +6667,9 @@ forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order resendMessages chat_id:int53 message_ids:vector = Messages; +//@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier +sendChatScreenshotTakenNotification chat_id:int53 = Ok; + //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message //@chat_id Target chat //@sender_id Identifier of the sender of the message