Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
#179 Property added as body for setBoardProperty (#185)
Browse files Browse the repository at this point in the history
* property added as body for setBoardProperty

* callback defined

* opts marked as optional
  • Loading branch information
MrRefactoring authored Jul 29, 2019
1 parent a14ae19 commit 604fda6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
1 change: 1 addition & 0 deletions api/board.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export declare class Board {
setBoardProperty(opts: {
boardId: number | string;
propertyKey: string;
property: any;
}, callback?: any): Promise<any>;
deleteBoardProperty(opts: {
boardId: number | string;
Expand Down
20 changes: 17 additions & 3 deletions api/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function AgileBoardClient(jiraClient) {
* Creates a board
*
* @method createBoard
* @memberOf AgileSprintClient#
* @memberOf AgileBoardClient#
* @param {string} name Must be less than 255 characters.
* @param {string} type Valid values: scrum, kanban
* @param {number} filterId ID of a filter that the user has permissions to view. Note, if the
Expand Down Expand Up @@ -472,13 +472,27 @@ function AgileBoardClient(jiraClient) {
return this.jiraClient.makeRequest(options, callback);
}

// TODO add JsDoc
/**
* Sets the value of the specified board's property. You can use this resource to store a
* custom data against the board identified by the id. The user who stores the data is required
* to have permissions to modify the board.
*
* @method setBoardProperty
* @memberof AgileBoardClient
* @param {Object} opts
* @param {string | number} opts.boardId
* @param {string | number} opts.propertyKey
* @param {any} opts.property specified board's property.
* @param {callback} [callback]
* @returns {Promise}
*/
this.setBoardProperty = function (opts, callback) {
var options = {
uri: this.jiraClient.buildAgileURL('/board/' + opts.boardId + '/properties/' + opts.propertyKey),
method: 'PUT',
json: true,
followAllRedirects: true
followAllRedirects: true,
body: opts.property
};

return this.jiraClient.makeRequest(options, callback);
Expand Down
20 changes: 14 additions & 6 deletions api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,30 +505,38 @@ function UserClient(jiraClient) {
*
* @method search
* @memberOf UserClient#
* @param {Object} opts The request options sent to the Jira API.
* @param {string} opts.username A query string used to search username, name or e-mail address
* @param {Object} [opts] The request options sent to the Jira API.
* @param {string} [opts.query]
* @param {string} [opts.username] A query string used to search username, name or e-mail address
* @param {string} [opts.accountId]
* @param {number} [opts.startAt=0] the index of the first user to return (0-based)
* @param {number} [opts.maxResults=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.
* @param {boolean} [opts.includeActive=true] If true, then active users are included in the results (default true)
* @param {boolean} [opts.includeInactive=false] If true, then inactive users are included in the results (default
* false)
* @param [callback] Called when the search results are retrieved.
* @param {string} [opts.property]
* @param {callback} [callback] Called when the search results are retrieved.
* @return {Promise} Resolved when the search results are retrieved.
*/
this.search = function (opts, callback) {
opts = opts || {};

var options = {
uri: this.jiraClient.buildURL('/user/search'),
method: 'GET',
json: true,
followAllRedirects: true,
qs: {
query: opts.query,
username: opts.username,
maxResults: opts.maxResults,
accountId: opts.accountId,
startAt: opts.startAt,
maxResults: opts.maxResults,
includeActive: opts.includeActive,
includeInactive: opts.includeInactive
includeInactive: opts.includeInactive,
property: opts.property
}
};
return this.jiraClient.makeRequest(options, callback);
Expand All @@ -542,7 +550,7 @@ function UserClient(jiraClient) {
* @param {Object} opts The request options sent to the Jira API.
* @param {number} [opts.startAt=0] the index of the first user to return (0-based)
* @param {number} [opts.maxResults=50] the maximum number of users to return (defaults to 50).
* @param [callback] Called when the search results are retrieved.
* @param {callback} [callback] Called when the search results are retrieved.
* @return {Promise} Resolved when the search results are retrieved.
*/
this.all = function (opts, callback) {
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ var workflow = require('./api/workflow');
var workflowScheme = require('./api/workflowScheme');
var worklog = require('./api/worklog');

/**
* @callback callback
* @param {any} err
* @param {any} data
* @returns {void}
*/

/**
* Represents a client for the Jira REST API
*
Expand Down Expand Up @@ -368,7 +375,7 @@ var JiraClient = module.exports = function (config) {
* @method makeRequest
* @memberOf JiraClient#
* @param options The request options.
* @param [callback] Called with the APIs response.
* @param {callback} [callback] Called with the APIs response.
* @param {string} [successString] If supplied, this is reported instead of the response body.
* @return {Promise} Resolved with APIs response or rejected with error
*/
Expand Down

0 comments on commit 604fda6

Please sign in to comment.