Class: UserClient

UserClient(jiraClient)

new UserClient(jiraClient)

Used to access Jira REST endpoints in '/rest/auth/1/session'

Parameters:
Name Type Description
jiraClient JiraClient
Source:

Methods

all(opts, callbackopt) → {Promise}

Returns a list of users that match the search string. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
startAt number <optional>
0

the index of the first user to return (0-based)

maxResults number <optional>
50

the maximum number of users to return (defaults to 50).

callback callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

changePassword(opts, callbackopt) → {Promise}

Modify user password.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Description
username

The name of the user for which to change the password.

userKey

The key of the user for which to change the password.

password

The new password.

callback <optional>

Called when the password has been set.

Source:
Returns:

Resolved when the password has been set.

Type
Promise

convertTemporaryAvatar(opts, callbackopt) → {Promise}

Converts temporary avatar into a real avatar

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

avatarId Object

The id of the temporary avatar to convert.

callback <optional>

Called when the avatar has been converted

Source:
Returns:

Resolved when the avatar has been converted

Type
Promise

createTemporaryAvatar(opts, callbackopt) → {Promise}

Creates temporary avatar. Creating a temporary avatar is part of a 3-step process in uploading a new avatar for a user: upload, crop, confirm.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

filepath string

The path to the file to upload.

callback <optional>

Called when the temporary avatar has been uploaded.

Source:
Returns:

Resolved when the temporary avatar has been uploaded.

Type
Promise

createUser(opts, callbackopt) → {Promise}

Create user. By default created user will not be notified with email. If password field is not set then password will be randomly generated.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API.

Properties
Name Type Description
user

See https://docs.atlassian.com/jira/REST/latest/#d2e4049

callback <optional>

Called when the user has been created.

Source:
Returns:

Resolved when the user has been created.

Type
Promise

deleteAvatar(opts, callbackopt) → {Promise}

Deletes avatar

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

avatarId Object

The id of the temporary avatar to delete.

callback <optional>

Called when the avatar has been deleted.

Source:
Returns:

Resolved when the avatar has been deleted.

Type
Promise

deleteUser(opts, callbackopt) → {Promise}

Removes user.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Description
username

The name of the user to delete.

userKey

The key of the user to delete.

callback <optional>

Called when the user has been deleted.

Source:
Returns:

Resolved when the user has been deleted.

Type
Promise

editUser(opts, callbackopt) → {Promise}

Modify user. The "value" fields present will override the existing value. Fields skipped in request will not be changed.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Description
user

See https://docs.atlassian.com/jira/REST/latest/#d2e4081

username

The name of the user to edit.

userKey

The key of the user to edit.

callback <optional>

Called when the user has been edited.

Source:
Returns:

Resolved when the user has been edited.

Type
Promise

getAvatars(opts, callbackopt) → {Promise}

Returns all avatars which are visible for the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

callback <optional>

Called when the avatars have been retrieved.

Source:
Returns:

Resolved when the avatars have been retrieved.

Type
Promise

getDefaultColumns(opts, callbackopt) → {Promise}

Returns the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

callback <optional>

Called when the columns have been retrieved.

Source:
Returns:

Resolved when the columns have been retrieved.

Type
Promise

getUser(opts, callbackopt) → {Promise}

Get a user. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Attributes Description
accountId string <optional>

The account ID of the user

username string <optional>

The name of the user to retrieve.

userKey string <optional>

The key of the user to retrieve.

expand string <optional>

The fields to be expanded.

callback callback <optional>

Called when the user has been retrieved.

Source:
Returns:

Resolved when the user has been retrieved.

Type
Promise

multiProjectSearchAssignable(opts, callbackopt) → {Promise}

Returns a list of users that match the search string and can be assigned issues for all the given projects. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Attributes Description
username string

The name of the user to search.

projectKeys Array

The keys of the projects we are finding assignable users for

startAt number <optional>

The index of the first user to return (0-based)

maxResults number <optional>

The maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

callback <optional>

Called when the search results have been retrieved.

Source:
Returns:

Resolved when the search results have been retrieved.

Type
Promise

resetDefaultColumns(opts, callbackopt) → {Promise}

Reset the default columns for the given user to the system default. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

callback <optional>

Called when the columns have been reset.

Source:
Returns:

Resolved when the columns have been reset.

Type
Promise

Returns a list of users that match the search string. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts Object <optional>

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
query string <optional>
username string <optional>

A query string used to search username, name or e-mail address

accountId string <optional>
startAt number <optional>
0

the index of the first user to return (0-based)

maxResults number <optional>
50

the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

includeActive boolean <optional>
true

If true, then active users are included in the results (default true)

includeInactive boolean <optional>
false

If true, then inactive users are included in the results (default false)

property string <optional>
callback callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

searchAssignable(opts, callbackopt) → {Promise}

Returns a list of users that match the search string. This resource cannot be accessed anonymously. Please note that this resource should be called with an issue key when a list of assignable users is retrieved for editing. For create only a project key should be supplied. The list of assignable users may be incorrect if it's called with the project key for editing.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Attributes Description
username string

The username

project string

The key of the project we are finding assignable users for

issueKey string <optional>

The issue key for the issue being edited we need to find assignable users for.

startAt number <optional>

The index of the first user to return (0-based)

maxResults number <optional>

The maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

actionDescriptorId number <optional>
callback <optional>

Called when the search results have been retrieved.

Source:
Returns:

Resolved when the search results have been retrieved.

Type
Promise

searchPermissions(opts, callbackopt) → {Promise}

Returns a list of active users that match the search string and have all specified permissions for the project or issue.

This resource can be accessed by users with ADMINISTER_PROJECT permission for the project or global ADMIN or SYSADMIN rights.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the jira API

Properties
Name Type Attributes Description
username string

The username filter, list includes all users if unspecified

permissions Array

Array of permissions for project or issue returned users must have, see Permissions JavaDoc for the list of all possible permissions.

issueKey string <optional>

the issue key for the issue for which returned users have specified permissions.

projectKey string <optional>

the optional project key to search for users with if no issueKey is supplied.

startAt number <optional>

the index of the first user to return (0-based)

maxResults number <optional>

the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

searchPicker(opts, callbackopt) → {Promise}

Returns a list of users matching query with highlighting. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
query string
maxResults number <optional>
50
showAvatar boolean <optional>
false
exclude string <optional>
callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

setDefaultColumns(opts, callbackopt) → {Promise}

Sets the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

columns Array

The names of the new columns. See https://docs.atlassian.com/jira/REST/latest/#d2e4566

callback <optional>

Called when the columns have been set.

Source:
Returns:

Resolved when the columns have been set.

Type
Promise

viewIssueSearch(opts, callbackopt) → {Promise}

Returns a list of active users that match the search string. This resource cannot be accessed anonymously. Given an issue key this resource will provide a list of users that match the search string and have the browse issue permission for the issue provided.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
username string

A query string used to search username, name or e-mail address

issueKey string <optional>

the issue key for the issue being edited we need to find viewable users for.

projectKey string <optional>

the optional project key to search for users with if no issueKey is supplied.

startAt number <optional>
0

the index of the first user to return (0-based)

maxResults number <optional>
50

the maximum number of users to return (defaults to 50). The maximum allowed

callback <optional>

Called when data has been retrieved

Source:
Returns:

Resolved when data has been retrieved

Type
Promise

UserClient(jiraClient)

new UserClient(jiraClient)

Used to access Jira REST endpoints in '/rest/api/2/user'

Parameters:
Name Type Description
jiraClient JiraClient
Source:

Methods

all(opts, callbackopt) → {Promise}

Returns a list of users that match the search string. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
startAt number <optional>
0

the index of the first user to return (0-based)

maxResults number <optional>
50

the maximum number of users to return (defaults to 50).

callback callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

changePassword(opts, callbackopt) → {Promise}

Modify user password.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Description
username

The name of the user for which to change the password.

userKey

The key of the user for which to change the password.

password

The new password.

callback <optional>

Called when the password has been set.

Source:
Returns:

Resolved when the password has been set.

Type
Promise

convertTemporaryAvatar(opts, callbackopt) → {Promise}

Converts temporary avatar into a real avatar

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

avatarId Object

The id of the temporary avatar to convert.

callback <optional>

Called when the avatar has been converted

Source:
Returns:

Resolved when the avatar has been converted

Type
Promise

createTemporaryAvatar(opts, callbackopt) → {Promise}

Creates temporary avatar. Creating a temporary avatar is part of a 3-step process in uploading a new avatar for a user: upload, crop, confirm.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

filepath string

The path to the file to upload.

callback <optional>

Called when the temporary avatar has been uploaded.

Source:
Returns:

Resolved when the temporary avatar has been uploaded.

Type
Promise

createUser(opts, callbackopt) → {Promise}

Create user. By default created user will not be notified with email. If password field is not set then password will be randomly generated.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API.

Properties
Name Type Description
user

See https://docs.atlassian.com/jira/REST/latest/#d2e4049

callback <optional>

Called when the user has been created.

Source:
Returns:

Resolved when the user has been created.

Type
Promise

deleteAvatar(opts, callbackopt) → {Promise}

Deletes avatar

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

avatarId Object

The id of the temporary avatar to delete.

callback <optional>

Called when the avatar has been deleted.

Source:
Returns:

Resolved when the avatar has been deleted.

Type
Promise

deleteUser(opts, callbackopt) → {Promise}

Removes user.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Description
username

The name of the user to delete.

userKey

The key of the user to delete.

callback <optional>

Called when the user has been deleted.

Source:
Returns:

Resolved when the user has been deleted.

Type
Promise

editUser(opts, callbackopt) → {Promise}

Modify user. The "value" fields present will override the existing value. Fields skipped in request will not be changed.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Description
user

See https://docs.atlassian.com/jira/REST/latest/#d2e4081

username

The name of the user to edit.

userKey

The key of the user to edit.

callback <optional>

Called when the user has been edited.

Source:
Returns:

Resolved when the user has been edited.

Type
Promise

getAvatars(opts, callbackopt) → {Promise}

Returns all avatars which are visible for the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

callback <optional>

Called when the avatars have been retrieved.

Source:
Returns:

Resolved when the avatars have been retrieved.

Type
Promise

getDefaultColumns(opts, callbackopt) → {Promise}

Returns the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

callback <optional>

Called when the columns have been retrieved.

Source:
Returns:

Resolved when the columns have been retrieved.

Type
Promise

getUser(opts, callbackopt) → {Promise}

Get a user. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API

Properties
Name Type Attributes Description
accountId string <optional>

The account ID of the user

username string <optional>

The name of the user to retrieve.

userKey string <optional>

The key of the user to retrieve.

expand string <optional>

The fields to be expanded.

callback callback <optional>

Called when the user has been retrieved.

Source:
Returns:

Resolved when the user has been retrieved.

Type
Promise

multiProjectSearchAssignable(opts, callbackopt) → {Promise}

Returns a list of users that match the search string and can be assigned issues for all the given projects. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Attributes Description
username string

The name of the user to search.

projectKeys Array

The keys of the projects we are finding assignable users for

startAt number <optional>

The index of the first user to return (0-based)

maxResults number <optional>

The maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

callback <optional>

Called when the search results have been retrieved.

Source:
Returns:

Resolved when the search results have been retrieved.

Type
Promise

resetDefaultColumns(opts, callbackopt) → {Promise}

Reset the default columns for the given user to the system default. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

callback <optional>

Called when the columns have been reset.

Source:
Returns:

Resolved when the columns have been reset.

Type
Promise

Returns a list of users that match the search string. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts Object <optional>

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
query string <optional>
username string <optional>

A query string used to search username, name or e-mail address

accountId string <optional>
startAt number <optional>
0

the index of the first user to return (0-based)

maxResults number <optional>
50

the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

includeActive boolean <optional>
true

If true, then active users are included in the results (default true)

includeInactive boolean <optional>
false

If true, then inactive users are included in the results (default false)

property string <optional>
callback callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

searchAssignable(opts, callbackopt) → {Promise}

Returns a list of users that match the search string. This resource cannot be accessed anonymously. Please note that this resource should be called with an issue key when a list of assignable users is retrieved for editing. For create only a project key should be supplied. The list of assignable users may be incorrect if it's called with the project key for editing.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Attributes Description
username string

The username

project string

The key of the project we are finding assignable users for

issueKey string <optional>

The issue key for the issue being edited we need to find assignable users for.

startAt number <optional>

The index of the first user to return (0-based)

maxResults number <optional>

The maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

actionDescriptorId number <optional>
callback <optional>

Called when the search results have been retrieved.

Source:
Returns:

Resolved when the search results have been retrieved.

Type
Promise

searchPermissions(opts, callbackopt) → {Promise}

Returns a list of active users that match the search string and have all specified permissions for the project or issue.

This resource can be accessed by users with ADMINISTER_PROJECT permission for the project or global ADMIN or SYSADMIN rights.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the jira API

Properties
Name Type Attributes Description
username string

The username filter, list includes all users if unspecified

permissions Array

Array of permissions for project or issue returned users must have, see Permissions JavaDoc for the list of all possible permissions.

issueKey string <optional>

the issue key for the issue for which returned users have specified permissions.

projectKey string <optional>

the optional project key to search for users with if no issueKey is supplied.

startAt number <optional>

the index of the first user to return (0-based)

maxResults number <optional>

the maximum number of users to return (defaults to 50). The maximum allowed value is 1000. If you specify a value that is higher than this number, your search results will be truncated.

callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

searchPicker(opts, callbackopt) → {Promise}

Returns a list of users matching query with highlighting. This resource cannot be accessed anonymously.

Parameters:
Name Type Attributes Description
opts

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
query string
maxResults number <optional>
50
showAvatar boolean <optional>
false
exclude string <optional>
callback <optional>

Called when the search results are retrieved.

Source:
Returns:

Resolved when the search results are retrieved.

Type
Promise

setDefaultColumns(opts, callbackopt) → {Promise}

Sets the default columns for the given user. Admin permission will be required to get columns for a user other than the currently logged in user.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API

Properties
Name Type Description
username string

The username

columns Array

The names of the new columns. See https://docs.atlassian.com/jira/REST/latest/#d2e4566

callback <optional>

Called when the columns have been set.

Source:
Returns:

Resolved when the columns have been set.

Type
Promise

viewIssueSearch(opts, callbackopt) → {Promise}

Returns a list of active users that match the search string. This resource cannot be accessed anonymously. Given an issue key this resource will provide a list of users that match the search string and have the browse issue permission for the issue provided.

Parameters:
Name Type Attributes Description
opts Object

The request options sent to the Jira API.

Properties
Name Type Attributes Default Description
username string

A query string used to search username, name or e-mail address

issueKey string <optional>

the issue key for the issue being edited we need to find viewable users for.

projectKey string <optional>

the optional project key to search for users with if no issueKey is supplied.

startAt number <optional>
0

the index of the first user to return (0-based)

maxResults number <optional>
50

the maximum number of users to return (defaults to 50). The maximum allowed

callback <optional>

Called when data has been retrieved

Source:
Returns:

Resolved when data has been retrieved

Type
Promise