Skip to content

Commit

Permalink
Merge pull request #253 from Asana/openapi-sync
Browse files Browse the repository at this point in the history
Generated from OpenAPI
  • Loading branch information
jv-asana authored Mar 4, 2022
2 parents 2837a70 + c35d4af commit 0847653
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.18.12
0.18.13
101 changes: 101 additions & 0 deletions lib/resources/gen/project_templates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* This file is auto-generated by our openapi spec.
* 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');

function ProjectTemplates(dispatcher) {
Resource.call(this, dispatcher);
}
util.inherits(ProjectTemplates, Resource);


/**
* Get a project template
* @param {String} projectTemplateGid: (required) Globally unique identifier for the project template.
* @param {Object} params: Parameters for the request
- optFields {[String]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
- optPretty {Boolean}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
ProjectTemplates.prototype.getProjectTemplate = function(
projectTemplateGid,
params,
dispatchOptions
) {
var path = "/project_templates/{project_template_gid}".replace("{project_template_gid}", projectTemplateGid);

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


/**
* Get multiple project templates
* @param {Object} params: Parameters for the request
- workspace {String}: The workspace to filter results on.
- team {String}: The team to filter projects on.
- offset {String}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
- limit {Number}: Results per page. The number of objects to return per page. The value must be between 1 and 100.
- optFields {[String]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
- optPretty {Boolean}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
ProjectTemplates.prototype.getProjectTemplates = function(
params,
dispatchOptions
) {
var path = "/project_templates";

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


/**
* Get a team's project templates
* @param {String} teamGid: (required) Globally unique identifier for the team.
* @param {Object} params: Parameters for the request
- offset {String}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
- limit {Number}: Results per page. The number of objects to return per page. The value must be between 1 and 100.
- optFields {[String]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
- optPretty {Boolean}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
ProjectTemplates.prototype.getProjectTemplatesForTeam = function(
teamGid,
params,
dispatchOptions
) {
var path = "/teams/{team_gid}/project_templates".replace("{team_gid}", teamGid);

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


/**
* Instantiate a project from a project template
* @param {String} projectTemplateGid: (required) Globally unique identifier for the project template.
* @param {Object} data: Data for the request
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
ProjectTemplates.prototype.instantiateProject = function(
projectTemplateGid,
data,
dispatchOptions
) {
var path = "/project_templates/{project_template_gid}/instantiateProject".replace("{project_template_gid}", projectTemplateGid);

return this.dispatchPost(path, data, dispatchOptions)
};

module.exports = ProjectTemplates;
/* jshint ignore:end */
18 changes: 18 additions & 0 deletions lib/resources/gen/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,24 @@ Projects.prototype.getTaskCountsForProject = function(
};


/**
* Create a project template from a project
* @param {String} projectGid: (required) Globally unique identifier for the project.
* @param {Object} data: Data for the request
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
* @return {Promise} The requested resource
*/
Projects.prototype.projectSaveAsTemplate = function(
projectGid,
data,
dispatchOptions
) {
var path = "/projects/{project_gid}/saveAsTemplate".replace("{project_gid}", projectGid);

return this.dispatchPost(path, data, dispatchOptions)
};


/**
* Remove a custom field from a project
* @param {String} projectGid: (required) Globally unique identifier for the project.
Expand Down
2 changes: 1 addition & 1 deletion lib/resources/gen/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ util.inherits(Typeahead, Resource);
* Get objects via typeahead
* @param {String} workspaceGid: (required) Globally unique identifier for the workspace or organization.
* @param {Object} params: Parameters for the request
- resourceType {String}: (required) The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported.
- resourceType {String}: (required) The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported.
- type {String}: *Deprecated: new integrations should prefer the resource_type field.*
- query {String}: The string that will be used to search for relevant objects. If an empty string is passed in, the API will currently return an empty result set.
- count {Number}: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asana",
"version": "0.18.12",
"version": "0.18.13",
"description": "Official NodeJS and BrowserJS client for the Asana API",
"main": "index.js",
"scripts": {
Expand Down
45 changes: 45 additions & 0 deletions samples/project_templates_sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
projecttemplates:
getProjectTemplate: >-
const asana = require('asana');
const client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');
client.projecttemplates.getProjectTemplate(projectTemplateGid, {param: "value", param: "value", opt_pretty: true})
.then((result) => {
console.log(result);
});
getProjectTemplates: >-
const asana = require('asana');
const client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');
client.projecttemplates.getProjectTemplates({param: "value", param: "value", opt_pretty: true})
.then((result) => {
console.log(result);
});
getProjectTemplatesForTeam: >-
const asana = require('asana');
const client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');
client.projecttemplates.getProjectTemplatesForTeam(teamGid, {param: "value", param: "value", opt_pretty: true})
.then((result) => {
console.log(result);
});
instantiateProject: >-
const asana = require('asana');
const client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');
client.projecttemplates.instantiateProject(projectTemplateGid, {field: "value", field: "value", pretty: true})
.then((result) => {
console.log(result);
});
11 changes: 11 additions & 0 deletions samples/projects_sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ projects:
.then((result) => {
console.log(result);
});
projectSaveAsTemplate: >-
const asana = require('asana');
const client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');
client.projects.projectSaveAsTemplate(projectGid, {field: "value", field: "value", pretty: true})
.then((result) => {
console.log(result);
});
removeCustomFieldSettingForProject: >-
const asana = require('asana');
Expand Down

0 comments on commit 0847653

Please sign in to comment.