UNPKG

synergia-jira-connector

Version:

Easy to use NodeJS wrapper for the Jira REST API.

1,541 lines (737 loc) 38.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Namespace: OauthUtil</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">Namespace: OauthUtil</h1> <section> <header> <h2> OauthUtil </h2> </header> <article> <div class="container-overview"> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="lib_oauth_util.js.html">lib/oauth_util.js</a>, <a href="lib_oauth_util.js.html#line12">line 12</a> </li> </ul> </dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".exports.getAuthorizeURL"><span class="type-signature">(static) </span>exports.getAuthorizeURL<span class="signature">(config, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Attempts to get an OAuth verification URL using the given API configuration.</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>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The information needed to access 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>host</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>The hostname of the Jira API.</p></td> </tr> <tr> <td class="name"><code>protocol</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> https </td> <td class="description last"><p>The protocol used to accses the Jira API.</p></td> </tr> <tr> <td class="name"><code>port</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 443 </td> <td class="description last"><p>The port number used to connect to Jira.</p></td> </tr> <tr> <td class="name"><code>version</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 2 </td> <td class="description last"><p>The version of the Jira API to which you will be connecting. Currently, only version 2 is supported.</p></td> </tr> <tr> <td class="name"><code>oauth</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The oauth information</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>consumer_key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"><p>The consumer key of the application accessing Jira.</p></td> </tr> <tr> <td class="name"><code>private_key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"><p>The private key of the application accessing Jira.</p></td> </tr> <tr> <td class="name"><code>callback_url</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>The callback URL to be called after the token is generated. If this is not included, the user will be given a verification code after authorizing the token, instead of Jira making a callback to the application.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="OauthUtil.html#~getOauthUrlCallback">OauthUtil~getOauthUrlCallback</a></span> </td> <td class="description last"><p>The function called when the URL 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="lib_oauth_util.js.html">lib/oauth_util.js</a>, <a href="lib_oauth_util.js.html#line34">line 34</a> </li> </ul> </dd> </dl> <h4 class="name" id=".exports.swapRequestTokenWithAccessToken"><span class="type-signature">(static) </span>exports.swapRequestTokenWithAccessToken<span class="signature">(config, callback)</span><span class="type-signature"></span></h4> <div class="description"> <p>Given an OAuth token, the token secret, and an access verification code (provided by Jira), swap an OAuth request token with an OAuth access token.</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>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The information needed to access 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>host</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>The hostname of the Jira API.</p></td> </tr> <tr> <td class="name"><code>protocol</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> https </td> <td class="description last"><p>The protocol used to accses the Jira API.</p></td> </tr> <tr> <td class="name"><code>port</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 443 </td> <td class="description last"><p>The port number used to connect to Jira.</p></td> </tr> <tr> <td class="name"><code>version</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 2 </td> <td class="description last"><p>The version of the Jira API to which you will be connecting. Currently, only version 2 is supported.</p></td> </tr> <tr> <td class="name"><code>oauth</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The oauth information</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>consumer_key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The consumer key of the application accessing Jira.</p></td> </tr> <tr> <td class="name"><code>private_key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The private key of the application accessing Jira.</p></td> </tr> <tr> <td class="name"><code>token</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The OAuth Token supplied by Jira.</p></td> </tr> <tr> <td class="name"><code>token_secret</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The OAuth Token secret supplied by Jira.</p> </td> </tr> <tr> <td class="name"><code>oauth_verifier</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The verified code given to the user after authorizing the OAuth token.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="OauthUtil.html#~swapRequestTokenCallback">OauthUtil~swapRequestTokenCallback</a></span> </td> <td class="description last"><p>The function called when the token has been swapped.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="lib_oauth_util.js.html">lib/oauth_util.js</a>, <a href="lib_oauth_util.js.html#line74">line 74</a> </li> </ul> </dd> </dl> <h4 class="name" id=".generateOAuthObject"><span class="type-signature">(static) </span>generateOAuthObject<span class="signature">(config)</span><span class="type-signature"> &rarr; {exports.OAuth}</span></h4> <div class="description"> <p>Utility function to generate an OAuth object.</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>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The information needed to access 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>host</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>The hostname of the Jira API.</p></td> </tr> <tr> <td class="name"><code>protocol</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> https </td> <td class="description last"><p>The protocol used to accses the Jira API.</p></td> </tr> <tr> <td class="name"><code>port</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 443 </td> <td class="description last"><p>The port number used to connect to Jira.</p></td> </tr> <tr> <td class="name"><code>version</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 2 </td> <td class="description last"><p>The version of the Jira API to which you will be connecting. Currently, only version 2 is supported.</p></td> </tr> <tr> <td class="name"><code>oauth</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The oauth information</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>consumer_key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"><p>The consumer key of the application accessing Jira.</p></td> </tr> <tr> <td class="name"><code>private_key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last"><p>The private key of the application accessing Jira.</p></td> </tr> <tr> <td class="name"><code>callback_url</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>The callback URL to be called after the token is generated. If this is not included, the user will be given a verification code after authorizing the token, instead of Jira making a callback to the application.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="lib_oauth_util.js.html">lib/oauth_util.js</a>, <a href="lib_oauth_util.js.html#line107">line 107</a> </li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The generated object.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">exports.OAuth</span> </dd> </dl> <h3 class="subsection-title">Type Definitions</h3> <h4 class="name" id="~getOauthUrlCallback"><span class="type-signature"></span>getOauthUrlCallback<span class="signature">(error, oauth)</span><span class="type-signature"></span></h4> <div class="description"> <p>Callback used by getOauthUrl.</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>error</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>The error which occurred, if any.</p></td> </tr> <tr> <td class="name"><code>oauth</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The OAuth information retrieved from 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>url</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>The URL that should be visited by the user to verify the OAuth access.</p></td> </tr> <tr> <td class="name"><code>token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>The OAuth Token retrieved from the Jira API.</p></td> </tr> <tr> <td class="name"><code>token_secret</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>The OAuth Token Secret retrieved from the Jira API.</p> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="lib_oauth_util.js.html">lib/oauth_util.js</a>, <a href="lib_oauth_util.js.html#line144">line 144</a> </li> </ul> </dd> </dl> <h4 class="name" id="~swapRequestTokenCallback"><span class="type-signature"></span>swapRequestTokenCallback<span class="signature">(error, access_token)</span><span class="type-signature"></span></h4> <div class="description"> <p>Callback used by swapRequestTokenWithAccessToken</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>error</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>The error which occurred, if any.</p></td> </tr> <tr> <td class="name"><code>access_token</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The access token retrieved from Jira.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="lib_oauth_util.js.html">lib/oauth_util.js</a>, <a href="lib_oauth_util.js.html#line154">line 154</a> </li> </ul> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2> <h3>Classes</h3> <ul> <li><a href="ApplicationPropertiesClient.html">ApplicationPropertiesClient</a></li> <li><a href="AttachmentClient.html">AttachmentClient</a></li> <li><a href="AuditingClient.html">AuditingClient</a></li> <li><a href="AvatarClient.html">AvatarClient</a></li> <li><a href="CommentClient.html">CommentClient</a></li> <li><a href="ComponentClient.html">ComponentClient</a></li> <li><a href="CustomFieldOptionClient.html">CustomFieldOptionClient</a></li> <li><a href="DashboardClient.html">DashboardClient</a></li> <li><a href="FieldClient.html">FieldClient</a></li> <li><a href="FilterClient.html">FilterClient</a></li> <li><a href="GroupClient.html">GroupClient</a></li> <li><a href="GroupsClient.html">GroupsClient</a></li> <li><a href="GroupUserPickerClient.html">GroupUserPickerClient</a></li> <li><a href="IssueClient.html">IssueClient</a></li> <li><a href="IssueLinkClient.html">IssueLinkClient</a></li> <li><a href="IssueLinkTypeClient.html">IssueLinkTypeClient</a></li> <li><a href="IssueTypeClient.html">IssueTypeClient</a></li> <li><a href="JiraClient.html">JiraClient</a></li> <li><a href="JqlClient.html">JqlClient</a></li> <li><a href="LicenseRoleClient.html">LicenseRoleClient</a></li> <li><a href="LicenseValidatorClient.html">LicenseValidatorClient</a></li> <li><a href="MyPermissionsClient.html">MyPermissionsClient</a></li> <li><a href="MyPreferencesClient.html">MyPreferencesClient</a></li> <li><a href="MyselfClient.html">MyselfClient</a></li> <li><a href="PasswordClient.html">PasswordClient</a></li> <li><a href="PriorityClient.html">PriorityClient</a></li> <li><a href="ProjectClient.html">ProjectClient</a></li> <li><a href="ProjectValidateClient.html">ProjectValidateClient</a></li> <li><a href="ReindexClient.html">ReindexClient</a></li> <li><a href="ResolutionClient.html">ResolutionClient</a></li> <li><a href="ScreensClient.html">ScreensClient</a></li> <li><a href="SearchClient.html">SearchClient</a></li> <li><a href="SecurityLevelClient.html">SecurityLevelClient</a></li> <li><a href="ServerInfoClient.html">ServerInfoClient</a></li> <li><a href="SettingsClient.html">SettingsClient</a></li> <li><a href="StatusCategoryClient.html">StatusCategoryClient</a></li> <li><a href="StatusClient.html">StatusClient</a></li> <li><a href="UserClient.html">UserClient</a></li> <li><a href="VersionClient.html">VersionClient</a></li> <li><a href="WorkflowClient.html">WorkflowClient</a></li> <li><a href="WorkflowSchemeClient.html">WorkflowSchemeClient</a></li> </ul> <h3>Namespaces</h3> <ul> <li><a href="OauthUtil.html">OauthUtil</a></li> </ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha13</a> on Sun Aug 09 2015 00:40:20 GMT-0500 (CDT) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"></script> </body> </html>