UNPKG

synergia-jira-connector

Version:

Easy to use NodeJS wrapper for the Jira REST API.

2,181 lines (1,065 loc) 78.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: UserClient</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: UserClient</h1> <section> <header> <h2> UserClient </h2> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="UserClient"><span class="type-signature"></span>new UserClient<span class="signature">(jiraClient)</span><span class="type-signature"></span></h4> <div class="description"> <p>Used to access Jira REST endpoints in '/rest/api/2/user'</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>jiraClient</code></td> <td class="type"> <span class="param-type"><a href="JiraClient.html">JiraClient</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line8">line 8</a> </li> </ul> </dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="changePassword"><span class="type-signature"></span>changePassword<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Modify user password.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> </td> <td class="description last"><p>The name of the user for which to change the password.</p></td> </tr> <tr> <td class="name"><code>userKey</code></td> <td class="type"> </td> <td class="description last"><p>The key of the user for which to change the password.</p></td> </tr> <tr> <td class="name"><code>password</code></td> <td class="type"> </td> <td class="description last"><p>The new password.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the password has been set.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line374">line 374</a> </li> </ul> </dd> </dl> <h4 class="name" id="convertTemporaryAvatar"><span class="type-signature"></span>convertTemporaryAvatar<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Converts temporary avatar into a real avatar</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The username</p></td> </tr> <tr> <td class="name"><code>avatarId</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The id of the temporary avatar to convert.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the avatar has been converted</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line228">line 228</a> </li> </ul> </dd> </dl> <h4 class="name" id="createTemporaryAvatar"><span class="type-signature"></span>createTemporaryAvatar<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>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.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The username</p></td> </tr> <tr> <td class="name"><code>filepath</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The path to the file to upload.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the temporary avatar has been uploaded.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line192">line 192</a> </li> </ul> </dd> </dl> <h4 class="name" id="createUser"><span class="type-signature"></span>createUser<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Create user. By default created user will not be notified with email. If password field is not set then password will be randomly generated.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> </td> <td class="description last"><p>The request options sent to the Jira API.</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>user</code></td> <td class="type"> </td> <td class="description last"><p>See <a href="https://docs.atlassian.com/jira/REST/latest/#d2e4049">https://docs.atlassian.com/jira/REST/latest/#d2e4049</a> </p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the user has been created.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line67">line 67</a> </li> </ul> </dd> </dl> <h4 class="name" id="deleteAvatar"><span class="type-signature"></span>deleteAvatar<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Deletes avatar</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The username</p></td> </tr> <tr> <td class="name"><code>avatarId</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The id of the temporary avatar to delete.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the avatar has been deleted.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line255">line 255</a> </li> </ul> </dd> </dl> <h4 class="name" id="deleteUser"><span class="type-signature"></span>deleteUser<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Removes user.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> </td> <td class="description last"><p>The name of the user to delete.</p></td> </tr> <tr> <td class="name"><code>userKey</code></td> <td class="type"> </td> <td class="description last"><p>The key of the user to delete.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the user has been deleted.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line42">line 42</a> </li> </ul> </dd> </dl> <h4 class="name" id="editUser"><span class="type-signature"></span>editUser<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Modify user. The &quot;value&quot; fields present will override the existing value. Fields skipped in request will not be changed.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>user</code></td> <td class="type"> </td> <td class="description last"><p>See <a href="https://docs.atlassian.com/jira/REST/latest/#d2e4081">https://docs.atlassian.com/jira/REST/latest/#d2e4081</a> </p></td> </tr> <tr> <td class="name"><code>username</code></td> <td class="type"> </td> <td class="description last"><p>The name of the user to edit.</p></td> </tr> <tr> <td class="name"><code>userKey</code></td> <td class="type"> </td> <td class="description last"><p>The key of the user to edit.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the user has been edited.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line89">line 89</a> </li> </ul> </dd> </dl> <h4 class="name" id="getAvatars"><span class="type-signature"></span>getAvatars<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Returns all avatars which are visible for the currently logged in user.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The username</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the avatars have been retrieved.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line278">line 278</a> </li> </ul> </dd> </dl> <h4 class="name" id="getDefaultColumns"><span class="type-signature"></span>getDefaultColumns<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>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.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The username</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the columns have been retrieved.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line300">line 300</a> </li> </ul> </dd> </dl> <h4 class="name" id="getUser"><span class="type-signature"></span>getUser<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Get a user. This resource cannot be accessed anonymously.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> </td> <td class="description last"><p>The name of the user to retrieve.</p></td> </tr> <tr> <td class="name"><code>userKey</code></td> <td class="type"> </td> <td class="description last"><p>The key of the user to retrieve.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the user has been retrieved.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line17">line 17</a> </li> </ul> </dd> </dl> <h4 class="name" id="multiProjectSearchAssignable"><span class="type-signature"></span>multiProjectSearchAssignable<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>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.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"><p>The name of the user to search.</p></td> </tr> <tr> <td class="name"><code>projectKeys</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="attributes"> </td> <td class="description last"><p>The keys of the projects we are finding assignable users for</p></td> </tr> <tr> <td class="name"><code>startAt</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>The index of the first user to return (0-based)</p></td> </tr> <tr> <td class="name"><code>maxResults</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>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.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the search results have been retrieved.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line117">line 117</a> </li> </ul> </dd> </dl> <h4 class="name" id="resetDefaultColumns"><span class="type-signature"></span>resetDefaultColumns<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>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.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The username</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the columns have been reset.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line351">line 351</a> </li> </ul> </dd> </dl> <h4 class="name" id="search"><span class="type-signature"></span>search<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Returns a list of users that match the search string. This resource cannot be accessed anonymously.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API.</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>A query string used to search username, name or e-mail address</p></td> </tr> <tr> <td class="name"><code>startAt</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>the index of the first user to return (0-based)</p></td> </tr> <tr> <td class="name"><code>maxResults</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 50 </td> <td class="description last"><p>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.</p></td> </tr> <tr> <td class="name"><code>includeActive</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last"><p>If true, then active users are included in the results (default true)</p></td> </tr> <tr> <td class="name"><code>includeInactive</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last"><p>If true, then inactive users are included in the results (default false)</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> </td> <td class="description last"><p>Called when the search results are retrieved.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="api_user.js.html">api/user.js</a>, <a href="api_user.js.html#line478">line 478</a> </li> </ul> </dd> </dl> <h4 class="name" id="searchAssignable"><span class="type-signature"></span>searchAssignable<span class="signature">(opts, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>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.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>opts</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The request options sent to the Jira API</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"><p>The username</p></td> </tr> <tr> <td class="name"><code>project</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td