diff --git a/VERSION b/VERSION index 75955dd2..cd47247a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.10.9 \ No newline at end of file +0.10.10 \ No newline at end of file diff --git a/asana/__init__.py b/asana/__init__.py index f66d562d..30a44329 100644 --- a/asana/__init__.py +++ b/asana/__init__.py @@ -1,5 +1,5 @@ __title__ = 'asana' -__version__ = '0.10.9' +__version__ = '0.10.10' __license__ = 'MIT' __copyright__ = 'Copyright 2016 Asana, Inc.' diff --git a/asana/resources/gen/project_templates.py b/asana/resources/gen/project_templates.py new file mode 100644 index 00000000..87c99d29 --- /dev/null +++ b/asana/resources/gen/project_templates.py @@ -0,0 +1,66 @@ +# coding=utf-8 +class _ProjectTemplates: + + def __init__(self, client=None): + self.client = client + + def get_project_template(self, project_template_gid, params=None, **options): + """Get a project template + :param str project_template_gid: (required) Globally unique identifier for the project template. + :param Object params: Parameters for the request + :param **options + - opt_fields {list[str]}: 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. + - opt_pretty {bool}: 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. + :return: Object + """ + if params is None: + params = {} + path = "/project_templates/{project_template_gid}".replace("{project_template_gid}", project_template_gid) + return self.client.get(path, params, **options) + + def get_project_templates(self, params=None, **options): + """Get multiple project templates + :param Object params: Parameters for the request + - workspace {str}: The workspace to filter results on. + - team {str}: The team to filter projects on. + :param **options + - offset {str}: 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 {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. + - opt_fields {list[str]}: 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. + - opt_pretty {bool}: 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. + :return: Object + """ + if params is None: + params = {} + path = "/project_templates" + return self.client.get_collection(path, params, **options) + + def get_project_templates_for_team(self, team_gid, params=None, **options): + """Get a team's project templates + :param str team_gid: (required) Globally unique identifier for the team. + :param Object params: Parameters for the request + :param **options + - offset {str}: 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 {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. + - opt_fields {list[str]}: 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. + - opt_pretty {bool}: 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. + :return: Object + """ + if params is None: + params = {} + path = "/teams/{team_gid}/project_templates".replace("{team_gid}", team_gid) + return self.client.get_collection(path, params, **options) + + def instantiate_project(self, project_template_gid, params=None, **options): + """Instantiate a project from a project template + :param str project_template_gid: (required) Globally unique identifier for the project template. + :param Object params: Parameters for the request + :param **options + - opt_fields {list[str]}: 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. + - opt_pretty {bool}: 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. + :return: Object + """ + if params is None: + params = {} + path = "/project_templates/{project_template_gid}/instantiateProject".replace("{project_template_gid}", project_template_gid) + return self.client.post(path, params, **options) diff --git a/asana/resources/gen/projects.py b/asana/resources/gen/projects.py index 0461aa59..f93fba92 100644 --- a/asana/resources/gen/projects.py +++ b/asana/resources/gen/projects.py @@ -212,6 +212,20 @@ def get_task_counts_for_project(self, project_gid, params=None, **options): path = "/projects/{project_gid}/task_counts".replace("{project_gid}", project_gid) return self.client.get(path, params, **options) + def project_save_as_template(self, project_gid, params=None, **options): + """Create a project template from a project + :param str project_gid: (required) Globally unique identifier for the project. + :param Object params: Parameters for the request + :param **options + - opt_fields {list[str]}: 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. + - opt_pretty {bool}: 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. + :return: Object + """ + if params is None: + params = {} + path = "/projects/{project_gid}/saveAsTemplate".replace("{project_gid}", project_gid) + return self.client.post(path, params, **options) + def remove_custom_field_setting_for_project(self, project_gid, params=None, **options): """Remove a custom field from a project :param str project_gid: (required) Globally unique identifier for the project. diff --git a/asana/resources/gen/typeahead.py b/asana/resources/gen/typeahead.py index 01242757..9a5d512a 100644 --- a/asana/resources/gen/typeahead.py +++ b/asana/resources/gen/typeahead.py @@ -8,7 +8,7 @@ def typeahead_for_workspace(self, workspace_gid, params=None, **options): """Get objects via typeahead :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. :param Object params: Parameters for the request - - resource_type {str}: (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. + - resource_type {str}: (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 {str}: *Deprecated: new integrations should prefer the resource_type field.* - query {str}: 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 {int}: 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. diff --git a/asana/version.py b/asana/version.py index b2bd1514..8c500218 100644 --- a/asana/version.py +++ b/asana/version.py @@ -1 +1 @@ -VERSION = '0.10.9' +VERSION = '0.10.10' diff --git a/samples/project_templates_sample.yaml b/samples/project_templates_sample.yaml new file mode 100644 index 00000000..ae4b37d5 --- /dev/null +++ b/samples/project_templates_sample.yaml @@ -0,0 +1,33 @@ +projecttemplates: + get_project_template: >- + import asana + + + client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') + + + result = client.project_templates.get_project_template(project_template_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) + get_project_templates: >- + import asana + + + client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') + + + result = client.project_templates.get_project_templates({'param': 'value', 'param': 'value'}, opt_pretty=True) + get_project_templates_for_team: >- + import asana + + + client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') + + + result = client.project_templates.get_project_templates_for_team(team_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) + instantiate_project: >- + import asana + + + client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') + + + result = client.project_templates.instantiate_project(project_template_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/projects_sample.yaml b/samples/projects_sample.yaml index 01ca00e0..30fd7d09 100644 --- a/samples/projects_sample.yaml +++ b/samples/projects_sample.yaml @@ -111,6 +111,14 @@ projects: result = client.projects.get_task_counts_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) + project_save_as_template: >- + import asana + + + client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') + + + result = client.projects.project_save_as_template(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) remove_custom_field_setting_for_project: >- import asana diff --git a/setup.py b/setup.py index 2b5c68db..3fc9c3fa 100755 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='asana', - version='0.10.9', + version='0.10.10', description='Asana API client', license='MIT', classifiers=[