"use strict";
const debug = require('debug')('loopback:connector:jira.resource.projectCategory');
const baseResource_1 = require('./baseResource');
/**
* The projectCategory class for the Jira Connector
*
* @constructor projectCategory
* @property {IConnector} connector the jira connector instance
* @property {Model} model the model definition
*/
class projectCategory extends baseResource_1.baseResource {
constructor(connector, definition) {
super(connector, definition);
/**
* Returns all project categories
*
* @method find
* @memberOf projectCategory#
* @param {Object} options The request options passed onto the Jira API.
* @param {string} [options.token] The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with Array of matching records
* @return {Promise.<Array>} Array of matching records
*/
this.find = (options = {}, callback) => {
return this.makeRequest("find", options, callback);
};
/**
* Returns a projectCategory
*
* @method findById
* @memberOf projectCategory#
* @param {Object} options The request options passed onto the Jira API.
* @param {string} [options.token] The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param {string} [options.id] The id of the record to find
* @param [callback] if supplied, called with Array of matching records
* @return {Promise.<Object>} the selected Project
*/
this.findById = (options = {}, callback) => {
return this.makeRequest("findById", options, callback);
};
/* ** */
/**
* Delete a project category.
*
* @method deleteById
* @memberOf projectCategory#
* @param {Object} options The request options passed onto the Jira API.
* @param {string} [options.id] The id of the record to delete
* @param {string} [options.token] The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] if supplied, called with empty result
* @return {Promise.<Object>} empty result
*/
this.deleteById = (options = {}, callback) => {
return this.makeRequest("deleteById", options, callback);
};
/**
* Creates a project category.
*
* @method create
* @memberOf ProjectCategory#
* @param {Object} options The request options sent to the Jira API. See {@link https://docs.atlassian.com/jira/REST/latest/#api/2/project}
* @param {string} options.name The name of the project category
* @param {string} options.description A description
* @param {string} [options.token] The token to use for authentication. This token is supplied on a sucessful login. If not supplied, the default token (if set) is used
* @param [callback] Called when the category has been created.
* @return {Promise} Resolved when the category has been created.
*/
this.create = (options = {}, callback) => {
return this.makeRequest("create", options, callback);
};
this.register();
}
}
exports.projectCategory = projectCategory;