mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
134 lines (133 loc) • 12 kB
TypeScript
import type { AnyAction } from 'redux';
import type { UserAutocomplete } from '@mattermost/types/autocomplete';
import type { Channel } from '@mattermost/types/channels';
import type { UserProfile, UserStatus, GetFilteredUsersStatsOpts, UsersStats, UserCustomStatus, UserAccessToken, UserAuthUpdate } from '@mattermost/types/users';
import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
export declare const maxUserIdsPerProfilesRequest = 100;
export declare const maxUserIdsPerStatusesRequest = 200;
export declare function generateMfaSecret(userId: string): ActionFuncAsync<import("@mattermost/types/mfa").MfaSecret, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function createUser(user: UserProfile, token: string, inviteId: string, redirect: string): ActionFuncAsync<UserProfile>;
export declare function loadMe(): ActionFuncAsync<boolean>;
export declare function logout(): ActionFuncAsync;
export declare function getTotalUsersStats(): ActionFuncAsync<UsersStats, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function getFilteredUsersStats(options?: GetFilteredUsersStatsOpts, updateGlobalState?: boolean): ActionFuncAsync<UsersStats>;
export declare function getProfiles(page?: number, perPage?: number, options?: any): ActionFuncAsync<UserProfile[]>;
export declare function getMissingProfilesByIds(userIds: string[]): ActionFuncAsync<Array<UserProfile['id']>>;
export declare function getMissingProfilesByUsernames(usernames: string[]): ActionFuncAsync<Array<UserProfile['username']>>;
export declare function getProfilesByIds(userIds: string[], options?: any): ActionFuncAsync<UserProfile[]>;
export declare function getProfilesByUsernames(usernames: string[]): ActionFuncAsync<UserProfile[]>;
export declare function getProfilesInTeam(teamId: string, page: number, perPage?: number, sort?: string, options?: any): ActionFuncAsync<UserProfile[]>;
export declare function getProfilesNotInTeam(teamId: string, groupConstrained: boolean, page: number, perPage?: number): ActionFuncAsync<UserProfile[]>;
export declare enum ProfilesInChannelSortBy {
None = "",
Admin = "admin"
}
export declare function getProfilesInChannel(channelId: string, page: number, perPage?: number, sort?: string, options?: {
active?: boolean;
}): ActionFuncAsync<UserProfile[]>;
export declare function batchGetProfilesInChannel(channelId: string): ActionFuncAsync<Array<Channel['id']>>;
export declare function getProfilesInGroupChannels(channelsIds: string[]): ActionFuncAsync;
export declare function getProfilesNotInChannel(teamId: string, channelId: string, groupConstrained: boolean, page: number, perPage?: number, cursorId?: string): ActionFuncAsync<UserProfile[]>;
export declare function getMe(): ActionFuncAsync<UserProfile>;
export declare function getCustomProfileAttributeValues(userID: string): ActionFuncAsync<Record<string, string>>;
export declare function updateMyTermsOfServiceStatus(termsOfServiceId: string, accepted: boolean): ActionFuncAsync;
export declare function getProfilesInGroup(groupId: string, page?: number, perPage?: number, sort?: string): ActionFuncAsync<UserProfile[]>;
export declare function getProfilesNotInGroup(groupId: string, page?: number, perPage?: number): ActionFuncAsync<UserProfile[]>;
export declare function getTermsOfService(): ActionFuncAsync<import("@mattermost/types/terms_of_service").TermsOfService, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function promoteGuestToUser(userId: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function demoteUserToGuest(userId: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function createTermsOfService(text: string): ActionFuncAsync<import("@mattermost/types/terms_of_service").TermsOfService, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function getUser(id: string): ActionFuncAsync<UserProfile, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function getUserByUsername(username: string): ActionFuncAsync<UserProfile, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function getUserByEmail(email: string): ActionFuncAsync<UserProfile, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function canUserDirectMessage(userId: string, otherUserId: string): ActionFuncAsync<{
can_dm: boolean;
}>;
export declare function getStatusesByIds(userIds: Array<UserProfile['id']>): ActionFuncAsync<UserStatus[]>;
export declare function setStatus(status: UserStatus): ActionFuncAsync<UserStatus>;
export declare function setCustomStatus(customStatus: UserCustomStatus): ActionFuncAsync<unknown, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function unsetCustomStatus(): ActionFuncAsync<unknown, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function removeRecentCustomStatus(customStatus: UserCustomStatus): ActionFuncAsync<unknown, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function getSessions(userId: string): ActionFuncAsync<import("@mattermost/types/sessions").Session[], import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function revokeSession(userId: string, sessionId: string): ActionFuncAsync;
export declare function revokeAllSessionsForUser(userId: string): ActionFuncAsync<boolean>;
export declare function revokeSessionsForAllUsers(): ActionFuncAsync<boolean>;
export declare function getUserAudits(userId: string, page?: number, perPage?: number): ActionFuncAsync<import("@mattermost/types/audits").Audit[], import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function autocompleteUsers(term: string, teamId?: string, channelId?: string, options?: {
limit: number;
}): ActionFuncAsync<UserAutocomplete>;
export declare function searchProfiles(term: string, options?: any): ActionFuncAsync<UserProfile[]>;
export declare function updateMe(user: Partial<UserProfile>): ActionFuncAsync<UserProfile>;
export declare function saveCustomProfileAttribute(userID: string, attributeID: string, attributeValue: string | string[]): ActionFuncAsync<Record<string, string | string[]>>;
export declare function patchUser(user: UserProfile): ActionFuncAsync<UserProfile>;
export declare function updateUserAuth(userId: string, userAuth: UserAuthUpdate): ActionFuncAsync<UserAuthUpdate>;
export declare function updateUserRoles(userId: string, roles: string): ActionFuncAsync;
export declare function updateUserMfa(userId: string, activate: boolean, code?: string): ActionFuncAsync;
export declare function updateUserPassword(userId: string, currentPassword: string, newPassword: string): ActionFuncAsync;
export declare function resetFailedAttempts(userId: string): ActionFuncAsync<true>;
export declare function updateUserActive(userId: string, active: boolean): ActionFuncAsync<true>;
export declare function verifyUserEmail(token: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function sendVerificationEmail(email: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function resetUserPassword(token: string, newPassword: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function sendPasswordResetEmail(email: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function setDefaultProfileImage(userId: string): ActionFuncAsync;
export declare function uploadProfileImage(userId: string, imageData: any): ActionFuncAsync;
export declare function switchEmailToOAuth(service: string, email: string, password: string, mfaCode?: string): ActionFuncAsync<import("@mattermost/types/users").AuthChangeResponse, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function switchOAuthToEmail(currentService: string, email: string, password: string): ActionFuncAsync<import("@mattermost/types/users").AuthChangeResponse, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function switchEmailToLdap(email: string, emailPassword: string, ldapId: string, ldapPassword: string, mfaCode?: string): ActionFuncAsync<import("@mattermost/types/users").AuthChangeResponse, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function switchLdapToEmail(ldapPassword: string, email: string, emailPassword: string, mfaCode?: string): ActionFuncAsync<import("@mattermost/types/users").AuthChangeResponse, import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function createUserAccessToken(userId: string, description: string): ActionFuncAsync<UserAccessToken>;
export declare function getUserAccessToken(tokenId: string): ActionFuncAsync<UserAccessToken>;
export declare function getUserAccessTokensForUser(userId: string, page?: number, perPage?: number): ActionFuncAsync<UserAccessToken[]>;
export declare function revokeUserAccessToken(tokenId: string): ActionFuncAsync;
export declare function disableUserAccessToken(tokenId: string): ActionFuncAsync;
export declare function enableUserAccessToken(tokenId: string): ActionFuncAsync;
export declare function getKnownUsers(): ActionFuncAsync<string[], import("@mattermost/types/store").GlobalState, AnyAction>;
export declare function clearUserAccessTokens(): ActionFuncAsync;
export declare function checkForModifiedUsers(): ActionFuncAsync;
declare const _default: {
generateMfaSecret: typeof generateMfaSecret;
logout: typeof logout;
getProfiles: typeof getProfiles;
getProfilesByIds: typeof getProfilesByIds;
getProfilesInTeam: typeof getProfilesInTeam;
getProfilesInChannel: typeof getProfilesInChannel;
getProfilesNotInChannel: typeof getProfilesNotInChannel;
getUser: typeof getUser;
getMe: typeof getMe;
getUserByUsername: typeof getUserByUsername;
getStatusesByIds: typeof getStatusesByIds;
getSessions: typeof getSessions;
getTotalUsersStats: typeof getTotalUsersStats;
revokeSession: typeof revokeSession;
revokeAllSessionsForUser: typeof revokeAllSessionsForUser;
revokeSessionsForAllUsers: typeof revokeSessionsForAllUsers;
getUserAudits: typeof getUserAudits;
searchProfiles: typeof searchProfiles;
updateMe: typeof updateMe;
updateUserAuth: typeof updateUserAuth;
updateUserRoles: typeof updateUserRoles;
updateUserMfa: typeof updateUserMfa;
updateUserPassword: typeof updateUserPassword;
updateUserActive: typeof updateUserActive;
verifyUserEmail: typeof verifyUserEmail;
sendVerificationEmail: typeof sendVerificationEmail;
resetUserPassword: typeof resetUserPassword;
sendPasswordResetEmail: typeof sendPasswordResetEmail;
uploadProfileImage: typeof uploadProfileImage;
switchEmailToOAuth: typeof switchEmailToOAuth;
switchOAuthToEmail: typeof switchOAuthToEmail;
switchEmailToLdap: typeof switchEmailToLdap;
switchLdapToEmail: typeof switchLdapToEmail;
getTermsOfService: typeof getTermsOfService;
createTermsOfService: typeof createTermsOfService;
updateMyTermsOfServiceStatus: typeof updateMyTermsOfServiceStatus;
createUserAccessToken: typeof createUserAccessToken;
getUserAccessToken: typeof getUserAccessToken;
getUserAccessTokensForUser: typeof getUserAccessTokensForUser;
revokeUserAccessToken: typeof revokeUserAccessToken;
disableUserAccessToken: typeof disableUserAccessToken;
enableUserAccessToken: typeof enableUserAccessToken;
checkForModifiedUsers: typeof checkForModifiedUsers;
};
export default _default;