From 4df777b16b97cb85ccfe639c65aa248a666fa14d Mon Sep 17 00:00:00 2001 From: John Vu Date: Mon, 4 Dec 2023 13:12:46 -0800 Subject: [PATCH] Generate python v5 --- .swagger-codegen-ignore | 23 + .swagger-codegen/VERSION | 1 + README.md | 929 ++++++ asana/__init__.py | 55 + asana/api/__init__.py | 40 + asana/api/attachments_api.py | 633 ++++ asana/api/audit_log_api_api.py | 189 ++ asana/api/batch_api_api.py | 178 ++ asana/api/custom_field_settings_api.py | 325 ++ asana/api/custom_fields_api.py | 1176 +++++++ asana/api/events_api.py | 177 ++ asana/api/goal_relationships_api.py | 761 +++++ asana/api/goals_api.py | 1486 +++++++++ asana/api/jobs_api.py | 172 ++ asana/api/memberships_api.py | 589 ++++ asana/api/organization_exports_api.py | 314 ++ asana/api/portfolio_memberships_api.py | 466 +++ asana/api/portfolios_api.py | 1768 +++++++++++ asana/api/project_briefs_api.py | 604 ++++ asana/api/project_memberships_api.py | 320 ++ asana/api/project_statuses_api.py | 602 ++++ asana/api/project_templates_api.py | 743 +++++ asana/api/projects_api.py | 2796 +++++++++++++++++ asana/api/rules_api.py | 178 ++ asana/api/sections_api.py | 1030 +++++++ asana/api/status_updates_api.py | 602 ++++ asana/api/stories_api.py | 750 +++++ asana/api/tags_api.py | 1171 +++++++ asana/api/task_templates_api.py | 459 +++ asana/api/tasks_api.py | 3936 ++++++++++++++++++++++++ asana/api/team_memberships_api.py | 616 ++++ asana/api/teams_api.py | 1053 +++++++ asana/api/time_periods_api.py | 322 ++ asana/api/time_tracking_entries_api.py | 750 +++++ asana/api/typeahead_api.py | 187 ++ asana/api/user_task_lists_api.py | 317 ++ asana/api/users_api.py | 762 +++++ asana/api/webhooks_api.py | 746 +++++ asana/api/workspace_memberships_api.py | 466 +++ asana/api/workspaces_api.py | 753 +++++ asana/api_client.py | 626 ++++ asana/configuration.py | 260 ++ asana/pagination/__init__.py | 19 + asana/pagination/event_iterator.py | 38 + asana/pagination/page_iterator.py | 64 + asana/rest.py | 317 ++ docs/AttachmentsApi.md | 227 ++ docs/AttachmentsApi.yaml | 95 + docs/AuditLogAPIApi.md | 74 + docs/AuditLogAPIApi.yaml | 31 + docs/BatchAPIApi.md | 60 + docs/BatchAPIApi.yaml | 24 + docs/CustomFieldSettingsApi.md | 121 + docs/CustomFieldSettingsApi.yaml | 51 + docs/CustomFieldsApi.md | 433 +++ docs/CustomFieldsApi.yaml | 182 ++ docs/EventsApi.md | 62 + docs/EventsApi.yaml | 25 + docs/GoalRelationshipsApi.md | 277 ++ docs/GoalRelationshipsApi.yaml | 116 + docs/GoalsApi.md | 552 ++++ docs/GoalsApi.yaml | 234 ++ docs/JobsApi.md | 59 + docs/JobsApi.yaml | 23 + docs/MembershipsApi.md | 217 ++ docs/MembershipsApi.yaml | 90 + docs/OrganizationExportsApi.md | 111 + docs/OrganizationExportsApi.yaml | 45 + docs/PortfolioMembershipsApi.md | 179 ++ docs/PortfolioMembershipsApi.yaml | 76 + docs/PortfoliosApi.md | 642 ++++ docs/PortfoliosApi.yaml | 269 ++ docs/ProjectBriefsApi.md | 216 ++ docs/ProjectBriefsApi.yaml | 89 + docs/ProjectMembershipsApi.md | 118 + docs/ProjectMembershipsApi.yaml | 49 + docs/ProjectStatusesApi.md | 219 ++ docs/ProjectStatusesApi.yaml | 91 + docs/ProjectTemplatesApi.md | 278 ++ docs/ProjectTemplatesApi.yaml | 117 + docs/ProjectsApi.md | 1036 +++++++ docs/ProjectsApi.yaml | 440 +++ docs/RulesApi.md | 58 + docs/RulesApi.yaml | 22 + docs/SectionsApi.md | 377 +++ docs/SectionsApi.yaml | 158 + docs/StatusUpdatesApi.md | 223 ++ docs/StatusUpdatesApi.yaml | 93 + docs/StoriesApi.md | 273 ++ docs/StoriesApi.yaml | 114 + docs/TagsApi.md | 437 +++ docs/TagsApi.yaml | 185 ++ docs/TaskTemplatesApi.md | 170 + docs/TaskTemplatesApi.yaml | 71 + docs/TasksApi.md | 1528 +++++++++ docs/TasksApi.yaml | 661 ++++ docs/TeamMembershipsApi.md | 236 ++ docs/TeamMembershipsApi.yaml | 101 + docs/TeamsApi.md | 386 +++ docs/TeamsApi.yaml | 163 + docs/TimePeriodsApi.md | 120 + docs/TimePeriodsApi.yaml | 50 + docs/TimeTrackingEntriesApi.md | 273 ++ docs/TimeTrackingEntriesApi.yaml | 114 + docs/TypeaheadApi.md | 68 + docs/TypeaheadApi.yaml | 28 + docs/UserTaskListsApi.md | 113 + docs/UserTaskListsApi.yaml | 46 + docs/UsersApi.md | 289 ++ docs/UsersApi.yaml | 124 + docs/WebhooksApi.md | 273 ++ docs/WebhooksApi.yaml | 114 + docs/WorkspaceMembershipsApi.md | 175 ++ docs/WorkspaceMembershipsApi.yaml | 74 + docs/WorkspacesApi.md | 273 ++ docs/WorkspacesApi.yaml | 114 + requirements.txt | 5 + setup.py | 48 + test-requirements.txt | 5 + test/__init__.py | 1 + test/test_attachments_api.py | 61 + test/test_audit_log_api_api.py | 40 + test/test_batch_api_api.py | 40 + test/test_custom_field_settings_api.py | 47 + test/test_custom_fields_api.py | 89 + test/test_events_api.py | 40 + test/test_goal_relationships_api.py | 68 + test/test_goals_api.py | 103 + test/test_jobs_api.py | 40 + test/test_memberships_api.py | 61 + test/test_organization_exports_api.py | 47 + test/test_portfolio_memberships_api.py | 54 + test/test_portfolios_api.py | 117 + test/test_project_briefs_api.py | 61 + test/test_project_memberships_api.py | 47 + test/test_project_statuses_api.py | 61 + test/test_project_templates_api.py | 68 + test/test_projects_api.py | 166 + test/test_rules_api.py | 40 + test/test_sections_api.py | 82 + test/test_status_updates_api.py | 61 + test/test_stories_api.py | 68 + test/test_tags_api.py | 89 + test/test_task_templates_api.py | 54 + test/test_tasks_api.py | 215 ++ test/test_team_memberships_api.py | 61 + test/test_teams_api.py | 82 + test/test_time_periods_api.py | 47 + test/test_time_tracking_entries_api.py | 68 + test/test_typeahead_api.py | 40 + test/test_user_task_lists_api.py | 47 + test/test_users_api.py | 68 + test/test_webhooks_api.py | 68 + test/test_workspace_memberships_api.py | 54 + test/test_workspaces_api.py | 68 + tox.ini | 10 + 156 files changed, 46692 insertions(+) create mode 100644 .swagger-codegen-ignore create mode 100644 .swagger-codegen/VERSION create mode 100644 README.md create mode 100644 asana/__init__.py create mode 100644 asana/api/__init__.py create mode 100644 asana/api/attachments_api.py create mode 100644 asana/api/audit_log_api_api.py create mode 100644 asana/api/batch_api_api.py create mode 100644 asana/api/custom_field_settings_api.py create mode 100644 asana/api/custom_fields_api.py create mode 100644 asana/api/events_api.py create mode 100644 asana/api/goal_relationships_api.py create mode 100644 asana/api/goals_api.py create mode 100644 asana/api/jobs_api.py create mode 100644 asana/api/memberships_api.py create mode 100644 asana/api/organization_exports_api.py create mode 100644 asana/api/portfolio_memberships_api.py create mode 100644 asana/api/portfolios_api.py create mode 100644 asana/api/project_briefs_api.py create mode 100644 asana/api/project_memberships_api.py create mode 100644 asana/api/project_statuses_api.py create mode 100644 asana/api/project_templates_api.py create mode 100644 asana/api/projects_api.py create mode 100644 asana/api/rules_api.py create mode 100644 asana/api/sections_api.py create mode 100644 asana/api/status_updates_api.py create mode 100644 asana/api/stories_api.py create mode 100644 asana/api/tags_api.py create mode 100644 asana/api/task_templates_api.py create mode 100644 asana/api/tasks_api.py create mode 100644 asana/api/team_memberships_api.py create mode 100644 asana/api/teams_api.py create mode 100644 asana/api/time_periods_api.py create mode 100644 asana/api/time_tracking_entries_api.py create mode 100644 asana/api/typeahead_api.py create mode 100644 asana/api/user_task_lists_api.py create mode 100644 asana/api/users_api.py create mode 100644 asana/api/webhooks_api.py create mode 100644 asana/api/workspace_memberships_api.py create mode 100644 asana/api/workspaces_api.py create mode 100644 asana/api_client.py create mode 100644 asana/configuration.py create mode 100644 asana/pagination/__init__.py create mode 100644 asana/pagination/event_iterator.py create mode 100644 asana/pagination/page_iterator.py create mode 100644 asana/rest.py create mode 100644 docs/AttachmentsApi.md create mode 100644 docs/AttachmentsApi.yaml create mode 100644 docs/AuditLogAPIApi.md create mode 100644 docs/AuditLogAPIApi.yaml create mode 100644 docs/BatchAPIApi.md create mode 100644 docs/BatchAPIApi.yaml create mode 100644 docs/CustomFieldSettingsApi.md create mode 100644 docs/CustomFieldSettingsApi.yaml create mode 100644 docs/CustomFieldsApi.md create mode 100644 docs/CustomFieldsApi.yaml create mode 100644 docs/EventsApi.md create mode 100644 docs/EventsApi.yaml create mode 100644 docs/GoalRelationshipsApi.md create mode 100644 docs/GoalRelationshipsApi.yaml create mode 100644 docs/GoalsApi.md create mode 100644 docs/GoalsApi.yaml create mode 100644 docs/JobsApi.md create mode 100644 docs/JobsApi.yaml create mode 100644 docs/MembershipsApi.md create mode 100644 docs/MembershipsApi.yaml create mode 100644 docs/OrganizationExportsApi.md create mode 100644 docs/OrganizationExportsApi.yaml create mode 100644 docs/PortfolioMembershipsApi.md create mode 100644 docs/PortfolioMembershipsApi.yaml create mode 100644 docs/PortfoliosApi.md create mode 100644 docs/PortfoliosApi.yaml create mode 100644 docs/ProjectBriefsApi.md create mode 100644 docs/ProjectBriefsApi.yaml create mode 100644 docs/ProjectMembershipsApi.md create mode 100644 docs/ProjectMembershipsApi.yaml create mode 100644 docs/ProjectStatusesApi.md create mode 100644 docs/ProjectStatusesApi.yaml create mode 100644 docs/ProjectTemplatesApi.md create mode 100644 docs/ProjectTemplatesApi.yaml create mode 100644 docs/ProjectsApi.md create mode 100644 docs/ProjectsApi.yaml create mode 100644 docs/RulesApi.md create mode 100644 docs/RulesApi.yaml create mode 100644 docs/SectionsApi.md create mode 100644 docs/SectionsApi.yaml create mode 100644 docs/StatusUpdatesApi.md create mode 100644 docs/StatusUpdatesApi.yaml create mode 100644 docs/StoriesApi.md create mode 100644 docs/StoriesApi.yaml create mode 100644 docs/TagsApi.md create mode 100644 docs/TagsApi.yaml create mode 100644 docs/TaskTemplatesApi.md create mode 100644 docs/TaskTemplatesApi.yaml create mode 100644 docs/TasksApi.md create mode 100644 docs/TasksApi.yaml create mode 100644 docs/TeamMembershipsApi.md create mode 100644 docs/TeamMembershipsApi.yaml create mode 100644 docs/TeamsApi.md create mode 100644 docs/TeamsApi.yaml create mode 100644 docs/TimePeriodsApi.md create mode 100644 docs/TimePeriodsApi.yaml create mode 100644 docs/TimeTrackingEntriesApi.md create mode 100644 docs/TimeTrackingEntriesApi.yaml create mode 100644 docs/TypeaheadApi.md create mode 100644 docs/TypeaheadApi.yaml create mode 100644 docs/UserTaskListsApi.md create mode 100644 docs/UserTaskListsApi.yaml create mode 100644 docs/UsersApi.md create mode 100644 docs/UsersApi.yaml create mode 100644 docs/WebhooksApi.md create mode 100644 docs/WebhooksApi.yaml create mode 100644 docs/WorkspaceMembershipsApi.md create mode 100644 docs/WorkspaceMembershipsApi.yaml create mode 100644 docs/WorkspacesApi.md create mode 100644 docs/WorkspacesApi.yaml create mode 100644 requirements.txt create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 test/__init__.py create mode 100644 test/test_attachments_api.py create mode 100644 test/test_audit_log_api_api.py create mode 100644 test/test_batch_api_api.py create mode 100644 test/test_custom_field_settings_api.py create mode 100644 test/test_custom_fields_api.py create mode 100644 test/test_events_api.py create mode 100644 test/test_goal_relationships_api.py create mode 100644 test/test_goals_api.py create mode 100644 test/test_jobs_api.py create mode 100644 test/test_memberships_api.py create mode 100644 test/test_organization_exports_api.py create mode 100644 test/test_portfolio_memberships_api.py create mode 100644 test/test_portfolios_api.py create mode 100644 test/test_project_briefs_api.py create mode 100644 test/test_project_memberships_api.py create mode 100644 test/test_project_statuses_api.py create mode 100644 test/test_project_templates_api.py create mode 100644 test/test_projects_api.py create mode 100644 test/test_rules_api.py create mode 100644 test/test_sections_api.py create mode 100644 test/test_status_updates_api.py create mode 100644 test/test_stories_api.py create mode 100644 test/test_tags_api.py create mode 100644 test/test_task_templates_api.py create mode 100644 test/test_tasks_api.py create mode 100644 test/test_team_memberships_api.py create mode 100644 test/test_teams_api.py create mode 100644 test/test_time_periods_api.py create mode 100644 test/test_time_tracking_entries_api.py create mode 100644 test/test_typeahead_api.py create mode 100644 test/test_user_task_lists_api.py create mode 100644 test/test_users_api.py create mode 100644 test/test_webhooks_api.py create mode 100644 test/test_workspace_memberships_api.py create mode 100644 test/test_workspaces_api.py create mode 100644 tox.ini diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 00000000..c5fa491b --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 00000000..16176176 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.46 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..38f159a6 --- /dev/null +++ b/README.md @@ -0,0 +1,929 @@ +# asana [![GitHub release][release-image]]() [![PyPi Version][pypi-image]][pypi-url] + +> **Warning** +> Python client library version `>5.X.X` is currently in BETA and subject to change. Please use v3.2.X for stable / production environments `pip install asana==3.2.2`. If you have feedback on the new version, please your feedback [here](https://form.asana.com/?k=C4sELCq6hAUsoWEY0kJwAA&d=15793206719). + +> You can try out our new python beta by installing version [v5.0.0](https://github.com/Asana/python-asana/tree/v5.0.0) (`pip install asana==5.0.0`) + +- API version: 1.0 +- Package version: 5.0.0 + +## Requirements. + +Python 3.4+ + +## Installation & Usage +### pip install from [PyPI](https://pypi.org/project/asana/) + +```sh +pip install asana +``` + +Then import the package: +```python +import asana +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import asana +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = "me" +opts = {} + +try: + # Get a user + user = users_api_instance.get_user(user_gid, opts) + pprint(user) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +### Example: GET, POST, PUT, DELETE on tasks + +#### GET - get multiple tasks +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +opts = { + 'limit': 50, + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", + 'assignee': "14641", + 'project': "321654", + 'section': "321654", + 'workspace': "321654", + 'completed_since': '2012-02-22T02:06:58.158Z', + 'modified_since': '2012-02-22T02:06:58.158Z', + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" +} + +try: + # Get multiple tasks + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +#### POST - create a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = { + "data": { + "name": "New Task", + "projects": [""], + } +} +opts = {} + +try: + # Create a task + task = tasks_api_instance.create_task(body, opts) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +#### PUT - update a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = { + "data": { + "name": "Updated Task", + } +} +task_gid = "" +opts = {} + +try: + # Update a task + task = tasks_api_instance.update_task(body, task_gid, opts) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) +``` + +#### DELETE - delete a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "" + +try: + # Delete a task + task = tasks_api_instance.delete_task(task_gid) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://app.asana.com/api/1.0* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AttachmentsApi* | [**create_attachment_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#create_attachment_for_object) | **POST** /attachments | Upload an attachment +*AttachmentsApi* | [**delete_attachment**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#delete_attachment) | **DELETE** /attachments/{attachment_gid} | Delete an attachment +*AttachmentsApi* | [**get_attachment**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#get_attachment) | **GET** /attachments/{attachment_gid} | Get an attachment +*AttachmentsApi* | [**get_attachments_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#get_attachments_for_object) | **GET** /attachments | Get attachments from an object +*AuditLogAPIApi* | [**get_audit_log_events**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AuditLogAPIApi.md#get_audit_log_events) | **GET** /workspaces/{workspace_gid}/audit_log_events | Get audit log events +*BatchAPIApi* | [**create_batch_request**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/BatchAPIApi.md#create_batch_request) | **POST** /batch | Submit parallel requests +*CustomFieldSettingsApi* | [**get_custom_field_settings_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldSettingsApi.md#get_custom_field_settings_for_portfolio) | **GET** /portfolios/{portfolio_gid}/custom_field_settings | Get a portfolio's custom fields +*CustomFieldSettingsApi* | [**get_custom_field_settings_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldSettingsApi.md#get_custom_field_settings_for_project) | **GET** /projects/{project_gid}/custom_field_settings | Get a project's custom fields +*CustomFieldsApi* | [**create_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#create_custom_field) | **POST** /custom_fields | Create a custom field +*CustomFieldsApi* | [**create_enum_option_for_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#create_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options | Create an enum option +*CustomFieldsApi* | [**delete_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#delete_custom_field) | **DELETE** /custom_fields/{custom_field_gid} | Delete a custom field +*CustomFieldsApi* | [**get_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#get_custom_field) | **GET** /custom_fields/{custom_field_gid} | Get a custom field +*CustomFieldsApi* | [**get_custom_fields_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#get_custom_fields_for_workspace) | **GET** /workspaces/{workspace_gid}/custom_fields | Get a workspace's custom fields +*CustomFieldsApi* | [**insert_enum_option_for_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#insert_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options/insert | Reorder a custom field's enum +*CustomFieldsApi* | [**update_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#update_custom_field) | **PUT** /custom_fields/{custom_field_gid} | Update a custom field +*CustomFieldsApi* | [**update_enum_option**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#update_enum_option) | **PUT** /enum_options/{enum_option_gid} | Update an enum option +*EventsApi* | [**get_events**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/EventsApi.md#get_events) | **GET** /events | Get events on a resource +*GoalRelationshipsApi* | [**add_supporting_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#add_supporting_relationship) | **POST** /goals/{goal_gid}/addSupportingRelationship | Add a supporting goal relationship +*GoalRelationshipsApi* | [**get_goal_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#get_goal_relationship) | **GET** /goal_relationships/{goal_relationship_gid} | Get a goal relationship +*GoalRelationshipsApi* | [**get_goal_relationships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#get_goal_relationships) | **GET** /goal_relationships | Get goal relationships +*GoalRelationshipsApi* | [**remove_supporting_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#remove_supporting_relationship) | **POST** /goals/{goal_gid}/removeSupportingRelationship | Removes a supporting goal relationship +*GoalRelationshipsApi* | [**update_goal_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#update_goal_relationship) | **PUT** /goal_relationships/{goal_relationship_gid} | Update a goal relationship +*GoalsApi* | [**add_followers**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#add_followers) | **POST** /goals/{goal_gid}/addFollowers | Add a collaborator to a goal +*GoalsApi* | [**create_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#create_goal) | **POST** /goals | Create a goal +*GoalsApi* | [**create_goal_metric**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#create_goal_metric) | **POST** /goals/{goal_gid}/setMetric | Create a goal metric +*GoalsApi* | [**delete_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#delete_goal) | **DELETE** /goals/{goal_gid} | Delete a goal +*GoalsApi* | [**get_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#get_goal) | **GET** /goals/{goal_gid} | Get a goal +*GoalsApi* | [**get_goals**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#get_goals) | **GET** /goals | Get goals +*GoalsApi* | [**get_parent_goals_for_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#get_parent_goals_for_goal) | **GET** /goals/{goal_gid}/parentGoals | Get parent goals from a goal +*GoalsApi* | [**remove_followers**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#remove_followers) | **POST** /goals/{goal_gid}/removeFollowers | Remove a collaborator from a goal +*GoalsApi* | [**update_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#update_goal) | **PUT** /goals/{goal_gid} | Update a goal +*GoalsApi* | [**update_goal_metric**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#update_goal_metric) | **POST** /goals/{goal_gid}/setMetricCurrentValue | Update a goal metric +*JobsApi* | [**get_job**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/JobsApi.md#get_job) | **GET** /jobs/{job_gid} | Get a job by id +*MembershipsApi* | [**create_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#create_membership) | **POST** /memberships | Create a membership +*MembershipsApi* | [**delete_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#delete_membership) | **DELETE** /memberships/{membership_gid} | Delete a membership +*MembershipsApi* | [**get_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#get_membership) | **GET** /memberships/{membership_gid} | Get a membership +*MembershipsApi* | [**get_memberships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#get_memberships) | **GET** /memberships | Get multiple memberships +*OrganizationExportsApi* | [**create_organization_export**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/OrganizationExportsApi.md#create_organization_export) | **POST** /organization_exports | Create an organization export request +*OrganizationExportsApi* | [**get_organization_export**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/OrganizationExportsApi.md#get_organization_export) | **GET** /organization_exports/{organization_export_gid} | Get details on an org export request +*PortfolioMembershipsApi* | [**get_portfolio_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfolioMembershipsApi.md#get_portfolio_membership) | **GET** /portfolio_memberships/{portfolio_membership_gid} | Get a portfolio membership +*PortfolioMembershipsApi* | [**get_portfolio_memberships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfolioMembershipsApi.md#get_portfolio_memberships) | **GET** /portfolio_memberships | Get multiple portfolio memberships +*PortfolioMembershipsApi* | [**get_portfolio_memberships_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfolioMembershipsApi.md#get_portfolio_memberships_for_portfolio) | **GET** /portfolios/{portfolio_gid}/portfolio_memberships | Get memberships from a portfolio +*PortfoliosApi* | [**add_custom_field_setting_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#add_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addCustomFieldSetting | Add a custom field to a portfolio +*PortfoliosApi* | [**add_item_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#add_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addItem | Add a portfolio item +*PortfoliosApi* | [**add_members_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#add_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addMembers | Add users to a portfolio +*PortfoliosApi* | [**create_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#create_portfolio) | **POST** /portfolios | Create a portfolio +*PortfoliosApi* | [**delete_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#delete_portfolio) | **DELETE** /portfolios/{portfolio_gid} | Delete a portfolio +*PortfoliosApi* | [**get_items_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#get_items_for_portfolio) | **GET** /portfolios/{portfolio_gid}/items | Get portfolio items +*PortfoliosApi* | [**get_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#get_portfolio) | **GET** /portfolios/{portfolio_gid} | Get a portfolio +*PortfoliosApi* | [**get_portfolios**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#get_portfolios) | **GET** /portfolios | Get multiple portfolios +*PortfoliosApi* | [**remove_custom_field_setting_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#remove_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeCustomFieldSetting | Remove a custom field from a portfolio +*PortfoliosApi* | [**remove_item_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#remove_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeItem | Remove a portfolio item +*PortfoliosApi* | [**remove_members_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#remove_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeMembers | Remove users from a portfolio +*PortfoliosApi* | [**update_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#update_portfolio) | **PUT** /portfolios/{portfolio_gid} | Update a portfolio +*ProjectBriefsApi* | [**create_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#create_project_brief) | **POST** /projects/{project_gid}/project_briefs | Create a project brief +*ProjectBriefsApi* | [**delete_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#delete_project_brief) | **DELETE** /project_briefs/{project_brief_gid} | Delete a project brief +*ProjectBriefsApi* | [**get_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#get_project_brief) | **GET** /project_briefs/{project_brief_gid} | Get a project brief +*ProjectBriefsApi* | [**update_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#update_project_brief) | **PUT** /project_briefs/{project_brief_gid} | Update a project brief +*ProjectMembershipsApi* | [**get_project_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectMembershipsApi.md#get_project_membership) | **GET** /project_memberships/{project_membership_gid} | Get a project membership +*ProjectMembershipsApi* | [**get_project_memberships_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectMembershipsApi.md#get_project_memberships_for_project) | **GET** /projects/{project_gid}/project_memberships | Get memberships from a project +*ProjectStatusesApi* | [**create_project_status_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#create_project_status_for_project) | **POST** /projects/{project_gid}/project_statuses | Create a project status +*ProjectStatusesApi* | [**delete_project_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#delete_project_status) | **DELETE** /project_statuses/{project_status_gid} | Delete a project status +*ProjectStatusesApi* | [**get_project_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#get_project_status) | **GET** /project_statuses/{project_status_gid} | Get a project status +*ProjectStatusesApi* | [**get_project_statuses_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#get_project_statuses_for_project) | **GET** /projects/{project_gid}/project_statuses | Get statuses from a project +*ProjectTemplatesApi* | [**delete_project_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#delete_project_template) | **DELETE** /project_templates/{project_template_gid} | Delete a project template +*ProjectTemplatesApi* | [**get_project_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#get_project_template) | **GET** /project_templates/{project_template_gid} | Get a project template +*ProjectTemplatesApi* | [**get_project_templates**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#get_project_templates) | **GET** /project_templates | Get multiple project templates +*ProjectTemplatesApi* | [**get_project_templates_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#get_project_templates_for_team) | **GET** /teams/{team_gid}/project_templates | Get a team's project templates +*ProjectTemplatesApi* | [**instantiate_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#instantiate_project) | **POST** /project_templates/{project_template_gid}/instantiateProject | Instantiate a project from a project template +*ProjectsApi* | [**add_custom_field_setting_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#add_custom_field_setting_for_project) | **POST** /projects/{project_gid}/addCustomFieldSetting | Add a custom field to a project +*ProjectsApi* | [**add_followers_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#add_followers_for_project) | **POST** /projects/{project_gid}/addFollowers | Add followers to a project +*ProjectsApi* | [**add_members_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#add_members_for_project) | **POST** /projects/{project_gid}/addMembers | Add users to a project +*ProjectsApi* | [**create_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#create_project) | **POST** /projects | Create a project +*ProjectsApi* | [**create_project_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#create_project_for_team) | **POST** /teams/{team_gid}/projects | Create a project in a team +*ProjectsApi* | [**create_project_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#create_project_for_workspace) | **POST** /workspaces/{workspace_gid}/projects | Create a project in a workspace +*ProjectsApi* | [**delete_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#delete_project) | **DELETE** /projects/{project_gid} | Delete a project +*ProjectsApi* | [**duplicate_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#duplicate_project) | **POST** /projects/{project_gid}/duplicate | Duplicate a project +*ProjectsApi* | [**get_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_project) | **GET** /projects/{project_gid} | Get a project +*ProjectsApi* | [**get_projects**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects) | **GET** /projects | Get multiple projects +*ProjectsApi* | [**get_projects_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects_for_task) | **GET** /tasks/{task_gid}/projects | Get projects a task is in +*ProjectsApi* | [**get_projects_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects_for_team) | **GET** /teams/{team_gid}/projects | Get a team's projects +*ProjectsApi* | [**get_projects_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects_for_workspace) | **GET** /workspaces/{workspace_gid}/projects | Get all projects in a workspace +*ProjectsApi* | [**get_task_counts_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_task_counts_for_project) | **GET** /projects/{project_gid}/task_counts | Get task count of a project +*ProjectsApi* | [**project_save_as_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#project_save_as_template) | **POST** /projects/{project_gid}/saveAsTemplate | Create a project template from a project +*ProjectsApi* | [**remove_custom_field_setting_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#remove_custom_field_setting_for_project) | **POST** /projects/{project_gid}/removeCustomFieldSetting | Remove a custom field from a project +*ProjectsApi* | [**remove_followers_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#remove_followers_for_project) | **POST** /projects/{project_gid}/removeFollowers | Remove followers from a project +*ProjectsApi* | [**remove_members_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#remove_members_for_project) | **POST** /projects/{project_gid}/removeMembers | Remove users from a project +*ProjectsApi* | [**update_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#update_project) | **PUT** /projects/{project_gid} | Update a project +*RulesApi* | [**trigger_rule**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/RulesApi.md#trigger_rule) | **POST** /rule_triggers/{rule_trigger_gid}/run | Trigger a rule +*SectionsApi* | [**add_task_for_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#add_task_for_section) | **POST** /sections/{section_gid}/addTask | Add task to section +*SectionsApi* | [**create_section_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#create_section_for_project) | **POST** /projects/{project_gid}/sections | Create a section in a project +*SectionsApi* | [**delete_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#delete_section) | **DELETE** /sections/{section_gid} | Delete a section +*SectionsApi* | [**get_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#get_section) | **GET** /sections/{section_gid} | Get a section +*SectionsApi* | [**get_sections_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#get_sections_for_project) | **GET** /projects/{project_gid}/sections | Get sections in a project +*SectionsApi* | [**insert_section_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#insert_section_for_project) | **POST** /projects/{project_gid}/sections/insert | Move or Insert sections +*SectionsApi* | [**update_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#update_section) | **PUT** /sections/{section_gid} | Update a section +*StatusUpdatesApi* | [**create_status_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#create_status_for_object) | **POST** /status_updates | Create a status update +*StatusUpdatesApi* | [**delete_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#delete_status) | **DELETE** /status_updates/{status_update_gid} | Delete a status update +*StatusUpdatesApi* | [**get_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#get_status) | **GET** /status_updates/{status_update_gid} | Get a status update +*StatusUpdatesApi* | [**get_statuses_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#get_statuses_for_object) | **GET** /status_updates | Get status updates from an object +*StoriesApi* | [**create_story_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#create_story_for_task) | **POST** /tasks/{task_gid}/stories | Create a story on a task +*StoriesApi* | [**delete_story**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#delete_story) | **DELETE** /stories/{story_gid} | Delete a story +*StoriesApi* | [**get_stories_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#get_stories_for_task) | **GET** /tasks/{task_gid}/stories | Get stories from a task +*StoriesApi* | [**get_story**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#get_story) | **GET** /stories/{story_gid} | Get a story +*StoriesApi* | [**update_story**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#update_story) | **PUT** /stories/{story_gid} | Update a story +*TagsApi* | [**create_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#create_tag) | **POST** /tags | Create a tag +*TagsApi* | [**create_tag_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#create_tag_for_workspace) | **POST** /workspaces/{workspace_gid}/tags | Create a tag in a workspace +*TagsApi* | [**delete_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#delete_tag) | **DELETE** /tags/{tag_gid} | Delete a tag +*TagsApi* | [**get_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tag) | **GET** /tags/{tag_gid} | Get a tag +*TagsApi* | [**get_tags**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tags) | **GET** /tags | Get multiple tags +*TagsApi* | [**get_tags_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tags_for_task) | **GET** /tasks/{task_gid}/tags | Get a task's tags +*TagsApi* | [**get_tags_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tags_for_workspace) | **GET** /workspaces/{workspace_gid}/tags | Get tags in a workspace +*TagsApi* | [**update_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#update_tag) | **PUT** /tags/{tag_gid} | Update a tag +*TaskTemplatesApi* | [**get_task_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TaskTemplatesApi.md#get_task_template) | **GET** /task_templates/{task_template_gid} | Get a task template +*TaskTemplatesApi* | [**get_task_templates**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TaskTemplatesApi.md#get_task_templates) | **GET** /task_templates | Get multiple task templates +*TaskTemplatesApi* | [**instantiate_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TaskTemplatesApi.md#instantiate_task) | **POST** /task_templates/{task_template_gid}/instantiateTask | Instantiate a task from a task template +*TasksApi* | [**add_dependencies_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_dependencies_for_task) | **POST** /tasks/{task_gid}/addDependencies | Set dependencies for a task +*TasksApi* | [**add_dependents_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_dependents_for_task) | **POST** /tasks/{task_gid}/addDependents | Set dependents for a task +*TasksApi* | [**add_followers_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_followers_for_task) | **POST** /tasks/{task_gid}/addFollowers | Add followers to a task +*TasksApi* | [**add_project_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_project_for_task) | **POST** /tasks/{task_gid}/addProject | Add a project to a task +*TasksApi* | [**add_tag_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_tag_for_task) | **POST** /tasks/{task_gid}/addTag | Add a tag to a task +*TasksApi* | [**create_subtask_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#create_subtask_for_task) | **POST** /tasks/{task_gid}/subtasks | Create a subtask +*TasksApi* | [**create_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#create_task) | **POST** /tasks | Create a task +*TasksApi* | [**delete_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#delete_task) | **DELETE** /tasks/{task_gid} | Delete a task +*TasksApi* | [**duplicate_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#duplicate_task) | **POST** /tasks/{task_gid}/duplicate | Duplicate a task +*TasksApi* | [**get_dependencies_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_dependencies_for_task) | **GET** /tasks/{task_gid}/dependencies | Get dependencies from a task +*TasksApi* | [**get_dependents_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_dependents_for_task) | **GET** /tasks/{task_gid}/dependents | Get dependents from a task +*TasksApi* | [**get_subtasks_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_subtasks_for_task) | **GET** /tasks/{task_gid}/subtasks | Get subtasks from a task +*TasksApi* | [**get_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_task) | **GET** /tasks/{task_gid} | Get a task +*TasksApi* | [**get_tasks**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks) | **GET** /tasks | Get multiple tasks +*TasksApi* | [**get_tasks_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_project) | **GET** /projects/{project_gid}/tasks | Get tasks from a project +*TasksApi* | [**get_tasks_for_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_section) | **GET** /sections/{section_gid}/tasks | Get tasks from a section +*TasksApi* | [**get_tasks_for_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_tag) | **GET** /tags/{tag_gid}/tasks | Get tasks from a tag +*TasksApi* | [**get_tasks_for_user_task_list**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_user_task_list) | **GET** /user_task_lists/{user_task_list_gid}/tasks | Get tasks from a user task list +*TasksApi* | [**remove_dependencies_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_dependencies_for_task) | **POST** /tasks/{task_gid}/removeDependencies | Unlink dependencies from a task +*TasksApi* | [**remove_dependents_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_dependents_for_task) | **POST** /tasks/{task_gid}/removeDependents | Unlink dependents from a task +*TasksApi* | [**remove_follower_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_follower_for_task) | **POST** /tasks/{task_gid}/removeFollowers | Remove followers from a task +*TasksApi* | [**remove_project_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_project_for_task) | **POST** /tasks/{task_gid}/removeProject | Remove a project from a task +*TasksApi* | [**remove_tag_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_tag_for_task) | **POST** /tasks/{task_gid}/removeTag | Remove a tag from a task +*TasksApi* | [**search_tasks_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#search_tasks_for_workspace) | **GET** /workspaces/{workspace_gid}/tasks/search | Search tasks in a workspace +*TasksApi* | [**set_parent_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#set_parent_for_task) | **POST** /tasks/{task_gid}/setParent | Set the parent of a task +*TasksApi* | [**update_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#update_task) | **PUT** /tasks/{task_gid} | Update a task +*TeamMembershipsApi* | [**get_team_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_membership) | **GET** /team_memberships/{team_membership_gid} | Get a team membership +*TeamMembershipsApi* | [**get_team_memberships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_memberships) | **GET** /team_memberships | Get team memberships +*TeamMembershipsApi* | [**get_team_memberships_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_memberships_for_team) | **GET** /teams/{team_gid}/team_memberships | Get memberships from a team +*TeamMembershipsApi* | [**get_team_memberships_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_memberships_for_user) | **GET** /users/{user_gid}/team_memberships | Get memberships from a user +*TeamsApi* | [**add_user_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#add_user_for_team) | **POST** /teams/{team_gid}/addUser | Add a user to a team +*TeamsApi* | [**create_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#create_team) | **POST** /teams | Create a team +*TeamsApi* | [**get_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#get_team) | **GET** /teams/{team_gid} | Get a team +*TeamsApi* | [**get_teams_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#get_teams_for_user) | **GET** /users/{user_gid}/teams | Get teams for a user +*TeamsApi* | [**get_teams_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#get_teams_for_workspace) | **GET** /workspaces/{workspace_gid}/teams | Get teams in a workspace +*TeamsApi* | [**remove_user_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#remove_user_for_team) | **POST** /teams/{team_gid}/removeUser | Remove a user from a team +*TeamsApi* | [**update_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#update_team) | **PUT** /teams/{team_gid} | Update a team +*TimePeriodsApi* | [**get_time_period**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimePeriodsApi.md#get_time_period) | **GET** /time_periods/{time_period_gid} | Get a time period +*TimePeriodsApi* | [**get_time_periods**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimePeriodsApi.md#get_time_periods) | **GET** /time_periods | Get time periods +*TimeTrackingEntriesApi* | [**create_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#create_time_tracking_entry) | **POST** /tasks/{task_gid}/time_tracking_entries | Create a time tracking entry +*TimeTrackingEntriesApi* | [**delete_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#delete_time_tracking_entry) | **DELETE** /time_tracking_entries/{time_tracking_entry_gid} | Delete a time tracking entry +*TimeTrackingEntriesApi* | [**get_time_tracking_entries_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#get_time_tracking_entries_for_task) | **GET** /tasks/{task_gid}/time_tracking_entries | Get time tracking entries for a task +*TimeTrackingEntriesApi* | [**get_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#get_time_tracking_entry) | **GET** /time_tracking_entries/{time_tracking_entry_gid} | Get a time tracking entry +*TimeTrackingEntriesApi* | [**update_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#update_time_tracking_entry) | **PUT** /time_tracking_entries/{time_tracking_entry_gid} | Update a time tracking entry +*TypeaheadApi* | [**typeahead_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TypeaheadApi.md#typeahead_for_workspace) | **GET** /workspaces/{workspace_gid}/typeahead | Get objects via typeahead +*UserTaskListsApi* | [**get_user_task_list**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UserTaskListsApi.md#get_user_task_list) | **GET** /user_task_lists/{user_task_list_gid} | Get a user task list +*UserTaskListsApi* | [**get_user_task_list_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UserTaskListsApi.md#get_user_task_list_for_user) | **GET** /users/{user_gid}/user_task_list | Get a user's task list +*UsersApi* | [**get_favorites_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_favorites_for_user) | **GET** /users/{user_gid}/favorites | Get a user's favorites +*UsersApi* | [**get_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_user) | **GET** /users/{user_gid} | Get a user +*UsersApi* | [**get_users**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_users) | **GET** /users | Get multiple users +*UsersApi* | [**get_users_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_users_for_team) | **GET** /teams/{team_gid}/users | Get users in a team +*UsersApi* | [**get_users_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_users_for_workspace) | **GET** /workspaces/{workspace_gid}/users | Get users in a workspace or organization +*WebhooksApi* | [**create_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#create_webhook) | **POST** /webhooks | Establish a webhook +*WebhooksApi* | [**delete_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#delete_webhook) | **DELETE** /webhooks/{webhook_gid} | Delete a webhook +*WebhooksApi* | [**get_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#get_webhook) | **GET** /webhooks/{webhook_gid} | Get a webhook +*WebhooksApi* | [**get_webhooks**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#get_webhooks) | **GET** /webhooks | Get multiple webhooks +*WebhooksApi* | [**update_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#update_webhook) | **PUT** /webhooks/{webhook_gid} | Update a webhook +*WorkspaceMembershipsApi* | [**get_workspace_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspaceMembershipsApi.md#get_workspace_membership) | **GET** /workspace_memberships/{workspace_membership_gid} | Get a workspace membership +*WorkspaceMembershipsApi* | [**get_workspace_memberships_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspaceMembershipsApi.md#get_workspace_memberships_for_user) | **GET** /users/{user_gid}/workspace_memberships | Get workspace memberships for a user +*WorkspaceMembershipsApi* | [**get_workspace_memberships_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspaceMembershipsApi.md#get_workspace_memberships_for_workspace) | **GET** /workspaces/{workspace_gid}/workspace_memberships | Get the workspace memberships for a workspace +*WorkspacesApi* | [**add_user_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#add_user_for_workspace) | **POST** /workspaces/{workspace_gid}/addUser | Add a user to a workspace or organization +*WorkspacesApi* | [**get_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#get_workspace) | **GET** /workspaces/{workspace_gid} | Get a workspace +*WorkspacesApi* | [**get_workspaces**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#get_workspaces) | **GET** /workspaces | Get multiple workspaces +*WorkspacesApi* | [**remove_user_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#remove_user_for_workspace) | **POST** /workspaces/{workspace_gid}/removeUser | Remove a user from a workspace or organization +*WorkspacesApi* | [**update_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#update_workspace) | **PUT** /workspaces/{workspace_gid} | Update a workspace + +## Accessing repsonse data + +### Example: Accessing task data +```python +. +. +. +try: + task = tasks_api_instance.get_task(task_gid, opts) + task_name = task['name'] + task_notes = task['notes'] +except ApiException as e: + . + . + . +``` + +## Accessing response status code and headers + +In the scenario you want to access the response headers or the status code along with the response data you can +provide the `_return_http_data_only` parameter argument in the request method and set the value to `False` + +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = 'me' # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = {} + +try: + # Get a user - Add asana-enable in the request + (api_response, status, headers) = users_api_instance.get_user(user_gid, opts, _return_http_data_only=False) # returns a tuple: (response, status, headers) + pprint(api_response) + pprint(status) + pprint(headers) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +## Adding deprecation flag: "asana-enable" or "asana-disable" header + +### On the client +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# Add asana-enable header for the client +api_client.default_headers['asana-enable'] = 'string_ids' +``` + +OR + +### On the request +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = 'me' # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = {} + +try: + # Get a user - Add asana-enable in the request + api_response = users_api_instance.get_user(user_gid, opts, header_params={'asana-enable': 'string_ids'}) + pprint(api_response) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +## Async requests with multithreading + +This client library uses multithreading to make async requests. To make async requests you can pass in `async_req=True` in the method call. + +NOTE: +- This feature disables our auto-pagination feature +- You will want to add logic to handle the Asana API rate limits + +The code belows is an example of how to make 15 async create task calls. It does not handle the Asana API rate limits. +You will have to implement your own solution for API rate limits based on your tier. + +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +threads = [] +for i in range(1, 15+1): + body = { + "data": { + "name": f"Task: {i}", + "projects": [""] + } + } + opts = {} + threads.append(tasks_api_instance.create_task(body, opts, async_req=True)) + +for thread in threads: + try: + pprint(thread.get()) + except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +## Pagination + +The pagination feature is enabled by default. This means two things: + +1: Endpoints that return a single response (EX: [get_task](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_task) ([Get a task](https://developers.asana.com/reference/gettask)), [get_project](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_project) ([Get a project](https://developers.asana.com/reference/getproject)), etc...) +will return a response with the `"data"` key abstracted from the response. + +Instead of returning: +```python +{ + "data": { + "gid": "123", + "actual_time_minutes": null, + "assignee": null, + ... + "workspace": { + "gid": "1234567", + "name": "user@example.com", + "resource_type": "workspace" + } + } +} +``` + +It returns: +```python +{ + "gid": "123", + "actual_time_minutes": null, + "assignee": null, + ... + "workspace": { + "gid": "1234567", + "name": "user@example.com", + "resource_type": "workspace" + } +} +``` + +2: Endpoints that return an array of resources (EX: [get_tasks](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks) ([Get multiple tasks](https://developers.asana.com/reference/gettasks)), [get_projects](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects) ([Get multiple projects](https://developers.asana.com/reference/getprojects)), etc...) +will return a generator object ([PageIterator.items](https://github.com/Asana/python-asana/blob/v5.0.0/asana/paget_iterator.py)) that you can use to iterate through each result. + +Example usage 1: +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +opts = {"project": ""} + +try: + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) + +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Example response: +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + . +``` + +Example usage 2: +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +opts = {"project": ""} + +try: + tasks = tasks_api_instance.get_tasks(opts) + pprint(list(tasks)) + +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Example response: +```python +[{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + .] +``` + +### Ending pagination early + +In the scenario where you want to end the pagination early, you can specify an `item_limit` in the method call. This will stop the iterator from going past that limit. + +**Example Scenario:** You have 1000 tasks in a project and are only interested in the first 2 tasks. Instead of letting the pagination code continue to run to get all those 1000 tasks you can specify that you only want the first X results with `item_limit`. + +**Without `item_limit` - The for loop will continue to run until it runs out of tasks:** + +```python + ... + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + . + <1000th_TASK> +``` + +**With `item_limit` - the for loop will stop at the `item_limit` you specified:** +```python + ... + tasks = tasks_api_instance.get_tasks(opts, item_limit=2) + for task in tasks: + pprint(task) + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, +{'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'} +``` + +Alternatively, if you are iterating over the generator object in a for loop, you can also just break out of the loop. + +**EX:** +```python +... +opts = {'project': ""} + +try: + count = 0 + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + if count == 2: + break + pprint(task) + count += 1 + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + {'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'} +``` + +### Disabling default pagination behaviour + +If you do not want to use the default pagination behaviour there are two ways to disbale it. + +1: Per request - Disable pagination behavior for a single request - pass in `full_payload=True` in the method request +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +opts = {"project": "", "limit": 2} + +try: + tasks = tasks_api_instance.get_tasks(opts, full_payload=True) + pprint(tasks) +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Sample response: +```python +{'data': [{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + {'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}], + 'next_page': {'offset': 'eyJ0...', + 'path': '/tasks?project=789&limit=2&offset=eyJ0...', + 'uri': 'https://app.asana.com/api/1.0/tasks?project=789&limit=2&offset=eyJ0...'}} +``` + +2: Globally - Disable pagination behavior for all requests - Set `return_page_iterator` to False +```python +... +configuration = asana.Configuration() +configuration.access_token = '' +configuration.return_page_iterator = False +api_client = asana.ApiClient(configuration) +... +``` + +## Documentation for Using the `call_api` method + +Use this to make HTTP calls when the endpoint does not exist in the current library version or has bugs + +### Example: GET, POST, PUT, DELETE on tasks + +#### GET - get a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # GET - get a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "GET", + path_params={"task_gid": ""}, + query_params={}, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### GET - get multiple tasks -> with opt_fields +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # GET - get multiple tasks + api_response = api_client.call_api( + "/tasks", + "GET", + path_params={}, + query_params={ + "project": "", + "opt_fields": "name,notes,projects", + }, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### POST - create a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # POST - create a task + api_response = api_client.call_api( + "/tasks", + "POST", + path_params={}, + query_params={}, + header_params={ + "Accept": "application/json; charset=utf-8", + "Content-Type": "application/json; charset=utf-8", + }, + body={ + "data": { + "name": "New Task", + "projects": [""], + } + }, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### PUT - update a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # PUT - update a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "PUT", + path_params={"task_gid": ""}, + query_params={}, + header_params={ + "Accept": "application/json; charset=utf-8", + "Content-Type": "application/json; charset=utf-8", + }, + body={ + "data": { + "name": "Updated Task", + } + }, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### DELETE - delete a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # DELETE - delete a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "DELETE", + path_params={"task_gid": ""}, + query_params={}, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +[release-image]: https://img.shields.io/github/release/asana/python-asana.svg + +[pypi-image]: https://img.shields.io/pypi/v/asana.svg?style=flat-square +[pypi-url]: https://pypi.python.org/pypi/asana/ diff --git a/asana/__init__.py b/asana/__init__.py new file mode 100644 index 00000000..c083de38 --- /dev/null +++ b/asana/__init__.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import apis into sdk package +from asana.api.attachments_api import AttachmentsApi +from asana.api.audit_log_api_api import AuditLogAPIApi +from asana.api.batch_api_api import BatchAPIApi +from asana.api.custom_field_settings_api import CustomFieldSettingsApi +from asana.api.custom_fields_api import CustomFieldsApi +from asana.api.events_api import EventsApi +from asana.api.goal_relationships_api import GoalRelationshipsApi +from asana.api.goals_api import GoalsApi +from asana.api.jobs_api import JobsApi +from asana.api.memberships_api import MembershipsApi +from asana.api.organization_exports_api import OrganizationExportsApi +from asana.api.portfolio_memberships_api import PortfolioMembershipsApi +from asana.api.portfolios_api import PortfoliosApi +from asana.api.project_briefs_api import ProjectBriefsApi +from asana.api.project_memberships_api import ProjectMembershipsApi +from asana.api.project_statuses_api import ProjectStatusesApi +from asana.api.project_templates_api import ProjectTemplatesApi +from asana.api.projects_api import ProjectsApi +from asana.api.rules_api import RulesApi +from asana.api.sections_api import SectionsApi +from asana.api.status_updates_api import StatusUpdatesApi +from asana.api.stories_api import StoriesApi +from asana.api.tags_api import TagsApi +from asana.api.task_templates_api import TaskTemplatesApi +from asana.api.tasks_api import TasksApi +from asana.api.team_memberships_api import TeamMembershipsApi +from asana.api.teams_api import TeamsApi +from asana.api.time_periods_api import TimePeriodsApi +from asana.api.time_tracking_entries_api import TimeTrackingEntriesApi +from asana.api.typeahead_api import TypeaheadApi +from asana.api.user_task_lists_api import UserTaskListsApi +from asana.api.users_api import UsersApi +from asana.api.webhooks_api import WebhooksApi +from asana.api.workspace_memberships_api import WorkspaceMembershipsApi +from asana.api.workspaces_api import WorkspacesApi +# import ApiClient +from asana.api_client import ApiClient +from asana.configuration import Configuration diff --git a/asana/api/__init__.py b/asana/api/__init__.py new file mode 100644 index 00000000..df32f318 --- /dev/null +++ b/asana/api/__init__.py @@ -0,0 +1,40 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from asana.api.attachments_api import AttachmentsApi +from asana.api.audit_log_api_api import AuditLogAPIApi +from asana.api.batch_api_api import BatchAPIApi +from asana.api.custom_field_settings_api import CustomFieldSettingsApi +from asana.api.custom_fields_api import CustomFieldsApi +from asana.api.events_api import EventsApi +from asana.api.goal_relationships_api import GoalRelationshipsApi +from asana.api.goals_api import GoalsApi +from asana.api.jobs_api import JobsApi +from asana.api.memberships_api import MembershipsApi +from asana.api.organization_exports_api import OrganizationExportsApi +from asana.api.portfolio_memberships_api import PortfolioMembershipsApi +from asana.api.portfolios_api import PortfoliosApi +from asana.api.project_briefs_api import ProjectBriefsApi +from asana.api.project_memberships_api import ProjectMembershipsApi +from asana.api.project_statuses_api import ProjectStatusesApi +from asana.api.project_templates_api import ProjectTemplatesApi +from asana.api.projects_api import ProjectsApi +from asana.api.rules_api import RulesApi +from asana.api.sections_api import SectionsApi +from asana.api.status_updates_api import StatusUpdatesApi +from asana.api.stories_api import StoriesApi +from asana.api.tags_api import TagsApi +from asana.api.task_templates_api import TaskTemplatesApi +from asana.api.tasks_api import TasksApi +from asana.api.team_memberships_api import TeamMembershipsApi +from asana.api.teams_api import TeamsApi +from asana.api.time_periods_api import TimePeriodsApi +from asana.api.time_tracking_entries_api import TimeTrackingEntriesApi +from asana.api.typeahead_api import TypeaheadApi +from asana.api.user_task_lists_api import UserTaskListsApi +from asana.api.users_api import UsersApi +from asana.api.webhooks_api import WebhooksApi +from asana.api.workspace_memberships_api import WorkspaceMembershipsApi +from asana.api.workspaces_api import WorkspacesApi diff --git a/asana/api/attachments_api.py b/asana/api/attachments_api.py new file mode 100644 index 00000000..64724e1d --- /dev/null +++ b/asana/api/attachments_api.py @@ -0,0 +1,633 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class AttachmentsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_attachment_for_object(self, opts, **kwargs): # noqa: E501 + """Upload an attachment # noqa: E501 + + Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_attachment_for_object(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_subtype: + :param str file: + :param str parent: + :param str url: + :param str name: + :param bool connect_to_app: + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_attachment_for_object_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.create_attachment_for_object_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def create_attachment_for_object_with_http_info(self, opts, **kwargs): # noqa: E501 + """Upload an attachment # noqa: E501 + + Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_attachment_for_object_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_subtype: + :param str file: + :param str parent: + :param str url: + :param str name: + :param bool connect_to_app: + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_attachment_for_object" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + if 'resource_subtype' in opts: + form_params.append(('resource_subtype', opts['resource_subtype'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('resource_subtype') + if 'file' in opts: + local_var_files['file'] = opts['file'] # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('file') + if 'parent' in opts: + form_params.append(('parent', opts['parent'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('parent') + if 'url' in opts: + form_params.append(('url', opts['url'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('url') + if 'name' in opts: + form_params.append(('name', opts['name'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('name') + if 'connect_to_app' in opts: + form_params.append(('connect_to_app', opts['connect_to_app'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('connect_to_app') + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/attachments', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/attachments', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_attachment(self, attachment_gid, **kwargs): # noqa: E501 + """Delete an attachment # noqa: E501 + + Deletes a specific, existing attachment. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_attachment(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_attachment_with_http_info(attachment_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_attachment_with_http_info(attachment_gid, **kwargs) # noqa: E501 + return data + + def delete_attachment_with_http_info(self, attachment_gid, **kwargs): # noqa: E501 + """Delete an attachment # noqa: E501 + + Deletes a specific, existing attachment. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_attachment_with_http_info(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_attachment" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'attachment_gid' is set + if (attachment_gid is None): + raise ValueError("Missing the required parameter `attachment_gid` when calling `delete_attachment`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['attachment_gid'] = attachment_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/attachments/{attachment_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attachment(self, attachment_gid, opts, **kwargs): # noqa: E501 + """Get an attachment # noqa: E501 + + Get the full record for a single attachment. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachment(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_attachment_with_http_info(attachment_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_attachment_with_http_info(attachment_gid, opts, **kwargs) # noqa: E501 + return data + + def get_attachment_with_http_info(self, attachment_gid, opts, **kwargs): # noqa: E501 + """Get an attachment # noqa: E501 + + Get the full record for a single attachment. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachment_with_http_info(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attachment" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'attachment_gid' is set + if (attachment_gid is None): + raise ValueError("Missing the required parameter `attachment_gid` when calling `get_attachment`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['attachment_gid'] = attachment_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/attachments/{attachment_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attachments_for_object(self, parent, opts, **kwargs): # noqa: E501 + """Get attachments from an object # noqa: E501 + + Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachments_for_object(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_attachments_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_attachments_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + return data + + def get_attachments_for_object_with_http_info(self, parent, opts, **kwargs): # noqa: E501 + """Get attachments from an object # noqa: E501 + + Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachments_for_object_with_http_info(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attachments_for_object" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'parent' is set + if (parent is None): + raise ValueError("Missing the required parameter `parent` when calling `get_attachments_for_object`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['parent'] = parent + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/attachments', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/attachments', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/audit_log_api_api.py b/asana/api/audit_log_api_api.py new file mode 100644 index 00000000..39d001e1 --- /dev/null +++ b/asana/api/audit_log_api_api.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class AuditLogAPIApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_audit_log_events(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get audit log events # noqa: E501 + + Retrieve the audit log events that have been captured in your domain. This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results. There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match. The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters. *Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.* When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_log_events(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param datetime start_at: Filter to events created after this time (inclusive). + :param datetime end_at: Filter to events created before this time (exclusive). + :param str event_type: Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + :param str actor_type: Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + :param str actor_gid: Filter to events triggered by the actor with this ID. + :param str resource_gid: Filter to events with this resource ID. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :return: AuditLogEventArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_audit_log_events_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_log_events_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_audit_log_events_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get audit log events # noqa: E501 + + Retrieve the audit log events that have been captured in your domain. This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results. There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match. The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters. *Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.* When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_log_events_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param datetime start_at: Filter to events created after this time (inclusive). + :param datetime end_at: Filter to events created before this time (exclusive). + :param str event_type: Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + :param str actor_type: Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + :param str actor_gid: Filter to events triggered by the actor with this ID. + :param str resource_gid: Filter to events with this resource ID. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :return: AuditLogEventArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_log_events" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_audit_log_events`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/audit_log_events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/audit_log_events', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/audit_log_events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/batch_api_api.py b/asana/api/batch_api_api.py new file mode 100644 index 00000000..23b34e9f --- /dev/null +++ b/asana/api/batch_api_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class BatchAPIApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_batch_request(self, body, opts, **kwargs): # noqa: E501 + """Submit parallel requests # noqa: E501 + + Make multiple requests in parallel to Asana's API. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_batch_request(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The requests to batch together via the Batch API. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: BatchResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_batch_request_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_batch_request_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_batch_request_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Submit parallel requests # noqa: E501 + + Make multiple requests in parallel to Asana's API. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_batch_request_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The requests to batch together via the Batch API. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: BatchResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_batch_request" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_batch_request`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/batch', + "method": 'POST', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/custom_field_settings_api.py b/asana/api/custom_field_settings_api.py new file mode 100644 index 00000000..9c0d15b9 --- /dev/null +++ b/asana/api/custom_field_settings_api.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class CustomFieldSettingsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_custom_field_settings_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio's custom fields # noqa: E501 + + Returns a list of all of the custom fields settings on a portfolio, in compact form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_field_settings_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_field_settings_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_field_settings_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio's custom fields # noqa: E501 + + Returns a list of all of the custom fields settings on a portfolio, in compact form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_field_settings_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_custom_field_settings_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios/{portfolio_gid}/custom_field_settings', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_field_settings_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project's custom fields # noqa: E501 + + 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` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_field_settings_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_field_settings_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_field_settings_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project's custom fields # noqa: E501 + + 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` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_field_settings_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_custom_field_settings_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/custom_field_settings', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/custom_fields_api.py b/asana/api/custom_fields_api.py new file mode 100644 index 00000000..b811964a --- /dev/null +++ b/asana/api/custom_fields_api.py @@ -0,0 +1,1176 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class CustomFieldsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_custom_field(self, body, opts, **kwargs): # noqa: E501 + """Create a custom field # noqa: E501 + + Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as `Due Date` or `Assignee`. A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`, `date`, or `people`. Returns the full record of the newly created custom field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_custom_field(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The custom field object to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_custom_field_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_custom_field_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_custom_field_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a custom field # noqa: E501 + + Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as `Due Date` or `Assignee`. A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`, `date`, or `people`. Returns the full record of the newly created custom field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_custom_field_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The custom field object to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_enum_option_for_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Create an enum option # noqa: E501 + + Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_enum_option_for_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def create_enum_option_for_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Create an enum option # noqa: E501 + + Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_enum_option_for_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_enum_option_for_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `create_enum_option_for_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_custom_field(self, custom_field_gid, **kwargs): # noqa: E501 + """Delete a custom field # noqa: E501 + + 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_custom_field_with_http_info(custom_field_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_custom_field_with_http_info(custom_field_gid, **kwargs) # noqa: E501 + return data + + def delete_custom_field_with_http_info(self, custom_field_gid, **kwargs): # noqa: E501 + """Delete a custom field # noqa: E501 + + 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `delete_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Get a custom field # noqa: E501 + + Get the complete definition of a custom field’s metadata. Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Get a custom field # noqa: E501 + + Get the complete definition of a custom field’s metadata. Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `get_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_fields_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace's custom fields # noqa: E501 + + Returns a list of the compact representation of all of the custom fields in a workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_fields_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_fields_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_fields_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_fields_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace's custom fields # noqa: E501 + + Returns a list of the compact representation of all of the custom fields in a workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_fields_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_fields_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_custom_fields_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/custom_fields', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/custom_fields', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/custom_fields', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def insert_enum_option_for_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Reorder a custom field's enum # noqa: E501 + + Moves a particular enum option to be either before or after another specified enum option in the custom field. Locked custom fields can only be reordered by the user who locked the field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_enum_option_for_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.insert_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.insert_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def insert_enum_option_for_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Reorder a custom field's enum # noqa: E501 + + Moves a particular enum option to be either before or after another specified enum option in the custom field. Locked custom fields can only be reordered by the user who locked the field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_enum_option_for_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method insert_enum_option_for_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `insert_enum_option_for_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Update a custom field # noqa: E501 + + A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The custom field object with all updated properties. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def update_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Update a custom field # noqa: E501 + + A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The custom field object with all updated properties. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `update_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_enum_option(self, enum_option_gid, opts, **kwargs): # noqa: E501 + """Update an enum option # noqa: E501 + + 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_enum_option(enum_option_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str enum_option_gid: Globally unique identifier for the enum option. (required) + :param dict body: The enum option object to update + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_enum_option_with_http_info(enum_option_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_enum_option_with_http_info(enum_option_gid, opts, **kwargs) # noqa: E501 + return data + + def update_enum_option_with_http_info(self, enum_option_gid, opts, **kwargs): # noqa: E501 + """Update an enum option # noqa: E501 + + 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. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_enum_option_with_http_info(enum_option_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str enum_option_gid: Globally unique identifier for the enum option. (required) + :param dict body: The enum option object to update + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_enum_option" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'enum_option_gid' is set + if (enum_option_gid is None): + raise ValueError("Missing the required parameter `enum_option_gid` when calling `update_enum_option`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['enum_option_gid'] = enum_option_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/enum_options/{enum_option_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/enum_options/{enum_option_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/enum_options/{enum_option_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/events_api.py b/asana/api/events_api.py new file mode 100644 index 00000000..c03fbfd0 --- /dev/null +++ b/asana/api/events_api.py @@ -0,0 +1,177 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class EventsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_events(self, resource, opts, **kwargs): # noqa: E501 + """Get events on a resource # noqa: E501 + + Returns the full record for all events that have occurred since the sync token was created. A `GET` request to the endpoint `/[path_to_resource]/events` can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, `has_more: true` will be returned in the response, indicating that there are more events to pull. *Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events(resource, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource: A resource ID to subscribe to. The resource can be a task or project. (required) + :param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EventResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_events_with_http_info(resource, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_events_with_http_info(resource, opts, **kwargs) # noqa: E501 + return data + + def get_events_with_http_info(self, resource, opts, **kwargs): # noqa: E501 + """Get events on a resource # noqa: E501 + + Returns the full record for all events that have occurred since the sync token was created. A `GET` request to the endpoint `/[path_to_resource]/events` can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, `has_more: true` will be returned in the response, indicating that there are more events to pull. *Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_with_http_info(resource, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource: A resource ID to subscribe to. The resource can be a task or project. (required) + :param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EventResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource' is set + if (resource is None): + raise ValueError("Missing the required parameter `resource` when calling `get_events`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['resource'] = resource + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return EventIterator( + self.api_client, + { + "resource_path": '/events', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/goal_relationships_api.py b/asana/api/goal_relationships_api.py new file mode 100644 index 00000000..13711369 --- /dev/null +++ b/asana/api/goal_relationships_api.py @@ -0,0 +1,761 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class GoalRelationshipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_supporting_relationship(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a supporting goal relationship # noqa: E501 + + Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_supporting_relationship(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be added to the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_supporting_relationship_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_supporting_relationship_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def add_supporting_relationship_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a supporting goal relationship # noqa: E501 + + Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_supporting_relationship_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be added to the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_supporting_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_supporting_relationship`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `add_supporting_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/addSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/addSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/addSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_goal_relationship(self, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Get a goal relationship # noqa: E501 + + Returns the complete updated goal relationship record for a single goal relationship. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationship(goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goal_relationship_with_http_info(goal_relationship_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goal_relationship_with_http_info(goal_relationship_gid, opts, **kwargs) # noqa: E501 + return data + + def get_goal_relationship_with_http_info(self, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Get a goal relationship # noqa: E501 + + Returns the complete updated goal relationship record for a single goal relationship. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationship_with_http_info(goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_goal_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_relationship_gid' is set + if (goal_relationship_gid is None): + raise ValueError("Missing the required parameter `goal_relationship_gid` when calling `get_goal_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_relationship_gid'] = goal_relationship_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_goal_relationships(self, supported_goal, opts, **kwargs): # noqa: E501 + """Get goal relationships # noqa: E501 + + Returns compact goal relationship records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationships(supported_goal, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str supported_goal: Globally unique identifier for the supported goal in the goal relationship. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str resource_subtype: If provided, filter to goal relationships with a given resource_subtype. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goal_relationships_with_http_info(supported_goal, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goal_relationships_with_http_info(supported_goal, opts, **kwargs) # noqa: E501 + return data + + def get_goal_relationships_with_http_info(self, supported_goal, opts, **kwargs): # noqa: E501 + """Get goal relationships # noqa: E501 + + Returns compact goal relationship records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationships_with_http_info(supported_goal, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str supported_goal: Globally unique identifier for the supported goal in the goal relationship. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str resource_subtype: If provided, filter to goal relationships with a given resource_subtype. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_goal_relationships" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'supported_goal' is set + if (supported_goal is None): + raise ValueError("Missing the required parameter `supported_goal` when calling `get_goal_relationships`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['supported_goal'] = supported_goal + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goal_relationships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/goal_relationships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/goal_relationships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_supporting_relationship(self, body, goal_gid, **kwargs): # noqa: E501 + """Removes a supporting goal relationship # noqa: E501 + + Removes a goal relationship for a given parent goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_supporting_relationship(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be removed from the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_supporting_relationship_with_http_info(body, goal_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_supporting_relationship_with_http_info(body, goal_gid, **kwargs) # noqa: E501 + return data + + def remove_supporting_relationship_with_http_info(self, body, goal_gid, **kwargs): # noqa: E501 + """Removes a supporting goal relationship # noqa: E501 + + Removes a goal relationship for a given parent goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_supporting_relationship_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be removed from the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_supporting_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_supporting_relationship`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `remove_supporting_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/removeSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/removeSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/removeSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_goal_relationship(self, body, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Update a goal relationship # noqa: E501 + + An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_relationship(body, goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal relationship. (required) + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_goal_relationship_with_http_info(body, goal_relationship_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_goal_relationship_with_http_info(body, goal_relationship_gid, opts, **kwargs) # noqa: E501 + return data + + def update_goal_relationship_with_http_info(self, body, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Update a goal relationship # noqa: E501 + + An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_relationship_with_http_info(body, goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal relationship. (required) + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_goal_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_goal_relationship`") # noqa: E501 + # verify the required parameter 'goal_relationship_gid' is set + if (goal_relationship_gid is None): + raise ValueError("Missing the required parameter `goal_relationship_gid` when calling `update_goal_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_relationship_gid'] = goal_relationship_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/goals_api.py b/asana/api/goals_api.py new file mode 100644 index 00000000..79fb51d9 --- /dev/null +++ b/asana/api/goals_api.py @@ -0,0 +1,1486 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class GoalsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_followers(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a collaborator to a goal # noqa: E501 + + Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be added as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def add_followers_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a collaborator to a goal # noqa: E501 + + Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be added as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_followers" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_followers`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `add_followers`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_goal(self, body, opts, **kwargs): # noqa: E501 + """Create a goal # noqa: E501 + + Creates a new goal in a workspace or team. Returns the full record of the newly created goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_goal_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_goal_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_goal_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a goal # noqa: E501 + + Creates a new goal in a workspace or team. Returns the full record of the newly created goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_goal_metric(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Create a goal metric # noqa: E501 + + Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal_metric(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal metric to create. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def create_goal_metric_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Create a goal metric # noqa: E501 + + Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal_metric_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal metric to create. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_goal_metric" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_goal_metric`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `create_goal_metric`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetric', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/setMetric', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetric', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_goal(self, goal_gid, **kwargs): # noqa: E501 + """Delete a goal # noqa: E501 + + A specific, existing goal can be deleted by making a DELETE request on the URL for that goal. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_goal(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_goal_with_http_info(goal_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_goal_with_http_info(goal_gid, **kwargs) # noqa: E501 + return data + + def delete_goal_with_http_info(self, goal_gid, **kwargs): # noqa: E501 + """Delete a goal # noqa: E501 + + A specific, existing goal can be deleted by making a DELETE request on the URL for that goal. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_goal_with_http_info(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `delete_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_goal(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get a goal # noqa: E501 + + Returns the complete goal record for a single goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + return data + + def get_goal_with_http_info(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get a goal # noqa: E501 + + Returns the complete goal record for a single goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_with_http_info(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `get_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_goals(self, opts, **kwargs): # noqa: E501 + """Get goals # noqa: E501 + + Returns compact goal records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goals(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: Globally unique identifier for supporting portfolio. + :param str project: Globally unique identifier for supporting project. + :param str task: Globally unique identifier for supporting task. + :param bool is_workspace_level: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + :param str team: Globally unique identifier for the team. + :param str workspace: Globally unique identifier for the workspace. + :param list[str] time_periods: Globally unique identifiers for the time periods. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goals_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goals_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_goals_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get goals # noqa: E501 + + Returns compact goal records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goals_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: Globally unique identifier for supporting portfolio. + :param str project: Globally unique identifier for supporting project. + :param str task: Globally unique identifier for supporting task. + :param bool is_workspace_level: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + :param str team: Globally unique identifier for the team. + :param str workspace: Globally unique identifier for the workspace. + :param list[str] time_periods: Globally unique identifiers for the time periods. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_goals" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/goals', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/goals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_parent_goals_for_goal(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get parent goals from a goal # noqa: E501 + + Returns a compact representation of all of the parent goals of a goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_parent_goals_for_goal(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_parent_goals_for_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_parent_goals_for_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + return data + + def get_parent_goals_for_goal_with_http_info(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get parent goals from a goal # noqa: E501 + + Returns a compact representation of all of the parent goals of a goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_parent_goals_for_goal_with_http_info(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_parent_goals_for_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `get_parent_goals_for_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/parentGoals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/goals/{goal_gid}/parentGoals', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/goals/{goal_gid}/parentGoals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_followers(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Remove a collaborator from a goal # noqa: E501 + + Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be removed as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_followers_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Remove a collaborator from a goal # noqa: E501 + + Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be removed as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_followers" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_followers`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `remove_followers`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_goal(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal # noqa: E501 + + An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_goal_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_goal_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def update_goal_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal # noqa: E501 + + An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_goal`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `update_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_goal_metric(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal metric # noqa: E501 + + Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code. Returns the complete updated goal metric record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_metric(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal metric. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def update_goal_metric_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal metric # noqa: E501 + + Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code. Returns the complete updated goal metric record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_metric_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal metric. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_goal_metric" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_goal_metric`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `update_goal_metric`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetricCurrentValue', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/setMetricCurrentValue', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetricCurrentValue', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/jobs_api.py b/asana/api/jobs_api.py new file mode 100644 index 00000000..f97ce7f9 --- /dev/null +++ b/asana/api/jobs_api.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class JobsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_job(self, job_gid, opts, **kwargs): # noqa: E501 + """Get a job by id # noqa: E501 + + Returns the full record for a job. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_job(job_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str job_gid: Globally unique identifier for the job. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_job_with_http_info(job_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_job_with_http_info(job_gid, opts, **kwargs) # noqa: E501 + return data + + def get_job_with_http_info(self, job_gid, opts, **kwargs): # noqa: E501 + """Get a job by id # noqa: E501 + + Returns the full record for a job. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_job_with_http_info(job_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str job_gid: Globally unique identifier for the job. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_job" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'job_gid' is set + if (job_gid is None): + raise ValueError("Missing the required parameter `job_gid` when calling `get_job`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['job_gid'] = job_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/jobs/{job_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/jobs/{job_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/jobs/{job_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/memberships_api.py b/asana/api/memberships_api.py new file mode 100644 index 00000000..aa9de516 --- /dev/null +++ b/asana/api/memberships_api.py @@ -0,0 +1,589 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class MembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_membership(self, opts, **kwargs): # noqa: E501 + """Create a membership # noqa: E501 + + Creates a new membership in a `goal`. `Teams` or `users` can be a member of `goals`. Returns the full record of the newly created membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_membership(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the membership. + :return: MembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_membership_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.create_membership_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501 + """Create a membership # noqa: E501 + + Creates a new membership in a `goal`. `Teams` or `users` can be a member of `goals`. Returns the full record of the newly created membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_membership_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the membership. + :return: MembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_membership" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/memberships', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/memberships', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_membership(self, membership_gid, **kwargs): # noqa: E501 + """Delete a membership # noqa: E501 + + A specific, existing membership can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_membership(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_membership_with_http_info(membership_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_membership_with_http_info(membership_gid, **kwargs) # noqa: E501 + return data + + def delete_membership_with_http_info(self, membership_gid, **kwargs): # noqa: E501 + """Delete a membership # noqa: E501 + + A specific, existing membership can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_membership_with_http_info(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'membership_gid' is set + if (membership_gid is None): + raise ValueError("Missing the required parameter `membership_gid` when calling `delete_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['membership_gid'] = membership_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/memberships/{membership_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_membership(self, membership_gid, opts, **kwargs): # noqa: E501 + """Get a membership # noqa: E501 + + Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_membership(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_membership_with_http_info(membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_membership_with_http_info(membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_membership_with_http_info(self, membership_gid, opts, **kwargs): # noqa: E501 + """Get a membership # noqa: E501 + + Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_membership_with_http_info(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'membership_gid' is set + if (membership_gid is None): + raise ValueError("Missing the required parameter `membership_gid` when calling `get_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['membership_gid'] = membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/memberships/{membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_memberships(self, opts, **kwargs): # noqa: E501 + """Get multiple memberships # noqa: E501 + + Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_memberships(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for `goal` or `project`. + :param str member: Globally unique identifier for `team` or `user`. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: MembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_memberships_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_memberships_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_memberships_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple memberships # noqa: E501 + + Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_memberships_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for `goal` or `project`. + :param str member: Globally unique identifier for `team` or `user`. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: MembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_memberships" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/organization_exports_api.py b/asana/api/organization_exports_api.py new file mode 100644 index 00000000..b30a1427 --- /dev/null +++ b/asana/api/organization_exports_api.py @@ -0,0 +1,314 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class OrganizationExportsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_organization_export(self, body, opts, **kwargs): # noqa: E501 + """Create an organization export request # noqa: E501 + + This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_organization_export(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The organization to export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_organization_export_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_organization_export_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_organization_export_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create an organization export request # noqa: E501 + + This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_organization_export_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The organization to export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_organization_export" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_organization_export`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/organization_exports', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/organization_exports', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/organization_exports', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_organization_export(self, organization_export_gid, opts, **kwargs): # noqa: E501 + """Get details on an org export request # noqa: E501 + + Returns details of a previously-requested Organization export. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_organization_export(organization_export_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str organization_export_gid: Globally unique identifier for the organization export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_organization_export_with_http_info(organization_export_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_organization_export_with_http_info(organization_export_gid, opts, **kwargs) # noqa: E501 + return data + + def get_organization_export_with_http_info(self, organization_export_gid, opts, **kwargs): # noqa: E501 + """Get details on an org export request # noqa: E501 + + Returns details of a previously-requested Organization export. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_organization_export_with_http_info(organization_export_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str organization_export_gid: Globally unique identifier for the organization export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_organization_export" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'organization_export_gid' is set + if (organization_export_gid is None): + raise ValueError("Missing the required parameter `organization_export_gid` when calling `get_organization_export`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['organization_export_gid'] = organization_export_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/organization_exports/{organization_export_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/organization_exports/{organization_export_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/organization_exports/{organization_export_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/portfolio_memberships_api.py b/asana/api/portfolio_memberships_api.py new file mode 100644 index 00000000..eb9d29c3 --- /dev/null +++ b/asana/api/portfolio_memberships_api.py @@ -0,0 +1,466 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class PortfolioMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_portfolio_membership(self, portfolio_membership_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio membership # noqa: E501 + + Returns the complete portfolio record for a single portfolio membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_membership(portfolio_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_membership_with_http_info(portfolio_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_membership_with_http_info(portfolio_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_membership_with_http_info(self, portfolio_membership_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio membership # noqa: E501 + + Returns the complete portfolio record for a single portfolio membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_membership_with_http_info(portfolio_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_portfolio_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_membership_gid' is set + if (portfolio_membership_gid is None): + raise ValueError("Missing the required parameter `portfolio_membership_gid` when calling `get_portfolio_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_membership_gid'] = portfolio_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolio_memberships/{portfolio_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolio_memberships/{portfolio_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolio_memberships/{portfolio_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_portfolio_memberships(self, opts, **kwargs): # noqa: E501 + """Get multiple portfolio memberships # noqa: E501 + + Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: The portfolio to filter results on. + :param str workspace: The workspace to filter results on. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_memberships_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_memberships_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_memberships_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple portfolio memberships # noqa: E501 + + Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: The portfolio to filter results on. + :param str workspace: The workspace to filter results on. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_portfolio_memberships" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolio_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_portfolio_memberships_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a portfolio # noqa: E501 + + Returns the compact portfolio membership records for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships_for_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_memberships_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a portfolio # noqa: E501 + + Returns the compact portfolio membership records for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_portfolio_memberships_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_portfolio_memberships_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios/{portfolio_gid}/portfolio_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/portfolios_api.py b/asana/api/portfolios_api.py new file mode 100644 index 00000000..f480fe14 --- /dev/null +++ b/asana/api/portfolios_api.py @@ -0,0 +1,1768 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class PortfoliosApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_custom_field_setting_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a custom field to a portfolio # noqa: E501 + + Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def add_custom_field_setting_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a custom field to a portfolio # noqa: E501 + + Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_custom_field_setting_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_custom_field_setting_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `add_custom_field_setting_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_item_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a portfolio item # noqa: E501 + + Add an item to a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_item_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being inserted. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def add_item_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a portfolio item # noqa: E501 + + Add an item to a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_item_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being inserted. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_item_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_item_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `add_item_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/addItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_members_for_portfolio(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Add users to a portfolio # noqa: E501 + + Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def add_members_for_portfolio_with_http_info(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Add users to a portfolio # noqa: E501 + + Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_members_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_members_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `add_members_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_portfolio(self, body, opts, **kwargs): # noqa: E501 + """Create a portfolio # noqa: E501 + + Creates a new portfolio in the given workspace with the supplied name. Note that portfolios created in the Asana UI may have some state (like the “Priority” custom field) which is automatically added to the portfolio when it is created. Portfolios created via our API will *not* be created with the same initial state to allow integrations to create their own starting state on a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_portfolio(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The portfolio to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_portfolio_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_portfolio_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_portfolio_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a portfolio # noqa: E501 + + Creates a new portfolio in the given workspace with the supplied name. Note that portfolios created in the Asana UI may have some state (like the “Priority” custom field) which is automatically added to the portfolio when it is created. Portfolios created via our API will *not* be created with the same initial state to allow integrations to create their own starting state on a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_portfolio_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The portfolio to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_portfolio(self, portfolio_gid, **kwargs): # noqa: E501 + """Delete a portfolio # noqa: E501 + + An existing portfolio can be deleted by making a DELETE request on the URL for that portfolio. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_portfolio_with_http_info(portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_portfolio_with_http_info(portfolio_gid, **kwargs) # noqa: E501 + return data + + def delete_portfolio_with_http_info(self, portfolio_gid, **kwargs): # noqa: E501 + """Delete a portfolio # noqa: E501 + + An existing portfolio can be deleted by making a DELETE request on the URL for that portfolio. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `delete_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_items_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get portfolio items # noqa: E501 + + Get a list of the items in compact form in a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_items_for_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_items_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_items_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_items_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get portfolio items # noqa: E501 + + Get a list of the items in compact form in a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_items_for_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_items_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_items_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/items', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios/{portfolio_gid}/items', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/items', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio # noqa: E501 + + Returns the complete portfolio record for a single portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio # noqa: E501 + + Returns the complete portfolio record for a single portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_portfolios(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple portfolios # noqa: E501 + + Returns a list of the portfolios in compact representation that are owned by the current API user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolios(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization to filter portfolios on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str owner: The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolios_with_http_info(workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolios_with_http_info(workspace, opts, **kwargs) # noqa: E501 + return data + + def get_portfolios_with_http_info(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple portfolios # noqa: E501 + + Returns a list of the portfolios in compact representation that are owned by the current API user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolios_with_http_info(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization to filter portfolios on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str owner: The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_portfolios" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_portfolios`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_custom_field_setting_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a custom field from a portfolio # noqa: E501 + + Removes a custom field setting from a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def remove_custom_field_setting_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a custom field from a portfolio # noqa: E501 + + Removes a custom field setting from a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_custom_field_setting_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_custom_field_setting_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `remove_custom_field_setting_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_item_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a portfolio item # noqa: E501 + + Remove an item from a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_item_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def remove_item_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a portfolio item # noqa: E501 + + Remove an item from a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_item_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_item_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_item_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `remove_item_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_members_for_portfolio(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Remove users from a portfolio # noqa: E501 + + Removes the specified list of users from members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_members_for_portfolio_with_http_info(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Remove users from a portfolio # noqa: E501 + + Removes the specified list of users from members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_members_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_members_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `remove_members_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_portfolio(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Update a portfolio # noqa: E501 + + An existing portfolio can be updated by making a PUT request on the URL for that portfolio. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the portfolio. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def update_portfolio_with_http_info(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Update a portfolio # noqa: E501 + + An existing portfolio can be updated by making a PUT request on the URL for that portfolio. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the portfolio. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `update_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/project_briefs_api.py b/asana/api/project_briefs_api.py new file mode 100644 index 00000000..dd62c7e2 --- /dev/null +++ b/asana/api/project_briefs_api.py @@ -0,0 +1,604 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectBriefsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_project_brief(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project brief # noqa: E501 + + Creates a new project brief. Returns the full record of the newly created project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_brief(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project brief to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_brief_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_brief_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_brief_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project brief # noqa: E501 + + Creates a new project brief. Returns the full record of the newly created project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_brief_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project brief to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_brief`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `create_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_briefs', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/project_briefs', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_briefs', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_project_brief(self, project_brief_gid, **kwargs): # noqa: E501 + """Delete a project brief # noqa: E501 + + Deletes a specific, existing project brief. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_brief(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_brief_with_http_info(project_brief_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_brief_with_http_info(project_brief_gid, **kwargs) # noqa: E501 + return data + + def delete_project_brief_with_http_info(self, project_brief_gid, **kwargs): # noqa: E501 + """Delete a project brief # noqa: E501 + + Deletes a specific, existing project brief. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_brief_with_http_info(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_brief_gid' is set + if (project_brief_gid is None): + raise ValueError("Missing the required parameter `project_brief_gid` when calling `delete_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_brief_gid'] = project_brief_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_brief(self, project_brief_gid, opts, **kwargs): # noqa: E501 + """Get a project brief # noqa: E501 + + Get the full record for a project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_brief(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_brief_with_http_info(project_brief_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_brief_with_http_info(project_brief_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_brief_with_http_info(self, project_brief_gid, opts, **kwargs): # noqa: E501 + """Get a project brief # noqa: E501 + + Get the full record for a project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_brief_with_http_info(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_brief_gid' is set + if (project_brief_gid is None): + raise ValueError("Missing the required parameter `project_brief_gid` when calling `get_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_brief_gid'] = project_brief_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_project_brief(self, body, project_brief_gid, opts, **kwargs): # noqa: E501 + """Update a project brief # noqa: E501 + + An existing project brief can be updated by making a PUT request on the URL for that project brief. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated project brief record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project_brief(body, project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project brief. (required) + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_project_brief_with_http_info(body, project_brief_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_project_brief_with_http_info(body, project_brief_gid, opts, **kwargs) # noqa: E501 + return data + + def update_project_brief_with_http_info(self, body, project_brief_gid, opts, **kwargs): # noqa: E501 + """Update a project brief # noqa: E501 + + An existing project brief can be updated by making a PUT request on the URL for that project brief. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated project brief record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project_brief_with_http_info(body, project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project brief. (required) + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_project_brief`") # noqa: E501 + # verify the required parameter 'project_brief_gid' is set + if (project_brief_gid is None): + raise ValueError("Missing the required parameter `project_brief_gid` when calling `update_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_brief_gid'] = project_brief_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/project_memberships_api.py b/asana/api/project_memberships_api.py new file mode 100644 index 00000000..da8e2484 --- /dev/null +++ b/asana/api/project_memberships_api.py @@ -0,0 +1,320 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_project_membership(self, project_membership_gid, opts, **kwargs): # noqa: E501 + """Get a project membership # noqa: E501 + + Returns the complete project record for a single project membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_membership(project_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipNormalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_membership_with_http_info(project_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_membership_with_http_info(project_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_membership_with_http_info(self, project_membership_gid, opts, **kwargs): # noqa: E501 + """Get a project membership # noqa: E501 + + Returns the complete project record for a single project membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_membership_with_http_info(project_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipNormalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_membership_gid' is set + if (project_membership_gid is None): + raise ValueError("Missing the required parameter `project_membership_gid` when calling `get_project_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_membership_gid'] = project_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_memberships/{project_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_memberships/{project_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_memberships/{project_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_memberships_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a project # noqa: E501 + + Returns the compact project membership records for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_memberships_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_memberships_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_memberships_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_memberships_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a project # noqa: E501 + + Returns the compact project membership records for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_memberships_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_memberships_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_project_memberships_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/project_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/project_statuses_api.py b/asana/api/project_statuses_api.py new file mode 100644 index 00000000..a483fbaa --- /dev/null +++ b/asana/api/project_statuses_api.py @@ -0,0 +1,602 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectStatusesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_project_status_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_status_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project status to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_status_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_status_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_status_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_status_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project status to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_project_status_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_status_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `create_project_status_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_project_status(self, project_status_gid, **kwargs): # noqa: E501 + """Delete a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_status(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_status_with_http_info(project_status_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_status_with_http_info(project_status_gid, **kwargs) # noqa: E501 + return data + + def delete_project_status_with_http_info(self, project_status_gid, **kwargs): # noqa: E501 + """Delete a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_status_with_http_info(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_project_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_status_gid' is set + if (project_status_gid is None): + raise ValueError("Missing the required parameter `project_status_gid` when calling `delete_project_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_status_gid'] = project_status_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_status(self, project_status_gid, opts, **kwargs): # noqa: E501 + """Get a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_status(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_status_with_http_info(project_status_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_status_with_http_info(project_status_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_status_with_http_info(self, project_status_gid, opts, **kwargs): # noqa: E501 + """Get a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_status_with_http_info(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_status_gid' is set + if (project_status_gid is None): + raise ValueError("Missing the required parameter `project_status_gid` when calling `get_project_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_status_gid'] = project_status_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_statuses_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get statuses from a project # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_statuses_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_statuses_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_statuses_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_statuses_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get statuses from a project # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_statuses_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_statuses_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_project_statuses_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/project_statuses', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/project_templates_api.py b/asana/api/project_templates_api.py new file mode 100644 index 00000000..403c9f09 --- /dev/null +++ b/asana/api/project_templates_api.py @@ -0,0 +1,743 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectTemplatesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_project_template(self, project_template_gid, **kwargs): # noqa: E501 + """Delete a project template # noqa: E501 + + A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_template(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_template_with_http_info(project_template_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_template_with_http_info(project_template_gid, **kwargs) # noqa: E501 + return data + + def delete_project_template_with_http_info(self, project_template_gid, **kwargs): # noqa: E501 + """Delete a project template # noqa: E501 + + A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_template_with_http_info(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_project_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_template_gid' is set + if (project_template_gid is None): + raise ValueError("Missing the required parameter `project_template_gid` when calling `delete_project_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_template_gid'] = project_template_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_templates/{project_template_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_template(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Get a project template # noqa: E501 + + Returns the complete project template record for a single project template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_template(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_template_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_template_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_template_with_http_info(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Get a project template # noqa: E501 + + Returns the complete project template record for a single project template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_template_with_http_info(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_template_gid' is set + if (project_template_gid is None): + raise ValueError("Missing the required parameter `project_template_gid` when calling `get_project_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_template_gid'] = project_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_templates/{project_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_templates(self, opts, **kwargs): # noqa: E501 + """Get multiple project templates # noqa: E501 + + Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to filter results on. + :param str team: The team to filter projects on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_templates_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_templates_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_project_templates_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple project templates # noqa: E501 + + Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to filter results on. + :param str team: The team to filter projects on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_templates" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/project_templates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project_templates_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's project templates # noqa: E501 + + Returns the compact project template records for all project templates in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_templates_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_templates_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_templates_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's project templates # noqa: E501 + + Returns the compact project template records for all project templates in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project_templates_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_project_templates_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/project_templates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def instantiate_project(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a project from a project template # noqa: E501 + + Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_project(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.instantiate_project_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.instantiate_project_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + return data + + def instantiate_project_with_http_info(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a project from a project template # noqa: E501 + + Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_project_with_http_info(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method instantiate_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_template_gid' is set + if (project_template_gid is None): + raise ValueError("Missing the required parameter `project_template_gid` when calling `instantiate_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_template_gid'] = project_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates/{project_template_gid}/instantiateProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_templates/{project_template_gid}/instantiateProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_templates/{project_template_gid}/instantiateProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/projects_api.py b/asana/api/projects_api.py new file mode 100644 index 00000000..7ec1c9ee --- /dev/null +++ b/asana/api/projects_api.py @@ -0,0 +1,2796 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_custom_field_setting_for_project(self, body, project_gid, **kwargs): # noqa: E501 + """Add a custom field to a project # noqa: E501 + + Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + return data + + def add_custom_field_setting_for_project_with_http_info(self, body, project_gid, **kwargs): # noqa: E501 + """Add a custom field to a project # noqa: E501 + + Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_custom_field_setting_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_custom_field_setting_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `add_custom_field_setting_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_followers_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add followers to a project # noqa: E501 + + Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def add_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add followers to a project # noqa: E501 + + Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_followers_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_followers_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `add_followers_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_members_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add users to a project # noqa: E501 + + Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifcations\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def add_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add users to a project # noqa: E501 + + Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifcations\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_members_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_members_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `add_members_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_project(self, body, opts, **kwargs): # noqa: E501 + """Create a project # noqa: E501 + + Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_project_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a project # noqa: E501 + + Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_project_for_team(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Create a project in a team # noqa: E501 + + Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_for_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Create a project in a team # noqa: E501 + + Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_project_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_for_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `create_project_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_project_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a project in a workspace # noqa: E501 + + Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a project in a workspace # noqa: E501 + + Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_project_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `create_project_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_project(self, project_gid, **kwargs): # noqa: E501 + """Delete a project # noqa: E501 + + A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_with_http_info(project_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_with_http_info(project_gid, **kwargs) # noqa: E501 + return data + + def delete_project_with_http_info(self, project_gid, **kwargs): # noqa: E501 + """Delete a project # noqa: E501 + + A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `delete_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def duplicate_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Duplicate a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: Describes the duplicate's name and the elements that will be duplicated. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.duplicate_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.duplicate_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def duplicate_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Duplicate a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: Describes the duplicate's name and the elements that will be duplicated. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method duplicate_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `duplicate_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project # noqa: E501 + + Returns the complete project record for a single project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project # noqa: E501 + + Returns the complete project record for a single project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_projects(self, opts, **kwargs): # noqa: E501 + """Get multiple projects # noqa: E501 + + Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str workspace: The workspace or organization to filter projects on. + :param str team: The team to filter projects on. + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_projects_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple projects # noqa: E501 + + Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str workspace: The workspace or organization to filter projects on. + :param str team: The team to filter projects on. + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_projects" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_projects_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get projects a task is in # noqa: E501 + + Returns a compact representation of all of the projects the task is in. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_projects_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get projects a task is in # noqa: E501 + + Returns a compact representation of all of the projects the task is in. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_projects_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_projects_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_projects_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's projects # noqa: E501 + + Returns the compact project records for all projects in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_projects_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's projects # noqa: E501 + + Returns the compact project records for all projects in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_projects_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_projects_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_projects_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get all projects in a workspace # noqa: E501 + + Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_projects_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get all projects in a workspace # noqa: E501 + + Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_projects_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_projects_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_task_counts_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get task count of a project # noqa: E501 + + Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_counts_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskCountResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_counts_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_counts_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_task_counts_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get task count of a project # noqa: E501 + + Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_counts_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskCountResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_task_counts_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_task_counts_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/task_counts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/task_counts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/task_counts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def project_save_as_template(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project template from a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won't be visible in the Asana UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.project_save_as_template(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.project_save_as_template_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.project_save_as_template_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def project_save_as_template_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project template from a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won't be visible in the Asana UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.project_save_as_template_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method project_save_as_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `project_save_as_template`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `project_save_as_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/saveAsTemplate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/saveAsTemplate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/saveAsTemplate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_custom_field_setting_for_project(self, body, project_gid, **kwargs): # noqa: E501 + """Remove a custom field from a project # noqa: E501 + + Removes a custom field setting from a project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + return data + + def remove_custom_field_setting_for_project_with_http_info(self, body, project_gid, **kwargs): # noqa: E501 + """Remove a custom field from a project # noqa: E501 + + Removes a custom field setting from a project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_custom_field_setting_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_custom_field_setting_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `remove_custom_field_setting_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_followers_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a project # noqa: E501 + + Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a project # noqa: E501 + + Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_followers_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_followers_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `remove_followers_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_members_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove users from a project # noqa: E501 + + Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove users from a project # noqa: E501 + + Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_members_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_members_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `remove_members_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Update a project # noqa: E501 + + A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def update_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Update a project # noqa: E501 + + A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `update_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/rules_api.py b/asana/api/rules_api.py new file mode 100644 index 00000000..a99d8b31 --- /dev/null +++ b/asana/api/rules_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class RulesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def trigger_rule(self, body, rule_trigger_gid, **kwargs): # noqa: E501 + """Trigger a rule # noqa: E501 + + Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.trigger_rule(body, rule_trigger_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: A dictionary of variables accessible from within the rule. (required) + :param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required) + :return: RuleTriggerResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.trigger_rule_with_http_info(body, rule_trigger_gid, **kwargs) # noqa: E501 + else: + (data) = self.trigger_rule_with_http_info(body, rule_trigger_gid, **kwargs) # noqa: E501 + return data + + def trigger_rule_with_http_info(self, body, rule_trigger_gid, **kwargs): # noqa: E501 + """Trigger a rule # noqa: E501 + + Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.trigger_rule_with_http_info(body, rule_trigger_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: A dictionary of variables accessible from within the rule. (required) + :param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required) + :return: RuleTriggerResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method trigger_rule" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `trigger_rule`") # noqa: E501 + # verify the required parameter 'rule_trigger_gid' is set + if (rule_trigger_gid is None): + raise ValueError("Missing the required parameter `rule_trigger_gid` when calling `trigger_rule`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['rule_trigger_gid'] = rule_trigger_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/rule_triggers/{rule_trigger_gid}/run', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/rule_triggers/{rule_trigger_gid}/run', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/rule_triggers/{rule_trigger_gid}/run', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/sections_api.py b/asana/api/sections_api.py new file mode 100644 index 00000000..5c0cf580 --- /dev/null +++ b/asana/api/sections_api.py @@ -0,0 +1,1030 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class SectionsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_task_for_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Add task to section # noqa: E501 + + Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_task_for_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The task and optionally the insert location. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_task_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_task_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def add_task_for_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Add task to section # noqa: E501 + + Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_task_for_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The task and optionally the insert location. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_task_for_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `add_task_for_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}/addTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}/addTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}/addTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_section_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Create a section in a project # noqa: E501 + + Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_section_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def create_section_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Create a section in a project # noqa: E501 + + Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_section_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_section_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `create_section_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/sections', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_section(self, section_gid, **kwargs): # noqa: E501 + """Delete a section # noqa: E501 + + A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_section_with_http_info(section_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_section_with_http_info(section_gid, **kwargs) # noqa: E501 + return data + + def delete_section_with_http_info(self, section_gid, **kwargs): # noqa: E501 + """Delete a section # noqa: E501 + + A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `delete_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Get a section # noqa: E501 + + Returns the complete record for a single section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def get_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Get a section # noqa: E501 + + Returns the complete record for a single section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `get_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_sections_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get sections in a project # noqa: E501 + + Returns the compact records for all sections in the specified project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sections_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_sections_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_sections_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_sections_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get sections in a project # noqa: E501 + + Returns the compact records for all sections in the specified project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sections_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_sections_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_sections_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/sections', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def insert_section_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Move or Insert sections # noqa: E501 + + Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_section_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section's move action. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.insert_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.insert_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def insert_section_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Move or Insert sections # noqa: E501 + + Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_section_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section's move action. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method insert_section_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `insert_section_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/sections/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/sections/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/sections/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Update a section # noqa: E501 + + A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) 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 task. Returns the complete updated section record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def update_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Update a section # noqa: E501 + + A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) 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 task. Returns the complete updated section record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `update_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/status_updates_api.py b/asana/api/status_updates_api.py new file mode 100644 index 00000000..bb677511 --- /dev/null +++ b/asana/api/status_updates_api.py @@ -0,0 +1,602 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class StatusUpdatesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_status_for_object(self, body, opts, **kwargs): # noqa: E501 + """Create a status update # noqa: E501 + + Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_status_for_object(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The status update to create. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_status_for_object_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_status_for_object_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_status_for_object_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a status update # noqa: E501 + + Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_status_for_object_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The status update to create. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_status_for_object" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_status_for_object`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/status_updates', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/status_updates', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_status(self, status_update_gid, **kwargs): # noqa: E501 + """Delete a status update # noqa: E501 + + Deletes a specific, existing status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_status(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_status_with_http_info(status_update_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_status_with_http_info(status_update_gid, **kwargs) # noqa: E501 + return data + + def delete_status_with_http_info(self, status_update_gid, **kwargs): # noqa: E501 + """Delete a status update # noqa: E501 + + Deletes a specific, existing status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_status_with_http_info(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'status_update_gid' is set + if (status_update_gid is None): + raise ValueError("Missing the required parameter `status_update_gid` when calling `delete_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['status_update_gid'] = status_update_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/status_updates/{status_update_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_status(self, status_update_gid, opts, **kwargs): # noqa: E501 + """Get a status update # noqa: E501 + + Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_status(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_status_with_http_info(status_update_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_status_with_http_info(status_update_gid, opts, **kwargs) # noqa: E501 + return data + + def get_status_with_http_info(self, status_update_gid, opts, **kwargs): # noqa: E501 + """Get a status update # noqa: E501 + + Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_status_with_http_info(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'status_update_gid' is set + if (status_update_gid is None): + raise ValueError("Missing the required parameter `status_update_gid` when calling `get_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['status_update_gid'] = status_update_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/status_updates/{status_update_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_statuses_for_object(self, parent, opts, **kwargs): # noqa: E501 + """Get status updates from an object # noqa: E501 + + Returns the compact status update records for all updates on the object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_statuses_for_object(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param datetime created_since: Only return statuses that have been created since the given time. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_statuses_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_statuses_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + return data + + def get_statuses_for_object_with_http_info(self, parent, opts, **kwargs): # noqa: E501 + """Get status updates from an object # noqa: E501 + + Returns the compact status update records for all updates on the object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_statuses_for_object_with_http_info(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param datetime created_since: Only return statuses that have been created since the given time. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_statuses_for_object" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'parent' is set + if (parent is None): + raise ValueError("Missing the required parameter `parent` when calling `get_statuses_for_object`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['parent'] = parent + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/status_updates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/status_updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/stories_api.py b/asana/api/stories_api.py new file mode 100644 index 00000000..dbb5e45a --- /dev/null +++ b/asana/api/stories_api.py @@ -0,0 +1,750 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class StoriesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_story_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a story on a task # noqa: E501 + + Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_story_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The story to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_story_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_story_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def create_story_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a story on a task # noqa: E501 + + Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_story_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The story to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_story_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_story_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `create_story_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/stories', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_story(self, story_gid, **kwargs): # noqa: E501 + """Delete a story # noqa: E501 + + Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_story(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_story_with_http_info(story_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_story_with_http_info(story_gid, **kwargs) # noqa: E501 + return data + + def delete_story_with_http_info(self, story_gid, **kwargs): # noqa: E501 + """Delete a story # noqa: E501 + + Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_story_with_http_info(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_story" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'story_gid' is set + if (story_gid is None): + raise ValueError("Missing the required parameter `story_gid` when calling `delete_story`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['story_gid'] = story_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/stories/{story_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/stories/{story_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/stories/{story_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_stories_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get stories from a task # noqa: E501 + + Returns the compact records for all stories on the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_stories_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_stories_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_stories_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_stories_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get stories from a task # noqa: E501 + + Returns the compact records for all stories on the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_stories_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_stories_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_stories_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/stories', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_story(self, story_gid, opts, **kwargs): # noqa: E501 + """Get a story # noqa: E501 + + Returns the full record for a single story. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_story(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_story_with_http_info(story_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_story_with_http_info(story_gid, opts, **kwargs) # noqa: E501 + return data + + def get_story_with_http_info(self, story_gid, opts, **kwargs): # noqa: E501 + """Get a story # noqa: E501 + + Returns the full record for a single story. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_story_with_http_info(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_story" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'story_gid' is set + if (story_gid is None): + raise ValueError("Missing the required parameter `story_gid` when calling `get_story`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['story_gid'] = story_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/stories/{story_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/stories/{story_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/stories/{story_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_story(self, body, story_gid, opts, **kwargs): # noqa: E501 + """Update a story # noqa: E501 + + Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_story(body, story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The comment story to update. (required) + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_story_with_http_info(body, story_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_story_with_http_info(body, story_gid, opts, **kwargs) # noqa: E501 + return data + + def update_story_with_http_info(self, body, story_gid, opts, **kwargs): # noqa: E501 + """Update a story # noqa: E501 + + Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_story_with_http_info(body, story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The comment story to update. (required) + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_story" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_story`") # noqa: E501 + # verify the required parameter 'story_gid' is set + if (story_gid is None): + raise ValueError("Missing the required parameter `story_gid` when calling `update_story`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['story_gid'] = story_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/stories/{story_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/stories/{story_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/stories/{story_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/tags_api.py b/asana/api/tags_api.py new file mode 100644 index 00000000..17c6b4f7 --- /dev/null +++ b/asana/api/tags_api.py @@ -0,0 +1,1171 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TagsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_tag(self, body, opts, **kwargs): # noqa: E501 + """Create a tag # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_tag_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_tag_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_tag_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a tag # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_tag_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a tag in a workspace # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_tag_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_tag_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def create_tag_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a tag in a workspace # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_tag_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_tag_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `create_tag_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_tag(self, tag_gid, **kwargs): # noqa: E501 + """Delete a tag # noqa: E501 + + A specific, existing tag can be deleted by making a DELETE request on the URL for that tag. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_tag_with_http_info(tag_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_tag_with_http_info(tag_gid, **kwargs) # noqa: E501 + return data + + def delete_tag_with_http_info(self, tag_gid, **kwargs): # noqa: E501 + """Delete a tag # noqa: E501 + + A specific, existing tag can be deleted by making a DELETE request on the URL for that tag. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `delete_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags/{tag_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags/{tag_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tag(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get a tag # noqa: E501 + + Returns the complete tag record for a single tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get a tag # noqa: E501 + + Returns the complete tag record for a single tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `get_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags/{tag_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags/{tag_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tags(self, opts, **kwargs): # noqa: E501 + """Get multiple tags # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str workspace: The workspace to filter tags on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tags_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tags_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_tags_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple tags # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str workspace: The workspace to filter tags on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tags" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tags', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tags_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task's tags # noqa: E501 + + Get a compact representation of all of the tags the task has. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tags_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tags_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tags_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task's tags # noqa: E501 + + Get a compact representation of all of the tags the task has. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tags_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_tags_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/tags', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tags_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get tags in a workspace # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tags_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tags_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tags_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get tags in a workspace # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tags_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_tags_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/tags', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_tag(self, tag_gid, opts, **kwargs): # noqa: E501 + """Update a tag # noqa: E501 + + Updates the properties of a tag. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 tag. Returns the complete updated tag record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + return data + + def update_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501 + """Update a tag # noqa: E501 + + Updates the properties of a tag. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 tag. Returns the complete updated tag record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `update_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags/{tag_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags/{tag_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/task_templates_api.py b/asana/api/task_templates_api.py new file mode 100644 index 00000000..06baec90 --- /dev/null +++ b/asana/api/task_templates_api.py @@ -0,0 +1,459 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TaskTemplatesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_task_template(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Get a task template # noqa: E501 + + Returns the complete task template record for a single task template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_template(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_template_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_template_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + return data + + def get_task_template_with_http_info(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Get a task template # noqa: E501 + + Returns the complete task template record for a single task template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_template_with_http_info(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_task_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_template_gid' is set + if (task_template_gid is None): + raise ValueError("Missing the required parameter `task_template_gid` when calling `get_task_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_template_gid'] = task_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/task_templates/{task_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/task_templates/{task_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/task_templates/{task_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_task_templates(self, opts, **kwargs): # noqa: E501 + """Get multiple task templates # noqa: E501 + + Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_templates(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str project: The project to filter task templates on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_templates_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_templates_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_task_templates_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple task templates # noqa: E501 + + Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_templates_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str project: The project to filter task templates on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_task_templates" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/task_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/task_templates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/task_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def instantiate_task(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a task from a task template # noqa: E501 + + Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_task(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param dict body: Describes the inputs used for instantiating a task - the task's name. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.instantiate_task_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.instantiate_task_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + return data + + def instantiate_task_with_http_info(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a task from a task template # noqa: E501 + + Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_task_with_http_info(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param dict body: Describes the inputs used for instantiating a task - the task's name. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method instantiate_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_template_gid' is set + if (task_template_gid is None): + raise ValueError("Missing the required parameter `task_template_gid` when calling `instantiate_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_template_gid'] = task_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/task_templates/{task_template_gid}/instantiateTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/task_templates/{task_template_gid}/instantiateTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/task_templates/{task_template_gid}/instantiateTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/tasks_api.py b/asana/api/tasks_api.py new file mode 100644 index 00000000..06180826 --- /dev/null +++ b/asana/api/tasks_api.py @@ -0,0 +1,3936 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TasksApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_dependencies_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependencies for a task # noqa: E501 + + Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependencies_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to set as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependencies for a task # noqa: E501 + + Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependencies_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to set as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_dependencies_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_dependencies_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_dependencies_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_dependents_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependents for a task # noqa: E501 + + Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependents_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to add as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_dependents_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependents for a task # noqa: E501 + + Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependents_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to add as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_dependents_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_dependents_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_dependents_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_followers_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Add followers to a task # noqa: E501 + + Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_followers_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_followers_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def add_followers_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Add followers to a task # noqa: E501 + + Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_followers_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_followers_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_followers_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_project_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Add a project to a task # noqa: E501 + + Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_project_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to add the task to. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_project_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Add a project to a task # noqa: E501 + + Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_project_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to add the task to. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_project_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_project_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_project_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def add_tag_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Add a tag to a task # noqa: E501 + + Adds a tag to a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_tag_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_tag_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Add a tag to a task # noqa: E501 + + Adds a tag to a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_tag_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_tag_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_tag_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_tag_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_subtask_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a subtask # noqa: E501 + + Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_subtask_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new subtask to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_subtask_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_subtask_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def create_subtask_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a subtask # noqa: E501 + + Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_subtask_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new subtask to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_subtask_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_subtask_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `create_subtask_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_task(self, body, opts, **kwargs): # noqa: E501 + """Create a task # noqa: E501 + + Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_task(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_task_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_task_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_task_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a task # noqa: E501 + + Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_task_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_task(self, task_gid, **kwargs): # noqa: E501 + """Delete a task # noqa: E501 + + A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_task_with_http_info(task_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_task_with_http_info(task_gid, **kwargs) # noqa: E501 + return data + + def delete_task_with_http_info(self, task_gid, **kwargs): # noqa: E501 + """Delete a task # noqa: E501 + + A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `delete_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def duplicate_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Duplicate a task # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the duplicate's name and the fields that will be duplicated. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.duplicate_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.duplicate_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def duplicate_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Duplicate a task # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the duplicate's name and the fields that will be duplicated. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method duplicate_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `duplicate_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `duplicate_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dependencies_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependencies from a task # noqa: E501 + + Returns the compact representations of all of the dependencies of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependencies_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_dependencies_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_dependencies_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_dependencies_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependencies from a task # noqa: E501 + + Returns the compact representations of all of the dependencies of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependencies_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dependencies_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_dependencies_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/dependencies', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/dependencies', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/dependencies', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dependents_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependents from a task # noqa: E501 + + Returns the compact representations of all of the dependents of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependents_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_dependents_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_dependents_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_dependents_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependents from a task # noqa: E501 + + Returns the compact representations of all of the dependents of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependents_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dependents_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_dependents_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/dependents', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/dependents', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/dependents', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_subtasks_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get subtasks from a task # noqa: E501 + + Returns a compact representation of all of the subtasks of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_subtasks_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_subtasks_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_subtasks_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_subtasks_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get subtasks from a task # noqa: E501 + + Returns a compact representation of all of the subtasks of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_subtasks_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_subtasks_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_subtasks_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/subtasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task # noqa: E501 + + Returns the complete task record for a single task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task # noqa: E501 + + Returns the complete task record for a single task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tasks(self, opts, **kwargs): # noqa: E501 + """Get multiple tasks # noqa: E501 + + Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + :param str project: The project to filter tasks on. + :param str section: The section to filter tasks on. + :param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + :param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time. + :param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_tasks_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple tasks # noqa: E501 + + Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + :param str project: The project to filter tasks on. + :param str section: The section to filter tasks on. + :param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + :param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time. + :param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tasks" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tasks_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a project # noqa: E501 + + Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a project # noqa: E501 + + Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tasks_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_tasks_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tasks_for_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a section # noqa: E501 + + *Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a section # noqa: E501 + + *Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tasks_for_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `get_tasks_for_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/sections/{section_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/sections/{section_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tasks_for_tag(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a tag # noqa: E501 + + Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a tag # noqa: E501 + + Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tasks_for_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `get_tasks_for_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tags/{tag_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tags/{tag_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tasks_for_user_task_list(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a user task list # noqa: E501 + + Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_user_task_list(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a user task list # noqa: E501 + + Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tasks_for_user_task_list" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_task_list_gid' is set + if (user_task_list_gid is None): + raise ValueError("Missing the required parameter `user_task_list_gid` when calling `get_tasks_for_user_task_list`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_task_list_gid'] = user_task_list_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/user_task_lists/{user_task_list_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_dependencies_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependencies from a task # noqa: E501 + + Unlinks a set of dependencies from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependencies_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to unlink as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependencies from a task # noqa: E501 + + Unlinks a set of dependencies from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependencies_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to unlink as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_dependencies_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_dependencies_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_dependencies_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_dependents_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependents from a task # noqa: E501 + + Unlinks a set of dependents from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependents_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to remove as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_dependents_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependents from a task # noqa: E501 + + Unlinks a set of dependents from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependents_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to remove as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_dependents_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_dependents_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_dependents_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_follower_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a task # noqa: E501 + + Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_follower_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_follower_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_follower_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_follower_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a task # noqa: E501 + + Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_follower_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_follower_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_follower_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_follower_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_project_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a project from a task # noqa: E501 + + Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_project_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to remove the task from. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_project_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a project from a task # noqa: E501 + + Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_project_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to remove the task from. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_project_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_project_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_project_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_tag_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a tag from a task # noqa: E501 + + Removes a tag from a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_tag_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_tag_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a tag from a task # noqa: E501 + + Removes a tag from a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_tag_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_tag_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_tag_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_tag_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def search_tasks_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Search tasks in a workspace # noqa: E501 + + To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.search_tasks_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str text: Performs full-text search on both task name and description + :param str resource_subtype: Filters results by the task's resource_subtype + :param str assignee.any: Comma-separated list of user identifiers + :param str assignee.not: Comma-separated list of user identifiers + :param str portfolios.any: Comma-separated list of portfolio IDs + :param str projects.any: Comma-separated list of project IDs + :param str projects.not: Comma-separated list of project IDs + :param str projects.all: Comma-separated list of project IDs + :param str sections.any: Comma-separated list of section or column IDs + :param str sections.not: Comma-separated list of section or column IDs + :param str sections.all: Comma-separated list of section or column IDs + :param str tags.any: Comma-separated list of tag IDs + :param str tags.not: Comma-separated list of tag IDs + :param str tags.all: Comma-separated list of tag IDs + :param str teams.any: Comma-separated list of team IDs + :param str followers.not: Comma-separated list of user identifiers + :param str created_by.any: Comma-separated list of user identifiers + :param str created_by.not: Comma-separated list of user identifiers + :param str assigned_by.any: Comma-separated list of user identifiers + :param str assigned_by.not: Comma-separated list of user identifiers + :param str liked_by.not: Comma-separated list of user identifiers + :param str commented_on_by.not: Comma-separated list of user identifiers + :param date due_on.before: ISO 8601 date string + :param date due_on.after: ISO 8601 date string + :param date due_on: ISO 8601 date string or `null` + :param datetime due_at.before: ISO 8601 datetime string + :param datetime due_at.after: ISO 8601 datetime string + :param date start_on.before: ISO 8601 date string + :param date start_on.after: ISO 8601 date string + :param date start_on: ISO 8601 date string or `null` + :param date created_on.before: ISO 8601 date string + :param date created_on.after: ISO 8601 date string + :param date created_on: ISO 8601 date string or `null` + :param datetime created_at.before: ISO 8601 datetime string + :param datetime created_at.after: ISO 8601 datetime string + :param date completed_on.before: ISO 8601 date string + :param date completed_on.after: ISO 8601 date string + :param date completed_on: ISO 8601 date string or `null` + :param datetime completed_at.before: ISO 8601 datetime string + :param datetime completed_at.after: ISO 8601 datetime string + :param date modified_on.before: ISO 8601 date string + :param date modified_on.after: ISO 8601 date string + :param date modified_on: ISO 8601 date string or `null` + :param datetime modified_at.before: ISO 8601 datetime string + :param datetime modified_at.after: ISO 8601 datetime string + :param bool is_blocking: Filter to incomplete tasks with dependents + :param bool is_blocked: Filter to tasks with incomplete dependencies + :param bool has_attachment: Filter to tasks with attachments + :param bool completed: Filter to completed tasks + :param bool is_subtask: Filter to subtasks + :param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + :param bool sort_ascending: Default `false` + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.search_tasks_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.search_tasks_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def search_tasks_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Search tasks in a workspace # noqa: E501 + + To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.search_tasks_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str text: Performs full-text search on both task name and description + :param str resource_subtype: Filters results by the task's resource_subtype + :param str assignee.any: Comma-separated list of user identifiers + :param str assignee.not: Comma-separated list of user identifiers + :param str portfolios.any: Comma-separated list of portfolio IDs + :param str projects.any: Comma-separated list of project IDs + :param str projects.not: Comma-separated list of project IDs + :param str projects.all: Comma-separated list of project IDs + :param str sections.any: Comma-separated list of section or column IDs + :param str sections.not: Comma-separated list of section or column IDs + :param str sections.all: Comma-separated list of section or column IDs + :param str tags.any: Comma-separated list of tag IDs + :param str tags.not: Comma-separated list of tag IDs + :param str tags.all: Comma-separated list of tag IDs + :param str teams.any: Comma-separated list of team IDs + :param str followers.not: Comma-separated list of user identifiers + :param str created_by.any: Comma-separated list of user identifiers + :param str created_by.not: Comma-separated list of user identifiers + :param str assigned_by.any: Comma-separated list of user identifiers + :param str assigned_by.not: Comma-separated list of user identifiers + :param str liked_by.not: Comma-separated list of user identifiers + :param str commented_on_by.not: Comma-separated list of user identifiers + :param date due_on.before: ISO 8601 date string + :param date due_on.after: ISO 8601 date string + :param date due_on: ISO 8601 date string or `null` + :param datetime due_at.before: ISO 8601 datetime string + :param datetime due_at.after: ISO 8601 datetime string + :param date start_on.before: ISO 8601 date string + :param date start_on.after: ISO 8601 date string + :param date start_on: ISO 8601 date string or `null` + :param date created_on.before: ISO 8601 date string + :param date created_on.after: ISO 8601 date string + :param date created_on: ISO 8601 date string or `null` + :param datetime created_at.before: ISO 8601 datetime string + :param datetime created_at.after: ISO 8601 datetime string + :param date completed_on.before: ISO 8601 date string + :param date completed_on.after: ISO 8601 date string + :param date completed_on: ISO 8601 date string or `null` + :param datetime completed_at.before: ISO 8601 datetime string + :param datetime completed_at.after: ISO 8601 datetime string + :param date modified_on.before: ISO 8601 date string + :param date modified_on.after: ISO 8601 date string + :param date modified_on: ISO 8601 date string or `null` + :param datetime modified_at.before: ISO 8601 datetime string + :param datetime modified_at.after: ISO 8601 datetime string + :param bool is_blocking: Filter to incomplete tasks with dependents + :param bool is_blocked: Filter to tasks with incomplete dependencies + :param bool has_attachment: Filter to tasks with attachments + :param bool completed: Filter to completed tasks + :param bool is_subtask: Filter to subtasks + :param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + :param bool sort_ascending: Default `false` + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + matchSnakeCase = '^custom_fields_(.*?)_.*$' + custom_fields_query_param_keys = [] + for key, val in six.iteritems(params['kwargs']): + # Do not throw an error if the user provides custom field query parameters + if (re.match(matchSnakeCase, key)): + custom_field_gid = re.search(matchSnakeCase, key).group(1) + custom_field_query_param_key = key.replace(f'custom_fields_{custom_field_gid}_', f'custom_fields.{custom_field_gid}.') + params[custom_field_query_param_key] = val + custom_fields_query_param_keys.append(custom_field_query_param_key) + continue + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method search_tasks_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `search_tasks_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + # Checks if the user provided custom field query parameters and adds it to the request + for key in custom_fields_query_param_keys: + query_params[key] = params[key] # noqa: E501 + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tasks/search', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/tasks/search', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tasks/search', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_parent_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Set the parent of a task # noqa: E501 + + parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_parent_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new parent of the subtask. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.set_parent_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.set_parent_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def set_parent_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Set the parent of a task # noqa: E501 + + parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_parent_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new parent of the subtask. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_parent_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `set_parent_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `set_parent_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/setParent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/setParent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/setParent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Update a task # noqa: E501 + + A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated task record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to update. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def update_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Update a task # noqa: E501 + + A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated task record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to update. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `update_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/team_memberships_api.py b/asana/api/team_memberships_api.py new file mode 100644 index 00000000..ba1c33c1 --- /dev/null +++ b/asana/api/team_memberships_api.py @@ -0,0 +1,616 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TeamMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_team_membership(self, team_membership_gid, opts, **kwargs): # noqa: E501 + """Get a team membership # noqa: E501 + + Returns the complete team membership record for a single team membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_membership(team_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_membership_with_http_info(team_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_membership_with_http_info(team_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_team_membership_with_http_info(self, team_membership_gid, opts, **kwargs): # noqa: E501 + """Get a team membership # noqa: E501 + + Returns the complete team membership record for a single team membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_membership_with_http_info(team_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_team_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_membership_gid' is set + if (team_membership_gid is None): + raise ValueError("Missing the required parameter `team_membership_gid` when calling `get_team_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_membership_gid'] = team_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/team_memberships/{team_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/team_memberships/{team_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/team_memberships/{team_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_team_memberships(self, opts, **kwargs): # noqa: E501 + """Get team memberships # noqa: E501 + + Returns compact team membership records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str team: Globally unique identifier for the team. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + :param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_memberships_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_memberships_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_team_memberships_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get team memberships # noqa: E501 + + Returns compact team membership records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str team: Globally unique identifier for the team. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + :param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_team_memberships" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/team_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_team_memberships_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a team # noqa: E501 + + Returns the compact team memberships for the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_memberships_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_memberships_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_team_memberships_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a team # noqa: E501 + + Returns the compact team memberships for the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_team_memberships_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_team_memberships_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/team_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_team_memberships_for_user(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get memberships from a user # noqa: E501 + + Returns the compact team membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_user(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_memberships_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_memberships_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + return data + + def get_team_memberships_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get memberships from a user # noqa: E501 + + Returns the compact team membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_user_with_http_info(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_team_memberships_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_team_memberships_for_user`") # noqa: E501 + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_team_memberships_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/team_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/teams_api.py b/asana/api/teams_api.py new file mode 100644 index 00000000..0392c9cd --- /dev/null +++ b/asana/api/teams_api.py @@ -0,0 +1,1053 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TeamsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_user_for_team(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Add a user to a team # noqa: E501 + + The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_user_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_user_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + return data + + def add_user_for_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Add a user to a team # noqa: E501 + + The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_user_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_user_for_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `add_user_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_team(self, body, opts, **kwargs): # noqa: E501 + """Create a team # noqa: E501 + + Creates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_team(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_team_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_team_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_team_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a team # noqa: E501 + + Creates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_team_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team # noqa: E501 + + Returns the full record for a single team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team # noqa: E501 + + Returns the full record for a single team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_teams_for_user(self, user_gid, organization, opts, **kwargs): # noqa: E501 + """Get teams for a user # noqa: E501 + + Returns the compact records for all teams to which the given user is assigned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_user(user_gid, organization, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str organization: The workspace or organization to filter teams on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_teams_for_user_with_http_info(user_gid, organization, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_teams_for_user_with_http_info(user_gid, organization, opts, **kwargs) # noqa: E501 + return data + + def get_teams_for_user_with_http_info(self, user_gid, organization, opts, **kwargs): # noqa: E501 + """Get teams for a user # noqa: E501 + + Returns the compact records for all teams to which the given user is assigned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_user_with_http_info(user_gid, organization, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str organization: The workspace or organization to filter teams on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_teams_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_teams_for_user`") # noqa: E501 + # verify the required parameter 'organization' is set + if (organization is None): + raise ValueError("Missing the required parameter `organization` when calling `get_teams_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['organization'] = organization + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/teams', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_teams_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get teams in a workspace # noqa: E501 + + Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_teams_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_teams_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_teams_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get teams in a workspace # noqa: E501 + + Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_teams_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_teams_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/teams', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_user_for_team(self, body, team_gid, **kwargs): # noqa: E501 + """Remove a user from a team # noqa: E501 + + The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_user_for_team_with_http_info(body, team_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_user_for_team_with_http_info(body, team_gid, **kwargs) # noqa: E501 + return data + + def remove_user_for_team_with_http_info(self, body, team_gid, **kwargs): # noqa: E501 + """Remove a user from a team # noqa: E501 + + The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_user_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_user_for_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `remove_user_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_team(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Update a team # noqa: E501 + + Updates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to update. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + return data + + def update_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Update a team # noqa: E501 + + Updates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to update. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `update_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/time_periods_api.py b/asana/api/time_periods_api.py new file mode 100644 index 00000000..eafe2d99 --- /dev/null +++ b/asana/api/time_periods_api.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TimePeriodsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_time_period(self, time_period_gid, opts, **kwargs): # noqa: E501 + """Get a time period # noqa: E501 + + Returns the full record for a single time period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_period(time_period_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_period_gid: Globally unique identifier for the time period. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_period_with_http_info(time_period_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_period_with_http_info(time_period_gid, opts, **kwargs) # noqa: E501 + return data + + def get_time_period_with_http_info(self, time_period_gid, opts, **kwargs): # noqa: E501 + """Get a time period # noqa: E501 + + Returns the full record for a single time period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_period_with_http_info(time_period_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_period_gid: Globally unique identifier for the time period. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_time_period" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'time_period_gid' is set + if (time_period_gid is None): + raise ValueError("Missing the required parameter `time_period_gid` when calling `get_time_period`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_period_gid'] = time_period_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_periods/{time_period_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_periods/{time_period_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_periods/{time_period_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_time_periods(self, workspace, opts, **kwargs): # noqa: E501 + """Get time periods # noqa: E501 + + Returns compact time period records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_periods(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param date start_on: ISO 8601 date string + :param date end_on: ISO 8601 date string + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_periods_with_http_info(workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_periods_with_http_info(workspace, opts, **kwargs) # noqa: E501 + return data + + def get_time_periods_with_http_info(self, workspace, opts, **kwargs): # noqa: E501 + """Get time periods # noqa: E501 + + Returns compact time period records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_periods_with_http_info(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param date start_on: ISO 8601 date string + :param date end_on: ISO 8601 date string + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_time_periods" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_time_periods`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_periods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/time_periods', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/time_periods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/time_tracking_entries_api.py b/asana/api/time_tracking_entries_api.py new file mode 100644 index 00000000..5f1b0298 --- /dev/null +++ b/asana/api/time_tracking_entries_api.py @@ -0,0 +1,750 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TimeTrackingEntriesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_time_tracking_entry(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a time tracking entry # noqa: E501 + + Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_time_tracking_entry(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the time tracking entry. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_time_tracking_entry_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_time_tracking_entry_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def create_time_tracking_entry_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a time tracking entry # noqa: E501 + + Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_time_tracking_entry_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the time tracking entry. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_time_tracking_entry`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `create_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_time_tracking_entry(self, time_tracking_entry_gid, **kwargs): # noqa: E501 + """Delete a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_time_tracking_entry(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, **kwargs) # noqa: E501 + return data + + def delete_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, **kwargs): # noqa: E501 + """Delete a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'time_tracking_entry_gid' is set + if (time_tracking_entry_gid is None): + raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `delete_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_time_tracking_entries_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get time tracking entries for a task # noqa: E501 + + Returns time tracking entries for a given task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entries_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryCompactArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_tracking_entries_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_tracking_entries_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_time_tracking_entries_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get time tracking entries for a task # noqa: E501 + + Returns time tracking entries for a given task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entries_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryCompactArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_time_tracking_entries_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_time_tracking_entries_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/time_tracking_entries', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_time_tracking_entry(self, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Get a time tracking entry # noqa: E501 + + Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entry(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + return data + + def get_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Get a time tracking entry # noqa: E501 + + Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'time_tracking_entry_gid' is set + if (time_tracking_entry_gid is None): + raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `get_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_time_tracking_entry(self, body, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Update a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated time tracking entry record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_time_tracking_entry(body, time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the time tracking entry. (required) + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + return data + + def update_time_tracking_entry_with_http_info(self, body, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Update a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated time tracking entry record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the time tracking entry. (required) + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_time_tracking_entry`") # noqa: E501 + # verify the required parameter 'time_tracking_entry_gid' is set + if (time_tracking_entry_gid is None): + raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `update_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/typeahead_api.py b/asana/api/typeahead_api.py new file mode 100644 index 00000000..d37e0cf9 --- /dev/null +++ b/asana/api/typeahead_api.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TypeaheadApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def typeahead_for_workspace(self, workspace_gid, resource_type, opts, **kwargs): # noqa: E501 + """Get objects via typeahead # noqa: E501 + + Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.typeahead_for_workspace(workspace_gid, resource_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str resource_type: 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. (required) + :param str type: *Deprecated: new integrations should prefer the resource_type field.* + :param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + :param int count: 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. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, opts, **kwargs) # noqa: E501 + else: + (data) = self.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, opts, **kwargs) # noqa: E501 + return data + + def typeahead_for_workspace_with_http_info(self, workspace_gid, resource_type, opts, **kwargs): # noqa: E501 + """Get objects via typeahead # noqa: E501 + + Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str resource_type: 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. (required) + :param str type: *Deprecated: new integrations should prefer the resource_type field.* + :param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + :param int count: 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. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method typeahead_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `typeahead_for_workspace`") # noqa: E501 + # verify the required parameter 'resource_type' is set + if (resource_type is None): + raise ValueError("Missing the required parameter `resource_type` when calling `typeahead_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['resource_type'] = resource_type + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/typeahead', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/typeahead', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/typeahead', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/user_task_lists_api.py b/asana/api/user_task_lists_api.py new file mode 100644 index 00000000..117ba91a --- /dev/null +++ b/asana/api/user_task_lists_api.py @@ -0,0 +1,317 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class UserTaskListsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_user_task_list(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get a user task list # noqa: E501 + + Returns the full record for a user task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + return data + + def get_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get a user task list # noqa: E501 + + Returns the full record for a user task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list_with_http_info(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_task_list" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_task_list_gid' is set + if (user_task_list_gid is None): + raise ValueError("Missing the required parameter `user_task_list_gid` when calling `get_user_task_list`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_task_list_gid'] = user_task_list_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_task_list_for_user(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get a user's task list # noqa: E501 + + Returns the full record for a user's task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list_for_user(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: The workspace in which to get the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_user_task_list_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_user_task_list_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + return data + + def get_user_task_list_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get a user's task list # noqa: E501 + + Returns the full record for a user's task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list_for_user_with_http_info(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: The workspace in which to get the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_task_list_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_user_task_list_for_user`") # noqa: E501 + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_user_task_list_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/user_task_list', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/users/{user_gid}/user_task_list', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/users/{user_gid}/user_task_list', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/users_api.py b/asana/api/users_api.py new file mode 100644 index 00000000..449f3f12 --- /dev/null +++ b/asana/api/users_api.py @@ -0,0 +1,762 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class UsersApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_favorites_for_user(self, user_gid, resource_type, workspace, opts, **kwargs): # noqa: E501 + """Get a user's favorites # noqa: E501 + + Returns all of a user's favorites in the given workspace, of the given type. Results are given in order (The same order as Asana's sidebar). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_favorites_for_user(user_gid, resource_type, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str resource_type: The resource type of favorites to be returned. (required) + :param str workspace: The workspace in which to get favorites. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, opts, **kwargs) # noqa: E501 + return data + + def get_favorites_for_user_with_http_info(self, user_gid, resource_type, workspace, opts, **kwargs): # noqa: E501 + """Get a user's favorites # noqa: E501 + + Returns all of a user's favorites in the given workspace, of the given type. Results are given in order (The same order as Asana's sidebar). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str resource_type: The resource type of favorites to be returned. (required) + :param str workspace: The workspace in which to get favorites. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_favorites_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_favorites_for_user`") # noqa: E501 + # verify the required parameter 'resource_type' is set + if (resource_type is None): + raise ValueError("Missing the required parameter `resource_type` when calling `get_favorites_for_user`") # noqa: E501 + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_favorites_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['resource_type'] = resource_type + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/favorites', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/favorites', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/favorites', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user(self, user_gid, opts, **kwargs): # noqa: E501 + """Get a user # noqa: E501 + + Returns the full user record for the single user with the provided ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + return data + + def get_user_with_http_info(self, user_gid, opts, **kwargs): # noqa: E501 + """Get a user # noqa: E501 + + Returns the full user record for the single user with the provided ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_with_http_info(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/users/{user_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/users/{user_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users(self, opts, **kwargs): # noqa: E501 + """Get multiple users # noqa: E501 + + Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization ID to filter users on. + :param str team: The team ID to filter users on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_users_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_users_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_users_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple users # noqa: E501 + + Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization ID to filter users on. + :param str team: The team ID to filter users on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get users in a team # noqa: E501 + + Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_users_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_users_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get users in a team # noqa: E501 + + Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_users_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/users', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get users in a workspace or organization # noqa: E501 + + Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_users_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_users_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get users in a workspace or organization # noqa: E501 + + Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_users_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/users', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/webhooks_api.py b/asana/api/webhooks_api.py new file mode 100644 index 00000000..55cb1ccb --- /dev/null +++ b/asana/api/webhooks_api.py @@ -0,0 +1,746 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class WebhooksApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_webhook(self, body, opts, **kwargs): # noqa: E501 + """Establish a webhook # noqa: E501 + + Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will recieve a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer \" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null } } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_webhook(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The webhook workspace and target. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_webhook_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_webhook_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_webhook_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Establish a webhook # noqa: E501 + + Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will recieve a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer \" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null } } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_webhook_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The webhook workspace and target. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_webhook(self, webhook_gid, **kwargs): # noqa: E501 + """Delete a webhook # noqa: E501 + + This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_webhook(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_webhook_with_http_info(webhook_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_webhook_with_http_info(webhook_gid, **kwargs) # noqa: E501 + return data + + def delete_webhook_with_http_info(self, webhook_gid, **kwargs): # noqa: E501 + """Delete a webhook # noqa: E501 + + This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_webhook_with_http_info(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'webhook_gid' is set + if (webhook_gid is None): + raise ValueError("Missing the required parameter `webhook_gid` when calling `delete_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['webhook_gid'] = webhook_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks/{webhook_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_webhook(self, webhook_gid, opts, **kwargs): # noqa: E501 + """Get a webhook # noqa: E501 + + Returns the full record for the given webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhook(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_webhook_with_http_info(webhook_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_webhook_with_http_info(webhook_gid, opts, **kwargs) # noqa: E501 + return data + + def get_webhook_with_http_info(self, webhook_gid, opts, **kwargs): # noqa: E501 + """Get a webhook # noqa: E501 + + Returns the full record for the given webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhook_with_http_info(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'webhook_gid' is set + if (webhook_gid is None): + raise ValueError("Missing the required parameter `webhook_gid` when calling `get_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['webhook_gid'] = webhook_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks/{webhook_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_webhooks(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple webhooks # noqa: E501 + + Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhooks(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to query for webhooks in. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str resource: Only return webhooks for the given resource. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_webhooks_with_http_info(workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_webhooks_with_http_info(workspace, opts, **kwargs) # noqa: E501 + return data + + def get_webhooks_with_http_info(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple webhooks # noqa: E501 + + Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhooks_with_http_info(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to query for webhooks in. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param str resource: Only return webhooks for the given resource. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_webhooks" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_webhooks`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/webhooks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/webhooks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_webhook(self, body, webhook_gid, opts, **kwargs): # noqa: E501 + """Update a webhook # noqa: E501 + + An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_webhook(body, webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated filters for the webhook. (required) + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_webhook_with_http_info(body, webhook_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_webhook_with_http_info(body, webhook_gid, opts, **kwargs) # noqa: E501 + return data + + def update_webhook_with_http_info(self, body, webhook_gid, opts, **kwargs): # noqa: E501 + """Update a webhook # noqa: E501 + + An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_webhook_with_http_info(body, webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated filters for the webhook. (required) + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_webhook`") # noqa: E501 + # verify the required parameter 'webhook_gid' is set + if (webhook_gid is None): + raise ValueError("Missing the required parameter `webhook_gid` when calling `update_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['webhook_gid'] = webhook_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks/{webhook_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/workspace_memberships_api.py b/asana/api/workspace_memberships_api.py new file mode 100644 index 00000000..1fe3c726 --- /dev/null +++ b/asana/api/workspace_memberships_api.py @@ -0,0 +1,466 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class WorkspaceMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_workspace_membership(self, workspace_membership_gid, opts, **kwargs): # noqa: E501 + """Get a workspace membership # noqa: E501 + + Returns the complete workspace record for a single workspace membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_membership(workspace_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_membership_with_http_info(workspace_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_membership_with_http_info(workspace_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_membership_with_http_info(self, workspace_membership_gid, opts, **kwargs): # noqa: E501 + """Get a workspace membership # noqa: E501 + + Returns the complete workspace record for a single workspace membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_membership_with_http_info(workspace_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_workspace_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_membership_gid' is set + if (workspace_membership_gid is None): + raise ValueError("Missing the required parameter `workspace_membership_gid` when calling `get_workspace_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_membership_gid'] = workspace_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspace_memberships/{workspace_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspace_memberships/{workspace_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspace_memberships/{workspace_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_workspace_memberships_for_user(self, user_gid, opts, **kwargs): # noqa: E501 + """Get workspace memberships for a user # noqa: E501 + + Returns the compact workspace membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_user(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_memberships_for_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_memberships_for_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_memberships_for_user_with_http_info(self, user_gid, opts, **kwargs): # noqa: E501 + """Get workspace memberships for a user # noqa: E501 + + Returns the compact workspace membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_user_with_http_info(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_workspace_memberships_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_workspace_memberships_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/workspace_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_workspace_memberships_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get the workspace memberships for a workspace # noqa: E501 + + Returns the compact workspace membership records for the workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_memberships_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get the workspace memberships for a workspace # noqa: E501 + + Returns the compact workspace membership records for the workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_workspace_memberships_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace_memberships_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/workspace_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api/workspaces_api.py b/asana/api/workspaces_api.py new file mode 100644 index 00000000..f052defc --- /dev/null +++ b/asana/api/workspaces_api.py @@ -0,0 +1,753 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class WorkspacesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_user_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Add a user to a workspace or organization # noqa: E501 + + Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserBaseResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_user_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_user_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def add_user_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Add a user to a workspace or organization # noqa: E501 + + Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserBaseResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_user_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_user_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `add_user_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace # noqa: E501 + + Returns the full workspace record for a single workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace # noqa: E501 + + Returns the full workspace record for a single workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_workspaces(self, opts, **kwargs): # noqa: E501 + """Get multiple workspaces # noqa: E501 + + Returns the compact records for all workspaces visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspaces(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspaces_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspaces_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_workspaces_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple workspaces # noqa: E501 + + Returns the compact records for all workspaces visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspaces_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: 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.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_workspaces" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_return_http_data_only": params.get('_return_http_data_only'), + "_preload_content": params.get('_preload_content', True), + "_request_timeout": params.get('_request_timeout'), + "collection_formats": collection_formats + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_user_for_workspace(self, body, workspace_gid, **kwargs): # noqa: E501 + """Remove a user from a workspace or organization # noqa: E501 + + Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_user_for_workspace_with_http_info(body, workspace_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_user_for_workspace_with_http_info(body, workspace_gid, **kwargs) # noqa: E501 + return data + + def remove_user_for_workspace_with_http_info(self, body, workspace_gid, **kwargs): # noqa: E501 + """Remove a user from a workspace or organization # noqa: E501 + + Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_user_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_user_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `remove_user_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Update a workspace # noqa: E501 + + A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The workspace object with all updated properties. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def update_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Update a workspace # noqa: E501 + + A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The workspace object with all updated properties. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `update_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats + ) + if params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/asana/api_client.py b/asana/api_client.py new file mode 100644 index 00000000..cb937f97 --- /dev/null +++ b/asana/api_client.py @@ -0,0 +1,626 @@ +# coding: utf-8 +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" +from __future__ import absolute_import + +import logging +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import platform +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from asana.configuration import Configuration +from asana import rest + +from urllib.parse import urlencode + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + try: + self.pool = ThreadPool() + except OSError: + logging.warning('Looks like your system does not support ThreadPool but it will try without it if you do not use async requests') + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/5.0.0/python' + # Add custom header + self.default_headers['X-Asana-Client-Lib'] = urlencode( + { + 'language': 'Python', + 'version': '5.0.0', + 'language_version': platform.python_version(), + 'os': platform.system(), + 'os_version': platform.release() + } + ) + + def __del__(self): + if hasattr(self, "pool"): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + # Decode the byte string and replace non-breaking space characters with regular + # spaces then parse the json bytes into a python dict + data = json.loads(response.data.decode('utf8').replace('\xa0', ' ')) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return data + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + + # Convert query params dict into a list of query param tuples. + # This step was previous implemented in the api.mustache but we needed + # to modify the query params dict for pagination so we move this conversion step here + query_params = [(k, v) for k, v in query_params.items()] + + if not async_req: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, _request_timeout)) + return thread + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + # In the OAS we define "personalAccessToken" but for the SDK we want users to use the term "token" + # this logic will get the auth_settings for "token" settings that we've added + if auth == 'personalAccessToken': + auth_setting = self.configuration.auth_settings().get('token') + else: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + response_data = response.data + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + else: + f.write(response_data) + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __hasattr(self, object, name): + return name in object.__class__.__dict__ diff --git a/asana/configuration.py b/asana/configuration.py new file mode 100644 index 00000000..57cd5da3 --- /dev/null +++ b/asana/configuration.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class TypeWithDefault(type): + def __init__(cls, name, bases, dct): + super(TypeWithDefault, cls).__init__(name, bases, dct) + cls._default = None + + def __call__(cls): + if cls._default is None: + cls._default = type.__call__(cls) + return copy.copy(cls._default) + + def set_default(cls, default): + cls._default = copy.copy(default) + + +class Configuration(six.with_metaclass(TypeWithDefault, object)): + """NOTE: This class is auto generated by the swagger code generator program. + + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "https://app.asana.com/api/1.0" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("asana") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + # Collection + # by default we return a collection object to be used for pagination. + # If the user wants to turn this off they can set this to False + self.return_page_iterator = True + + # The default limit query parameter value for api endpoints that return multiple resources + self.page_limit = 100 + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + # Add a case for OAS bearer token definition + 'token': + { + 'type': 'token', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, + } + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.0\n"\ + "SDK Package Version: 5.0.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/asana/pagination/__init__.py b/asana/pagination/__init__.py new file mode 100644 index 00000000..c9c10e9f --- /dev/null +++ b/asana/pagination/__init__.py @@ -0,0 +1,19 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import pagination into pagination package +from asana.pagination.page_iterator import PageIterator +from asana.pagination.event_iterator import EventIterator diff --git a/asana/pagination/event_iterator.py b/asana/pagination/event_iterator.py new file mode 100644 index 00000000..6ccc5250 --- /dev/null +++ b/asana/pagination/event_iterator.py @@ -0,0 +1,38 @@ +import json +from asana.pagination.page_iterator import PageIterator +from asana.rest import ApiException + +class EventIterator(PageIterator): + def __init__(self, api_client, api_request_data, **kwargs): + super().__init__(api_client, api_request_data, **kwargs) + self.sync = False + self.has_more = True + + def __next__(self): + if not self.has_more: + raise StopIteration + + result = {} + + try: + result = self.call_api() + except ApiException as e: + if (e.status == 412): + errors = json.loads(e.body.decode("utf-8")) + self.sync = errors["sync"] + else: + raise e + + if (self.sync): + self.api_request_data["query_params"]["sync"] = self.sync + else: + self.sync = result.get('sync', None) + + if not result: + try: + result = self.call_api() + except ApiException as e: + raise e + + self.has_more = result.get('has_more', False) + return result["data"] diff --git a/asana/pagination/page_iterator.py b/asana/pagination/page_iterator.py new file mode 100644 index 00000000..66c078e1 --- /dev/null +++ b/asana/pagination/page_iterator.py @@ -0,0 +1,64 @@ +from asana.rest import ApiException + +class PageIterator(object): + def __init__(self, api_client, api_request_data, **kwargs): + self.__api_client = api_client + self.api_request_data = api_request_data + self.next_page = False + self.item_limit = float('inf') if kwargs.get('item_limit', None) == None else kwargs.get('item_limit') + self.count = 0 + + def __iter__(self): + """Iterator interface, self is an iterator""" + return self + + def __next__(self): + limit = self.api_request_data["query_params"].get("limit", None) + if limit: + self.api_request_data["query_params"]["limit"] = min(limit, self.item_limit - self.count) + + if self.next_page is None or self.api_request_data["query_params"].get("limit", None) == 0: + raise StopIteration + + try: + result = self.call_api() + except ApiException as e: + raise e + + # If the response has a next_page add the offset to the api_request_data for the next request + self.next_page = result.get('next_page', None) + if (self.next_page): + self.api_request_data["query_params"]["offset"] = self.next_page["offset"] + data = result['data'] + if data != None: + self.count += len(data) + return data + + def next(self): + """Alias for __next__""" + return self.__next__() + + def items(self): + """Returns an iterator for each item in each page""" + for page in self: + for item in page: + yield item + + def call_api(self): + return self.__api_client.call_api( + self.api_request_data["resource_path"], + self.api_request_data["method"], + self.api_request_data["path_params"], + self.api_request_data["query_params"], + self.api_request_data["header_params"], + self.api_request_data["body"], + self.api_request_data["post_params"], + self.api_request_data["files"], + self.api_request_data["response_type"], + self.api_request_data["auth_settings"], + self.api_request_data["async_req"], + self.api_request_data["_return_http_data_only"], + self.api_request_data["collection_formats"], + self.api_request_data["_preload_content"], + self.api_request_data["_request_timeout"] + ) diff --git a/asana/rest.py b/asana/rest.py new file mode 100644 index 00000000..8b169f7f --- /dev/null +++ b/asana/rest.py @@ -0,0 +1,317 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if query_params: + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = '{}' + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/docs/AttachmentsApi.md b/docs/AttachmentsApi.md new file mode 100644 index 00000000..4d2eda6e --- /dev/null +++ b/docs/AttachmentsApi.md @@ -0,0 +1,227 @@ +# asana.AttachmentsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_attachment_for_object**](AttachmentsApi.md#create_attachment_for_object) | **POST** /attachments | Upload an attachment +[**delete_attachment**](AttachmentsApi.md#delete_attachment) | **DELETE** /attachments/{attachment_gid} | Delete an attachment +[**get_attachment**](AttachmentsApi.md#get_attachment) | **GET** /attachments/{attachment_gid} | Get an attachment +[**get_attachments_for_object**](AttachmentsApi.md#get_attachments_for_object) | **GET** /attachments | Get attachments from an object + +# **create_attachment_for_object** + +Upload an attachment + +Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request. + +([more information](https://developers.asana.com/reference/createattachmentforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +opts = { + 'resource_subtype': "external" # str | + 'file': "file_example" # str | + 'parent': "parent_example" # str | + 'url': "url_example" # str | + 'name': "name_example" # str | + 'connect_to_app': True # bool | + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Upload an attachment + api_response = attachments_api_instance.create_attachment_for_object(opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling AttachmentsApi->create_attachment_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource_subtype** | **str**| | [optional] + **file** | **str**| | [optional] + **parent** | **str**| | [optional] + **url** | **str**| | [optional] + **name** | **str**| | [optional] + **connect_to_app** | **bool**| | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_attachment** + +Delete an attachment + +Deletes a specific, existing attachment. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteattachment)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +attachment_gid = "12345" # str | Globally unique identifier for the attachment. + + +try: + # Delete an attachment + api_response = attachments_api_instance.delete_attachment(attachment_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling AttachmentsApi->delete_attachment: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **attachment_gid** | **str**| Globally unique identifier for the attachment. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_attachment** + +Get an attachment + +Get the full record for a single attachment. + +([more information](https://developers.asana.com/reference/getattachment)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +attachment_gid = "12345" # str | Globally unique identifier for the attachment. +opts = { + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get an attachment + api_response = attachments_api_instance.get_attachment(attachment_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachment: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **attachment_gid** | **str**| Globally unique identifier for the attachment. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_attachments_for_object** + +Get attachments from an object + +Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images. + +([more information](https://developers.asana.com/reference/getattachmentsforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "connected_to_app,created_at,download_url,host,name,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permanent_url,resource_subtype,size,uri,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get attachments from an object + api_response = attachments_api_instance.get_attachments_for_object(parent, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachments_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AttachmentsApi.yaml b/docs/AttachmentsApi.yaml new file mode 100644 index 00000000..4bac2b73 --- /dev/null +++ b/docs/AttachmentsApi.yaml @@ -0,0 +1,95 @@ +AttachmentsApi: + create_attachment_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + opts = { + 'resource_subtype': "external" # str | + 'file': "file_example" # str | + 'parent': "parent_example" # str | + 'url': "url_example" # str | + 'name': "name_example" # str | + 'connect_to_app': True # bool | + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Upload an attachment + api_response = attachments_api_instance.create_attachment_for_object(opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling AttachmentsApi->create_attachment_for_object: %s\n" % e) + delete_attachment: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + attachment_gid = "12345" # str | Globally unique identifier for the attachment. + + + try: + # Delete an attachment + api_response = attachments_api_instance.delete_attachment(attachment_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling AttachmentsApi->delete_attachment: %s\n" % e) + get_attachment: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + attachment_gid = "12345" # str | Globally unique identifier for the attachment. + opts = { + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get an attachment + api_response = attachments_api_instance.get_attachment(attachment_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachment: %s\n" % e) + get_attachments_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "connected_to_app,created_at,download_url,host,name,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permanent_url,resource_subtype,size,uri,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get attachments from an object + api_response = attachments_api_instance.get_attachments_for_object(parent, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachments_for_object: %s\n" % e) diff --git a/docs/AuditLogAPIApi.md b/docs/AuditLogAPIApi.md new file mode 100644 index 00000000..0f8b41c5 --- /dev/null +++ b/docs/AuditLogAPIApi.md @@ -0,0 +1,74 @@ +# asana.AuditLogAPIApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_audit_log_events**](AuditLogAPIApi.md#get_audit_log_events) | **GET** /workspaces/{workspace_gid}/audit_log_events | Get audit log events + +# **get_audit_log_events** + +Get audit log events + +Retrieve the audit log events that have been captured in your domain. This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results. There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match. The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters. *Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.* When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs. + +([more information](https://developers.asana.com/reference/getauditlogevents)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +audit_log_api_api_instance = asana.AuditLogAPIApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'start_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created after this time (inclusive). + 'end_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created before this time (exclusive). + 'event_type': "event_type_example", # str | Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + 'actor_type': "actor_type_example", # str | Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + 'actor_gid': "actor_gid_example", # str | Filter to events triggered by the actor with this ID. + 'resource_gid': "resource_gid_example", # str | Filter to events with this resource ID. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # 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.' +} + +try: + # Get audit log events + api_response = audit_log_api_api_instance.get_audit_log_events(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling AuditLogAPIApi->get_audit_log_events: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **start_at** | **datetime**| Filter to events created after this time (inclusive). | [optional] + **end_at** | **datetime**| Filter to events created before this time (exclusive). | [optional] + **event_type** | **str**| Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. | [optional] + **actor_type** | **str**| Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. | [optional] + **actor_gid** | **str**| Filter to events triggered by the actor with this ID. | [optional] + **resource_gid** | **str**| Filter to events with this resource ID. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AuditLogAPIApi.yaml b/docs/AuditLogAPIApi.yaml new file mode 100644 index 00000000..495783a4 --- /dev/null +++ b/docs/AuditLogAPIApi.yaml @@ -0,0 +1,31 @@ +AuditLogAPIApi: + get_audit_log_events: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + audit_log_api_api_instance = asana.AuditLogAPIApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'start_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created after this time (inclusive). + 'end_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created before this time (exclusive). + 'event_type': "event_type_example", # str | Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + 'actor_type': "actor_type_example", # str | Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + 'actor_gid': "actor_gid_example", # str | Filter to events triggered by the actor with this ID. + 'resource_gid': "resource_gid_example", # str | Filter to events with this resource ID. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # 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.' + } + + try: + # Get audit log events + api_response = audit_log_api_api_instance.get_audit_log_events(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling AuditLogAPIApi->get_audit_log_events: %s\n" % e) diff --git a/docs/BatchAPIApi.md b/docs/BatchAPIApi.md new file mode 100644 index 00000000..7b6c57e6 --- /dev/null +++ b/docs/BatchAPIApi.md @@ -0,0 +1,60 @@ +# asana.BatchAPIApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_batch_request**](BatchAPIApi.md#create_batch_request) | **POST** /batch | Submit parallel requests + +# **create_batch_request** + +Submit parallel requests + +Make multiple requests in parallel to Asana's API. + +([more information](https://developers.asana.com/reference/createbatchrequest)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +batch_api_api_instance = asana.BatchAPIApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The requests to batch together via the Batch API. +opts = { + 'opt_fields': "body,headers,status_code" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Submit parallel requests + api_response = batch_api_api_instance.create_batch_request(body, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling BatchAPIApi->create_batch_request: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The requests to batch together via the Batch API. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/BatchAPIApi.yaml b/docs/BatchAPIApi.yaml new file mode 100644 index 00000000..bf6ecb83 --- /dev/null +++ b/docs/BatchAPIApi.yaml @@ -0,0 +1,24 @@ +BatchAPIApi: + create_batch_request: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + batch_api_api_instance = asana.BatchAPIApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The requests to batch together via the Batch API. + opts = { + 'opt_fields': "body,headers,status_code" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Submit parallel requests + api_response = batch_api_api_instance.create_batch_request(body, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling BatchAPIApi->create_batch_request: %s\n" % e) diff --git a/docs/CustomFieldSettingsApi.md b/docs/CustomFieldSettingsApi.md new file mode 100644 index 00000000..acd98728 --- /dev/null +++ b/docs/CustomFieldSettingsApi.md @@ -0,0 +1,121 @@ +# asana.CustomFieldSettingsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_custom_field_settings_for_portfolio**](CustomFieldSettingsApi.md#get_custom_field_settings_for_portfolio) | **GET** /portfolios/{portfolio_gid}/custom_field_settings | Get a portfolio's custom fields +[**get_custom_field_settings_for_project**](CustomFieldSettingsApi.md#get_custom_field_settings_for_project) | **GET** /projects/{project_gid}/custom_field_settings | Get a project's custom fields + +# **get_custom_field_settings_for_portfolio** + +Get a portfolio's custom fields + +Returns a list of all of the custom fields settings on a portfolio, in compact form. + +([more information](https://developers.asana.com/reference/getcustomfieldsettingsforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a portfolio's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_custom_field_settings_for_project** + +Get a project's custom fields + +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` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information. + +([more information](https://developers.asana.com/reference/getcustomfieldsettingsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CustomFieldSettingsApi.yaml b/docs/CustomFieldSettingsApi.yaml new file mode 100644 index 00000000..4e83314b --- /dev/null +++ b/docs/CustomFieldSettingsApi.yaml @@ -0,0 +1,51 @@ +CustomFieldSettingsApi: + get_custom_field_settings_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a portfolio's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_portfolio: %s\n" % e) + get_custom_field_settings_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_project: %s\n" % e) diff --git a/docs/CustomFieldsApi.md b/docs/CustomFieldsApi.md new file mode 100644 index 00000000..4af01f02 --- /dev/null +++ b/docs/CustomFieldsApi.md @@ -0,0 +1,433 @@ +# asana.CustomFieldsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_custom_field**](CustomFieldsApi.md#create_custom_field) | **POST** /custom_fields | Create a custom field +[**create_enum_option_for_custom_field**](CustomFieldsApi.md#create_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options | Create an enum option +[**delete_custom_field**](CustomFieldsApi.md#delete_custom_field) | **DELETE** /custom_fields/{custom_field_gid} | Delete a custom field +[**get_custom_field**](CustomFieldsApi.md#get_custom_field) | **GET** /custom_fields/{custom_field_gid} | Get a custom field +[**get_custom_fields_for_workspace**](CustomFieldsApi.md#get_custom_fields_for_workspace) | **GET** /workspaces/{workspace_gid}/custom_fields | Get a workspace's custom fields +[**insert_enum_option_for_custom_field**](CustomFieldsApi.md#insert_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options/insert | Reorder a custom field's enum +[**update_custom_field**](CustomFieldsApi.md#update_custom_field) | **PUT** /custom_fields/{custom_field_gid} | Update a custom field +[**update_enum_option**](CustomFieldsApi.md#update_enum_option) | **PUT** /enum_options/{enum_option_gid} | Update an enum option + +# **create_custom_field** + +Create a custom field + +Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as `Due Date` or `Assignee`. A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`, `date`, or `people`. Returns the full record of the newly created custom field. + +([more information](https://developers.asana.com/reference/createcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object to create. +opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a custom field + api_response = custom_fields_api_instance.create_custom_field(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->create_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The custom field object to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_enum_option_for_custom_field** + +Create an enum option + +Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 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. + +([more information](https://developers.asana.com/reference/createenumoptionforcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create an enum option + api_response = custom_fields_api_instance.create_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->create_enum_option_for_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **body** | **Dict**| The enum option object to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_custom_field** + +Delete a custom field + +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. + +([more information](https://developers.asana.com/reference/deletecustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + + +try: + # Delete a custom field + api_response = custom_fields_api_instance.delete_custom_field(custom_field_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->delete_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_custom_field** + +Get a custom field + +Get the complete definition of a custom field’s metadata. Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions. + +([more information](https://developers.asana.com/reference/getcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a custom field + api_response = custom_fields_api_instance.get_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_custom_fields_for_workspace** + +Get a workspace's custom fields + +Returns a list of the compact representation of all of the custom fields in a workspace. + +([more information](https://developers.asana.com/reference/getcustomfieldsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,offset,path,people_value,people_value.name,precision,resource_subtype,text_value,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a workspace's custom fields + api_response = custom_fields_api_instance.get_custom_fields_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_fields_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **insert_enum_option_for_custom_field** + +Reorder a custom field's enum + +Moves a particular enum option to be either before or after another specified enum option in the custom field. Locked custom fields can only be reordered by the user who locked the field. + +([more information](https://developers.asana.com/reference/insertenumoptionforcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Reorder a custom field's enum + api_response = custom_fields_api_instance.insert_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->insert_enum_option_for_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **body** | **Dict**| The enum option object to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_custom_field** + +Update a custom field + +A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged 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. + +([more information](https://developers.asana.com/reference/updatecustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object with all updated properties. + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a custom field + api_response = custom_fields_api_instance.update_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->update_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **body** | **Dict**| The custom field object with all updated properties. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_enum_option** + +Update an enum option + +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. + +([more information](https://developers.asana.com/reference/updateenumoption)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +enum_option_gid = "124578" # str | Globally unique identifier for the enum option. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to update + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update an enum option + api_response = custom_fields_api_instance.update_enum_option(enum_option_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->update_enum_option: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_option_gid** | **str**| Globally unique identifier for the enum option. | + **body** | **Dict**| The enum option object to update | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CustomFieldsApi.yaml b/docs/CustomFieldsApi.yaml new file mode 100644 index 00000000..1d3b56df --- /dev/null +++ b/docs/CustomFieldsApi.yaml @@ -0,0 +1,182 @@ +CustomFieldsApi: + create_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object to create. + opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a custom field + api_response = custom_fields_api_instance.create_custom_field(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->create_custom_field: %s\n" % e) + create_enum_option_for_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create an enum option + api_response = custom_fields_api_instance.create_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->create_enum_option_for_custom_field: %s\n" % e) + delete_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + + + try: + # Delete a custom field + api_response = custom_fields_api_instance.delete_custom_field(custom_field_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->delete_custom_field: %s\n" % e) + get_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a custom field + api_response = custom_fields_api_instance.get_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_field: %s\n" % e) + get_custom_fields_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,offset,path,people_value,people_value.name,precision,resource_subtype,text_value,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a workspace's custom fields + api_response = custom_fields_api_instance.get_custom_fields_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_fields_for_workspace: %s\n" % e) + insert_enum_option_for_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Reorder a custom field's enum + api_response = custom_fields_api_instance.insert_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->insert_enum_option_for_custom_field: %s\n" % e) + update_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object with all updated properties. + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a custom field + api_response = custom_fields_api_instance.update_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->update_custom_field: %s\n" % e) + update_enum_option: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + enum_option_gid = "124578" # str | Globally unique identifier for the enum option. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to update + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update an enum option + api_response = custom_fields_api_instance.update_enum_option(enum_option_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->update_enum_option: %s\n" % e) diff --git a/docs/EventsApi.md b/docs/EventsApi.md new file mode 100644 index 00000000..32c112c4 --- /dev/null +++ b/docs/EventsApi.md @@ -0,0 +1,62 @@ +# asana.EventsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_events**](EventsApi.md#get_events) | **GET** /events | Get events on a resource + +# **get_events** + +Get events on a resource + +Returns the full record for all events that have occurred since the sync token was created. A `GET` request to the endpoint `/[path_to_resource]/events` can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, `has_more: true` will be returned in the response, indicating that there are more events to pull. *Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.* + +([more information](https://developers.asana.com/reference/getevents)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +events_api_instance = asana.EventsApi(api_client) +resource = "12345" # str | A resource ID to subscribe to. The resource can be a task or project. +opts = { + 'sync': "de4774f6915eae04714ca93bb2f5ee81", # str | A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + 'opt_fields': "action,change,change.action,change.added_value,change.field,change.new_value,change.removed_value,created_at,parent,parent.name,resource,resource.name,type,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get events on a resource + api_response = events_api_instance.get_events(resource, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling EventsApi->get_events: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| A resource ID to subscribe to. The resource can be a task or project. | + **sync** | **str**| A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/EventsApi.yaml b/docs/EventsApi.yaml new file mode 100644 index 00000000..35b93e8f --- /dev/null +++ b/docs/EventsApi.yaml @@ -0,0 +1,25 @@ +EventsApi: + get_events: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + events_api_instance = asana.EventsApi(api_client) + resource = "12345" # str | A resource ID to subscribe to. The resource can be a task or project. + opts = { + 'sync': "de4774f6915eae04714ca93bb2f5ee81", # str | A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + 'opt_fields': "action,change,change.action,change.added_value,change.field,change.new_value,change.removed_value,created_at,parent,parent.name,resource,resource.name,type,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get events on a resource + api_response = events_api_instance.get_events(resource, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling EventsApi->get_events: %s\n" % e) diff --git a/docs/GoalRelationshipsApi.md b/docs/GoalRelationshipsApi.md new file mode 100644 index 00000000..b0697e45 --- /dev/null +++ b/docs/GoalRelationshipsApi.md @@ -0,0 +1,277 @@ +# asana.GoalRelationshipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_supporting_relationship**](GoalRelationshipsApi.md#add_supporting_relationship) | **POST** /goals/{goal_gid}/addSupportingRelationship | Add a supporting goal relationship +[**get_goal_relationship**](GoalRelationshipsApi.md#get_goal_relationship) | **GET** /goal_relationships/{goal_relationship_gid} | Get a goal relationship +[**get_goal_relationships**](GoalRelationshipsApi.md#get_goal_relationships) | **GET** /goal_relationships | Get goal relationships +[**remove_supporting_relationship**](GoalRelationshipsApi.md#remove_supporting_relationship) | **POST** /goals/{goal_gid}/removeSupportingRelationship | Removes a supporting goal relationship +[**update_goal_relationship**](GoalRelationshipsApi.md#update_goal_relationship) | **PUT** /goal_relationships/{goal_relationship_gid} | Update a goal relationship + +# **add_supporting_relationship** + +Add a supporting goal relationship + +Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record. + +([more information](https://developers.asana.com/reference/addsupportingrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be added to the goal +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a supporting goal relationship + api_response = goal_relationships_api_instance.add_supporting_relationship(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->add_supporting_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The supporting resource to be added to the goal | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goal_relationship** + +Get a goal relationship + +Returns the complete updated goal relationship record for a single goal relationship. + +([more information](https://developers.asana.com/reference/getgoalrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. +opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a goal relationship + api_response = goal_relationships_api_instance.get_goal_relationship(goal_relationship_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_relationship_gid** | **str**| Globally unique identifier for the goal relationship. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goal_relationships** + +Get goal relationships + +Returns compact goal relationship records. + +([more information](https://developers.asana.com/reference/getgoalrelationships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +supported_goal = "12345" # str | Globally unique identifier for the supported goal in the goal relationship. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'resource_subtype': "subgoal", # str | If provided, filter to goal relationships with a given resource_subtype. + 'opt_fields': "contribution_weight,offset,path,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get goal relationships + api_response = goal_relationships_api_instance.get_goal_relationships(supported_goal, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **supported_goal** | **str**| Globally unique identifier for the supported goal in the goal relationship. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **resource_subtype** | **str**| If provided, filter to goal relationships with a given resource_subtype. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_supporting_relationship** + +Removes a supporting goal relationship + +Removes a goal relationship for a given parent goal. + +([more information](https://developers.asana.com/reference/removesupportingrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be removed from the goal +goal_gid = "12345" # str | Globally unique identifier for the goal. + + +try: + # Removes a supporting goal relationship + api_response = goal_relationships_api_instance.remove_supporting_relationship(body, goal_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->remove_supporting_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The supporting resource to be removed from the goal | + **goal_gid** | **str**| Globally unique identifier for the goal. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_goal_relationship** + +Update a goal relationship + +An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record. + +([more information](https://developers.asana.com/reference/updategoalrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal relationship. +goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. +opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a goal relationship + api_response = goal_relationships_api_instance.update_goal_relationship(body, goal_relationship_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->update_goal_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the goal relationship. | + **goal_relationship_gid** | **str**| Globally unique identifier for the goal relationship. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/GoalRelationshipsApi.yaml b/docs/GoalRelationshipsApi.yaml new file mode 100644 index 00000000..3f46c607 --- /dev/null +++ b/docs/GoalRelationshipsApi.yaml @@ -0,0 +1,116 @@ +GoalRelationshipsApi: + add_supporting_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be added to the goal + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a supporting goal relationship + api_response = goal_relationships_api_instance.add_supporting_relationship(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->add_supporting_relationship: %s\n" % e) + get_goal_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. + opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a goal relationship + api_response = goal_relationships_api_instance.get_goal_relationship(goal_relationship_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationship: %s\n" % e) + get_goal_relationships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + supported_goal = "12345" # str | Globally unique identifier for the supported goal in the goal relationship. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'resource_subtype': "subgoal", # str | If provided, filter to goal relationships with a given resource_subtype. + 'opt_fields': "contribution_weight,offset,path,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get goal relationships + api_response = goal_relationships_api_instance.get_goal_relationships(supported_goal, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationships: %s\n" % e) + remove_supporting_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be removed from the goal + goal_gid = "12345" # str | Globally unique identifier for the goal. + + + try: + # Removes a supporting goal relationship + api_response = goal_relationships_api_instance.remove_supporting_relationship(body, goal_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->remove_supporting_relationship: %s\n" % e) + update_goal_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal relationship. + goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. + opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a goal relationship + api_response = goal_relationships_api_instance.update_goal_relationship(body, goal_relationship_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->update_goal_relationship: %s\n" % e) diff --git a/docs/GoalsApi.md b/docs/GoalsApi.md new file mode 100644 index 00000000..6e2315da --- /dev/null +++ b/docs/GoalsApi.md @@ -0,0 +1,552 @@ +# asana.GoalsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_followers**](GoalsApi.md#add_followers) | **POST** /goals/{goal_gid}/addFollowers | Add a collaborator to a goal +[**create_goal**](GoalsApi.md#create_goal) | **POST** /goals | Create a goal +[**create_goal_metric**](GoalsApi.md#create_goal_metric) | **POST** /goals/{goal_gid}/setMetric | Create a goal metric +[**delete_goal**](GoalsApi.md#delete_goal) | **DELETE** /goals/{goal_gid} | Delete a goal +[**get_goal**](GoalsApi.md#get_goal) | **GET** /goals/{goal_gid} | Get a goal +[**get_goals**](GoalsApi.md#get_goals) | **GET** /goals | Get goals +[**get_parent_goals_for_goal**](GoalsApi.md#get_parent_goals_for_goal) | **GET** /goals/{goal_gid}/parentGoals | Get parent goals from a goal +[**remove_followers**](GoalsApi.md#remove_followers) | **POST** /goals/{goal_gid}/removeFollowers | Remove a collaborator from a goal +[**update_goal**](GoalsApi.md#update_goal) | **PUT** /goals/{goal_gid} | Update a goal +[**update_goal_metric**](GoalsApi.md#update_goal_metric) | **POST** /goals/{goal_gid}/setMetricCurrentValue | Update a goal metric + +# **add_followers** + +Add a collaborator to a goal + +Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. + +([more information](https://developers.asana.com/reference/addfollowers)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be added as collaborators +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a collaborator to a goal + api_response = goals_api_instance.add_followers(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->add_followers: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to be added as collaborators | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_goal** + +Create a goal + +Creates a new goal in a workspace or team. Returns the full record of the newly created goal. + +([more information](https://developers.asana.com/reference/creategoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal to create. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a goal + api_response = goals_api_instance.create_goal(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->create_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The goal to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_goal_metric** + +Create a goal metric + +Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists. + +([more information](https://developers.asana.com/reference/creategoalmetric)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal metric to create. +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a goal metric + api_response = goals_api_instance.create_goal_metric(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->create_goal_metric: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The goal metric to create. | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_goal** + +Delete a goal + +A specific, existing goal can be deleted by making a DELETE request on the URL for that goal. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletegoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +goal_gid = "12345" # str | Globally unique identifier for the goal. + + +try: + # Delete a goal + api_response = goals_api_instance.delete_goal(goal_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->delete_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_gid** | **str**| Globally unique identifier for the goal. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goal** + +Get a goal + +Returns the complete goal record for a single goal. + +([more information](https://developers.asana.com/reference/getgoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a goal + api_response = goals_api_instance.get_goal(goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->get_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goals** + +Get goals + +Returns compact goal records. + +([more information](https://developers.asana.com/reference/getgoals)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +opts = { + 'portfolio': "159874", # str | Globally unique identifier for supporting portfolio. + 'project': "512241", # str | Globally unique identifier for supporting project. + 'task': "78424", # str | Globally unique identifier for supporting task. + 'is_workspace_level': False, # bool | Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + 'team': "31326", # str | Globally unique identifier for the team. + 'workspace': "31326", # str | Globally unique identifier for the workspace. + 'time_periods': "221693,506165", # list[str] | Globally unique identifiers for the time periods. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,offset,owner,owner.name,path,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get goals + api_response = goals_api_instance.get_goals(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling GoalsApi->get_goals: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio** | **str**| Globally unique identifier for supporting portfolio. | [optional] + **project** | **str**| Globally unique identifier for supporting project. | [optional] + **task** | **str**| Globally unique identifier for supporting task. | [optional] + **is_workspace_level** | **bool**| Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. | [optional] + **team** | **str**| Globally unique identifier for the team. | [optional] + **workspace** | **str**| Globally unique identifier for the workspace. | [optional] + **time_periods** | **Dict**| Globally unique identifiers for the time periods. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_parent_goals_for_goal** + +Get parent goals from a goal + +Returns a compact representation of all of the parent goals of a goal. + +([more information](https://developers.asana.com/reference/getparentgoalsforgoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get parent goals from a goal + api_response = goals_api_instance.get_parent_goals_for_goal(goal_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling GoalsApi->get_parent_goals_for_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_followers** + +Remove a collaborator from a goal + +Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. + +([more information](https://developers.asana.com/reference/removefollowers)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be removed as collaborators +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove a collaborator from a goal + api_response = goals_api_instance.remove_followers(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->remove_followers: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to be removed as collaborators | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_goal** + +Update a goal + +An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal record. + +([more information](https://developers.asana.com/reference/updategoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal. +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a goal + api_response = goals_api_instance.update_goal(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->update_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the goal. | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_goal_metric** + +Update a goal metric + +Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code. Returns the complete updated goal metric record. + +([more information](https://developers.asana.com/reference/updategoalmetric)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal metric. +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a goal metric + api_response = goals_api_instance.update_goal_metric(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->update_goal_metric: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the goal metric. | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/GoalsApi.yaml b/docs/GoalsApi.yaml new file mode 100644 index 00000000..e93575d1 --- /dev/null +++ b/docs/GoalsApi.yaml @@ -0,0 +1,234 @@ +GoalsApi: + add_followers: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be added as collaborators + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a collaborator to a goal + api_response = goals_api_instance.add_followers(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->add_followers: %s\n" % e) + create_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal to create. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a goal + api_response = goals_api_instance.create_goal(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->create_goal: %s\n" % e) + create_goal_metric: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal metric to create. + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a goal metric + api_response = goals_api_instance.create_goal_metric(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->create_goal_metric: %s\n" % e) + delete_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + goal_gid = "12345" # str | Globally unique identifier for the goal. + + + try: + # Delete a goal + api_response = goals_api_instance.delete_goal(goal_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->delete_goal: %s\n" % e) + get_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a goal + api_response = goals_api_instance.get_goal(goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->get_goal: %s\n" % e) + get_goals: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + opts = { + 'portfolio': "159874", # str | Globally unique identifier for supporting portfolio. + 'project': "512241", # str | Globally unique identifier for supporting project. + 'task': "78424", # str | Globally unique identifier for supporting task. + 'is_workspace_level': False, # bool | Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + 'team': "31326", # str | Globally unique identifier for the team. + 'workspace': "31326", # str | Globally unique identifier for the workspace. + 'time_periods': "221693,506165", # list[str] | Globally unique identifiers for the time periods. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,offset,owner,owner.name,path,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get goals + api_response = goals_api_instance.get_goals(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling GoalsApi->get_goals: %s\n" % e) + get_parent_goals_for_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get parent goals from a goal + api_response = goals_api_instance.get_parent_goals_for_goal(goal_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling GoalsApi->get_parent_goals_for_goal: %s\n" % e) + remove_followers: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be removed as collaborators + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove a collaborator from a goal + api_response = goals_api_instance.remove_followers(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->remove_followers: %s\n" % e) + update_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal. + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a goal + api_response = goals_api_instance.update_goal(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->update_goal: %s\n" % e) + update_goal_metric: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal metric. + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a goal metric + api_response = goals_api_instance.update_goal_metric(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->update_goal_metric: %s\n" % e) diff --git a/docs/JobsApi.md b/docs/JobsApi.md new file mode 100644 index 00000000..53dd4abf --- /dev/null +++ b/docs/JobsApi.md @@ -0,0 +1,59 @@ +# asana.JobsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_job**](JobsApi.md#get_job) | **GET** /jobs/{job_gid} | Get a job by id + +# **get_job** + +Get a job by id + +Returns the full record for a job. + +([more information](https://developers.asana.com/reference/getjob)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +jobs_api_instance = asana.JobsApi(api_client) +job_gid = "12345" # str | Globally unique identifier for the job. +opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a job by id + api_response = jobs_api_instance.get_job(job_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling JobsApi->get_job: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job_gid** | **str**| Globally unique identifier for the job. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/JobsApi.yaml b/docs/JobsApi.yaml new file mode 100644 index 00000000..ad231d92 --- /dev/null +++ b/docs/JobsApi.yaml @@ -0,0 +1,23 @@ +JobsApi: + get_job: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + jobs_api_instance = asana.JobsApi(api_client) + job_gid = "12345" # str | Globally unique identifier for the job. + opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a job by id + api_response = jobs_api_instance.get_job(job_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling JobsApi->get_job: %s\n" % e) diff --git a/docs/MembershipsApi.md b/docs/MembershipsApi.md new file mode 100644 index 00000000..dde8dafa --- /dev/null +++ b/docs/MembershipsApi.md @@ -0,0 +1,217 @@ +# asana.MembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_membership**](MembershipsApi.md#create_membership) | **POST** /memberships | Create a membership +[**delete_membership**](MembershipsApi.md#delete_membership) | **DELETE** /memberships/{membership_gid} | Delete a membership +[**get_membership**](MembershipsApi.md#get_membership) | **GET** /memberships/{membership_gid} | Get a membership +[**get_memberships**](MembershipsApi.md#get_memberships) | **GET** /memberships | Get multiple memberships + +# **create_membership** + +Create a membership + +Creates a new membership in a `goal`. `Teams` or `users` can be a member of `goals`. Returns the full record of the newly created membership. + +([more information](https://developers.asana.com/reference/createmembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the membership. +} + +try: + # Create a membership + api_response = memberships_api_instance.create_membership(opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling MembershipsApi->create_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the membership. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_membership** + +Delete a membership + +A specific, existing membership can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletemembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +membership_gid = "12345" # str | Globally unique identifier for the membership. + + +try: + # Delete a membership + api_response = memberships_api_instance.delete_membership(membership_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling MembershipsApi->delete_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **membership_gid** | **str**| Globally unique identifier for the membership. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_membership** + +Get a membership + +Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently + +([more information](https://developers.asana.com/reference/getmembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +membership_gid = "12345" # str | Globally unique identifier for the membership. +opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a membership + api_response = memberships_api_instance.get_membership(membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling MembershipsApi->get_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **membership_gid** | **str**| Globally unique identifier for the membership. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_memberships** + +Get multiple memberships + +Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. + +([more information](https://developers.asana.com/reference/getmemberships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +opts = { + 'parent': "159874", # str | Globally unique identifier for `goal` or `project`. + 'member': "1061493", # str | Globally unique identifier for `team` or `user`. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple memberships + api_response = memberships_api_instance.get_memberships(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling MembershipsApi->get_memberships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| Globally unique identifier for `goal` or `project`. | [optional] + **member** | **str**| Globally unique identifier for `team` or `user`. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/MembershipsApi.yaml b/docs/MembershipsApi.yaml new file mode 100644 index 00000000..0f4b4a4f --- /dev/null +++ b/docs/MembershipsApi.yaml @@ -0,0 +1,90 @@ +MembershipsApi: + create_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the membership. + } + + try: + # Create a membership + api_response = memberships_api_instance.create_membership(opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling MembershipsApi->create_membership: %s\n" % e) + delete_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + membership_gid = "12345" # str | Globally unique identifier for the membership. + + + try: + # Delete a membership + api_response = memberships_api_instance.delete_membership(membership_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling MembershipsApi->delete_membership: %s\n" % e) + get_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + membership_gid = "12345" # str | Globally unique identifier for the membership. + opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a membership + api_response = memberships_api_instance.get_membership(membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling MembershipsApi->get_membership: %s\n" % e) + get_memberships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + opts = { + 'parent': "159874", # str | Globally unique identifier for `goal` or `project`. + 'member': "1061493", # str | Globally unique identifier for `team` or `user`. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple memberships + api_response = memberships_api_instance.get_memberships(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling MembershipsApi->get_memberships: %s\n" % e) diff --git a/docs/OrganizationExportsApi.md b/docs/OrganizationExportsApi.md new file mode 100644 index 00000000..ca412236 --- /dev/null +++ b/docs/OrganizationExportsApi.md @@ -0,0 +1,111 @@ +# asana.OrganizationExportsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_organization_export**](OrganizationExportsApi.md#create_organization_export) | **POST** /organization_exports | Create an organization export request +[**get_organization_export**](OrganizationExportsApi.md#get_organization_export) | **GET** /organization_exports/{organization_export_gid} | Get details on an org export request + +# **create_organization_export** + +Create an organization export request + +This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. + +([more information](https://developers.asana.com/reference/createorganizationexport)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +organization_exports_api_instance = asana.OrganizationExportsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The organization to export. +opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create an organization export request + api_response = organization_exports_api_instance.create_organization_export(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling OrganizationExportsApi->create_organization_export: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The organization to export. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_organization_export** + +Get details on an org export request + +Returns details of a previously-requested Organization export. + +([more information](https://developers.asana.com/reference/getorganizationexport)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +organization_exports_api_instance = asana.OrganizationExportsApi(api_client) +organization_export_gid = "12345" # str | Globally unique identifier for the organization export. +opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get details on an org export request + api_response = organization_exports_api_instance.get_organization_export(organization_export_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling OrganizationExportsApi->get_organization_export: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **organization_export_gid** | **str**| Globally unique identifier for the organization export. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/OrganizationExportsApi.yaml b/docs/OrganizationExportsApi.yaml new file mode 100644 index 00000000..d52ae209 --- /dev/null +++ b/docs/OrganizationExportsApi.yaml @@ -0,0 +1,45 @@ +OrganizationExportsApi: + create_organization_export: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + organization_exports_api_instance = asana.OrganizationExportsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The organization to export. + opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create an organization export request + api_response = organization_exports_api_instance.create_organization_export(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling OrganizationExportsApi->create_organization_export: %s\n" % e) + get_organization_export: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + organization_exports_api_instance = asana.OrganizationExportsApi(api_client) + organization_export_gid = "12345" # str | Globally unique identifier for the organization export. + opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get details on an org export request + api_response = organization_exports_api_instance.get_organization_export(organization_export_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling OrganizationExportsApi->get_organization_export: %s\n" % e) diff --git a/docs/PortfolioMembershipsApi.md b/docs/PortfolioMembershipsApi.md new file mode 100644 index 00000000..1b1fa5a0 --- /dev/null +++ b/docs/PortfolioMembershipsApi.md @@ -0,0 +1,179 @@ +# asana.PortfolioMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_portfolio_membership**](PortfolioMembershipsApi.md#get_portfolio_membership) | **GET** /portfolio_memberships/{portfolio_membership_gid} | Get a portfolio membership +[**get_portfolio_memberships**](PortfolioMembershipsApi.md#get_portfolio_memberships) | **GET** /portfolio_memberships | Get multiple portfolio memberships +[**get_portfolio_memberships_for_portfolio**](PortfolioMembershipsApi.md#get_portfolio_memberships_for_portfolio) | **GET** /portfolios/{portfolio_gid}/portfolio_memberships | Get memberships from a portfolio + +# **get_portfolio_membership** + +Get a portfolio membership + +Returns the complete portfolio record for a single portfolio membership. + +([more information](https://developers.asana.com/reference/getportfoliomembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) +portfolio_membership_gid = "1331" # str | +opts = { + 'opt_fields': "portfolio,portfolio.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a portfolio membership + api_response = portfolio_memberships_api_instance.get_portfolio_membership(portfolio_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolio_memberships** + +Get multiple portfolio memberships + +Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. + +([more information](https://developers.asana.com/reference/getportfoliomemberships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) +opts = { + 'portfolio': "12345", # str | The portfolio to filter results on. + 'workspace': "12345", # str | The workspace to filter results on. + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple portfolio memberships + api_response = portfolio_memberships_api_instance.get_portfolio_memberships(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio** | **str**| The portfolio to filter results on. | [optional] + **workspace** | **str**| The workspace to filter results on. | [optional] + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolio_memberships_for_portfolio** + +Get memberships from a portfolio + +Returns the compact portfolio membership records for the portfolio. + +([more information](https://developers.asana.com/reference/getportfoliomembershipsforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a portfolio + api_response = portfolio_memberships_api_instance.get_portfolio_memberships_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PortfolioMembershipsApi.yaml b/docs/PortfolioMembershipsApi.yaml new file mode 100644 index 00000000..6daae795 --- /dev/null +++ b/docs/PortfolioMembershipsApi.yaml @@ -0,0 +1,76 @@ +PortfolioMembershipsApi: + get_portfolio_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) + portfolio_membership_gid = "1331" # str | + opts = { + 'opt_fields': "portfolio,portfolio.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a portfolio membership + api_response = portfolio_memberships_api_instance.get_portfolio_membership(portfolio_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_membership: %s\n" % e) + get_portfolio_memberships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) + opts = { + 'portfolio': "12345", # str | The portfolio to filter results on. + 'workspace': "12345", # str | The workspace to filter results on. + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple portfolio memberships + api_response = portfolio_memberships_api_instance.get_portfolio_memberships(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships: %s\n" % e) + get_portfolio_memberships_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a portfolio + api_response = portfolio_memberships_api_instance.get_portfolio_memberships_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships_for_portfolio: %s\n" % e) diff --git a/docs/PortfoliosApi.md b/docs/PortfoliosApi.md new file mode 100644 index 00000000..e5a9641c --- /dev/null +++ b/docs/PortfoliosApi.md @@ -0,0 +1,642 @@ +# asana.PortfoliosApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_custom_field_setting_for_portfolio**](PortfoliosApi.md#add_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addCustomFieldSetting | Add a custom field to a portfolio +[**add_item_for_portfolio**](PortfoliosApi.md#add_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addItem | Add a portfolio item +[**add_members_for_portfolio**](PortfoliosApi.md#add_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addMembers | Add users to a portfolio +[**create_portfolio**](PortfoliosApi.md#create_portfolio) | **POST** /portfolios | Create a portfolio +[**delete_portfolio**](PortfoliosApi.md#delete_portfolio) | **DELETE** /portfolios/{portfolio_gid} | Delete a portfolio +[**get_items_for_portfolio**](PortfoliosApi.md#get_items_for_portfolio) | **GET** /portfolios/{portfolio_gid}/items | Get portfolio items +[**get_portfolio**](PortfoliosApi.md#get_portfolio) | **GET** /portfolios/{portfolio_gid} | Get a portfolio +[**get_portfolios**](PortfoliosApi.md#get_portfolios) | **GET** /portfolios | Get multiple portfolios +[**remove_custom_field_setting_for_portfolio**](PortfoliosApi.md#remove_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeCustomFieldSetting | Remove a custom field from a portfolio +[**remove_item_for_portfolio**](PortfoliosApi.md#remove_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeItem | Remove a portfolio item +[**remove_members_for_portfolio**](PortfoliosApi.md#remove_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeMembers | Remove users from a portfolio +[**update_portfolio**](PortfoliosApi.md#update_portfolio) | **PUT** /portfolios/{portfolio_gid} | Update a portfolio + +# **add_custom_field_setting_for_portfolio** + +Add a custom field to a portfolio + +Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio. + +([more information](https://developers.asana.com/reference/addcustomfieldsettingforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Add a custom field to a portfolio + api_response = portfolios_api_instance.add_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->add_custom_field_setting_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_item_for_portfolio** + +Add a portfolio item + +Add an item to a portfolio. Returns an empty data block. + +([more information](https://developers.asana.com/reference/additemforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being inserted. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Add a portfolio item + api_response = portfolios_api_instance.add_item_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->add_item_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the item being inserted. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_members_for_portfolio** + +Add users to a portfolio + +Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. + +([more information](https://developers.asana.com/reference/addmembersforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add users to a portfolio + api_response = portfolios_api_instance.add_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->add_members_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being added. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_portfolio** + +Create a portfolio + +Creates a new portfolio in the given workspace with the supplied name. Note that portfolios created in the Asana UI may have some state (like the “Priority” custom field) which is automatically added to the portfolio when it is created. Portfolios created via our API will *not* be created with the same initial state to allow integrations to create their own starting state on a portfolio. + +([more information](https://developers.asana.com/reference/createportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The portfolio to create. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a portfolio + api_response = portfolios_api_instance.create_portfolio(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->create_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The portfolio to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_portfolio** + +Delete a portfolio + +An existing portfolio can be deleted by making a DELETE request on the URL for that portfolio. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Delete a portfolio + api_response = portfolios_api_instance.delete_portfolio(portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->delete_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_items_for_portfolio** + +Get portfolio items + +Get a list of the items in compact form in a portfolio. + +([more information](https://developers.asana.com/reference/getitemsforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get portfolio items + api_response = portfolios_api_instance.get_items_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfoliosApi->get_items_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolio** + +Get a portfolio + +Returns the complete portfolio record for a single portfolio. + +([more information](https://developers.asana.com/reference/getportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a portfolio + api_response = portfolios_api_instance.get_portfolio(portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolios** + +Get multiple portfolios + +Returns a list of the portfolios in compact representation that are owned by the current API user. + +([more information](https://developers.asana.com/reference/getportfolios)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +workspace = "1331" # str | The workspace or organization to filter portfolios on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'owner': "14916", # str | The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,offset,owner,owner.name,path,permalink_url,project_templates,project_templates.name,public,start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple portfolios + api_response = portfolios_api_instance.get_portfolios(workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolios: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace or organization to filter portfolios on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **owner** | **str**| The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_custom_field_setting_for_portfolio** + +Remove a custom field from a portfolio + +Removes a custom field setting from a portfolio. + +([more information](https://developers.asana.com/reference/removecustomfieldsettingforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Remove a custom field from a portfolio + api_response = portfolios_api_instance.remove_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->remove_custom_field_setting_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting being removed. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_item_for_portfolio** + +Remove a portfolio item + +Remove an item from a portfolio. Returns an empty data block. + +([more information](https://developers.asana.com/reference/removeitemforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being removed. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Remove a portfolio item + api_response = portfolios_api_instance.remove_item_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->remove_item_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the item being removed. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_members_for_portfolio** + +Remove users from a portfolio + +Removes the specified list of users from members of the portfolio. Returns the updated portfolio record. + +([more information](https://developers.asana.com/reference/removemembersforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove users from a portfolio + api_response = portfolios_api_instance.remove_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->remove_members_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being removed. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_portfolio** + +Update a portfolio + +An existing portfolio can be updated by making a PUT request on the URL for that portfolio. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated portfolio record. + +([more information](https://developers.asana.com/reference/updateportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the portfolio. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a portfolio + api_response = portfolios_api_instance.update_portfolio(body, portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->update_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the portfolio. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PortfoliosApi.yaml b/docs/PortfoliosApi.yaml new file mode 100644 index 00000000..28658cd8 --- /dev/null +++ b/docs/PortfoliosApi.yaml @@ -0,0 +1,269 @@ +PortfoliosApi: + add_custom_field_setting_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Add a custom field to a portfolio + api_response = portfolios_api_instance.add_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->add_custom_field_setting_for_portfolio: %s\n" % e) + add_item_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being inserted. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Add a portfolio item + api_response = portfolios_api_instance.add_item_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->add_item_for_portfolio: %s\n" % e) + add_members_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add users to a portfolio + api_response = portfolios_api_instance.add_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->add_members_for_portfolio: %s\n" % e) + create_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The portfolio to create. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a portfolio + api_response = portfolios_api_instance.create_portfolio(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->create_portfolio: %s\n" % e) + delete_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Delete a portfolio + api_response = portfolios_api_instance.delete_portfolio(portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->delete_portfolio: %s\n" % e) + get_items_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get portfolio items + api_response = portfolios_api_instance.get_items_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfoliosApi->get_items_for_portfolio: %s\n" % e) + get_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a portfolio + api_response = portfolios_api_instance.get_portfolio(portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolio: %s\n" % e) + get_portfolios: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + workspace = "1331" # str | The workspace or organization to filter portfolios on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'owner': "14916", # str | The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,offset,owner,owner.name,path,permalink_url,project_templates,project_templates.name,public,start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple portfolios + api_response = portfolios_api_instance.get_portfolios(workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolios: %s\n" % e) + remove_custom_field_setting_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Remove a custom field from a portfolio + api_response = portfolios_api_instance.remove_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->remove_custom_field_setting_for_portfolio: %s\n" % e) + remove_item_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being removed. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Remove a portfolio item + api_response = portfolios_api_instance.remove_item_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->remove_item_for_portfolio: %s\n" % e) + remove_members_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove users from a portfolio + api_response = portfolios_api_instance.remove_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->remove_members_for_portfolio: %s\n" % e) + update_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the portfolio. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a portfolio + api_response = portfolios_api_instance.update_portfolio(body, portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->update_portfolio: %s\n" % e) diff --git a/docs/ProjectBriefsApi.md b/docs/ProjectBriefsApi.md new file mode 100644 index 00000000..b254a498 --- /dev/null +++ b/docs/ProjectBriefsApi.md @@ -0,0 +1,216 @@ +# asana.ProjectBriefsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_project_brief**](ProjectBriefsApi.md#create_project_brief) | **POST** /projects/{project_gid}/project_briefs | Create a project brief +[**delete_project_brief**](ProjectBriefsApi.md#delete_project_brief) | **DELETE** /project_briefs/{project_brief_gid} | Delete a project brief +[**get_project_brief**](ProjectBriefsApi.md#get_project_brief) | **GET** /project_briefs/{project_brief_gid} | Get a project brief +[**update_project_brief**](ProjectBriefsApi.md#update_project_brief) | **PUT** /project_briefs/{project_brief_gid} | Update a project brief + +# **create_project_brief** + +Create a project brief + +Creates a new project brief. Returns the full record of the newly created project brief. + +([more information](https://developers.asana.com/reference/createprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project brief to create. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project brief + api_response = project_briefs_api_instance.create_project_brief(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->create_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project brief to create. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_project_brief** + +Delete a project brief + +Deletes a specific, existing project brief. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + + +try: + # Delete a project brief + api_response = project_briefs_api_instance.delete_project_brief(project_brief_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->delete_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_brief_gid** | **str**| Globally unique identifier for the project brief. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_brief** + +Get a project brief + +Get the full record for a project brief. + +([more information](https://developers.asana.com/reference/getprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +project_brief_gid = "12345" # str | Globally unique identifier for the project brief. +opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project brief + api_response = project_briefs_api_instance.get_project_brief(project_brief_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->get_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_brief_gid** | **str**| Globally unique identifier for the project brief. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_project_brief** + +Update a project brief + +An existing project brief can be updated by making a PUT request on the URL for that project brief. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated project brief record. + +([more information](https://developers.asana.com/reference/updateprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project brief. +project_brief_gid = "12345" # str | Globally unique identifier for the project brief. +opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a project brief + api_response = project_briefs_api_instance.update_project_brief(body, project_brief_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->update_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the project brief. | + **project_brief_gid** | **str**| Globally unique identifier for the project brief. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectBriefsApi.yaml b/docs/ProjectBriefsApi.yaml new file mode 100644 index 00000000..9a1954f7 --- /dev/null +++ b/docs/ProjectBriefsApi.yaml @@ -0,0 +1,89 @@ +ProjectBriefsApi: + create_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project brief to create. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project brief + api_response = project_briefs_api_instance.create_project_brief(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->create_project_brief: %s\n" % e) + delete_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + + + try: + # Delete a project brief + api_response = project_briefs_api_instance.delete_project_brief(project_brief_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->delete_project_brief: %s\n" % e) + get_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project brief + api_response = project_briefs_api_instance.get_project_brief(project_brief_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->get_project_brief: %s\n" % e) + update_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project brief. + project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a project brief + api_response = project_briefs_api_instance.update_project_brief(body, project_brief_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->update_project_brief: %s\n" % e) diff --git a/docs/ProjectMembershipsApi.md b/docs/ProjectMembershipsApi.md new file mode 100644 index 00000000..d88767f3 --- /dev/null +++ b/docs/ProjectMembershipsApi.md @@ -0,0 +1,118 @@ +# asana.ProjectMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_project_membership**](ProjectMembershipsApi.md#get_project_membership) | **GET** /project_memberships/{project_membership_gid} | Get a project membership +[**get_project_memberships_for_project**](ProjectMembershipsApi.md#get_project_memberships_for_project) | **GET** /projects/{project_gid}/project_memberships | Get memberships from a project + +# **get_project_membership** + +Get a project membership + +Returns the complete project record for a single project membership. + +([more information](https://developers.asana.com/reference/getprojectmembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) +project_membership_gid = "1331" # str | +opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,project,project.name,user,user.name,write_access" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project membership + api_response = project_memberships_api_instance.get_project_membership(project_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_memberships_for_project** + +Get memberships from a project + +Returns the compact project membership records for the project. + +([more information](https://developers.asana.com/reference/getprojectmembershipsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "access_level,member,member.name,offset,parent,parent.name,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a project + api_response = project_memberships_api_instance.get_project_memberships_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_memberships_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectMembershipsApi.yaml b/docs/ProjectMembershipsApi.yaml new file mode 100644 index 00000000..856fc92a --- /dev/null +++ b/docs/ProjectMembershipsApi.yaml @@ -0,0 +1,49 @@ +ProjectMembershipsApi: + get_project_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) + project_membership_gid = "1331" # str | + opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,project,project.name,user,user.name,write_access" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project membership + api_response = project_memberships_api_instance.get_project_membership(project_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_membership: %s\n" % e) + get_project_memberships_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "access_level,member,member.name,offset,parent,parent.name,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a project + api_response = project_memberships_api_instance.get_project_memberships_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_memberships_for_project: %s\n" % e) diff --git a/docs/ProjectStatusesApi.md b/docs/ProjectStatusesApi.md new file mode 100644 index 00000000..7bd63ebe --- /dev/null +++ b/docs/ProjectStatusesApi.md @@ -0,0 +1,219 @@ +# asana.ProjectStatusesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_project_status_for_project**](ProjectStatusesApi.md#create_project_status_for_project) | **POST** /projects/{project_gid}/project_statuses | Create a project status +[**delete_project_status**](ProjectStatusesApi.md#delete_project_status) | **DELETE** /project_statuses/{project_status_gid} | Delete a project status +[**get_project_status**](ProjectStatusesApi.md#get_project_status) | **GET** /project_statuses/{project_status_gid} | Get a project status +[**get_project_statuses_for_project**](ProjectStatusesApi.md#get_project_statuses_for_project) | **GET** /projects/{project_gid}/project_statuses | Get statuses from a project + +# **create_project_status_for_project** + +Create a project status + +*Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. + +([more information](https://developers.asana.com/reference/createprojectstatusforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project status to create. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project status + api_response = project_statuses_api_instance.create_project_status_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->create_project_status_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project status to create. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_project_status** + +Delete a project status + +*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteprojectstatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +project_status_gid = "321654" # str | The project status update to get. + + +try: + # Delete a project status + api_response = project_statuses_api_instance.delete_project_status(project_status_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->delete_project_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_status_gid** | **str**| The project status update to get. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_status** + +Get a project status + +*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. + +([more information](https://developers.asana.com/reference/getprojectstatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +project_status_gid = "321654" # str | The project status update to get. +opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project status + api_response = project_statuses_api_instance.get_project_status(project_status_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_status_gid** | **str**| The project status update to get. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_statuses_for_project** + +Get statuses from a project + +*Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. + +([more information](https://developers.asana.com/reference/getprojectstatusesforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,offset,path,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get statuses from a project + api_response = project_statuses_api_instance.get_project_statuses_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_statuses_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectStatusesApi.yaml b/docs/ProjectStatusesApi.yaml new file mode 100644 index 00000000..b5631177 --- /dev/null +++ b/docs/ProjectStatusesApi.yaml @@ -0,0 +1,91 @@ +ProjectStatusesApi: + create_project_status_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project status to create. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project status + api_response = project_statuses_api_instance.create_project_status_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->create_project_status_for_project: %s\n" % e) + delete_project_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + project_status_gid = "321654" # str | The project status update to get. + + + try: + # Delete a project status + api_response = project_statuses_api_instance.delete_project_status(project_status_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->delete_project_status: %s\n" % e) + get_project_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + project_status_gid = "321654" # str | The project status update to get. + opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project status + api_response = project_statuses_api_instance.get_project_status(project_status_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_status: %s\n" % e) + get_project_statuses_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,offset,path,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get statuses from a project + api_response = project_statuses_api_instance.get_project_statuses_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_statuses_for_project: %s\n" % e) diff --git a/docs/ProjectTemplatesApi.md b/docs/ProjectTemplatesApi.md new file mode 100644 index 00000000..590ef10a --- /dev/null +++ b/docs/ProjectTemplatesApi.md @@ -0,0 +1,278 @@ +# asana.ProjectTemplatesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_project_template**](ProjectTemplatesApi.md#delete_project_template) | **DELETE** /project_templates/{project_template_gid} | Delete a project template +[**get_project_template**](ProjectTemplatesApi.md#get_project_template) | **GET** /project_templates/{project_template_gid} | Get a project template +[**get_project_templates**](ProjectTemplatesApi.md#get_project_templates) | **GET** /project_templates | Get multiple project templates +[**get_project_templates_for_team**](ProjectTemplatesApi.md#get_project_templates_for_team) | **GET** /teams/{team_gid}/project_templates | Get a team's project templates +[**instantiate_project**](ProjectTemplatesApi.md#instantiate_project) | **POST** /project_templates/{project_template_gid}/instantiateProject | Instantiate a project from a project template + +# **delete_project_template** + +Delete a project template + +A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteprojecttemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +project_template_gid = "1331" # str | Globally unique identifier for the project template. + + +try: + # Delete a project template + api_response = project_templates_api_instance.delete_project_template(project_template_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->delete_project_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_template_gid** | **str**| Globally unique identifier for the project template. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_template** + +Get a project template + +Returns the complete project template record for a single project template. + +([more information](https://developers.asana.com/reference/getprojecttemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +project_template_gid = "1331" # str | Globally unique identifier for the project template. +opts = { + 'opt_fields': "color,description,html_description,name,owner,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project template + api_response = project_templates_api_instance.get_project_template(project_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_template_gid** | **str**| Globally unique identifier for the project template. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_templates** + +Get multiple project templates + +Returns the compact project template records for all project templates in the given team or workspace. + +([more information](https://developers.asana.com/reference/getprojecttemplates)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +opts = { + 'workspace': "12345", # str | The workspace to filter results on. + 'team': "14916", # str | The team to filter projects on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple project templates + api_response = project_templates_api_instance.get_project_templates(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace to filter results on. | [optional] + **team** | **str**| The team to filter projects on. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_templates_for_team** + +Get a team's project templates + +Returns the compact project template records for all project templates in the team. + +([more information](https://developers.asana.com/reference/getprojecttemplatesforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team's project templates + api_response = project_templates_api_instance.get_project_templates_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **instantiate_project** + +Instantiate a project from a project template + +Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ + +([more information](https://developers.asana.com/reference/instantiateproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +project_template_gid = "1331" # str | Globally unique identifier for the project template. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Instantiate a project from a project template + api_response = project_templates_api_instance.instantiate_project(project_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->instantiate_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_template_gid** | **str**| Globally unique identifier for the project template. | + **body** | **Dict**| Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectTemplatesApi.yaml b/docs/ProjectTemplatesApi.yaml new file mode 100644 index 00000000..984dfd0b --- /dev/null +++ b/docs/ProjectTemplatesApi.yaml @@ -0,0 +1,117 @@ +ProjectTemplatesApi: + delete_project_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + project_template_gid = "1331" # str | Globally unique identifier for the project template. + + + try: + # Delete a project template + api_response = project_templates_api_instance.delete_project_template(project_template_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->delete_project_template: %s\n" % e) + get_project_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + project_template_gid = "1331" # str | Globally unique identifier for the project template. + opts = { + 'opt_fields': "color,description,html_description,name,owner,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project template + api_response = project_templates_api_instance.get_project_template(project_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_template: %s\n" % e) + get_project_templates: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + opts = { + 'workspace': "12345", # str | The workspace to filter results on. + 'team': "14916", # str | The team to filter projects on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple project templates + api_response = project_templates_api_instance.get_project_templates(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates: %s\n" % e) + get_project_templates_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team's project templates + api_response = project_templates_api_instance.get_project_templates_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates_for_team: %s\n" % e) + instantiate_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + project_template_gid = "1331" # str | Globally unique identifier for the project template. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Instantiate a project from a project template + api_response = project_templates_api_instance.instantiate_project(project_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->instantiate_project: %s\n" % e) diff --git a/docs/ProjectsApi.md b/docs/ProjectsApi.md new file mode 100644 index 00000000..80bc62dd --- /dev/null +++ b/docs/ProjectsApi.md @@ -0,0 +1,1036 @@ +# asana.ProjectsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_custom_field_setting_for_project**](ProjectsApi.md#add_custom_field_setting_for_project) | **POST** /projects/{project_gid}/addCustomFieldSetting | Add a custom field to a project +[**add_followers_for_project**](ProjectsApi.md#add_followers_for_project) | **POST** /projects/{project_gid}/addFollowers | Add followers to a project +[**add_members_for_project**](ProjectsApi.md#add_members_for_project) | **POST** /projects/{project_gid}/addMembers | Add users to a project +[**create_project**](ProjectsApi.md#create_project) | **POST** /projects | Create a project +[**create_project_for_team**](ProjectsApi.md#create_project_for_team) | **POST** /teams/{team_gid}/projects | Create a project in a team +[**create_project_for_workspace**](ProjectsApi.md#create_project_for_workspace) | **POST** /workspaces/{workspace_gid}/projects | Create a project in a workspace +[**delete_project**](ProjectsApi.md#delete_project) | **DELETE** /projects/{project_gid} | Delete a project +[**duplicate_project**](ProjectsApi.md#duplicate_project) | **POST** /projects/{project_gid}/duplicate | Duplicate a project +[**get_project**](ProjectsApi.md#get_project) | **GET** /projects/{project_gid} | Get a project +[**get_projects**](ProjectsApi.md#get_projects) | **GET** /projects | Get multiple projects +[**get_projects_for_task**](ProjectsApi.md#get_projects_for_task) | **GET** /tasks/{task_gid}/projects | Get projects a task is in +[**get_projects_for_team**](ProjectsApi.md#get_projects_for_team) | **GET** /teams/{team_gid}/projects | Get a team's projects +[**get_projects_for_workspace**](ProjectsApi.md#get_projects_for_workspace) | **GET** /workspaces/{workspace_gid}/projects | Get all projects in a workspace +[**get_task_counts_for_project**](ProjectsApi.md#get_task_counts_for_project) | **GET** /projects/{project_gid}/task_counts | Get task count of a project +[**project_save_as_template**](ProjectsApi.md#project_save_as_template) | **POST** /projects/{project_gid}/saveAsTemplate | Create a project template from a project +[**remove_custom_field_setting_for_project**](ProjectsApi.md#remove_custom_field_setting_for_project) | **POST** /projects/{project_gid}/removeCustomFieldSetting | Remove a custom field from a project +[**remove_followers_for_project**](ProjectsApi.md#remove_followers_for_project) | **POST** /projects/{project_gid}/removeFollowers | Remove followers from a project +[**remove_members_for_project**](ProjectsApi.md#remove_members_for_project) | **POST** /projects/{project_gid}/removeMembers | Remove users from a project +[**update_project**](ProjectsApi.md#update_project) | **PUT** /projects/{project_gid} | Update a project + +# **add_custom_field_setting_for_project** + +Add a custom field to a project + +Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. + +([more information](https://developers.asana.com/reference/addcustomfieldsettingforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. +project_gid = "1331" # str | Globally unique identifier for the project. + + +try: + # Add a custom field to a project + api_response = projects_api_instance.add_custom_field_setting_for_project(body, project_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->add_custom_field_setting_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting. | + **project_gid** | **str**| Globally unique identifier for the project. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_followers_for_project** + +Add followers to a project + +Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. + +([more information](https://developers.asana.com/reference/addfollowersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being added. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add followers to a project + api_response = projects_api_instance.add_followers_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->add_followers_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the followers being added. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_members_for_project** + +Add users to a project + +Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifcations\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. + +([more information](https://developers.asana.com/reference/addmembersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add users to a project + api_response = projects_api_instance.add_members_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->add_members_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being added. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_project** + +Create a project + +Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. + +([more information](https://developers.asana.com/reference/createproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to create. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project + api_response = projects_api_instance.create_project(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->create_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_project_for_team** + +Create a project in a team + +Creates a project shared with the given team. Returns the full record of the newly created project. + +([more information](https://developers.asana.com/reference/createprojectforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project in a team + api_response = projects_api_instance.create_project_for_team(body, team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new project to create. | + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_project_for_workspace** + +Create a project in a workspace + +Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. + +([more information](https://developers.asana.com/reference/createprojectforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project in a workspace + api_response = projects_api_instance.create_project_for_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new project to create. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_project** + +Delete a project + +A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. + + +try: + # Delete a project + api_response = projects_api_instance.delete_project(project_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->delete_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **duplicate_project** + +Duplicate a project + +Creates and returns a job that will asynchronously handle the duplication. + +([more information](https://developers.asana.com/reference/duplicateproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the elements that will be duplicated. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Duplicate a project + api_response = projects_api_instance.duplicate_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->duplicate_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **body** | **Dict**| Describes the duplicate's name and the elements that will be duplicated. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project** + +Get a project + +Returns the complete project record for a single project. + +([more information](https://developers.asana.com/reference/getproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project + api_response = projects_api_instance.get_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->get_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects** + +Get multiple projects + +Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* + +([more information](https://developers.asana.com/reference/getprojects)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'workspace': "1331", # str | The workspace or organization to filter projects on. + 'team': "14916", # str | The team to filter projects on. + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple projects + api_response = projects_api_instance.get_projects(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **workspace** | **str**| The workspace or organization to filter projects on. | [optional] + **team** | **str**| The team to filter projects on. | [optional] + **archived** | **bool**| Only return projects whose `archived` field takes on the value of this parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects_for_task** + +Get projects a task is in + +Returns a compact representation of all of the projects the task is in. + +([more information](https://developers.asana.com/reference/getprojectsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get projects a task is in + api_response = projects_api_instance.get_projects_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects_for_team** + +Get a team's projects + +Returns the compact project records for all projects in the team. + +([more information](https://developers.asana.com/reference/getprojectsforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team's projects + api_response = projects_api_instance.get_projects_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **archived** | **bool**| Only return projects whose `archived` field takes on the value of this parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects_for_workspace** + +Get all projects in a workspace + +Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* + +([more information](https://developers.asana.com/reference/getprojectsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get all projects in a workspace + api_response = projects_api_instance.get_projects_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **archived** | **bool**| Only return projects whose `archived` field takes on the value of this parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_task_counts_for_project** + +Get task count of a project + +Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. + +([more information](https://developers.asana.com/reference/gettaskcountsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "num_completed_milestones,num_completed_tasks,num_incomplete_milestones,num_incomplete_tasks,num_milestones,num_tasks" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get task count of a project + api_response = projects_api_instance.get_task_counts_for_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->get_task_counts_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **project_save_as_template** + +Create a project template from a project + +Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won't be visible in the Asana UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432). + +([more information](https://developers.asana.com/reference/projectsaveastemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project template from a project + api_response = projects_api_instance.project_save_as_template(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->project_save_as_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_custom_field_setting_for_project** + +Remove a custom field from a project + +Removes a custom field setting from a project. + +([more information](https://developers.asana.com/reference/removecustomfieldsettingforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. +project_gid = "1331" # str | Globally unique identifier for the project. + + +try: + # Remove a custom field from a project + api_response = projects_api_instance.remove_custom_field_setting_for_project(body, project_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->remove_custom_field_setting_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting being removed. | + **project_gid** | **str**| Globally unique identifier for the project. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_followers_for_project** + +Remove followers from a project + +Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. + +([more information](https://developers.asana.com/reference/removefollowersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being removed. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove followers from a project + api_response = projects_api_instance.remove_followers_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->remove_followers_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the followers being removed. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_members_for_project** + +Remove users from a project + +Removes the specified list of users from members of the project. Returns the updated project record. + +([more information](https://developers.asana.com/reference/removemembersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove users from a project + api_response = projects_api_instance.remove_members_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->remove_members_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being removed. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_project** + +Update a project + +A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated project record. + +([more information](https://developers.asana.com/reference/updateproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a project + api_response = projects_api_instance.update_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->update_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the project. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectsApi.yaml b/docs/ProjectsApi.yaml new file mode 100644 index 00000000..a4a63dae --- /dev/null +++ b/docs/ProjectsApi.yaml @@ -0,0 +1,440 @@ +ProjectsApi: + add_custom_field_setting_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. + project_gid = "1331" # str | Globally unique identifier for the project. + + + try: + # Add a custom field to a project + api_response = projects_api_instance.add_custom_field_setting_for_project(body, project_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->add_custom_field_setting_for_project: %s\n" % e) + add_followers_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being added. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add followers to a project + api_response = projects_api_instance.add_followers_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->add_followers_for_project: %s\n" % e) + add_members_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add users to a project + api_response = projects_api_instance.add_members_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->add_members_for_project: %s\n" % e) + create_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to create. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project + api_response = projects_api_instance.create_project(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->create_project: %s\n" % e) + create_project_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project in a team + api_response = projects_api_instance.create_project_for_team(body, team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_team: %s\n" % e) + create_project_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project in a workspace + api_response = projects_api_instance.create_project_for_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_workspace: %s\n" % e) + delete_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + + + try: + # Delete a project + api_response = projects_api_instance.delete_project(project_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->delete_project: %s\n" % e) + duplicate_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the elements that will be duplicated. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Duplicate a project + api_response = projects_api_instance.duplicate_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->duplicate_project: %s\n" % e) + get_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project + api_response = projects_api_instance.get_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->get_project: %s\n" % e) + get_projects: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'workspace': "1331", # str | The workspace or organization to filter projects on. + 'team': "14916", # str | The team to filter projects on. + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple projects + api_response = projects_api_instance.get_projects(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects: %s\n" % e) + get_projects_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get projects a task is in + api_response = projects_api_instance.get_projects_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_task: %s\n" % e) + get_projects_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team's projects + api_response = projects_api_instance.get_projects_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_team: %s\n" % e) + get_projects_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get all projects in a workspace + api_response = projects_api_instance.get_projects_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_workspace: %s\n" % e) + get_task_counts_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "num_completed_milestones,num_completed_tasks,num_incomplete_milestones,num_incomplete_tasks,num_milestones,num_tasks" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get task count of a project + api_response = projects_api_instance.get_task_counts_for_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->get_task_counts_for_project: %s\n" % e) + project_save_as_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project template from a project + api_response = projects_api_instance.project_save_as_template(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->project_save_as_template: %s\n" % e) + remove_custom_field_setting_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. + project_gid = "1331" # str | Globally unique identifier for the project. + + + try: + # Remove a custom field from a project + api_response = projects_api_instance.remove_custom_field_setting_for_project(body, project_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->remove_custom_field_setting_for_project: %s\n" % e) + remove_followers_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being removed. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove followers from a project + api_response = projects_api_instance.remove_followers_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->remove_followers_for_project: %s\n" % e) + remove_members_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove users from a project + api_response = projects_api_instance.remove_members_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->remove_members_for_project: %s\n" % e) + update_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a project + api_response = projects_api_instance.update_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->update_project: %s\n" % e) diff --git a/docs/RulesApi.md b/docs/RulesApi.md new file mode 100644 index 00000000..f3d75cfd --- /dev/null +++ b/docs/RulesApi.md @@ -0,0 +1,58 @@ +# asana.RulesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**trigger_rule**](RulesApi.md#trigger_rule) | **POST** /rule_triggers/{rule_trigger_gid}/run | Trigger a rule + +# **trigger_rule** + +Trigger a rule + +Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. + +([more information](https://developers.asana.com/reference/triggerrule)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +rules_api_instance = asana.RulesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | A dictionary of variables accessible from within the rule. +rule_trigger_gid = "12345" # str | The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. + + +try: + # Trigger a rule + api_response = rules_api_instance.trigger_rule(body, rule_trigger_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling RulesApi->trigger_rule: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| A dictionary of variables accessible from within the rule. | + **rule_trigger_gid** | **str**| The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/RulesApi.yaml b/docs/RulesApi.yaml new file mode 100644 index 00000000..26c3e4ca --- /dev/null +++ b/docs/RulesApi.yaml @@ -0,0 +1,22 @@ +RulesApi: + trigger_rule: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + rules_api_instance = asana.RulesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | A dictionary of variables accessible from within the rule. + rule_trigger_gid = "12345" # str | The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. + + + try: + # Trigger a rule + api_response = rules_api_instance.trigger_rule(body, rule_trigger_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling RulesApi->trigger_rule: %s\n" % e) diff --git a/docs/SectionsApi.md b/docs/SectionsApi.md new file mode 100644 index 00000000..4efe71aa --- /dev/null +++ b/docs/SectionsApi.md @@ -0,0 +1,377 @@ +# asana.SectionsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_task_for_section**](SectionsApi.md#add_task_for_section) | **POST** /sections/{section_gid}/addTask | Add task to section +[**create_section_for_project**](SectionsApi.md#create_section_for_project) | **POST** /projects/{project_gid}/sections | Create a section in a project +[**delete_section**](SectionsApi.md#delete_section) | **DELETE** /sections/{section_gid} | Delete a section +[**get_section**](SectionsApi.md#get_section) | **GET** /sections/{section_gid} | Get a section +[**get_sections_for_project**](SectionsApi.md#get_sections_for_project) | **GET** /projects/{project_gid}/sections | Get sections in a project +[**insert_section_for_project**](SectionsApi.md#insert_section_for_project) | **POST** /projects/{project_gid}/sections/insert | Move or Insert sections +[**update_section**](SectionsApi.md#update_section) | **PUT** /sections/{section_gid} | Update a section + +# **add_task_for_section** + +Add task to section + +Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). + +([more information](https://developers.asana.com/reference/addtaskforsection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The task and optionally the insert location. +} + +try: + # Add task to section + api_response = sections_api_instance.add_task_for_section(section_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->add_task_for_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **body** | **Dict**| The task and optionally the insert location. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_section_for_project** + +Create a section in a project + +Creates a new section in a project. Returns the full record of the newly created section. + +([more information](https://developers.asana.com/reference/createsectionforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a section in a project + api_response = sections_api_instance.create_section_for_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->create_section_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **body** | **Dict**| The section to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_section** + +Delete a section + +A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. + +([more information](https://developers.asana.com/reference/deletesection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. + + +try: + # Delete a section + api_response = sections_api_instance.delete_section(section_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->delete_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_section** + +Get a section + +Returns the complete record for a single section. + +([more information](https://developers.asana.com/reference/getsection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a section + api_response = sections_api_instance.get_section(section_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->get_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_sections_for_project** + +Get sections in a project + +Returns the compact records for all sections in the specified project. + +([more information](https://developers.asana.com/reference/getsectionsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_at,name,offset,path,project,project.name,projects,projects.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get sections in a project + api_response = sections_api_instance.get_sections_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling SectionsApi->get_sections_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **insert_section_for_project** + +Move or Insert sections + +Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. + +([more information](https://developers.asana.com/reference/insertsectionforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section's move action. +} + +try: + # Move or Insert sections + api_response = sections_api_instance.insert_section_for_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->insert_section_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **body** | **Dict**| The section's move action. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_section** + +Update a section + +A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) 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 task. Returns the complete updated section record. + +([more information](https://developers.asana.com/reference/updatesection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a section + api_response = sections_api_instance.update_section(section_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->update_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **body** | **Dict**| The section to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/SectionsApi.yaml b/docs/SectionsApi.yaml new file mode 100644 index 00000000..23adafff --- /dev/null +++ b/docs/SectionsApi.yaml @@ -0,0 +1,158 @@ +SectionsApi: + add_task_for_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The task and optionally the insert location. + } + + try: + # Add task to section + api_response = sections_api_instance.add_task_for_section(section_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->add_task_for_section: %s\n" % e) + create_section_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a section in a project + api_response = sections_api_instance.create_section_for_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->create_section_for_project: %s\n" % e) + delete_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + + + try: + # Delete a section + api_response = sections_api_instance.delete_section(section_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->delete_section: %s\n" % e) + get_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a section + api_response = sections_api_instance.get_section(section_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->get_section: %s\n" % e) + get_sections_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_at,name,offset,path,project,project.name,projects,projects.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get sections in a project + api_response = sections_api_instance.get_sections_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling SectionsApi->get_sections_for_project: %s\n" % e) + insert_section_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section's move action. + } + + try: + # Move or Insert sections + api_response = sections_api_instance.insert_section_for_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->insert_section_for_project: %s\n" % e) + update_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a section + api_response = sections_api_instance.update_section(section_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->update_section: %s\n" % e) diff --git a/docs/StatusUpdatesApi.md b/docs/StatusUpdatesApi.md new file mode 100644 index 00000000..ccaebe24 --- /dev/null +++ b/docs/StatusUpdatesApi.md @@ -0,0 +1,223 @@ +# asana.StatusUpdatesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_status_for_object**](StatusUpdatesApi.md#create_status_for_object) | **POST** /status_updates | Create a status update +[**delete_status**](StatusUpdatesApi.md#delete_status) | **DELETE** /status_updates/{status_update_gid} | Delete a status update +[**get_status**](StatusUpdatesApi.md#get_status) | **GET** /status_updates/{status_update_gid} | Get a status update +[**get_statuses_for_object**](StatusUpdatesApi.md#get_statuses_for_object) | **GET** /status_updates | Get status updates from an object + +# **create_status_for_object** + +Create a status update + +Creates a new status update on an object. Returns the full record of the newly created status update. + +([more information](https://developers.asana.com/reference/createstatusforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The status update to create. +opts = { + 'limit': 50 # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # 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.' + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a status update + api_response = status_updates_api_instance.create_status_for_object(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->create_status_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The status update to create. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_status** + +Delete a status update + +Deletes a specific, existing status update. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletestatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +status_update_gid = "321654" # str | The status update to get. + + +try: + # Delete a status update + api_response = status_updates_api_instance.delete_status(status_update_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->delete_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status_update_gid** | **str**| The status update to get. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_status** + +Get a status update + +Returns the complete record for a single status update. + +([more information](https://developers.asana.com/reference/getstatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +status_update_gid = "321654" # str | The status update to get. +opts = { + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a status update + api_response = status_updates_api_instance.get_status(status_update_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status_update_gid** | **str**| The status update to get. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_statuses_for_object** + +Get status updates from an object + +Returns the compact status update records for all updates on the object. + +([more information](https://developers.asana.com/reference/getstatusesforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'created_since': '2012-02-22T02:06:58.158Z', # datetime | Only return statuses that have been created since the given time. + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,offset,parent,parent.name,path,resource_subtype,status_type,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get status updates from an object + api_response = status_updates_api_instance.get_statuses_for_object(parent, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_statuses_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **created_since** | **datetime**| Only return statuses that have been created since the given time. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/StatusUpdatesApi.yaml b/docs/StatusUpdatesApi.yaml new file mode 100644 index 00000000..73169a19 --- /dev/null +++ b/docs/StatusUpdatesApi.yaml @@ -0,0 +1,93 @@ +StatusUpdatesApi: + create_status_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The status update to create. + opts = { + 'limit': 50 # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # 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.' + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a status update + api_response = status_updates_api_instance.create_status_for_object(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->create_status_for_object: %s\n" % e) + delete_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + status_update_gid = "321654" # str | The status update to get. + + + try: + # Delete a status update + api_response = status_updates_api_instance.delete_status(status_update_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->delete_status: %s\n" % e) + get_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + status_update_gid = "321654" # str | The status update to get. + opts = { + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a status update + api_response = status_updates_api_instance.get_status(status_update_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_status: %s\n" % e) + get_statuses_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'created_since': '2012-02-22T02:06:58.158Z', # datetime | Only return statuses that have been created since the given time. + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,offset,parent,parent.name,path,resource_subtype,status_type,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get status updates from an object + api_response = status_updates_api_instance.get_statuses_for_object(parent, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_statuses_for_object: %s\n" % e) diff --git a/docs/StoriesApi.md b/docs/StoriesApi.md new file mode 100644 index 00000000..cc4d3c65 --- /dev/null +++ b/docs/StoriesApi.md @@ -0,0 +1,273 @@ +# asana.StoriesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_story_for_task**](StoriesApi.md#create_story_for_task) | **POST** /tasks/{task_gid}/stories | Create a story on a task +[**delete_story**](StoriesApi.md#delete_story) | **DELETE** /stories/{story_gid} | Delete a story +[**get_stories_for_task**](StoriesApi.md#get_stories_for_task) | **GET** /tasks/{task_gid}/stories | Get stories from a task +[**get_story**](StoriesApi.md#get_story) | **GET** /stories/{story_gid} | Get a story +[**update_story**](StoriesApi.md#update_story) | **PUT** /stories/{story_gid} | Update a story + +# **create_story_for_task** + +Create a story on a task + +Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. + +([more information](https://developers.asana.com/reference/createstoryfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The story to create. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a story on a task + api_response = stories_api_instance.create_story_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->create_story_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The story to create. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_story** + +Delete a story + +Deletes a story. A user can only delete stories they have created. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletestory)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +story_gid = "35678" # str | Globally unique identifier for the story. + + +try: + # Delete a story + api_response = stories_api_instance.delete_story(story_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->delete_story: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **story_gid** | **str**| Globally unique identifier for the story. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_stories_for_task** + +Get stories from a task + +Returns the compact records for all stories on the task. + +([more information](https://developers.asana.com/reference/getstoriesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,offset,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,path,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get stories from a task + api_response = stories_api_instance.get_stories_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling StoriesApi->get_stories_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_story** + +Get a story + +Returns the full record for a single story. + +([more information](https://developers.asana.com/reference/getstory)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +story_gid = "35678" # str | Globally unique identifier for the story. +opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a story + api_response = stories_api_instance.get_story(story_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->get_story: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **story_gid** | **str**| Globally unique identifier for the story. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_story** + +Update a story + +Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. + +([more information](https://developers.asana.com/reference/updatestory)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The comment story to update. +story_gid = "35678" # str | Globally unique identifier for the story. +opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a story + api_response = stories_api_instance.update_story(body, story_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->update_story: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The comment story to update. | + **story_gid** | **str**| Globally unique identifier for the story. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/StoriesApi.yaml b/docs/StoriesApi.yaml new file mode 100644 index 00000000..e6e4ce4f --- /dev/null +++ b/docs/StoriesApi.yaml @@ -0,0 +1,114 @@ +StoriesApi: + create_story_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The story to create. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a story on a task + api_response = stories_api_instance.create_story_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->create_story_for_task: %s\n" % e) + delete_story: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + story_gid = "35678" # str | Globally unique identifier for the story. + + + try: + # Delete a story + api_response = stories_api_instance.delete_story(story_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->delete_story: %s\n" % e) + get_stories_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,offset,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,path,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get stories from a task + api_response = stories_api_instance.get_stories_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling StoriesApi->get_stories_for_task: %s\n" % e) + get_story: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + story_gid = "35678" # str | Globally unique identifier for the story. + opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a story + api_response = stories_api_instance.get_story(story_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->get_story: %s\n" % e) + update_story: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The comment story to update. + story_gid = "35678" # str | Globally unique identifier for the story. + opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a story + api_response = stories_api_instance.update_story(body, story_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->update_story: %s\n" % e) diff --git a/docs/TagsApi.md b/docs/TagsApi.md new file mode 100644 index 00000000..f95908be --- /dev/null +++ b/docs/TagsApi.md @@ -0,0 +1,437 @@ +# asana.TagsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_tag**](TagsApi.md#create_tag) | **POST** /tags | Create a tag +[**create_tag_for_workspace**](TagsApi.md#create_tag_for_workspace) | **POST** /workspaces/{workspace_gid}/tags | Create a tag in a workspace +[**delete_tag**](TagsApi.md#delete_tag) | **DELETE** /tags/{tag_gid} | Delete a tag +[**get_tag**](TagsApi.md#get_tag) | **GET** /tags/{tag_gid} | Get a tag +[**get_tags**](TagsApi.md#get_tags) | **GET** /tags | Get multiple tags +[**get_tags_for_task**](TagsApi.md#get_tags_for_task) | **GET** /tasks/{task_gid}/tags | Get a task's tags +[**get_tags_for_workspace**](TagsApi.md#get_tags_for_workspace) | **GET** /workspaces/{workspace_gid}/tags | Get tags in a workspace +[**update_tag**](TagsApi.md#update_tag) | **PUT** /tags/{tag_gid} | Update a tag + +# **create_tag** + +Create a tag + +Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. + +([more information](https://developers.asana.com/reference/createtag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a tag + api_response = tags_api_instance.create_tag(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->create_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_tag_for_workspace** + +Create a tag in a workspace + +Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. + +([more information](https://developers.asana.com/reference/createtagforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a tag in a workspace + api_response = tags_api_instance.create_tag_for_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->create_tag_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to create. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_tag** + +Delete a tag + +A specific, existing tag can be deleted by making a DELETE request on the URL for that tag. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletetag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. + + +try: + # Delete a tag + api_response = tags_api_instance.delete_tag(tag_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->delete_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tag** + +Get a tag + +Returns the complete tag record for a single tag. + +([more information](https://developers.asana.com/reference/gettag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a tag + api_response = tags_api_instance.get_tag(tag_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->get_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tags** + +Get multiple tags + +Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. + +([more information](https://developers.asana.com/reference/gettags)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'workspace': "1331", # str | The workspace to filter tags on. + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple tags + api_response = tags_api_instance.get_tags(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TagsApi->get_tags: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **workspace** | **str**| The workspace to filter tags on. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tags_for_task** + +Get a task's tags + +Get a compact representation of all of the tags the task has. + +([more information](https://developers.asana.com/reference/gettagsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a task's tags + api_response = tags_api_instance.get_tags_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tags_for_workspace** + +Get tags in a workspace + +Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. + +([more information](https://developers.asana.com/reference/gettagsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tags in a workspace + api_response = tags_api_instance.get_tags_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_tag** + +Update a tag + +Updates the properties of a tag. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 tag. Returns the complete updated tag record. + +([more information](https://developers.asana.com/reference/updatetag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a tag + api_response = tags_api_instance.update_tag(tag_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->update_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TagsApi.yaml b/docs/TagsApi.yaml new file mode 100644 index 00000000..71049318 --- /dev/null +++ b/docs/TagsApi.yaml @@ -0,0 +1,185 @@ +TagsApi: + create_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a tag + api_response = tags_api_instance.create_tag(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->create_tag: %s\n" % e) + create_tag_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a tag in a workspace + api_response = tags_api_instance.create_tag_for_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->create_tag_for_workspace: %s\n" % e) + delete_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + + + try: + # Delete a tag + api_response = tags_api_instance.delete_tag(tag_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->delete_tag: %s\n" % e) + get_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a tag + api_response = tags_api_instance.get_tag(tag_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->get_tag: %s\n" % e) + get_tags: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'workspace': "1331", # str | The workspace to filter tags on. + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple tags + api_response = tags_api_instance.get_tags(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TagsApi->get_tags: %s\n" % e) + get_tags_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a task's tags + api_response = tags_api_instance.get_tags_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_task: %s\n" % e) + get_tags_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tags in a workspace + api_response = tags_api_instance.get_tags_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_workspace: %s\n" % e) + update_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a tag + api_response = tags_api_instance.update_tag(tag_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->update_tag: %s\n" % e) diff --git a/docs/TaskTemplatesApi.md b/docs/TaskTemplatesApi.md new file mode 100644 index 00000000..744b752e --- /dev/null +++ b/docs/TaskTemplatesApi.md @@ -0,0 +1,170 @@ +# asana.TaskTemplatesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_task_template**](TaskTemplatesApi.md#get_task_template) | **GET** /task_templates/{task_template_gid} | Get a task template +[**get_task_templates**](TaskTemplatesApi.md#get_task_templates) | **GET** /task_templates | Get multiple task templates +[**instantiate_task**](TaskTemplatesApi.md#instantiate_task) | **POST** /task_templates/{task_template_gid}/instantiateTask | Instantiate a task from a task template + +# **get_task_template** + +Get a task template + +Returns the complete task template record for a single task template. + +([more information](https://developers.asana.com/reference/gettasktemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +task_templates_api_instance = asana.TaskTemplatesApi(api_client) +task_template_gid = "1331" # str | Globally unique identifier for the task template. +opts = { + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a task template + api_response = task_templates_api_instance.get_task_template(task_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_template_gid** | **str**| Globally unique identifier for the task template. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_task_templates** + +Get multiple task templates + +Returns the compact task template records for some filtered set of task templates. You must specify a `project` + +([more information](https://developers.asana.com/reference/gettasktemplates)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +task_templates_api_instance = asana.TaskTemplatesApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'project': "321654", # str | The project to filter task templates on. + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple task templates + api_response = task_templates_api_instance.get_task_templates(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_templates: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **project** | **str**| The project to filter task templates on. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **instantiate_task** + +Instantiate a task from a task template + +Creates and returns a job that will asynchronously handle the task instantiation. + +([more information](https://developers.asana.com/reference/instantiatetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +task_templates_api_instance = asana.TaskTemplatesApi(api_client) +task_template_gid = "1331" # str | Globally unique identifier for the task template. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a task - the task's name. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Instantiate a task from a task template + api_response = task_templates_api_instance.instantiate_task(task_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TaskTemplatesApi->instantiate_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_template_gid** | **str**| Globally unique identifier for the task template. | + **body** | **Dict**| Describes the inputs used for instantiating a task - the task's name. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TaskTemplatesApi.yaml b/docs/TaskTemplatesApi.yaml new file mode 100644 index 00000000..399439d1 --- /dev/null +++ b/docs/TaskTemplatesApi.yaml @@ -0,0 +1,71 @@ +TaskTemplatesApi: + get_task_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + task_templates_api_instance = asana.TaskTemplatesApi(api_client) + task_template_gid = "1331" # str | Globally unique identifier for the task template. + opts = { + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a task template + api_response = task_templates_api_instance.get_task_template(task_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_template: %s\n" % e) + get_task_templates: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + task_templates_api_instance = asana.TaskTemplatesApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'project': "321654", # str | The project to filter task templates on. + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple task templates + api_response = task_templates_api_instance.get_task_templates(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_templates: %s\n" % e) + instantiate_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + task_templates_api_instance = asana.TaskTemplatesApi(api_client) + task_template_gid = "1331" # str | Globally unique identifier for the task template. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a task - the task's name. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Instantiate a task from a task template + api_response = task_templates_api_instance.instantiate_task(task_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TaskTemplatesApi->instantiate_task: %s\n" % e) diff --git a/docs/TasksApi.md b/docs/TasksApi.md new file mode 100644 index 00000000..d2cfcfdc --- /dev/null +++ b/docs/TasksApi.md @@ -0,0 +1,1528 @@ +# asana.TasksApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_dependencies_for_task**](TasksApi.md#add_dependencies_for_task) | **POST** /tasks/{task_gid}/addDependencies | Set dependencies for a task +[**add_dependents_for_task**](TasksApi.md#add_dependents_for_task) | **POST** /tasks/{task_gid}/addDependents | Set dependents for a task +[**add_followers_for_task**](TasksApi.md#add_followers_for_task) | **POST** /tasks/{task_gid}/addFollowers | Add followers to a task +[**add_project_for_task**](TasksApi.md#add_project_for_task) | **POST** /tasks/{task_gid}/addProject | Add a project to a task +[**add_tag_for_task**](TasksApi.md#add_tag_for_task) | **POST** /tasks/{task_gid}/addTag | Add a tag to a task +[**create_subtask_for_task**](TasksApi.md#create_subtask_for_task) | **POST** /tasks/{task_gid}/subtasks | Create a subtask +[**create_task**](TasksApi.md#create_task) | **POST** /tasks | Create a task +[**delete_task**](TasksApi.md#delete_task) | **DELETE** /tasks/{task_gid} | Delete a task +[**duplicate_task**](TasksApi.md#duplicate_task) | **POST** /tasks/{task_gid}/duplicate | Duplicate a task +[**get_dependencies_for_task**](TasksApi.md#get_dependencies_for_task) | **GET** /tasks/{task_gid}/dependencies | Get dependencies from a task +[**get_dependents_for_task**](TasksApi.md#get_dependents_for_task) | **GET** /tasks/{task_gid}/dependents | Get dependents from a task +[**get_subtasks_for_task**](TasksApi.md#get_subtasks_for_task) | **GET** /tasks/{task_gid}/subtasks | Get subtasks from a task +[**get_task**](TasksApi.md#get_task) | **GET** /tasks/{task_gid} | Get a task +[**get_tasks**](TasksApi.md#get_tasks) | **GET** /tasks | Get multiple tasks +[**get_tasks_for_project**](TasksApi.md#get_tasks_for_project) | **GET** /projects/{project_gid}/tasks | Get tasks from a project +[**get_tasks_for_section**](TasksApi.md#get_tasks_for_section) | **GET** /sections/{section_gid}/tasks | Get tasks from a section +[**get_tasks_for_tag**](TasksApi.md#get_tasks_for_tag) | **GET** /tags/{tag_gid}/tasks | Get tasks from a tag +[**get_tasks_for_user_task_list**](TasksApi.md#get_tasks_for_user_task_list) | **GET** /user_task_lists/{user_task_list_gid}/tasks | Get tasks from a user task list +[**remove_dependencies_for_task**](TasksApi.md#remove_dependencies_for_task) | **POST** /tasks/{task_gid}/removeDependencies | Unlink dependencies from a task +[**remove_dependents_for_task**](TasksApi.md#remove_dependents_for_task) | **POST** /tasks/{task_gid}/removeDependents | Unlink dependents from a task +[**remove_follower_for_task**](TasksApi.md#remove_follower_for_task) | **POST** /tasks/{task_gid}/removeFollowers | Remove followers from a task +[**remove_project_for_task**](TasksApi.md#remove_project_for_task) | **POST** /tasks/{task_gid}/removeProject | Remove a project from a task +[**remove_tag_for_task**](TasksApi.md#remove_tag_for_task) | **POST** /tasks/{task_gid}/removeTag | Remove a tag from a task +[**search_tasks_for_workspace**](TasksApi.md#search_tasks_for_workspace) | **GET** /workspaces/{workspace_gid}/tasks/search | Search tasks in a workspace +[**set_parent_for_task**](TasksApi.md#set_parent_for_task) | **POST** /tasks/{task_gid}/setParent | Set the parent of a task +[**update_task**](TasksApi.md#update_task) | **PUT** /tasks/{task_gid} | Update a task + +# **add_dependencies_for_task** + +Set dependencies for a task + +Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. + +([more information](https://developers.asana.com/reference/adddependenciesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to set as dependencies. +task_gid = "321654" # str | The task to operate on. + + +try: + # Set dependencies for a task + api_response = tasks_api_instance.add_dependencies_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_dependencies_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to set as dependencies. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_dependents_for_task** + +Set dependents for a task + +Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. + +([more information](https://developers.asana.com/reference/adddependentsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to add as dependents. +task_gid = "321654" # str | The task to operate on. + + +try: + # Set dependents for a task + api_response = tasks_api_instance.add_dependents_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_dependents_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to add as dependents. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_followers_for_task** + +Add followers to a task + +Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. + +([more information](https://developers.asana.com/reference/addfollowersfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to add to the task. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add followers to a task + api_response = tasks_api_instance.add_followers_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_followers_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to add to the task. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_project_for_task** + +Add a project to a task + +Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block. + +([more information](https://developers.asana.com/reference/addprojectfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to add the task to. +task_gid = "321654" # str | The task to operate on. + + +try: + # Add a project to a task + api_response = tasks_api_instance.add_project_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_project_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project to add the task to. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_tag_for_task** + +Add a tag to a task + +Adds a tag to a task. Returns an empty data block. + +([more information](https://developers.asana.com/reference/addtagfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to add to the task. +task_gid = "321654" # str | The task to operate on. + + +try: + # Add a tag to a task + api_response = tasks_api_instance.add_tag_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_tag_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to add to the task. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_subtask_for_task** + +Create a subtask + +Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. + +([more information](https://developers.asana.com/reference/createsubtaskfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new subtask to create. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a subtask + api_response = tasks_api_instance.create_subtask_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->create_subtask_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new subtask to create. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_task** + +Create a task + +Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. + +([more information](https://developers.asana.com/reference/createtask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to create. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a task + api_response = tasks_api_instance.create_task(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The task to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_task** + +Delete a task + +A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. + + +try: + # Delete a task + api_response = tasks_api_instance.delete_task(task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **duplicate_task** + +Duplicate a task + +Creates and returns a job that will asynchronously handle the duplication. + +([more information](https://developers.asana.com/reference/duplicatetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the fields that will be duplicated. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Duplicate a task + api_response = tasks_api_instance.duplicate_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->duplicate_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Describes the duplicate's name and the fields that will be duplicated. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_dependencies_for_task** + +Get dependencies from a task + +Returns the compact representations of all of the dependencies of a task. + +([more information](https://developers.asana.com/reference/getdependenciesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get dependencies from a task + api_response = tasks_api_instance.get_dependencies_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_dependencies_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_dependents_for_task** + +Get dependents from a task + +Returns the compact representations of all of the dependents of a task. + +([more information](https://developers.asana.com/reference/getdependentsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get dependents from a task + api_response = tasks_api_instance.get_dependents_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_dependents_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_subtasks_for_task** + +Get subtasks from a task + +Returns a compact representation of all of the subtasks of a task. + +([more information](https://developers.asana.com/reference/getsubtasksfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get subtasks from a task + api_response = tasks_api_instance.get_subtasks_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_subtasks_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_task** + +Get a task + +Returns the complete task record for a single task. + +([more information](https://developers.asana.com/reference/gettask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a task + api_response = tasks_api_instance.get_task(task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->get_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks** + +Get multiple tasks + +Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). + +([more information](https://developers.asana.com/reference/gettasks)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'assignee': "14641", # str | The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + 'project': "321654", # str | The project to filter tasks on. + 'section': "321654", # str | The section to filter tasks on. + 'workspace': "321654", # str | The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + 'completed_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that are either incomplete or that have been completed since this time. + 'modified_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple tasks + api_response = tasks_api_instance.get_tasks(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **assignee** | **str**| The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* | [optional] + **project** | **str**| The project to filter tasks on. | [optional] + **section** | **str**| The section to filter tasks on. | [optional] + **workspace** | **str**| The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* | [optional] + **completed_since** | **datetime**| Only return tasks that are either incomplete or that have been completed since this time. | [optional] + **modified_since** | **datetime**| Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_project** + +Get tasks from a project + +Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. + +([more information](https://developers.asana.com/reference/gettasksforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a project + api_response = tasks_api_instance.get_tasks_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **completed_since** | **str**| Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_section** + +Get tasks from a section + +*Board view only*: Returns the compact section records for all tasks within the given section. + +([more information](https://developers.asana.com/reference/gettasksforsection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a section + api_response = tasks_api_instance.get_tasks_for_section(section_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **completed_since** | **str**| Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_tag** + +Get tasks from a tag + +Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. + +([more information](https://developers.asana.com/reference/gettasksfortag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a tag + api_response = tasks_api_instance.get_tasks_for_tag(tag_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_user_task_list** + +Get tasks from a user task list + +Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* + +([more information](https://developers.asana.com/reference/gettasksforusertasklist)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. +opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a user task list + api_response = tasks_api_instance.get_tasks_for_user_task_list(user_task_list_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_user_task_list: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_task_list_gid** | **str**| Globally unique identifier for the user task list. | + **completed_since** | **str**| Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_dependencies_for_task** + +Unlink dependencies from a task + +Unlinks a set of dependencies from this task. + +([more information](https://developers.asana.com/reference/removedependenciesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to unlink as dependencies. +task_gid = "321654" # str | The task to operate on. + + +try: + # Unlink dependencies from a task + api_response = tasks_api_instance.remove_dependencies_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_dependencies_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to unlink as dependencies. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_dependents_for_task** + +Unlink dependents from a task + +Unlinks a set of dependents from this task. + +([more information](https://developers.asana.com/reference/removedependentsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to remove as dependents. +task_gid = "321654" # str | The task to operate on. + + +try: + # Unlink dependents from a task + api_response = tasks_api_instance.remove_dependents_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_dependents_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to remove as dependents. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_follower_for_task** + +Remove followers from a task + +Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. + +([more information](https://developers.asana.com/reference/removefollowerfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to remove from the task. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove followers from a task + api_response = tasks_api_instance.remove_follower_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_follower_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to remove from the task. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_project_for_task** + +Remove a project from a task + +Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. + +([more information](https://developers.asana.com/reference/removeprojectfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to remove the task from. +task_gid = "321654" # str | The task to operate on. + + +try: + # Remove a project from a task + api_response = tasks_api_instance.remove_project_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_project_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project to remove the task from. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_tag_for_task** + +Remove a tag from a task + +Removes a tag from a task. Returns an empty data block. + +([more information](https://developers.asana.com/reference/removetagfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to remove from the task. +task_gid = "321654" # str | The task to operate on. + + +try: + # Remove a tag from a task + api_response = tasks_api_instance.remove_tag_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_tag_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to remove from the task. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **search_tasks_for_workspace** + +Search tasks in a workspace + +To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* + +([more information](https://developers.asana.com/reference/searchtasksforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'text': "Bug", # str | Performs full-text search on both task name and description + 'resource_subtype': "milestone", # str | Filters results by the task's resource_subtype + 'assignee.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assignee.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'portfolios.any': "12345,23456,34567", # str | Comma-separated list of portfolio IDs + 'projects.any': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.not': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.all': "12345,23456,34567", # str | Comma-separated list of project IDs + 'sections.any': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.not': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.all': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'tags.any': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.not': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.all': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'teams.any': "12345,23456,34567", # str | Comma-separated list of team IDs + 'followers.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'liked_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'commented_on_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'due_on.before': '2019-09-15', # date | ISO 8601 date string + 'due_on.after': '2019-09-15', # date | ISO 8601 date string + 'due_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'due_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'due_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'start_on.before': '2019-09-15', # date | ISO 8601 date string + 'start_on.after': '2019-09-15', # date | ISO 8601 date string + 'start_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_on.before': '2019-09-15', # date | ISO 8601 date string + 'created_on.after': '2019-09-15', # date | ISO 8601 date string + 'created_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'created_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_on.before': '2019-09-15', # date | ISO 8601 date string + 'completed_on.after': '2019-09-15', # date | ISO 8601 date string + 'completed_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'completed_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_on.before': '2019-09-15', # date | ISO 8601 date string + 'modified_on.after': '2019-09-15', # date | ISO 8601 date string + 'modified_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'modified_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'is_blocking': False, # bool | Filter to incomplete tasks with dependents + 'is_blocked': False, # bool | Filter to tasks with incomplete dependencies + 'has_attachment': False, # bool | Filter to tasks with attachments + 'completed': False, # bool | Filter to completed tasks + 'is_subtask': False, # bool | Filter to subtasks + 'sort_by': "modified_at", # str | One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + 'sort_ascending': True, # bool | Default `false` + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} +opts['custom_fields.123.is_set'] = True # bool | Filiter to tasks with custom field set or unset. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.value'] = '456' # str or bool or Enum option ID | Filter to tasks with custom field that matches the provided value. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.starts_with'] = 'start' # string | Filter to tasks with custom field that starts with provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.ends_with'] = 'end' # string | Filter to tasks with custom field that ends in provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.contains'] = 'first' # string | Filter to tasks with custom field that contains the provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.less_than'] = 10 # number | Filter to tasks with custom field with number value less than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.greater_than'] = 100 # number | Filter to tasks with custom field with number value greater than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + +try: + # Search tasks in a workspace + api_response = tasks_api_instance.search_tasks_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->search_tasks_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **text** | **str**| Performs full-text search on both task name and description | [optional] + **resource_subtype** | **str**| Filters results by the task's resource_subtype | [optional] [default to milestone] + **assignee.any** | **str**| Comma-separated list of user identifiers | [optional] + **assignee.not** | **str**| Comma-separated list of user identifiers | [optional] + **portfolios.any** | **str**| Comma-separated list of portfolio IDs | [optional] + **projects.any** | **str**| Comma-separated list of project IDs | [optional] + **projects.not** | **str**| Comma-separated list of project IDs | [optional] + **projects.all** | **str**| Comma-separated list of project IDs | [optional] + **sections.any** | **str**| Comma-separated list of section or column IDs | [optional] + **sections.not** | **str**| Comma-separated list of section or column IDs | [optional] + **sections.all** | **str**| Comma-separated list of section or column IDs | [optional] + **tags.any** | **str**| Comma-separated list of tag IDs | [optional] + **tags.not** | **str**| Comma-separated list of tag IDs | [optional] + **tags.all** | **str**| Comma-separated list of tag IDs | [optional] + **teams.any** | **str**| Comma-separated list of team IDs | [optional] + **followers.not** | **str**| Comma-separated list of user identifiers | [optional] + **created_by.any** | **str**| Comma-separated list of user identifiers | [optional] + **created_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **assigned_by.any** | **str**| Comma-separated list of user identifiers | [optional] + **assigned_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **liked_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **commented_on_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **due_on.before** | **date**| ISO 8601 date string | [optional] + **due_on.after** | **date**| ISO 8601 date string | [optional] + **due_on** | **date**| ISO 8601 date string or `null` | [optional] + **due_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **due_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **start_on.before** | **date**| ISO 8601 date string | [optional] + **start_on.after** | **date**| ISO 8601 date string | [optional] + **start_on** | **date**| ISO 8601 date string or `null` | [optional] + **created_on.before** | **date**| ISO 8601 date string | [optional] + **created_on.after** | **date**| ISO 8601 date string | [optional] + **created_on** | **date**| ISO 8601 date string or `null` | [optional] + **created_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **created_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **completed_on.before** | **date**| ISO 8601 date string | [optional] + **completed_on.after** | **date**| ISO 8601 date string | [optional] + **completed_on** | **date**| ISO 8601 date string or `null` | [optional] + **completed_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **completed_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **modified_on.before** | **date**| ISO 8601 date string | [optional] + **modified_on.after** | **date**| ISO 8601 date string | [optional] + **modified_on** | **date**| ISO 8601 date string or `null` | [optional] + **modified_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **modified_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **is_blocking** | **bool**| Filter to incomplete tasks with dependents | [optional] + **is_blocked** | **bool**| Filter to tasks with incomplete dependencies | [optional] + **has_attachment** | **bool**| Filter to tasks with attachments | [optional] + **completed** | **bool**| Filter to completed tasks | [optional] + **is_subtask** | **bool**| Filter to subtasks | [optional] + **sort_by** | **str**| One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` | [optional] [default to modified_at] + **sort_ascending** | **bool**| Default `false` | [optional] [default to false] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **set_parent_for_task** + +Set the parent of a task + +parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. + +([more information](https://developers.asana.com/reference/setparentfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new parent of the subtask. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Set the parent of a task + api_response = tasks_api_instance.set_parent_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->set_parent_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new parent of the subtask. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_task** + +Update a task + +A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated task record. + +([more information](https://developers.asana.com/reference/updatetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to update. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a task + api_response = tasks_api_instance.update_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The task to update. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TasksApi.yaml b/docs/TasksApi.yaml new file mode 100644 index 00000000..23960bf7 --- /dev/null +++ b/docs/TasksApi.yaml @@ -0,0 +1,661 @@ +TasksApi: + add_dependencies_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to set as dependencies. + task_gid = "321654" # str | The task to operate on. + + + try: + # Set dependencies for a task + api_response = tasks_api_instance.add_dependencies_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_dependencies_for_task: %s\n" % e) + add_dependents_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to add as dependents. + task_gid = "321654" # str | The task to operate on. + + + try: + # Set dependents for a task + api_response = tasks_api_instance.add_dependents_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_dependents_for_task: %s\n" % e) + add_followers_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to add to the task. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add followers to a task + api_response = tasks_api_instance.add_followers_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_followers_for_task: %s\n" % e) + add_project_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to add the task to. + task_gid = "321654" # str | The task to operate on. + + + try: + # Add a project to a task + api_response = tasks_api_instance.add_project_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_project_for_task: %s\n" % e) + add_tag_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to add to the task. + task_gid = "321654" # str | The task to operate on. + + + try: + # Add a tag to a task + api_response = tasks_api_instance.add_tag_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_tag_for_task: %s\n" % e) + create_subtask_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new subtask to create. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a subtask + api_response = tasks_api_instance.create_subtask_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->create_subtask_for_task: %s\n" % e) + create_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to create. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a task + api_response = tasks_api_instance.create_task(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) + delete_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + + + try: + # Delete a task + api_response = tasks_api_instance.delete_task(task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) + duplicate_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the fields that will be duplicated. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Duplicate a task + api_response = tasks_api_instance.duplicate_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->duplicate_task: %s\n" % e) + get_dependencies_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get dependencies from a task + api_response = tasks_api_instance.get_dependencies_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_dependencies_for_task: %s\n" % e) + get_dependents_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get dependents from a task + api_response = tasks_api_instance.get_dependents_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_dependents_for_task: %s\n" % e) + get_subtasks_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get subtasks from a task + api_response = tasks_api_instance.get_subtasks_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_subtasks_for_task: %s\n" % e) + get_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a task + api_response = tasks_api_instance.get_task(task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->get_task: %s\n" % e) + get_tasks: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'assignee': "14641", # str | The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + 'project': "321654", # str | The project to filter tasks on. + 'section': "321654", # str | The section to filter tasks on. + 'workspace': "321654", # str | The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + 'completed_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that are either incomplete or that have been completed since this time. + 'modified_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple tasks + api_response = tasks_api_instance.get_tasks(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) + get_tasks_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a project + api_response = tasks_api_instance.get_tasks_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_project: %s\n" % e) + get_tasks_for_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a section + api_response = tasks_api_instance.get_tasks_for_section(section_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_section: %s\n" % e) + get_tasks_for_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a tag + api_response = tasks_api_instance.get_tasks_for_tag(tag_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_tag: %s\n" % e) + get_tasks_for_user_task_list: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. + opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a user task list + api_response = tasks_api_instance.get_tasks_for_user_task_list(user_task_list_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_user_task_list: %s\n" % e) + remove_dependencies_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to unlink as dependencies. + task_gid = "321654" # str | The task to operate on. + + + try: + # Unlink dependencies from a task + api_response = tasks_api_instance.remove_dependencies_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_dependencies_for_task: %s\n" % e) + remove_dependents_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to remove as dependents. + task_gid = "321654" # str | The task to operate on. + + + try: + # Unlink dependents from a task + api_response = tasks_api_instance.remove_dependents_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_dependents_for_task: %s\n" % e) + remove_follower_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to remove from the task. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove followers from a task + api_response = tasks_api_instance.remove_follower_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_follower_for_task: %s\n" % e) + remove_project_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to remove the task from. + task_gid = "321654" # str | The task to operate on. + + + try: + # Remove a project from a task + api_response = tasks_api_instance.remove_project_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_project_for_task: %s\n" % e) + remove_tag_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to remove from the task. + task_gid = "321654" # str | The task to operate on. + + + try: + # Remove a tag from a task + api_response = tasks_api_instance.remove_tag_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_tag_for_task: %s\n" % e) + search_tasks_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'text': "Bug", # str | Performs full-text search on both task name and description + 'resource_subtype': "milestone", # str | Filters results by the task's resource_subtype + 'assignee.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assignee.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'portfolios.any': "12345,23456,34567", # str | Comma-separated list of portfolio IDs + 'projects.any': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.not': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.all': "12345,23456,34567", # str | Comma-separated list of project IDs + 'sections.any': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.not': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.all': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'tags.any': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.not': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.all': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'teams.any': "12345,23456,34567", # str | Comma-separated list of team IDs + 'followers.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'liked_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'commented_on_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'due_on.before': '2019-09-15', # date | ISO 8601 date string + 'due_on.after': '2019-09-15', # date | ISO 8601 date string + 'due_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'due_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'due_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'start_on.before': '2019-09-15', # date | ISO 8601 date string + 'start_on.after': '2019-09-15', # date | ISO 8601 date string + 'start_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_on.before': '2019-09-15', # date | ISO 8601 date string + 'created_on.after': '2019-09-15', # date | ISO 8601 date string + 'created_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'created_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_on.before': '2019-09-15', # date | ISO 8601 date string + 'completed_on.after': '2019-09-15', # date | ISO 8601 date string + 'completed_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'completed_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_on.before': '2019-09-15', # date | ISO 8601 date string + 'modified_on.after': '2019-09-15', # date | ISO 8601 date string + 'modified_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'modified_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'is_blocking': False, # bool | Filter to incomplete tasks with dependents + 'is_blocked': False, # bool | Filter to tasks with incomplete dependencies + 'has_attachment': False, # bool | Filter to tasks with attachments + 'completed': False, # bool | Filter to completed tasks + 'is_subtask': False, # bool | Filter to subtasks + 'sort_by': "modified_at", # str | One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + 'sort_ascending': True, # bool | Default `false` + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + opts['custom_fields.123.is_set'] = True # bool | Filiter to tasks with custom field set or unset. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.value'] = '456' # str or bool or Enum option ID | Filter to tasks with custom field that matches the provided value. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.starts_with'] = 'start' # string | Filter to tasks with custom field that starts with provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.ends_with'] = 'end' # string | Filter to tasks with custom field that ends in provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.contains'] = 'first' # string | Filter to tasks with custom field that contains the provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.less_than'] = 10 # number | Filter to tasks with custom field with number value less than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.greater_than'] = 100 # number | Filter to tasks with custom field with number value greater than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + + try: + # Search tasks in a workspace + api_response = tasks_api_instance.search_tasks_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->search_tasks_for_workspace: %s\n" % e) + set_parent_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new parent of the subtask. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Set the parent of a task + api_response = tasks_api_instance.set_parent_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->set_parent_for_task: %s\n" % e) + update_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to update. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a task + api_response = tasks_api_instance.update_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) diff --git a/docs/TeamMembershipsApi.md b/docs/TeamMembershipsApi.md new file mode 100644 index 00000000..4bacd1f5 --- /dev/null +++ b/docs/TeamMembershipsApi.md @@ -0,0 +1,236 @@ +# asana.TeamMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_team_membership**](TeamMembershipsApi.md#get_team_membership) | **GET** /team_memberships/{team_membership_gid} | Get a team membership +[**get_team_memberships**](TeamMembershipsApi.md#get_team_memberships) | **GET** /team_memberships | Get team memberships +[**get_team_memberships_for_team**](TeamMembershipsApi.md#get_team_memberships_for_team) | **GET** /teams/{team_gid}/team_memberships | Get memberships from a team +[**get_team_memberships_for_user**](TeamMembershipsApi.md#get_team_memberships_for_user) | **GET** /users/{user_gid}/team_memberships | Get memberships from a user + +# **get_team_membership** + +Get a team membership + +Returns the complete team membership record for a single team membership. + +([more information](https://developers.asana.com/reference/getteammembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +team_membership_gid = "724362" # str | +opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team membership + api_response = team_memberships_api_instance.get_team_membership(team_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team_memberships** + +Get team memberships + +Returns compact team membership records. + +([more information](https://developers.asana.com/reference/getteammemberships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'team': "159874", # str | Globally unique identifier for the team. + 'user': "512241", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + 'workspace': "31326", # str | Globally unique identifier for the workspace. This parameter must be used with the user parameter. + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get team memberships + api_response = team_memberships_api_instance.get_team_memberships(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **team** | **str**| Globally unique identifier for the team. | [optional] + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. | [optional] + **workspace** | **str**| Globally unique identifier for the workspace. This parameter must be used with the user parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team_memberships_for_team** + +Get memberships from a team + +Returns the compact team memberships for the team. + +([more information](https://developers.asana.com/reference/getteammembershipsforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a team + api_response = team_memberships_api_instance.get_team_memberships_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team_memberships_for_user** + +Get memberships from a user + +Returns the compact team membership records for the user. + +([more information](https://developers.asana.com/reference/getteammembershipsforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +workspace = "31326" # str | Globally unique identifier for the workspace. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a user + api_response = team_memberships_api_instance.get_team_memberships_for_user(user_gid, workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **workspace** | **str**| Globally unique identifier for the workspace. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TeamMembershipsApi.yaml b/docs/TeamMembershipsApi.yaml new file mode 100644 index 00000000..622b0659 --- /dev/null +++ b/docs/TeamMembershipsApi.yaml @@ -0,0 +1,101 @@ +TeamMembershipsApi: + get_team_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + team_membership_gid = "724362" # str | + opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team membership + api_response = team_memberships_api_instance.get_team_membership(team_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_membership: %s\n" % e) + get_team_memberships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'team': "159874", # str | Globally unique identifier for the team. + 'user': "512241", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + 'workspace': "31326", # str | Globally unique identifier for the workspace. This parameter must be used with the user parameter. + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get team memberships + api_response = team_memberships_api_instance.get_team_memberships(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships: %s\n" % e) + get_team_memberships_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a team + api_response = team_memberships_api_instance.get_team_memberships_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_team: %s\n" % e) + get_team_memberships_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + workspace = "31326" # str | Globally unique identifier for the workspace. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a user + api_response = team_memberships_api_instance.get_team_memberships_for_user(user_gid, workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_user: %s\n" % e) diff --git a/docs/TeamsApi.md b/docs/TeamsApi.md new file mode 100644 index 00000000..2798bee5 --- /dev/null +++ b/docs/TeamsApi.md @@ -0,0 +1,386 @@ +# asana.TeamsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_user_for_team**](TeamsApi.md#add_user_for_team) | **POST** /teams/{team_gid}/addUser | Add a user to a team +[**create_team**](TeamsApi.md#create_team) | **POST** /teams | Create a team +[**get_team**](TeamsApi.md#get_team) | **GET** /teams/{team_gid} | Get a team +[**get_teams_for_user**](TeamsApi.md#get_teams_for_user) | **GET** /users/{user_gid}/teams | Get teams for a user +[**get_teams_for_workspace**](TeamsApi.md#get_teams_for_workspace) | **GET** /workspaces/{workspace_gid}/teams | Get teams in a workspace +[**remove_user_for_team**](TeamsApi.md#remove_user_for_team) | **POST** /teams/{team_gid}/removeUser | Remove a user from a team +[**update_team**](TeamsApi.md#update_team) | **PUT** /teams/{team_gid} | Update a team + +# **add_user_for_team** + +Add a user to a team + +The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. + +([more information](https://developers.asana.com/reference/adduserforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the team. +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a user to a team + api_response = teams_api_instance.add_user_for_team(body, team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->add_user_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to add to the team. | + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_team** + +Create a team + +Creates a team within the current workspace. + +([more information](https://developers.asana.com/reference/createteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to create. +opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a team + api_response = teams_api_instance.create_team(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->create_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The team to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team** + +Get a team + +Returns the full record for a single team. + +([more information](https://developers.asana.com/reference/getteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team + api_response = teams_api_instance.get_team(team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->get_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_teams_for_user** + +Get teams for a user + +Returns the compact records for all teams to which the given user is assigned. + +([more information](https://developers.asana.com/reference/getteamsforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +organization = "1331" # str | The workspace or organization to filter teams on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get teams for a user + api_response = teams_api_instance.get_teams_for_user(user_gid, organization, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **organization** | **str**| The workspace or organization to filter teams on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_teams_for_workspace** + +Get teams in a workspace + +Returns the compact records for all teams in the workspace visible to the authorized user. + +([more information](https://developers.asana.com/reference/getteamsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get teams in a workspace + api_response = teams_api_instance.get_teams_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_user_for_team** + +Remove a user from a team + +The user making this call must be a member of the team in order to remove themselves or others. + +([more information](https://developers.asana.com/reference/removeuserforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the team. +team_gid = "159874" # str | Globally unique identifier for the team. + + +try: + # Remove a user from a team + api_response = teams_api_instance.remove_user_for_team(body, team_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->remove_user_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to remove from the team. | + **team_gid** | **str**| Globally unique identifier for the team. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_team** + +Update a team + +Updates a team within the current workspace. + +([more information](https://developers.asana.com/reference/updateteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to update. +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a team + api_response = teams_api_instance.update_team(body, team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->update_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The team to update. | + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TeamsApi.yaml b/docs/TeamsApi.yaml new file mode 100644 index 00000000..856ed224 --- /dev/null +++ b/docs/TeamsApi.yaml @@ -0,0 +1,163 @@ +TeamsApi: + add_user_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the team. + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a user to a team + api_response = teams_api_instance.add_user_for_team(body, team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->add_user_for_team: %s\n" % e) + create_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to create. + opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a team + api_response = teams_api_instance.create_team(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->create_team: %s\n" % e) + get_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team + api_response = teams_api_instance.get_team(team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->get_team: %s\n" % e) + get_teams_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + organization = "1331" # str | The workspace or organization to filter teams on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get teams for a user + api_response = teams_api_instance.get_teams_for_user(user_gid, organization, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_user: %s\n" % e) + get_teams_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get teams in a workspace + api_response = teams_api_instance.get_teams_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_workspace: %s\n" % e) + remove_user_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the team. + team_gid = "159874" # str | Globally unique identifier for the team. + + + try: + # Remove a user from a team + api_response = teams_api_instance.remove_user_for_team(body, team_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->remove_user_for_team: %s\n" % e) + update_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to update. + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a team + api_response = teams_api_instance.update_team(body, team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->update_team: %s\n" % e) diff --git a/docs/TimePeriodsApi.md b/docs/TimePeriodsApi.md new file mode 100644 index 00000000..f5e716f1 --- /dev/null +++ b/docs/TimePeriodsApi.md @@ -0,0 +1,120 @@ +# asana.TimePeriodsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_time_period**](TimePeriodsApi.md#get_time_period) | **GET** /time_periods/{time_period_gid} | Get a time period +[**get_time_periods**](TimePeriodsApi.md#get_time_periods) | **GET** /time_periods | Get time periods + +# **get_time_period** + +Get a time period + +Returns the full record for a single time period. + +([more information](https://developers.asana.com/reference/gettimeperiod)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_periods_api_instance = asana.TimePeriodsApi(api_client) +time_period_gid = "917392" # str | Globally unique identifier for the time period. +opts = { + 'opt_fields': "display_name,end_on,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,period,start_on" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a time period + api_response = time_periods_api_instance.get_time_period(time_period_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_period: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **time_period_gid** | **str**| Globally unique identifier for the time period. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_time_periods** + +Get time periods + +Returns compact time period records. + +([more information](https://developers.asana.com/reference/gettimeperiods)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_periods_api_instance = asana.TimePeriodsApi(api_client) +workspace = "31326" # str | Globally unique identifier for the workspace. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'start_on': '2019-09-15', # date | ISO 8601 date string + 'end_on': '2019-09-15', # date | ISO 8601 date string + 'opt_fields': "display_name,end_on,offset,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,path,period,start_on,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get time periods + api_response = time_periods_api_instance.get_time_periods(workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_periods: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| Globally unique identifier for the workspace. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **start_on** | **date**| ISO 8601 date string | [optional] + **end_on** | **date**| ISO 8601 date string | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TimePeriodsApi.yaml b/docs/TimePeriodsApi.yaml new file mode 100644 index 00000000..213f9412 --- /dev/null +++ b/docs/TimePeriodsApi.yaml @@ -0,0 +1,50 @@ +TimePeriodsApi: + get_time_period: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_periods_api_instance = asana.TimePeriodsApi(api_client) + time_period_gid = "917392" # str | Globally unique identifier for the time period. + opts = { + 'opt_fields': "display_name,end_on,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,period,start_on" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a time period + api_response = time_periods_api_instance.get_time_period(time_period_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_period: %s\n" % e) + get_time_periods: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_periods_api_instance = asana.TimePeriodsApi(api_client) + workspace = "31326" # str | Globally unique identifier for the workspace. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'start_on': '2019-09-15', # date | ISO 8601 date string + 'end_on': '2019-09-15', # date | ISO 8601 date string + 'opt_fields': "display_name,end_on,offset,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,path,period,start_on,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get time periods + api_response = time_periods_api_instance.get_time_periods(workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_periods: %s\n" % e) diff --git a/docs/TimeTrackingEntriesApi.md b/docs/TimeTrackingEntriesApi.md new file mode 100644 index 00000000..58427a71 --- /dev/null +++ b/docs/TimeTrackingEntriesApi.md @@ -0,0 +1,273 @@ +# asana.TimeTrackingEntriesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_time_tracking_entry**](TimeTrackingEntriesApi.md#create_time_tracking_entry) | **POST** /tasks/{task_gid}/time_tracking_entries | Create a time tracking entry +[**delete_time_tracking_entry**](TimeTrackingEntriesApi.md#delete_time_tracking_entry) | **DELETE** /time_tracking_entries/{time_tracking_entry_gid} | Delete a time tracking entry +[**get_time_tracking_entries_for_task**](TimeTrackingEntriesApi.md#get_time_tracking_entries_for_task) | **GET** /tasks/{task_gid}/time_tracking_entries | Get time tracking entries for a task +[**get_time_tracking_entry**](TimeTrackingEntriesApi.md#get_time_tracking_entry) | **GET** /time_tracking_entries/{time_tracking_entry_gid} | Get a time tracking entry +[**update_time_tracking_entry**](TimeTrackingEntriesApi.md#update_time_tracking_entry) | **PUT** /time_tracking_entries/{time_tracking_entry_gid} | Update a time tracking entry + +# **create_time_tracking_entry** + +Create a time tracking entry + +Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. + +([more information](https://developers.asana.com/reference/createtimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the time tracking entry. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a time tracking entry + api_response = time_tracking_entries_api_instance.create_time_tracking_entry(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->create_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the time tracking entry. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_time_tracking_entry** + +Delete a time tracking entry + +A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletetimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + + +try: + # Delete a time tracking entry + api_response = time_tracking_entries_api_instance.delete_time_tracking_entry(time_tracking_entry_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->delete_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **time_tracking_entry_gid** | **str**| Globally unique identifier for the time tracking entry. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_time_tracking_entries_for_task** + +Get time tracking entries for a task + +Returns time tracking entries for a given task. + +([more information](https://developers.asana.com/reference/gettimetrackingentriesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_by,created_by.name,duration_minutes,entered_on,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get time tracking entries for a task + api_response = time_tracking_entries_api_instance.get_time_tracking_entries_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entries_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_time_tracking_entry** + +Get a time tracking entry + +Returns the complete time tracking entry record for a single time tracking entry. + +([more information](https://developers.asana.com/reference/gettimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. +opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a time tracking entry + api_response = time_tracking_entries_api_instance.get_time_tracking_entry(time_tracking_entry_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **time_tracking_entry_gid** | **str**| Globally unique identifier for the time tracking entry. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_time_tracking_entry** + +Update a time tracking entry + +A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. 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 task. Returns the complete updated time tracking entry record. + +([more information](https://developers.asana.com/reference/updatetimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the time tracking entry. +time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. +opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a time tracking entry + api_response = time_tracking_entries_api_instance.update_time_tracking_entry(body, time_tracking_entry_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->update_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the time tracking entry. | + **time_tracking_entry_gid** | **str**| Globally unique identifier for the time tracking entry. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TimeTrackingEntriesApi.yaml b/docs/TimeTrackingEntriesApi.yaml new file mode 100644 index 00000000..7b112362 --- /dev/null +++ b/docs/TimeTrackingEntriesApi.yaml @@ -0,0 +1,114 @@ +TimeTrackingEntriesApi: + create_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the time tracking entry. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a time tracking entry + api_response = time_tracking_entries_api_instance.create_time_tracking_entry(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->create_time_tracking_entry: %s\n" % e) + delete_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + + + try: + # Delete a time tracking entry + api_response = time_tracking_entries_api_instance.delete_time_tracking_entry(time_tracking_entry_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->delete_time_tracking_entry: %s\n" % e) + get_time_tracking_entries_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_by,created_by.name,duration_minutes,entered_on,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get time tracking entries for a task + api_response = time_tracking_entries_api_instance.get_time_tracking_entries_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entries_for_task: %s\n" % e) + get_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a time tracking entry + api_response = time_tracking_entries_api_instance.get_time_tracking_entry(time_tracking_entry_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entry: %s\n" % e) + update_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the time tracking entry. + time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a time tracking entry + api_response = time_tracking_entries_api_instance.update_time_tracking_entry(body, time_tracking_entry_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->update_time_tracking_entry: %s\n" % e) diff --git a/docs/TypeaheadApi.md b/docs/TypeaheadApi.md new file mode 100644 index 00000000..7741c253 --- /dev/null +++ b/docs/TypeaheadApi.md @@ -0,0 +1,68 @@ +# asana.TypeaheadApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**typeahead_for_workspace**](TypeaheadApi.md#typeahead_for_workspace) | **GET** /workspaces/{workspace_gid}/typeahead | Get objects via typeahead + +# **typeahead_for_workspace** + +Get objects via typeahead + +Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. + +([more information](https://developers.asana.com/reference/typeaheadforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +typeahead_api_instance = asana.TypeaheadApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +resource_type = "user" # str | 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. +opts = { + 'type': "user", # str | *Deprecated: new integrations should prefer the resource_type field.* + 'query': "Greg", # str | The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + 'count': 20, # 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. + 'opt_fields': "name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get objects via typeahead + api_response = typeahead_api_instance.typeahead_for_workspace(workspace_gid, resource_type, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TypeaheadApi->typeahead_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **resource_type** | **str**| 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. | [default to user] + **type** | **str**| *Deprecated: new integrations should prefer the resource_type field.* | [optional] [default to user] + **query** | **str**| The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. | [optional] + **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. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TypeaheadApi.yaml b/docs/TypeaheadApi.yaml new file mode 100644 index 00000000..cac33229 --- /dev/null +++ b/docs/TypeaheadApi.yaml @@ -0,0 +1,28 @@ +TypeaheadApi: + typeahead_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + typeahead_api_instance = asana.TypeaheadApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + resource_type = "user" # str | 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. + opts = { + 'type': "user", # str | *Deprecated: new integrations should prefer the resource_type field.* + 'query': "Greg", # str | The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + 'count': 20, # 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. + 'opt_fields': "name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get objects via typeahead + api_response = typeahead_api_instance.typeahead_for_workspace(workspace_gid, resource_type, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TypeaheadApi->typeahead_for_workspace: %s\n" % e) diff --git a/docs/UserTaskListsApi.md b/docs/UserTaskListsApi.md new file mode 100644 index 00000000..61734b5e --- /dev/null +++ b/docs/UserTaskListsApi.md @@ -0,0 +1,113 @@ +# asana.UserTaskListsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_user_task_list**](UserTaskListsApi.md#get_user_task_list) | **GET** /user_task_lists/{user_task_list_gid} | Get a user task list +[**get_user_task_list_for_user**](UserTaskListsApi.md#get_user_task_list_for_user) | **GET** /users/{user_gid}/user_task_list | Get a user's task list + +# **get_user_task_list** + +Get a user task list + +Returns the full record for a user task list. + +([more information](https://developers.asana.com/reference/getusertasklist)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +user_task_lists_api_instance = asana.UserTaskListsApi(api_client) +user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. +opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user task list + api_response = user_task_lists_api_instance.get_user_task_list(user_task_list_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_task_list_gid** | **str**| Globally unique identifier for the user task list. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_user_task_list_for_user** + +Get a user's task list + +Returns the full record for a user's task list. + +([more information](https://developers.asana.com/reference/getusertasklistforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +user_task_lists_api_instance = asana.UserTaskListsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +workspace = "1234" # str | The workspace in which to get the user task list. +opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user's task list + api_response = user_task_lists_api_instance.get_user_task_list_for_user(user_gid, workspace, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **workspace** | **str**| The workspace in which to get the user task list. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/UserTaskListsApi.yaml b/docs/UserTaskListsApi.yaml new file mode 100644 index 00000000..37c8bad1 --- /dev/null +++ b/docs/UserTaskListsApi.yaml @@ -0,0 +1,46 @@ +UserTaskListsApi: + get_user_task_list: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + user_task_lists_api_instance = asana.UserTaskListsApi(api_client) + user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. + opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user task list + api_response = user_task_lists_api_instance.get_user_task_list(user_task_list_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list: %s\n" % e) + get_user_task_list_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + user_task_lists_api_instance = asana.UserTaskListsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + workspace = "1234" # str | The workspace in which to get the user task list. + opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user's task list + api_response = user_task_lists_api_instance.get_user_task_list_for_user(user_gid, workspace, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list_for_user: %s\n" % e) diff --git a/docs/UsersApi.md b/docs/UsersApi.md new file mode 100644 index 00000000..fd3d062a --- /dev/null +++ b/docs/UsersApi.md @@ -0,0 +1,289 @@ +# asana.UsersApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_favorites_for_user**](UsersApi.md#get_favorites_for_user) | **GET** /users/{user_gid}/favorites | Get a user's favorites +[**get_user**](UsersApi.md#get_user) | **GET** /users/{user_gid} | Get a user +[**get_users**](UsersApi.md#get_users) | **GET** /users | Get multiple users +[**get_users_for_team**](UsersApi.md#get_users_for_team) | **GET** /teams/{team_gid}/users | Get users in a team +[**get_users_for_workspace**](UsersApi.md#get_users_for_workspace) | **GET** /workspaces/{workspace_gid}/users | Get users in a workspace or organization + +# **get_favorites_for_user** + +Get a user's favorites + +Returns all of a user's favorites in the given workspace, of the given type. Results are given in order (The same order as Asana's sidebar). + +([more information](https://developers.asana.com/reference/getfavoritesforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +resource_type = "project" # str | The resource type of favorites to be returned. +workspace = "1234" # str | The workspace in which to get favorites. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user's favorites + api_response = users_api_instance.get_favorites_for_user(user_gid, resource_type, workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_favorites_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **resource_type** | **str**| The resource type of favorites to be returned. | [default to project] + **workspace** | **str**| The workspace in which to get favorites. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_user** + +Get a user + +Returns the full user record for the single user with the provided ID. + +([more information](https://developers.asana.com/reference/getuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user + api_response = users_api_instance.get_user(user_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_users** + +Get multiple users + +Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. + +([more information](https://developers.asana.com/reference/getusers)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +opts = { + 'workspace': "1331", # str | The workspace or organization ID to filter users on. + 'team': "15627", # str | The team ID to filter users on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email,name,offset,path,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,uri,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple users + api_response = users_api_instance.get_users(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_users: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace or organization ID to filter users on. | [optional] + **team** | **str**| The team ID to filter users on. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_users_for_team** + +Get users in a team + +Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. + +([more information](https://developers.asana.com/reference/getusersforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get users in a team + api_response = users_api_instance.get_users_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_users_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_users_for_workspace** + +Get users in a workspace or organization + +Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. + +([more information](https://developers.asana.com/reference/getusersforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get users in a workspace or organization + api_response = users_api_instance.get_users_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_users_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/UsersApi.yaml b/docs/UsersApi.yaml new file mode 100644 index 00000000..2fda92b8 --- /dev/null +++ b/docs/UsersApi.yaml @@ -0,0 +1,124 @@ +UsersApi: + get_favorites_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + resource_type = "project" # str | The resource type of favorites to be returned. + workspace = "1234" # str | The workspace in which to get favorites. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user's favorites + api_response = users_api_instance.get_favorites_for_user(user_gid, resource_type, workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_favorites_for_user: %s\n" % e) + get_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user + api_response = users_api_instance.get_user(user_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) + get_users: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + opts = { + 'workspace': "1331", # str | The workspace or organization ID to filter users on. + 'team': "15627", # str | The team ID to filter users on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email,name,offset,path,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,uri,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple users + api_response = users_api_instance.get_users(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_users: %s\n" % e) + get_users_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get users in a team + api_response = users_api_instance.get_users_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_users_for_team: %s\n" % e) + get_users_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get users in a workspace or organization + api_response = users_api_instance.get_users_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_users_for_workspace: %s\n" % e) diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md new file mode 100644 index 00000000..08c68b57 --- /dev/null +++ b/docs/WebhooksApi.md @@ -0,0 +1,273 @@ +# asana.WebhooksApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_webhook**](WebhooksApi.md#create_webhook) | **POST** /webhooks | Establish a webhook +[**delete_webhook**](WebhooksApi.md#delete_webhook) | **DELETE** /webhooks/{webhook_gid} | Delete a webhook +[**get_webhook**](WebhooksApi.md#get_webhook) | **GET** /webhooks/{webhook_gid} | Get a webhook +[**get_webhooks**](WebhooksApi.md#get_webhooks) | **GET** /webhooks | Get multiple webhooks +[**update_webhook**](WebhooksApi.md#update_webhook) | **PUT** /webhooks/{webhook_gid} | Update a webhook + +# **create_webhook** + +Establish a webhook + +Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will recieve a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer \" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null } } ``` + +([more information](https://developers.asana.com/reference/createwebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The webhook workspace and target. +opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Establish a webhook + api_response = webhooks_api_instance.create_webhook(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->create_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The webhook workspace and target. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_webhook** + +Delete a webhook + +This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. + +([more information](https://developers.asana.com/reference/deletewebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +webhook_gid = "12345" # str | Globally unique identifier for the webhook. + + +try: + # Delete a webhook + api_response = webhooks_api_instance.delete_webhook(webhook_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->delete_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **webhook_gid** | **str**| Globally unique identifier for the webhook. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_webhook** + +Get a webhook + +Returns the full record for the given webhook. + +([more information](https://developers.asana.com/reference/getwebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +webhook_gid = "12345" # str | Globally unique identifier for the webhook. +opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a webhook + api_response = webhooks_api_instance.get_webhook(webhook_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->get_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **webhook_gid** | **str**| Globally unique identifier for the webhook. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_webhooks** + +Get multiple webhooks + +Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. + +([more information](https://developers.asana.com/reference/getwebhooks)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +workspace = "1331" # str | The workspace to query for webhooks in. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'resource': "51648", # str | Only return webhooks for the given resource. + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,offset,path,resource,resource.name,target,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple webhooks + api_response = webhooks_api_instance.get_webhooks(workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WebhooksApi->get_webhooks: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace to query for webhooks in. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **resource** | **str**| Only return webhooks for the given resource. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_webhook** + +Update a webhook + +An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. + +([more information](https://developers.asana.com/reference/updatewebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated filters for the webhook. +webhook_gid = "12345" # str | Globally unique identifier for the webhook. +opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a webhook + api_response = webhooks_api_instance.update_webhook(body, webhook_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->update_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated filters for the webhook. | + **webhook_gid** | **str**| Globally unique identifier for the webhook. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WebhooksApi.yaml b/docs/WebhooksApi.yaml new file mode 100644 index 00000000..89fdc287 --- /dev/null +++ b/docs/WebhooksApi.yaml @@ -0,0 +1,114 @@ +WebhooksApi: + create_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The webhook workspace and target. + opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Establish a webhook + api_response = webhooks_api_instance.create_webhook(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->create_webhook: %s\n" % e) + delete_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + webhook_gid = "12345" # str | Globally unique identifier for the webhook. + + + try: + # Delete a webhook + api_response = webhooks_api_instance.delete_webhook(webhook_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->delete_webhook: %s\n" % e) + get_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + webhook_gid = "12345" # str | Globally unique identifier for the webhook. + opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a webhook + api_response = webhooks_api_instance.get_webhook(webhook_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->get_webhook: %s\n" % e) + get_webhooks: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + workspace = "1331" # str | The workspace to query for webhooks in. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'resource': "51648", # str | Only return webhooks for the given resource. + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,offset,path,resource,resource.name,target,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple webhooks + api_response = webhooks_api_instance.get_webhooks(workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WebhooksApi->get_webhooks: %s\n" % e) + update_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated filters for the webhook. + webhook_gid = "12345" # str | Globally unique identifier for the webhook. + opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a webhook + api_response = webhooks_api_instance.update_webhook(body, webhook_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->update_webhook: %s\n" % e) diff --git a/docs/WorkspaceMembershipsApi.md b/docs/WorkspaceMembershipsApi.md new file mode 100644 index 00000000..75819826 --- /dev/null +++ b/docs/WorkspaceMembershipsApi.md @@ -0,0 +1,175 @@ +# asana.WorkspaceMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_workspace_membership**](WorkspaceMembershipsApi.md#get_workspace_membership) | **GET** /workspace_memberships/{workspace_membership_gid} | Get a workspace membership +[**get_workspace_memberships_for_user**](WorkspaceMembershipsApi.md#get_workspace_memberships_for_user) | **GET** /users/{user_gid}/workspace_memberships | Get workspace memberships for a user +[**get_workspace_memberships_for_workspace**](WorkspaceMembershipsApi.md#get_workspace_memberships_for_workspace) | **GET** /workspaces/{workspace_gid}/workspace_memberships | Get the workspace memberships for a workspace + +# **get_workspace_membership** + +Get a workspace membership + +Returns the complete workspace record for a single workspace membership. + +([more information](https://developers.asana.com/reference/getworkspacemembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) +workspace_membership_gid = "12345" # str | +opts = { + 'opt_fields': "created_at,is_active,is_admin,is_guest,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a workspace membership + api_response = workspace_memberships_api_instance.get_workspace_membership(workspace_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspace_memberships_for_user** + +Get workspace memberships for a user + +Returns the compact workspace membership records for the user. + +([more information](https://developers.asana.com/reference/getworkspacemembershipsforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get workspace memberships for a user + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_user(user_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspace_memberships_for_workspace** + +Get the workspace memberships for a workspace + +Returns the compact workspace membership records for the workspace. + +([more information](https://developers.asana.com/reference/getworkspacemembershipsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get the workspace memberships for a workspace + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WorkspaceMembershipsApi.yaml b/docs/WorkspaceMembershipsApi.yaml new file mode 100644 index 00000000..fc0945ac --- /dev/null +++ b/docs/WorkspaceMembershipsApi.yaml @@ -0,0 +1,74 @@ +WorkspaceMembershipsApi: + get_workspace_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) + workspace_membership_gid = "12345" # str | + opts = { + 'opt_fields': "created_at,is_active,is_admin,is_guest,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a workspace membership + api_response = workspace_memberships_api_instance.get_workspace_membership(workspace_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_membership: %s\n" % e) + get_workspace_memberships_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get workspace memberships for a user + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_user(user_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_user: %s\n" % e) + get_workspace_memberships_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get the workspace memberships for a workspace + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_workspace: %s\n" % e) diff --git a/docs/WorkspacesApi.md b/docs/WorkspacesApi.md new file mode 100644 index 00000000..9644d845 --- /dev/null +++ b/docs/WorkspacesApi.md @@ -0,0 +1,273 @@ +# asana.WorkspacesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_user_for_workspace**](WorkspacesApi.md#add_user_for_workspace) | **POST** /workspaces/{workspace_gid}/addUser | Add a user to a workspace or organization +[**get_workspace**](WorkspacesApi.md#get_workspace) | **GET** /workspaces/{workspace_gid} | Get a workspace +[**get_workspaces**](WorkspacesApi.md#get_workspaces) | **GET** /workspaces | Get multiple workspaces +[**remove_user_for_workspace**](WorkspacesApi.md#remove_user_for_workspace) | **POST** /workspaces/{workspace_gid}/removeUser | Remove a user from a workspace or organization +[**update_workspace**](WorkspacesApi.md#update_workspace) | **PUT** /workspaces/{workspace_gid} | Update a workspace + +# **add_user_for_workspace** + +Add a user to a workspace or organization + +Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. + +([more information](https://developers.asana.com/reference/adduserforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the workspace. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a user to a workspace or organization + api_response = workspaces_api_instance.add_user_for_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->add_user_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to add to the workspace. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspace** + +Get a workspace + +Returns the full workspace record for a single workspace. + +([more information](https://developers.asana.com/reference/getworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a workspace + api_response = workspaces_api_instance.get_workspace(workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspaces** + +Get multiple workspaces + +Returns the compact records for all workspaces visible to the authorized user. + +([more information](https://developers.asana.com/reference/getworkspaces)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email_domains,is_organization,name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple workspaces + api_response = workspaces_api_instance.get_workspaces(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspaces: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **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.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_user_for_workspace** + +Remove a user from a workspace or organization + +Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. + +([more information](https://developers.asana.com/reference/removeuserforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the workspace. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + + +try: + # Remove a user from a workspace or organization + api_response = workspaces_api_instance.remove_user_for_workspace(body, workspace_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->remove_user_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to remove from the workspace. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_workspace** + +Update a workspace + +A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. + +([more information](https://developers.asana.com/reference/updateworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The workspace object with all updated properties. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a workspace + api_response = workspaces_api_instance.update_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->update_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The workspace object with all updated properties. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WorkspacesApi.yaml b/docs/WorkspacesApi.yaml new file mode 100644 index 00000000..b287f71f --- /dev/null +++ b/docs/WorkspacesApi.yaml @@ -0,0 +1,114 @@ +WorkspacesApi: + add_user_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the workspace. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a user to a workspace or organization + api_response = workspaces_api_instance.add_user_for_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->add_user_for_workspace: %s\n" % e) + get_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a workspace + api_response = workspaces_api_instance.get_workspace(workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspace: %s\n" % e) + get_workspaces: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # 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.' + 'opt_fields': "email_domains,is_organization,name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple workspaces + api_response = workspaces_api_instance.get_workspaces(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspaces: %s\n" % e) + remove_user_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the workspace. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + + + try: + # Remove a user from a workspace or organization + api_response = workspaces_api_instance.remove_user_for_workspace(body, workspace_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->remove_user_for_workspace: %s\n" % e) + update_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The workspace object with all updated properties. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a workspace + api_response = workspaces_api_instance.update_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->update_workspace: %s\n" % e) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..bafdc075 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +certifi >= 14.05.14 +six >= 1.10 +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.15.1 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..5ac1cbb1 --- /dev/null +++ b/setup.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import os +from setuptools import setup, find_packages # noqa: H301 + +NAME = "asana" +VERSION = "5.0.0" +with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: + LONG_DESCRIPTION = readme.read() +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = [ + "certifi>=2017.4.17", + "python-dateutil>=2.1", + "six>=1.10", + "urllib3>=1.23" +] + + +setup( + name=NAME, + version=VERSION, + description="Asana", + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', + author='Asana, Inc', + url="http://github.com/asana/python-asana", + keywords=["asana", "Asana"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + license='MIT', +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..2702246c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..576f56f8 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1 @@ +# coding: utf-8 \ No newline at end of file diff --git a/test/test_attachments_api.py b/test/test_attachments_api.py new file mode 100644 index 00000000..1d8c7899 --- /dev/null +++ b/test/test_attachments_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.attachments_api import AttachmentsApi # noqa: E501 +from asana.rest import ApiException + + +class TestAttachmentsApi(unittest.TestCase): + """AttachmentsApi unit test stubs""" + + def setUp(self): + self.api = AttachmentsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_attachment_for_object(self): + """Test case for create_attachment_for_object + + Upload an attachment # noqa: E501 + """ + pass + + def test_delete_attachment(self): + """Test case for delete_attachment + + Delete an attachment # noqa: E501 + """ + pass + + def test_get_attachment(self): + """Test case for get_attachment + + Get an attachment # noqa: E501 + """ + pass + + def test_get_attachments_for_object(self): + """Test case for get_attachments_for_object + + Get attachments from an object # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_audit_log_api_api.py b/test/test_audit_log_api_api.py new file mode 100644 index 00000000..5c0fe1d5 --- /dev/null +++ b/test/test_audit_log_api_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.audit_log_api_api import AuditLogAPIApi # noqa: E501 +from asana.rest import ApiException + + +class TestAuditLogAPIApi(unittest.TestCase): + """AuditLogAPIApi unit test stubs""" + + def setUp(self): + self.api = AuditLogAPIApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_audit_log_events(self): + """Test case for get_audit_log_events + + Get audit log events # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_batch_api_api.py b/test/test_batch_api_api.py new file mode 100644 index 00000000..bffbc5a3 --- /dev/null +++ b/test/test_batch_api_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.batch_api_api import BatchAPIApi # noqa: E501 +from asana.rest import ApiException + + +class TestBatchAPIApi(unittest.TestCase): + """BatchAPIApi unit test stubs""" + + def setUp(self): + self.api = BatchAPIApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_batch_request(self): + """Test case for create_batch_request + + Submit parallel requests # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_custom_field_settings_api.py b/test/test_custom_field_settings_api.py new file mode 100644 index 00000000..c82c55fc --- /dev/null +++ b/test/test_custom_field_settings_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.custom_field_settings_api import CustomFieldSettingsApi # noqa: E501 +from asana.rest import ApiException + + +class TestCustomFieldSettingsApi(unittest.TestCase): + """CustomFieldSettingsApi unit test stubs""" + + def setUp(self): + self.api = CustomFieldSettingsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_custom_field_settings_for_portfolio(self): + """Test case for get_custom_field_settings_for_portfolio + + Get a portfolio's custom fields # noqa: E501 + """ + pass + + def test_get_custom_field_settings_for_project(self): + """Test case for get_custom_field_settings_for_project + + Get a project's custom fields # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_custom_fields_api.py b/test/test_custom_fields_api.py new file mode 100644 index 00000000..473420bc --- /dev/null +++ b/test/test_custom_fields_api.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.custom_fields_api import CustomFieldsApi # noqa: E501 +from asana.rest import ApiException + + +class TestCustomFieldsApi(unittest.TestCase): + """CustomFieldsApi unit test stubs""" + + def setUp(self): + self.api = CustomFieldsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_custom_field(self): + """Test case for create_custom_field + + Create a custom field # noqa: E501 + """ + pass + + def test_create_enum_option_for_custom_field(self): + """Test case for create_enum_option_for_custom_field + + Create an enum option # noqa: E501 + """ + pass + + def test_delete_custom_field(self): + """Test case for delete_custom_field + + Delete a custom field # noqa: E501 + """ + pass + + def test_get_custom_field(self): + """Test case for get_custom_field + + Get a custom field # noqa: E501 + """ + pass + + def test_get_custom_fields_for_workspace(self): + """Test case for get_custom_fields_for_workspace + + Get a workspace's custom fields # noqa: E501 + """ + pass + + def test_insert_enum_option_for_custom_field(self): + """Test case for insert_enum_option_for_custom_field + + Reorder a custom field's enum # noqa: E501 + """ + pass + + def test_update_custom_field(self): + """Test case for update_custom_field + + Update a custom field # noqa: E501 + """ + pass + + def test_update_enum_option(self): + """Test case for update_enum_option + + Update an enum option # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_events_api.py b/test/test_events_api.py new file mode 100644 index 00000000..5fbad0e8 --- /dev/null +++ b/test/test_events_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.events_api import EventsApi # noqa: E501 +from asana.rest import ApiException + + +class TestEventsApi(unittest.TestCase): + """EventsApi unit test stubs""" + + def setUp(self): + self.api = EventsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_events(self): + """Test case for get_events + + Get events on a resource # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_goal_relationships_api.py b/test/test_goal_relationships_api.py new file mode 100644 index 00000000..456e02f1 --- /dev/null +++ b/test/test_goal_relationships_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.goal_relationships_api import GoalRelationshipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestGoalRelationshipsApi(unittest.TestCase): + """GoalRelationshipsApi unit test stubs""" + + def setUp(self): + self.api = GoalRelationshipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_supporting_relationship(self): + """Test case for add_supporting_relationship + + Add a supporting goal relationship # noqa: E501 + """ + pass + + def test_get_goal_relationship(self): + """Test case for get_goal_relationship + + Get a goal relationship # noqa: E501 + """ + pass + + def test_get_goal_relationships(self): + """Test case for get_goal_relationships + + Get goal relationships # noqa: E501 + """ + pass + + def test_remove_supporting_relationship(self): + """Test case for remove_supporting_relationship + + Removes a supporting goal relationship # noqa: E501 + """ + pass + + def test_update_goal_relationship(self): + """Test case for update_goal_relationship + + Update a goal relationship # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_goals_api.py b/test/test_goals_api.py new file mode 100644 index 00000000..746e7324 --- /dev/null +++ b/test/test_goals_api.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.goals_api import GoalsApi # noqa: E501 +from asana.rest import ApiException + + +class TestGoalsApi(unittest.TestCase): + """GoalsApi unit test stubs""" + + def setUp(self): + self.api = GoalsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_followers(self): + """Test case for add_followers + + Add a collaborator to a goal # noqa: E501 + """ + pass + + def test_create_goal(self): + """Test case for create_goal + + Create a goal # noqa: E501 + """ + pass + + def test_create_goal_metric(self): + """Test case for create_goal_metric + + Create a goal metric # noqa: E501 + """ + pass + + def test_delete_goal(self): + """Test case for delete_goal + + Delete a goal # noqa: E501 + """ + pass + + def test_get_goal(self): + """Test case for get_goal + + Get a goal # noqa: E501 + """ + pass + + def test_get_goals(self): + """Test case for get_goals + + Get goals # noqa: E501 + """ + pass + + def test_get_parent_goals_for_goal(self): + """Test case for get_parent_goals_for_goal + + Get parent goals from a goal # noqa: E501 + """ + pass + + def test_remove_followers(self): + """Test case for remove_followers + + Remove a collaborator from a goal # noqa: E501 + """ + pass + + def test_update_goal(self): + """Test case for update_goal + + Update a goal # noqa: E501 + """ + pass + + def test_update_goal_metric(self): + """Test case for update_goal_metric + + Update a goal metric # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_jobs_api.py b/test/test_jobs_api.py new file mode 100644 index 00000000..88fe30f7 --- /dev/null +++ b/test/test_jobs_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.jobs_api import JobsApi # noqa: E501 +from asana.rest import ApiException + + +class TestJobsApi(unittest.TestCase): + """JobsApi unit test stubs""" + + def setUp(self): + self.api = JobsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_job(self): + """Test case for get_job + + Get a job by id # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_memberships_api.py b/test/test_memberships_api.py new file mode 100644 index 00000000..87c883f5 --- /dev/null +++ b/test/test_memberships_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.memberships_api import MembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestMembershipsApi(unittest.TestCase): + """MembershipsApi unit test stubs""" + + def setUp(self): + self.api = MembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_membership(self): + """Test case for create_membership + + Create a membership # noqa: E501 + """ + pass + + def test_delete_membership(self): + """Test case for delete_membership + + Delete a membership # noqa: E501 + """ + pass + + def test_get_membership(self): + """Test case for get_membership + + Get a membership # noqa: E501 + """ + pass + + def test_get_memberships(self): + """Test case for get_memberships + + Get multiple memberships # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_organization_exports_api.py b/test/test_organization_exports_api.py new file mode 100644 index 00000000..3450ffbd --- /dev/null +++ b/test/test_organization_exports_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.organization_exports_api import OrganizationExportsApi # noqa: E501 +from asana.rest import ApiException + + +class TestOrganizationExportsApi(unittest.TestCase): + """OrganizationExportsApi unit test stubs""" + + def setUp(self): + self.api = OrganizationExportsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_organization_export(self): + """Test case for create_organization_export + + Create an organization export request # noqa: E501 + """ + pass + + def test_get_organization_export(self): + """Test case for get_organization_export + + Get details on an org export request # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_portfolio_memberships_api.py b/test/test_portfolio_memberships_api.py new file mode 100644 index 00000000..329b11f0 --- /dev/null +++ b/test/test_portfolio_memberships_api.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.portfolio_memberships_api import PortfolioMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestPortfolioMembershipsApi(unittest.TestCase): + """PortfolioMembershipsApi unit test stubs""" + + def setUp(self): + self.api = PortfolioMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_portfolio_membership(self): + """Test case for get_portfolio_membership + + Get a portfolio membership # noqa: E501 + """ + pass + + def test_get_portfolio_memberships(self): + """Test case for get_portfolio_memberships + + Get multiple portfolio memberships # noqa: E501 + """ + pass + + def test_get_portfolio_memberships_for_portfolio(self): + """Test case for get_portfolio_memberships_for_portfolio + + Get memberships from a portfolio # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_portfolios_api.py b/test/test_portfolios_api.py new file mode 100644 index 00000000..36b434f3 --- /dev/null +++ b/test/test_portfolios_api.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.portfolios_api import PortfoliosApi # noqa: E501 +from asana.rest import ApiException + + +class TestPortfoliosApi(unittest.TestCase): + """PortfoliosApi unit test stubs""" + + def setUp(self): + self.api = PortfoliosApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_custom_field_setting_for_portfolio(self): + """Test case for add_custom_field_setting_for_portfolio + + Add a custom field to a portfolio # noqa: E501 + """ + pass + + def test_add_item_for_portfolio(self): + """Test case for add_item_for_portfolio + + Add a portfolio item # noqa: E501 + """ + pass + + def test_add_members_for_portfolio(self): + """Test case for add_members_for_portfolio + + Add users to a portfolio # noqa: E501 + """ + pass + + def test_create_portfolio(self): + """Test case for create_portfolio + + Create a portfolio # noqa: E501 + """ + pass + + def test_delete_portfolio(self): + """Test case for delete_portfolio + + Delete a portfolio # noqa: E501 + """ + pass + + def test_get_items_for_portfolio(self): + """Test case for get_items_for_portfolio + + Get portfolio items # noqa: E501 + """ + pass + + def test_get_portfolio(self): + """Test case for get_portfolio + + Get a portfolio # noqa: E501 + """ + pass + + def test_get_portfolios(self): + """Test case for get_portfolios + + Get multiple portfolios # noqa: E501 + """ + pass + + def test_remove_custom_field_setting_for_portfolio(self): + """Test case for remove_custom_field_setting_for_portfolio + + Remove a custom field from a portfolio # noqa: E501 + """ + pass + + def test_remove_item_for_portfolio(self): + """Test case for remove_item_for_portfolio + + Remove a portfolio item # noqa: E501 + """ + pass + + def test_remove_members_for_portfolio(self): + """Test case for remove_members_for_portfolio + + Remove users from a portfolio # noqa: E501 + """ + pass + + def test_update_portfolio(self): + """Test case for update_portfolio + + Update a portfolio # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_briefs_api.py b/test/test_project_briefs_api.py new file mode 100644 index 00000000..f2c81108 --- /dev/null +++ b/test/test_project_briefs_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_briefs_api import ProjectBriefsApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectBriefsApi(unittest.TestCase): + """ProjectBriefsApi unit test stubs""" + + def setUp(self): + self.api = ProjectBriefsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_project_brief(self): + """Test case for create_project_brief + + Create a project brief # noqa: E501 + """ + pass + + def test_delete_project_brief(self): + """Test case for delete_project_brief + + Delete a project brief # noqa: E501 + """ + pass + + def test_get_project_brief(self): + """Test case for get_project_brief + + Get a project brief # noqa: E501 + """ + pass + + def test_update_project_brief(self): + """Test case for update_project_brief + + Update a project brief # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_memberships_api.py b/test/test_project_memberships_api.py new file mode 100644 index 00000000..58da9cea --- /dev/null +++ b/test/test_project_memberships_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_memberships_api import ProjectMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectMembershipsApi(unittest.TestCase): + """ProjectMembershipsApi unit test stubs""" + + def setUp(self): + self.api = ProjectMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_project_membership(self): + """Test case for get_project_membership + + Get a project membership # noqa: E501 + """ + pass + + def test_get_project_memberships_for_project(self): + """Test case for get_project_memberships_for_project + + Get memberships from a project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_statuses_api.py b/test/test_project_statuses_api.py new file mode 100644 index 00000000..ca1867f9 --- /dev/null +++ b/test/test_project_statuses_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_statuses_api import ProjectStatusesApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectStatusesApi(unittest.TestCase): + """ProjectStatusesApi unit test stubs""" + + def setUp(self): + self.api = ProjectStatusesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_project_status_for_project(self): + """Test case for create_project_status_for_project + + Create a project status # noqa: E501 + """ + pass + + def test_delete_project_status(self): + """Test case for delete_project_status + + Delete a project status # noqa: E501 + """ + pass + + def test_get_project_status(self): + """Test case for get_project_status + + Get a project status # noqa: E501 + """ + pass + + def test_get_project_statuses_for_project(self): + """Test case for get_project_statuses_for_project + + Get statuses from a project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_templates_api.py b/test/test_project_templates_api.py new file mode 100644 index 00000000..bcc9bad9 --- /dev/null +++ b/test/test_project_templates_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_templates_api import ProjectTemplatesApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectTemplatesApi(unittest.TestCase): + """ProjectTemplatesApi unit test stubs""" + + def setUp(self): + self.api = ProjectTemplatesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_delete_project_template(self): + """Test case for delete_project_template + + Delete a project template # noqa: E501 + """ + pass + + def test_get_project_template(self): + """Test case for get_project_template + + Get a project template # noqa: E501 + """ + pass + + def test_get_project_templates(self): + """Test case for get_project_templates + + Get multiple project templates # noqa: E501 + """ + pass + + def test_get_project_templates_for_team(self): + """Test case for get_project_templates_for_team + + Get a team's project templates # noqa: E501 + """ + pass + + def test_instantiate_project(self): + """Test case for instantiate_project + + Instantiate a project from a project template # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_projects_api.py b/test/test_projects_api.py new file mode 100644 index 00000000..ad6b8ab0 --- /dev/null +++ b/test/test_projects_api.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.projects_api import ProjectsApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectsApi(unittest.TestCase): + """ProjectsApi unit test stubs""" + + def setUp(self): + self.api = ProjectsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_custom_field_setting_for_project(self): + """Test case for add_custom_field_setting_for_project + + Add a custom field to a project # noqa: E501 + """ + pass + + def test_add_followers_for_project(self): + """Test case for add_followers_for_project + + Add followers to a project # noqa: E501 + """ + pass + + def test_add_members_for_project(self): + """Test case for add_members_for_project + + Add users to a project # noqa: E501 + """ + pass + + def test_create_project(self): + """Test case for create_project + + Create a project # noqa: E501 + """ + pass + + def test_create_project_for_team(self): + """Test case for create_project_for_team + + Create a project in a team # noqa: E501 + """ + pass + + def test_create_project_for_workspace(self): + """Test case for create_project_for_workspace + + Create a project in a workspace # noqa: E501 + """ + pass + + def test_delete_project(self): + """Test case for delete_project + + Delete a project # noqa: E501 + """ + pass + + def test_duplicate_project(self): + """Test case for duplicate_project + + Duplicate a project # noqa: E501 + """ + pass + + def test_get_project(self): + """Test case for get_project + + Get a project # noqa: E501 + """ + pass + + def test_get_projects(self): + """Test case for get_projects + + Get multiple projects # noqa: E501 + """ + pass + + def test_get_projects_for_task(self): + """Test case for get_projects_for_task + + Get projects a task is in # noqa: E501 + """ + pass + + def test_get_projects_for_team(self): + """Test case for get_projects_for_team + + Get a team's projects # noqa: E501 + """ + pass + + def test_get_projects_for_workspace(self): + """Test case for get_projects_for_workspace + + Get all projects in a workspace # noqa: E501 + """ + pass + + def test_get_task_counts_for_project(self): + """Test case for get_task_counts_for_project + + Get task count of a project # noqa: E501 + """ + pass + + def test_project_save_as_template(self): + """Test case for project_save_as_template + + Create a project template from a project # noqa: E501 + """ + pass + + def test_remove_custom_field_setting_for_project(self): + """Test case for remove_custom_field_setting_for_project + + Remove a custom field from a project # noqa: E501 + """ + pass + + def test_remove_followers_for_project(self): + """Test case for remove_followers_for_project + + Remove followers from a project # noqa: E501 + """ + pass + + def test_remove_members_for_project(self): + """Test case for remove_members_for_project + + Remove users from a project # noqa: E501 + """ + pass + + def test_update_project(self): + """Test case for update_project + + Update a project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_rules_api.py b/test/test_rules_api.py new file mode 100644 index 00000000..d98bb830 --- /dev/null +++ b/test/test_rules_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.rules_api import RulesApi # noqa: E501 +from asana.rest import ApiException + + +class TestRulesApi(unittest.TestCase): + """RulesApi unit test stubs""" + + def setUp(self): + self.api = RulesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_trigger_rule(self): + """Test case for trigger_rule + + Trigger a rule # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_sections_api.py b/test/test_sections_api.py new file mode 100644 index 00000000..8fac50ae --- /dev/null +++ b/test/test_sections_api.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.sections_api import SectionsApi # noqa: E501 +from asana.rest import ApiException + + +class TestSectionsApi(unittest.TestCase): + """SectionsApi unit test stubs""" + + def setUp(self): + self.api = SectionsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_task_for_section(self): + """Test case for add_task_for_section + + Add task to section # noqa: E501 + """ + pass + + def test_create_section_for_project(self): + """Test case for create_section_for_project + + Create a section in a project # noqa: E501 + """ + pass + + def test_delete_section(self): + """Test case for delete_section + + Delete a section # noqa: E501 + """ + pass + + def test_get_section(self): + """Test case for get_section + + Get a section # noqa: E501 + """ + pass + + def test_get_sections_for_project(self): + """Test case for get_sections_for_project + + Get sections in a project # noqa: E501 + """ + pass + + def test_insert_section_for_project(self): + """Test case for insert_section_for_project + + Move or Insert sections # noqa: E501 + """ + pass + + def test_update_section(self): + """Test case for update_section + + Update a section # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_status_updates_api.py b/test/test_status_updates_api.py new file mode 100644 index 00000000..d54b2136 --- /dev/null +++ b/test/test_status_updates_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.status_updates_api import StatusUpdatesApi # noqa: E501 +from asana.rest import ApiException + + +class TestStatusUpdatesApi(unittest.TestCase): + """StatusUpdatesApi unit test stubs""" + + def setUp(self): + self.api = StatusUpdatesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_status_for_object(self): + """Test case for create_status_for_object + + Create a status update # noqa: E501 + """ + pass + + def test_delete_status(self): + """Test case for delete_status + + Delete a status update # noqa: E501 + """ + pass + + def test_get_status(self): + """Test case for get_status + + Get a status update # noqa: E501 + """ + pass + + def test_get_statuses_for_object(self): + """Test case for get_statuses_for_object + + Get status updates from an object # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_stories_api.py b/test/test_stories_api.py new file mode 100644 index 00000000..d52d2b67 --- /dev/null +++ b/test/test_stories_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.stories_api import StoriesApi # noqa: E501 +from asana.rest import ApiException + + +class TestStoriesApi(unittest.TestCase): + """StoriesApi unit test stubs""" + + def setUp(self): + self.api = StoriesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_story_for_task(self): + """Test case for create_story_for_task + + Create a story on a task # noqa: E501 + """ + pass + + def test_delete_story(self): + """Test case for delete_story + + Delete a story # noqa: E501 + """ + pass + + def test_get_stories_for_task(self): + """Test case for get_stories_for_task + + Get stories from a task # noqa: E501 + """ + pass + + def test_get_story(self): + """Test case for get_story + + Get a story # noqa: E501 + """ + pass + + def test_update_story(self): + """Test case for update_story + + Update a story # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_tags_api.py b/test/test_tags_api.py new file mode 100644 index 00000000..03235037 --- /dev/null +++ b/test/test_tags_api.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.tags_api import TagsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTagsApi(unittest.TestCase): + """TagsApi unit test stubs""" + + def setUp(self): + self.api = TagsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_tag(self): + """Test case for create_tag + + Create a tag # noqa: E501 + """ + pass + + def test_create_tag_for_workspace(self): + """Test case for create_tag_for_workspace + + Create a tag in a workspace # noqa: E501 + """ + pass + + def test_delete_tag(self): + """Test case for delete_tag + + Delete a tag # noqa: E501 + """ + pass + + def test_get_tag(self): + """Test case for get_tag + + Get a tag # noqa: E501 + """ + pass + + def test_get_tags(self): + """Test case for get_tags + + Get multiple tags # noqa: E501 + """ + pass + + def test_get_tags_for_task(self): + """Test case for get_tags_for_task + + Get a task's tags # noqa: E501 + """ + pass + + def test_get_tags_for_workspace(self): + """Test case for get_tags_for_workspace + + Get tags in a workspace # noqa: E501 + """ + pass + + def test_update_tag(self): + """Test case for update_tag + + Update a tag # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_task_templates_api.py b/test/test_task_templates_api.py new file mode 100644 index 00000000..5bf08710 --- /dev/null +++ b/test/test_task_templates_api.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.task_templates_api import TaskTemplatesApi # noqa: E501 +from asana.rest import ApiException + + +class TestTaskTemplatesApi(unittest.TestCase): + """TaskTemplatesApi unit test stubs""" + + def setUp(self): + self.api = TaskTemplatesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_task_template(self): + """Test case for get_task_template + + Get a task template # noqa: E501 + """ + pass + + def test_get_task_templates(self): + """Test case for get_task_templates + + Get multiple task templates # noqa: E501 + """ + pass + + def test_instantiate_task(self): + """Test case for instantiate_task + + Instantiate a task from a task template # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_tasks_api.py b/test/test_tasks_api.py new file mode 100644 index 00000000..a66ced7e --- /dev/null +++ b/test/test_tasks_api.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.tasks_api import TasksApi # noqa: E501 +from asana.rest import ApiException + + +class TestTasksApi(unittest.TestCase): + """TasksApi unit test stubs""" + + def setUp(self): + self.api = TasksApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_dependencies_for_task(self): + """Test case for add_dependencies_for_task + + Set dependencies for a task # noqa: E501 + """ + pass + + def test_add_dependents_for_task(self): + """Test case for add_dependents_for_task + + Set dependents for a task # noqa: E501 + """ + pass + + def test_add_followers_for_task(self): + """Test case for add_followers_for_task + + Add followers to a task # noqa: E501 + """ + pass + + def test_add_project_for_task(self): + """Test case for add_project_for_task + + Add a project to a task # noqa: E501 + """ + pass + + def test_add_tag_for_task(self): + """Test case for add_tag_for_task + + Add a tag to a task # noqa: E501 + """ + pass + + def test_create_subtask_for_task(self): + """Test case for create_subtask_for_task + + Create a subtask # noqa: E501 + """ + pass + + def test_create_task(self): + """Test case for create_task + + Create a task # noqa: E501 + """ + pass + + def test_delete_task(self): + """Test case for delete_task + + Delete a task # noqa: E501 + """ + pass + + def test_duplicate_task(self): + """Test case for duplicate_task + + Duplicate a task # noqa: E501 + """ + pass + + def test_get_dependencies_for_task(self): + """Test case for get_dependencies_for_task + + Get dependencies from a task # noqa: E501 + """ + pass + + def test_get_dependents_for_task(self): + """Test case for get_dependents_for_task + + Get dependents from a task # noqa: E501 + """ + pass + + def test_get_subtasks_for_task(self): + """Test case for get_subtasks_for_task + + Get subtasks from a task # noqa: E501 + """ + pass + + def test_get_task(self): + """Test case for get_task + + Get a task # noqa: E501 + """ + pass + + def test_get_tasks(self): + """Test case for get_tasks + + Get multiple tasks # noqa: E501 + """ + pass + + def test_get_tasks_for_project(self): + """Test case for get_tasks_for_project + + Get tasks from a project # noqa: E501 + """ + pass + + def test_get_tasks_for_section(self): + """Test case for get_tasks_for_section + + Get tasks from a section # noqa: E501 + """ + pass + + def test_get_tasks_for_tag(self): + """Test case for get_tasks_for_tag + + Get tasks from a tag # noqa: E501 + """ + pass + + def test_get_tasks_for_user_task_list(self): + """Test case for get_tasks_for_user_task_list + + Get tasks from a user task list # noqa: E501 + """ + pass + + def test_remove_dependencies_for_task(self): + """Test case for remove_dependencies_for_task + + Unlink dependencies from a task # noqa: E501 + """ + pass + + def test_remove_dependents_for_task(self): + """Test case for remove_dependents_for_task + + Unlink dependents from a task # noqa: E501 + """ + pass + + def test_remove_follower_for_task(self): + """Test case for remove_follower_for_task + + Remove followers from a task # noqa: E501 + """ + pass + + def test_remove_project_for_task(self): + """Test case for remove_project_for_task + + Remove a project from a task # noqa: E501 + """ + pass + + def test_remove_tag_for_task(self): + """Test case for remove_tag_for_task + + Remove a tag from a task # noqa: E501 + """ + pass + + def test_search_tasks_for_workspace(self): + """Test case for search_tasks_for_workspace + + Search tasks in a workspace # noqa: E501 + """ + pass + + def test_set_parent_for_task(self): + """Test case for set_parent_for_task + + Set the parent of a task # noqa: E501 + """ + pass + + def test_update_task(self): + """Test case for update_task + + Update a task # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_team_memberships_api.py b/test/test_team_memberships_api.py new file mode 100644 index 00000000..6ed7e137 --- /dev/null +++ b/test/test_team_memberships_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.team_memberships_api import TeamMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTeamMembershipsApi(unittest.TestCase): + """TeamMembershipsApi unit test stubs""" + + def setUp(self): + self.api = TeamMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_team_membership(self): + """Test case for get_team_membership + + Get a team membership # noqa: E501 + """ + pass + + def test_get_team_memberships(self): + """Test case for get_team_memberships + + Get team memberships # noqa: E501 + """ + pass + + def test_get_team_memberships_for_team(self): + """Test case for get_team_memberships_for_team + + Get memberships from a team # noqa: E501 + """ + pass + + def test_get_team_memberships_for_user(self): + """Test case for get_team_memberships_for_user + + Get memberships from a user # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_teams_api.py b/test/test_teams_api.py new file mode 100644 index 00000000..6b114d60 --- /dev/null +++ b/test/test_teams_api.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.teams_api import TeamsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTeamsApi(unittest.TestCase): + """TeamsApi unit test stubs""" + + def setUp(self): + self.api = TeamsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_user_for_team(self): + """Test case for add_user_for_team + + Add a user to a team # noqa: E501 + """ + pass + + def test_create_team(self): + """Test case for create_team + + Create a team # noqa: E501 + """ + pass + + def test_get_team(self): + """Test case for get_team + + Get a team # noqa: E501 + """ + pass + + def test_get_teams_for_user(self): + """Test case for get_teams_for_user + + Get teams for a user # noqa: E501 + """ + pass + + def test_get_teams_for_workspace(self): + """Test case for get_teams_for_workspace + + Get teams in a workspace # noqa: E501 + """ + pass + + def test_remove_user_for_team(self): + """Test case for remove_user_for_team + + Remove a user from a team # noqa: E501 + """ + pass + + def test_update_team(self): + """Test case for update_team + + Update a team # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_time_periods_api.py b/test/test_time_periods_api.py new file mode 100644 index 00000000..1520f9d0 --- /dev/null +++ b/test/test_time_periods_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.time_periods_api import TimePeriodsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTimePeriodsApi(unittest.TestCase): + """TimePeriodsApi unit test stubs""" + + def setUp(self): + self.api = TimePeriodsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_time_period(self): + """Test case for get_time_period + + Get a time period # noqa: E501 + """ + pass + + def test_get_time_periods(self): + """Test case for get_time_periods + + Get time periods # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_time_tracking_entries_api.py b/test/test_time_tracking_entries_api.py new file mode 100644 index 00000000..badc3f1b --- /dev/null +++ b/test/test_time_tracking_entries_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.time_tracking_entries_api import TimeTrackingEntriesApi # noqa: E501 +from asana.rest import ApiException + + +class TestTimeTrackingEntriesApi(unittest.TestCase): + """TimeTrackingEntriesApi unit test stubs""" + + def setUp(self): + self.api = TimeTrackingEntriesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_time_tracking_entry(self): + """Test case for create_time_tracking_entry + + Create a time tracking entry # noqa: E501 + """ + pass + + def test_delete_time_tracking_entry(self): + """Test case for delete_time_tracking_entry + + Delete a time tracking entry # noqa: E501 + """ + pass + + def test_get_time_tracking_entries_for_task(self): + """Test case for get_time_tracking_entries_for_task + + Get time tracking entries for a task # noqa: E501 + """ + pass + + def test_get_time_tracking_entry(self): + """Test case for get_time_tracking_entry + + Get a time tracking entry # noqa: E501 + """ + pass + + def test_update_time_tracking_entry(self): + """Test case for update_time_tracking_entry + + Update a time tracking entry # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_typeahead_api.py b/test/test_typeahead_api.py new file mode 100644 index 00000000..3d977d05 --- /dev/null +++ b/test/test_typeahead_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.typeahead_api import TypeaheadApi # noqa: E501 +from asana.rest import ApiException + + +class TestTypeaheadApi(unittest.TestCase): + """TypeaheadApi unit test stubs""" + + def setUp(self): + self.api = TypeaheadApi() # noqa: E501 + + def tearDown(self): + pass + + def test_typeahead_for_workspace(self): + """Test case for typeahead_for_workspace + + Get objects via typeahead # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_user_task_lists_api.py b/test/test_user_task_lists_api.py new file mode 100644 index 00000000..c7d53c27 --- /dev/null +++ b/test/test_user_task_lists_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.user_task_lists_api import UserTaskListsApi # noqa: E501 +from asana.rest import ApiException + + +class TestUserTaskListsApi(unittest.TestCase): + """UserTaskListsApi unit test stubs""" + + def setUp(self): + self.api = UserTaskListsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_user_task_list(self): + """Test case for get_user_task_list + + Get a user task list # noqa: E501 + """ + pass + + def test_get_user_task_list_for_user(self): + """Test case for get_user_task_list_for_user + + Get a user's task list # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_users_api.py b/test/test_users_api.py new file mode 100644 index 00000000..73258f4d --- /dev/null +++ b/test/test_users_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.users_api import UsersApi # noqa: E501 +from asana.rest import ApiException + + +class TestUsersApi(unittest.TestCase): + """UsersApi unit test stubs""" + + def setUp(self): + self.api = UsersApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_favorites_for_user(self): + """Test case for get_favorites_for_user + + Get a user's favorites # noqa: E501 + """ + pass + + def test_get_user(self): + """Test case for get_user + + Get a user # noqa: E501 + """ + pass + + def test_get_users(self): + """Test case for get_users + + Get multiple users # noqa: E501 + """ + pass + + def test_get_users_for_team(self): + """Test case for get_users_for_team + + Get users in a team # noqa: E501 + """ + pass + + def test_get_users_for_workspace(self): + """Test case for get_users_for_workspace + + Get users in a workspace or organization # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_webhooks_api.py b/test/test_webhooks_api.py new file mode 100644 index 00000000..9816f96a --- /dev/null +++ b/test/test_webhooks_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.webhooks_api import WebhooksApi # noqa: E501 +from asana.rest import ApiException + + +class TestWebhooksApi(unittest.TestCase): + """WebhooksApi unit test stubs""" + + def setUp(self): + self.api = WebhooksApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_webhook(self): + """Test case for create_webhook + + Establish a webhook # noqa: E501 + """ + pass + + def test_delete_webhook(self): + """Test case for delete_webhook + + Delete a webhook # noqa: E501 + """ + pass + + def test_get_webhook(self): + """Test case for get_webhook + + Get a webhook # noqa: E501 + """ + pass + + def test_get_webhooks(self): + """Test case for get_webhooks + + Get multiple webhooks # noqa: E501 + """ + pass + + def test_update_webhook(self): + """Test case for update_webhook + + Update a webhook # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_workspace_memberships_api.py b/test/test_workspace_memberships_api.py new file mode 100644 index 00000000..3d78d88b --- /dev/null +++ b/test/test_workspace_memberships_api.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.workspace_memberships_api import WorkspaceMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestWorkspaceMembershipsApi(unittest.TestCase): + """WorkspaceMembershipsApi unit test stubs""" + + def setUp(self): + self.api = WorkspaceMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_workspace_membership(self): + """Test case for get_workspace_membership + + Get a workspace membership # noqa: E501 + """ + pass + + def test_get_workspace_memberships_for_user(self): + """Test case for get_workspace_memberships_for_user + + Get workspace memberships for a user # noqa: E501 + """ + pass + + def test_get_workspace_memberships_for_workspace(self): + """Test case for get_workspace_memberships_for_workspace + + Get the workspace memberships for a workspace # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_workspaces_api.py b/test/test_workspaces_api.py new file mode 100644 index 00000000..68447122 --- /dev/null +++ b/test/test_workspaces_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.workspaces_api import WorkspacesApi # noqa: E501 +from asana.rest import ApiException + + +class TestWorkspacesApi(unittest.TestCase): + """WorkspacesApi unit test stubs""" + + def setUp(self): + self.api = WorkspacesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_user_for_workspace(self): + """Test case for add_user_for_workspace + + Add a user to a workspace or organization # noqa: E501 + """ + pass + + def test_get_workspace(self): + """Test case for get_workspace + + Get a workspace # noqa: E501 + """ + pass + + def test_get_workspaces(self): + """Test case for get_workspaces + + Get multiple workspaces # noqa: E501 + """ + pass + + def test_remove_user_for_workspace(self): + """Test case for remove_user_for_workspace + + Remove a user from a workspace or organization # noqa: E501 + """ + pass + + def test_update_workspace(self): + """Test case for update_workspace + + Update a workspace # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..a310bec9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + []