UNPKG

mattermost-redux

Version:

Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client

149 lines (148 loc) 7.67 kB
import type { AnyAction } from 'redux'; import type { Channel } from '@mattermost/types/channels'; import type { Post, PostList } from '@mattermost/types/posts'; import type { Reaction } from '@mattermost/types/reactions'; import type { GlobalState } from '@mattermost/types/store'; import type { DispatchFunc, GetStateFunc, ActionFunc, ActionFuncAsync, ThunkActionFunc } from 'mattermost-redux/types/actions'; export declare function receivedPost(post: Post, crtEnabled?: boolean): { type: "RECEIVED_POST"; data: Post; features: { crtEnabled: boolean | undefined; }; }; export declare function receivedNewPost(post: Post, crtEnabled: boolean): { type: "RECEIVED_NEW_POST"; data: Post; features: { crtEnabled: boolean; }; }; export declare function receivedPosts(posts: PostList): { type: "RECEIVED_POSTS"; data: PostList; }; export declare function receivedPostsAfter(posts: PostList, channelId: string, afterPostId: string, recent?: boolean): { type: "RECEIVED_POSTS_AFTER"; channelId: string; data: PostList; afterPostId: string; recent: boolean; }; export declare function receivedPostsBefore(posts: PostList, channelId: string, beforePostId: string, oldest?: boolean): { type: "RECEIVED_POSTS_BEFORE"; channelId: string; data: PostList; beforePostId: string; oldest: boolean; }; export declare function receivedPostsSince(posts: PostList, channelId: string): { type: "RECEIVED_POSTS_SINCE"; channelId: string; data: PostList; }; export declare function receivedPostsInChannel(posts: PostList, channelId: string, recent?: boolean, oldest?: boolean): { type: "RECEIVED_POSTS_IN_CHANNEL"; channelId: string; data: PostList; recent: boolean; oldest: boolean; }; export declare function receivedPostsInThread(posts: PostList, rootId: string): { type: "RECEIVED_POSTS_IN_THREAD"; data: PostList; rootId: string; }; export declare function postDeleted(post: Post): { type: "POST_DELETED"; data: Post; }; export declare function postRemoved(post: Post): { type: "POST_REMOVED"; data: Post; }; export declare function postPinnedChanged(postId: string, isPinned: boolean, updateAt?: number): { type: "POST_PINNED_CHANGED"; postId: string; isPinned: boolean; updateAt: number; }; export declare function getPost(postId: string, includeDeleted?: boolean, retainContent?: boolean): ActionFuncAsync<Post>; export type CreatePostReturnType = { created?: boolean; pending?: string; error?: string; }; export declare function createPost(post: Post, files?: any[], afterSubmit?: (response: any) => void): ActionFuncAsync<CreatePostReturnType>; export declare function resetCreatePostRequest(): { type: "CREATE_POST_RESET_REQUEST"; }; export declare function deletePost(post: ExtendedPost): ActionFuncAsync; export declare function editPost(post: Post): ActionFuncAsync<Post, GlobalState, AnyAction>; export declare function setUnreadPost(userId: string, postId: string): ActionFuncAsync; export declare function pinPost(postId: string): ActionFuncAsync; /** * Decrements the pinned post count for a channel by 1 */ export declare function decrementPinnedPostCount(channelId: Channel['id']): { type: "DECREMENT_PINNED_POST_COUNT"; id: string; }; export declare function unpinPost(postId: string): ActionFuncAsync; export type SubmitReactionReturnType = { reaction?: Reaction; removedReaction?: boolean; }; export declare function addReaction(postId: string, emojiName: string): ActionFuncAsync<SubmitReactionReturnType>; export declare function removeReaction(postId: string, emojiName: string): ActionFuncAsync<SubmitReactionReturnType>; export declare function getCustomEmojiForReaction(name: string): ActionFuncAsync; export declare function flagPost(postId: string): ActionFuncAsync; export declare function getPostThread(rootId: string, fetchThreads?: boolean, lastUpdateAt?: number): ActionFuncAsync<PostList>; export declare function getNewestPostThread(rootId: string): ActionFuncAsync; export declare function getPosts(channelId: string, page?: number, perPage?: number, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>; export declare function getPostsUnread(channelId: string, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>; export declare function getPostsSince(channelId: string, since: number, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>; export declare function getPostsBefore(channelId: string, postId: string, page?: number, perPage?: number, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>; export declare function getPostsAfter(channelId: string, postId: string, page?: number, perPage?: number, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>; export declare function getPostsAround(channelId: string, postId: string, perPage?: number, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>; /** * getPostThreads is intended for an array of posts that have been batched * (see the actions/websocket_actions/handleNewPostEvents function in the webapp) * */ export declare function getPostThreads(posts: Post[], fetchThreads?: boolean): ThunkActionFunc<unknown>; export declare function getMentionsAndStatusesForPosts(postsArrayOrMap: Post[] | PostList['posts'], dispatch: DispatchFunc, getState: GetStateFunc): Promise<void | any[]>; export declare function getPostsByIds(ids: string[]): ActionFuncAsync; export declare function getPostsByIdsBatched(postIds: string[]): ActionFuncAsync<true>; export declare function getPostEditHistory(postId: string): ActionFuncAsync<Post[], GlobalState, AnyAction>; export declare function getNeededAtMentionedUsernamesAndGroups(state: GlobalState, posts: Post[]): Set<string>; export type ExtendedPost = Post & { system_post_ids?: string[]; }; export declare function removePost(post: ExtendedPost): ActionFunc<boolean>; export declare function moveThread(postId: string, channelId: string): ActionFuncAsync; export declare function selectFocusedPostId(postId: string): { type: "RECEIVED_FOCUSED_POST"; data: string; }; export declare function unflagPost(postId: string): ActionFuncAsync; export declare function addPostReminder(userId: string, postId: string, timestamp: number): ActionFuncAsync; export declare function doPostAction(postId: string, actionId: string, selectedOption?: string): ActionFuncAsync; export declare function doPostActionWithCookie(postId: string, actionId: string, actionCookie: string, selectedOption?: string): ActionFuncAsync; export declare function addMessageIntoHistory(message: string): { type: "ADD_MESSAGE_INTO_HISTORY"; data: string; }; export declare function resetHistoryIndex(index: string): { type: "RESET_HISTORY_INDEX"; data: string; }; export declare function moveHistoryIndexBack(index: string): ActionFuncAsync; export declare function moveHistoryIndexForward(index: string): ActionFuncAsync; export declare function resetReloadPostsInTranslatedChannels(): ActionFuncAsync; /** * Ensures thread-replies in channels correctly follow CRT:ON/OFF */ export declare function resetReloadPostsInChannel(channelId?: string): ActionFuncAsync; export declare function acknowledgePost(postId: string): ActionFuncAsync; export declare function unacknowledgePost(postId: string): ActionFuncAsync; export declare function restorePostVersion(postId: string, restoreVersionId: string, connectionId: string): ActionFuncAsync;