Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds importUsersJob to ManagementClient #553

Merged
merged 2 commits into from
Dec 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,38 @@ utils.wrapPropertyMethod(ManagementClient, 'getJob', 'jobs.get');
*/
utils.wrapPropertyMethod(ManagementClient, 'importUsers', 'jobs.importUsers');

/**
* Given a path to a file and a connection id, create a new job that imports the
* users contained in the file or JSON string and associate them with the given
* connection.
*
* @method importUsersJob
* @memberOf module:management.ManagementClient.prototype
*
* @example
* var params = {
* connection_id: '{CONNECTION_ID}',
* users: '{PATH_TO_USERS_FILE}' // or users_json: '{USERS_JSON_STRING}'
* };
*
* management.importUsersJob(params, function (err) {
* if (err) {
* // Handle error.
* }
* });
*
* @param {Object} data Users import data.
* @param {String} data.connection_id connection_id of the connection to which users will be imported.
* @param {String} [data.users] Path to the users data file. Either users or users_json is mandatory.
* @param {String} [data.users_json] JSON data for the users.
* @param {Boolean} [data.upsert] Whether to update users if they already exist (true) or to ignore them (false).
* @param {Boolean} [data.send_completion_email] Whether to send a completion email to all tenant owners when the job is finished (true) or not (false).
* @param {Function} [cb] Callback function.
*
* @return {Promise|undefined}
*/
utils.wrapPropertyMethod(ManagementClient, 'importUsersJob', 'jobs.importUsersJob');

/**
* Export all users to a file using a long running job.
*
Expand Down