* trial commit * [MM-56172] Integrate fetching and sorting of user reporting into the table component (#25749) * inint * lint * Update system_users.test.tsx.snap * cypress test fix * added pkg * revoke sessio into new compo * Update system_users.test.tsx.snap * trans * more disable * rename * Update system_users_dropdown.test.tsx * snap * Delete system_users_list.test.tsx.snap * Create system_users_list.test.tsx.snap * Delete system_users_list.test.tsx.snap * name2 * start removing the filter from the list * more clean * snaps * Update package-lock.json * des * Update index.scss * Update system_users_list.tsx * Update system_users_list.tsx * Update system_users.tsx * Update system_users_list.tsx * Update index.scss * menu * action menu * split * Update system_users_list.tsx * Update system_users_list_new.tsx * fix * Update en.json * temp remove * Update system_users.test.tsx.snap * Delete system_users_list.test.tsx.snap * Update en.json * ch * move * a * Update en.json * fix * Update system_users.test.tsx.snap * Update menu.tsx * Update admin_header.tsx * changes in the file system * fixes * integration begin * lint * Update rhs.ts * upper pagination * Update list_table.scss * pinned * more a11y * Update list_table.scss * i18n mor * design changes * descriptions * lint * loading states * fix * actions update * index fix * single action --------- Co-authored-by: Mattermost Build <build@mattermost.com> * [MM-56467] Clear up unused code of old systems users (#25855) * ccc * Update en.json * [MM-56478] Improve the user loading in user details page after changes in users list page in admin console (#25861) * init * tem * more fix * handlers clear up, team's fixes --------- Co-authored-by: Mattermost Build <build@mattermost.com> * Merge'd * [MM-56279] Add paging to user list (#25863) * Update system_users.tsx * Update system_users.tsx * [MM-56270] Hook up user actions menu, refactor modals to work with new menuing style (#25897) * Hookup menu items and modals * Add error handling, test fixes * Ensure modals animate properly * Add a bunch of TODOs around keeping the user data up to date * Fix i18n and snaps --------- Co-authored-by: Mattermost Build <build@mattermost.com> * [MM-56263] Enable selective column hiding for users table (#25898) * [MM-56539] Revisiting the design of the total users count on the left and in pagination in users table (#25947) * default sort order * default sort order (#25956) Co-authored-by: Mattermost Build <build@mattermost.com> * [MM-56267] Add search term filtering (#25952) * Include search term with request * Update user count with filtering * Oops * Add 500ms debounce to avoid spamming server with requests * PR feedback --------- Co-authored-by: Mattermost Build <build@mattermost.com> * [MM-56398] Add date range filter to user reporting table (#25974) * WIP * Some small adjustments * Two fixes * PR feedback * Remove menuitem --------- Co-authored-by: Mattermost Build <build@mattermost.com> * Merge'd * [MM-56615] Add messaging for MySQL instances around the post stats (#26036) * [MM-56261] Add export modals and hook up button to user management screen (#26015) * [MM-56576] Update users when actions occur and show errors when actions fail (#25951) * [MM-56576] Update users when actions occur and show errors when actions fail * Forgot the else * PR feedback * [MM-56617] Move action modals to ConfirmModalRedux * Add filters popover to the users admin table (#26042) * int * 0 zeros * dd * re * file move * Update system_users_filter_popover.scss * a * Update system_users_filter_popover.scss * role and status * fix * Update index.test.ts * overlay * Update dropdown_input.tsx * i * Update en.json * done * Update en.json * dd --------- Co-authored-by: Mattermost Build <build@mattermost.com> * Make column toggler column menu items consistent with table column names * Couple typo fixes * Fix i18n * some e2e related changes * Fixed issue where you couldn't queue multiple batch export jobs * Fix id tag * table header mis allignment issue solved * [MM-56727] Fix a TODO, fix Demote to guest should only appear when enabled * rev comments * Stop sending down all profile data * chore(e2e): Fix tests cases for new user Management ui (#26089) * chore(e2e): Fix lint issues in cypress tests * chore(e2e): Fix e2e tests - user_management_spec - authentication_method_spec * [MM-56710] Revert to in-memory compilation of CSV report * Update system_users.tsx * Merge'd * Fix test --------- Co-authored-by: M-ZubairAhmed <m-zubairahmed@protonmail.com> Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Mattermost Client
This package contains the JavaScript/TypeScript client for Mattermost. It's used by the Mattermost web app and related projects.
Installation
JavaScript
$ npm install @mattermost/client
TypeScript
$ npm install @mattermost/client @mattermost/types
Usage
To use the client, create an instance of Client4, set the server URL, and log in, and then you can start making requests.
import {Client4} from '@mattermost/client';
const client = new Client4();
client4.setUrl('https://mymattermostserver.example.com');
client4.login('username', 'password').then((user) => {
// ...
});
If you already have a session token or a user access token, you can call Client4.setToken instead of logging in.
import {Client4} from '@mattermost/client';
const client = new Client4();
client4.setUrl('https://mymattermostserver.example.com');
client4.setToken('accesstoken');
If needed, methods exist to set other headers such as the User-Agent (Client4.setUserAgent), the CSRF token (Client4.setCSRF), or any extra headers you wish to include (Client4.setHeader).
Methods of Client4 which make requests to the server return a Promise which does the following:
- On success, the promise resolves to a
ClientResponse<T>object which contains the the Response (response), a Map of headers (headers), and the data sent from the server (data). - On an error, the promise rejects with a
ClientErrorwhich contains the error message and the URL being requested. If the error happened on the server, the status code and an error ID (server_error_id) are included.
let user;
try {
user = (await client.getUser('userid')).data;
} catch (e) {
console.error(`An error occurred when making a request to ${e.url}: ${e.message}`);
}
Compilation and Packaging
As a member of Mattermost with write access to our NPM organization, you can build and publish this package by running the following commands:
npm run build --workspace=platform/client
npm publish --workspace=platform/client
Make sure to increment the version number in package.json first! You can add -0, -1, etc for pre-release versions.