Skip to content

Commit

Permalink
Updates from asana-api-meta
Browse files Browse the repository at this point in the history
  • Loading branch information
rossgrambo-zz committed Jun 18, 2019
1 parent 1486c97 commit 78c665d
Show file tree
Hide file tree
Showing 24 changed files with 888 additions and 154 deletions.
3 changes: 1 addition & 2 deletions lib/auth/native_flow.js
@@ -1,4 +1,3 @@
var readline = require('readline');
var Bluebird = require('bluebird');
var oauthUtil = require('./oauth_util');

Expand Down Expand Up @@ -103,4 +102,4 @@ NativeFlow.prototype.promptForCode = function(url) {
});
};

module.exports = NativeFlow;
module.exports = NativeFlow;
4 changes: 1 addition & 3 deletions lib/dispatcher.js
Expand Up @@ -286,13 +286,11 @@ Dispatcher.prototype._addVersionInfo = function(request) {
*/
Dispatcher.prototype._generateVersionInfo = function() {
if (typeof(navigator) === 'undefined' || typeof(window) === 'undefined') {
var os = require('os');
return {
'version': VERSION,
'language': 'NodeJS',
'language_version': process.version,
'os': os.type(),
'os_version': os.release()
'os': process.platform
};
} else {
return {
Expand Down
4 changes: 2 additions & 2 deletions lib/resources/gen/attachments.js
Expand Up @@ -26,7 +26,7 @@ util.inherits(Attachments, Resource);

/**
* Returns the full record for a single attachment.
* @param {String} attachment Globally unique identifier for the attachment.
* @param {Gid} attachment Globally unique identifier for the attachment.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
Expand All @@ -43,7 +43,7 @@ Attachments.prototype.findById = function(

/**
* Returns the compact records for all attachments on the task.
* @param {String} task Globally unique identifier for the task.
* @param {Gid} task Globally unique identifier for the task.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
Expand Down
32 changes: 25 additions & 7 deletions lib/resources/gen/custom_field_settings.js
Expand Up @@ -12,11 +12,12 @@ var util = require('util');
var _ = require('lodash');

/**
* Custom fields are attached to a particular project with the Custom
* Field Settings resource. This resource both represents the many-to-many join
* of the Custom Field and Project as well as stores information that is relevant to that
* particular pairing; for instance, the `is_important` property determines
* some possible application-specific handling of that custom field (see below)
* Custom fields are applied to a particular project or portfolio with the
* Custom Field Settings resource. This resource both represents the
* many-to-many join of the Custom Field and Project or Portfolio as well as
* stores information that is relevant to that particular pairing; for instance,
* the `is_important` property determines some possible application-specific
* handling of that custom field and parent.
* @class
* @param {Dispatcher} dispatcher The API dispatcher
*/
Expand All @@ -27,8 +28,8 @@ util.inherits(CustomFieldSettings, Resource);


/**
* Returns a list of all of the custom fields settings on a project, in compact form. Note that, as in all queries to collections which return compact representation, `opt_fields` and `opt_expand` can be used to include more data than is returned in the compact representation. See the getting started guide on [input/output options](/developers/documentation/getting-started/input-output-options) for more information.
* @param {String} project The ID of the project for which to list custom field settings
* Returns a list of all of the custom fields settings on a project.
* @param {Gid} project The ID of the project for which to list custom field settings
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
Expand All @@ -43,6 +44,23 @@ CustomFieldSettings.prototype.findByProject = function(
return this.dispatchGetCollection(path, params, dispatchOptions);
};

/**
* Returns a list of all of the custom fields settings on a portfolio.
* @param {Gid} portfolio The ID of the portfolio for which to list custom field settings
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
CustomFieldSettings.prototype.findByPortfolio = function(
portfolio,
params,
dispatchOptions
) {
var path = util.format('/portfolios/%s/custom_field_settings', portfolio);

return this.dispatchGetCollection(path, params, dispatchOptions);
};


module.exports = CustomFieldSettings;
/* jshint ignore:end */
50 changes: 32 additions & 18 deletions lib/resources/gen/custom_fields.js
Expand Up @@ -17,6 +17,11 @@ var _ = require('lodash');
* Fields](/developers/documentation/getting-started/custom-fields) developer
* documentation for more information about how custom fields relate to various
* resources in Asana.
*
* Users in Asana can [lock custom
* fields](/guide/help/premium/custom-fields#gl-lock-fields), which will make
* them read-only when accessed by other users. Attempting to edit a locked
* custom field will return HTTP error code `403 Forbidden`.
* @class
* @param {Dispatcher} dispatcher The API dispatcher
*/
Expand All @@ -33,8 +38,9 @@ util.inherits(CustomFields, Resource);
*
* Returns the full record of the newly created custom field.
* @param {Object} data Data for the request
* @param {String} data.workspace The workspace to create a custom field in.
* @param {String} data.type The type of the custom field.
* @param {Gid} data.workspace The workspace to create a custom field in.
* @param {String} data.resource_subtype The type of the custom field. Must be one of the given values.
* @param {String} [data.type] **Deprecated: New integrations should prefer the `resource_subtype` parameter.**
* @param {String} data.name The name of the custom field.
* @param {String} [data.description] The description of the custom field.
* @param {Integer} [data.precision] The number of decimal places for the numerical values. Required if the custom field is of type 'number'.
Expand All @@ -53,7 +59,7 @@ CustomFields.prototype.create = function(

/**
* Returns the complete definition of a custom field's metadata.
* @param {String} custom_field Globally unique identifier for the custom field.
* @param {Gid} custom_field Globally unique identifier for the custom field.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
Expand All @@ -70,7 +76,7 @@ CustomFields.prototype.findById = function(

/**
* Returns a list of the compact representation of all of the custom fields in a workspace.
* @param {String} workspace The workspace or organization to find custom field definitions in.
* @param {Gid} workspace The workspace or organization to find custom field definitions in.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
Expand All @@ -90,12 +96,12 @@ CustomFields.prototype.findByWorkspace = function(
*
* When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field.
*
* A custom field's `type` cannot be updated.
*
* An enum custom field's `enum_options` cannot be updated with this endpoint. Instead see "Work With Enum Options" for information on how to update `enum_options`.
*
* Locked custom fields can only be updated by the user who locked the field.
*
* Returns the complete updated custom field record.
* @param {String} custom_field Globally unique identifier for the custom field.
* @param {Gid} custom_field Globally unique identifier for the custom field.
* @param {Object} data Data for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
Expand All @@ -113,8 +119,10 @@ CustomFields.prototype.update = function(
/**
* A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field.
*
* Locked custom fields can only be deleted by the user who locked the field.
*
* Returns an empty data record.
* @param {String} custom_field Globally unique identifier for the custom field.
* @param {Gid} custom_field Globally unique identifier for the custom field.
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
Expand All @@ -130,17 +138,19 @@ CustomFields.prototype.delete = function(
/**
* Creates an enum option and adds it to this custom field's list of enum options. A custom field can have at most 50 enum options (including disabled options). By default new enum options are inserted at the end of a custom field's list.
*
* Locked custom fields can only have enum options added by the user who locked the field.
*
* Returns the full record of the newly created enum option.
* @param {String} custom_field Globally unique identifier for the custom field.
* @param {Gid} custom_field Globally unique identifier for the custom field.
* @param {Object} data Data for the request
* @param {String} data.name The name of the enum option.
* @param {String} [data.color] The color of the enum option. Defaults to 'none'.
* @param {String} [data.insert_before] An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option.
* @param {String} [data.insert_after] An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option.
* @param {Gid} [data.insert_before] An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option.
* @param {Gid} [data.insert_after] An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option.
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
CustomFields.prototype.addEnumOption = function(
CustomFields.prototype.createEnumOption = function(
customField,
data,
dispatchOptions
Expand All @@ -153,8 +163,10 @@ CustomFields.prototype.addEnumOption = function(
/**
* Updates an existing enum option. Enum custom fields require at least one enabled enum option.
*
* Locked custom fields can only be updated by the user who locked the field.
*
* Returns the full record of the updated enum option.
* @param {String} enum_option Globally unique identifier for the enum option.
* @param {Gid} enum_option Globally unique identifier for the enum option.
* @param {Object} data Data for the request
* @param {String} data.name The name of the enum option.
* @param {String} [data.color] The color of the enum option. Defaults to 'none'.
Expand All @@ -174,17 +186,19 @@ CustomFields.prototype.updateEnumOption = function(

/**
* Moves a particular enum option to be either before or after another specified enum option in the custom field.
* @param {String} custom_field Globally unique identifier for the custom field.
*
* Locked custom fields can only be reordered by the user who locked the field.
* @param {Gid} custom_field Globally unique identifier for the custom field.
* @param {Object} data Data for the request
* @param {String} data.enum_option The ID of the enum option to relocate.
* @param {Gid} data.enum_option The ID of the enum option to relocate.
* @param {String} data.name The name of the enum option.
* @param {String} [data.color] The color of the enum option. Defaults to 'none'.
* @param {String} [data.before_enum_option] An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option.
* @param {String} [data.after_enum_option] An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option.
* @param {Gid} [data.before_enum_option] An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option.
* @param {Gid} [data.after_enum_option] An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option.
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
CustomFields.prototype.reorderEnumOption = function(
CustomFields.prototype.insertEnumOption = function(
customField,
data,
dispatchOptions
Expand Down
47 changes: 47 additions & 0 deletions lib/resources/gen/jobs.js
@@ -0,0 +1,47 @@

/**
* This file is auto-generated by the `asana-api-meta` NodeJS package.
* We try to keep the generated code pretty clean but there will be lint
* errors that are just not worth fixing (like unused requires).
* TODO: maybe we can just disable those specifically and keep this code
* pretty lint-free too!
*/
/* jshint ignore:start */
var Resource = require('../resource');
var util = require('util');
var _ = require('lodash');

/**
* A _job_ represents a process that handles asynchronous work.
*
* Jobs are created when an endpoint requests an action that will be handled asynchronously.
* Such as project or task duplication.
* @class
* @param {Dispatcher} dispatcher The API dispatcher
*/
function Jobs(dispatcher) {
Resource.call(this, dispatcher);
}
util.inherits(Jobs, Resource);


/**
* Returns the complete job record for a single job.
* @param {Gid} job The job to get.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
Jobs.prototype.findById = function(
job,
params,
dispatchOptions
) {
var path = util.format('/jobs/%s', job);

return this.dispatchGet(path, params, dispatchOptions);
};


module.exports = Jobs;
/* jshint ignore:end */
4 changes: 2 additions & 2 deletions lib/resources/gen/organization_exports.js
Expand Up @@ -36,7 +36,7 @@ util.inherits(OrganizationExports, Resource);

/**
* Returns details of a previously-requested Organization export.
* @param {String} organization_export Globally unique identifier for the Organization export.
* @param {Gid} organization_export Globally unique identifier for the Organization export.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
Expand All @@ -55,7 +55,7 @@ OrganizationExports.prototype.findById = function(
* This method creates a request to export an Organization. Asana will complete the export at some
* point after you create the request.
* @param {Object} data Data for the request
* @param {String} data.organization Globally unique identifier for the workspace or organization.
* @param {Gid} data.organization Globally unique identifier for the workspace or organization.
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
Expand Down
81 changes: 81 additions & 0 deletions lib/resources/gen/portfolio_memberships.js
@@ -0,0 +1,81 @@

/**
* This file is auto-generated by the `asana-api-meta` NodeJS package.
* We try to keep the generated code pretty clean but there will be lint
* errors that are just not worth fixing (like unused requires).
* TODO: maybe we can just disable those specifically and keep this code
* pretty lint-free too!
*/
/* jshint ignore:start */
var Resource = require('../resource');
var util = require('util');
var _ = require('lodash');

/**
* This object determines if a user is a member of a portfolio.
* @class
* @param {Dispatcher} dispatcher The API dispatcher
*/
function PortfolioMemberships(dispatcher) {
Resource.call(this, dispatcher);
}
util.inherits(PortfolioMemberships, Resource);


/**
* Returns the compact portfolio membership records for the portfolio. You must
* specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`.
* @param {Object} [params] Parameters for the request
* @param {Gid} [params.portfolio] The portfolio for which to fetch memberships.
* @param {Gid} [params.workspace] The workspace for which to fetch memberships.
* @param {String} [params.user] The user to filter the memberships to.
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
PortfolioMemberships.prototype.findAll = function(
params,
dispatchOptions
) {
var path = util.format('/portfolio_memberships');

return this.dispatchGetCollection(path, params, dispatchOptions);
};

/**
* Returns the compact portfolio membership records for the portfolio.
* @param {Gid} portfolio The portfolio for which to fetch memberships.
* @param {Object} [params] Parameters for the request
* @param {String} [params.user] If present, the user to filter the memberships to.
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The response from the API
*/
PortfolioMemberships.prototype.findByPortfolio = function(
portfolio,
params,
dispatchOptions
) {
var path = util.format('/portfolios/%s/portfolio_memberships', portfolio);

return this.dispatchGetCollection(path, params, dispatchOptions);
};

/**
* Returns the portfolio membership record.
* @param {Gid} portfolio_membership Globally unique identifier for the portfolio membership.
* @param {Object} [params] Parameters for the request
* @param {Object} [dispatchOptions] Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
PortfolioMemberships.prototype.findById = function(
portfolioMembership,
params,
dispatchOptions
) {
var path = util.format('/portfolio_memberships/%s', portfolioMembership);

return this.dispatchGet(path, params, dispatchOptions);
};


module.exports = PortfolioMemberships;
/* jshint ignore:end */

0 comments on commit 78c665d

Please sign in to comment.