# Class: UserClient

## UserClient

## Constructor

#### new UserClient(jiraClient)

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`jiraClient` | JiraClient |

Source:
  - api/user.js, line 8

### Methods

#### changePassword(opts, callback)

Modify user password.

##### Parameters:

Name | Type | 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` |  | Called when the password has been set.

Source:
  - api/user.js, line 374

#### convertTemporaryAvatar(opts, callback)

Converts temporary avatar into a real avatar

##### Parameters:

Name | Type | 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` |  | Called when the avatar has been converted

Source:
  - api/user.js, line 228

#### createTemporaryAvatar(opts, callback)

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 | 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` |  | Called when the temporary avatar has been uploaded.

Source:
  - api/user.js, line 192

#### createUser(opts, callback)

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 | 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` |  | Called when the user has been created.

Source:
  - api/user.js, line 67

#### deleteAvatar(opts, callback)

Deletes avatar

##### Parameters:

Name | Type | 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` |  | Called when the avatar has been deleted.

Source:
  - api/user.js, line 255

#### deleteUser(opts, callback)

Removes user.

##### Parameters:

Name | Type | 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` |  | Called when the user has been deleted.

Source:
  - api/user.js, line 42

#### editUser(opts, callback)

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

##### Parameters:

Name | Type | 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` |  | Called when the user has been edited.

Source:
  - api/user.js, line 89

#### getAvatars(opts, callback)

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`username` | string | The username
`callback` |  | Called when the avatars have been retrieved.

Source:
  - api/user.js, line 278

#### getDefaultColumns(opts, callback)

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 | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`username` | string | The username
`callback` |  | Called when the columns have been retrieved.

Source:
  - api/user.js, line 300

#### getUser(opts, callback)

Get a user. This resource cannot be accessed anonymously.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`username` |  | The name of the user to retrieve.
`userKey` |  | The key of the user to retrieve.
`callback` |  | Called when the user has been retrieved.

Source:
  - api/user.js, line 17

#### multiProjectSearchAssignable(opts, callback)

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 | 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` |  | Called when the search results have been retrieved.

Source:
  - api/user.js, line 117

#### resetDefaultColumns(opts, callback)

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 | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`username` | string | The username
`callback` |  | Called when the columns have been reset.

Source:
  - api/user.js, line 351

#### search(opts, callback)

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

##### Parameters:

Name | Type | 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
`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)
`callback` |  | Called when the search results are retrieved.

Source:
  - api/user.js, line 478

#### searchAssignable(opts, callback)

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 | 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` |  | Called when the search results have been retrieved.

Source:
  - api/user.js, line 155

#### searchPermissions(opts, callback)

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 | 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` |  | Called when the search results are retrieved.

Source:
  - api/user.js, line 402

#### searchPicker(opts, callback)

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

##### Parameters:

Name | Type | 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` |  | Called when the search results are retrieved.

Source:
  - api/user.js, line 450

#### setDefaultColumns(opts, callback)

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 | 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` |  | Called when the columns have been set.

Source:
  - api/user.js, line 323

#### viewIssueSearch(opts, callback)

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 | 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` |  |

Source:
  - api/user.js, line 511