asana-api-cli 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. asana_api_cli/__init__.py +3 -0
  2. asana_api_cli/cli/__init__.py +140 -0
  3. asana_api_cli/cli/access_requests.py +66 -0
  4. asana_api_cli/cli/allocations.py +101 -0
  5. asana_api_cli/cli/attachments.py +92 -0
  6. asana_api_cli/cli/audit_log_api.py +52 -0
  7. asana_api_cli/cli/batch_api.py +30 -0
  8. asana_api_cli/cli/budgets.py +79 -0
  9. asana_api_cli/cli/custom_field_settings.py +92 -0
  10. asana_api_cli/cli/custom_fields.py +133 -0
  11. asana_api_cli/cli/custom_types.py +50 -0
  12. asana_api_cli/cli/events.py +32 -0
  13. asana_api_cli/cli/exports.py +39 -0
  14. asana_api_cli/cli/goal_relationships.py +98 -0
  15. asana_api_cli/cli/goals.py +217 -0
  16. asana_api_cli/cli/jobs.py +29 -0
  17. asana_api_cli/cli/memberships.py +89 -0
  18. asana_api_cli/cli/organization_exports.py +44 -0
  19. asana_api_cli/cli/portfolio_memberships.py +83 -0
  20. asana_api_cli/cli/portfolios.py +215 -0
  21. asana_api_cli/cli/project_briefs.py +72 -0
  22. asana_api_cli/cli/project_memberships.py +53 -0
  23. asana_api_cli/cli/project_portfolio_settings.py +87 -0
  24. asana_api_cli/cli/project_statuses.py +77 -0
  25. asana_api_cli/cli/project_templates.py +102 -0
  26. asana_api_cli/cli/projects.py +380 -0
  27. asana_api_cli/cli/rates.py +97 -0
  28. asana_api_cli/cli/reactions.py +34 -0
  29. asana_api_cli/cli/roles.py +98 -0
  30. asana_api_cli/cli/rules.py +28 -0
  31. asana_api_cli/cli/sections.py +111 -0
  32. asana_api_cli/cli/status_updates.py +86 -0
  33. asana_api_cli/cli/stories.py +130 -0
  34. asana_api_cli/cli/tags.py +155 -0
  35. asana_api_cli/cli/task_templates.py +77 -0
  36. asana_api_cli/cli/tasks.py +520 -0
  37. asana_api_cli/cli/team_memberships.py +103 -0
  38. asana_api_cli/cli/teams.py +133 -0
  39. asana_api_cli/cli/time_periods.py +57 -0
  40. asana_api_cli/cli/time_tracking_categories.py +123 -0
  41. asana_api_cli/cli/time_tracking_entries.py +138 -0
  42. asana_api_cli/cli/timesheet_approval_statuses.py +94 -0
  43. asana_api_cli/cli/typeahead.py +40 -0
  44. asana_api_cli/cli/user_task_lists.py +45 -0
  45. asana_api_cli/cli/users.py +173 -0
  46. asana_api_cli/cli/webhooks.py +96 -0
  47. asana_api_cli/cli/workspace_memberships.py +75 -0
  48. asana_api_cli/cli/workspaces.py +113 -0
  49. asana_api_cli/formatter.py +161 -0
  50. asana_api_cli/session.py +173 -0
  51. asana_api_cli/version.py +11 -0
  52. asana_api_cli-1.2.0.dist-info/METADATA +105 -0
  53. asana_api_cli-1.2.0.dist-info/RECORD +57 -0
  54. asana_api_cli-1.2.0.dist-info/WHEEL +5 -0
  55. asana_api_cli-1.2.0.dist-info/entry_points.txt +2 -0
  56. asana_api_cli-1.2.0.dist-info/licenses/LICENSE +190 -0
  57. asana_api_cli-1.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,77 @@
1
+ # This file is auto-generated by tools/codegen.py — do not edit manually.
2
+ from __future__ import annotations
3
+
4
+ from typing import Any
5
+
6
+ import click
7
+ from asana import TaskTemplatesApi
8
+
9
+ from asana_api_cli.formatter import formatted
10
+ from asana_api_cli.session import AsanaSession, resolve_body, resolve_workspace
11
+
12
+
13
+ @click.group("task-templates")
14
+ def task_templates_group() -> None:
15
+ """TaskTemplates commands."""
16
+
17
+
18
+ @task_templates_group.command("delete-task-template")
19
+ @click.option("--task-template", required=True, help="Globally unique identifier for the task template. If the method is called asynchronously, returns the request thread.")
20
+ @formatted
21
+ def delete_task_template(task_template: str) -> Any:
22
+ """Delete a task template"""
23
+ session = AsanaSession.from_env()
24
+ api = TaskTemplatesApi(session.client)
25
+ opts: dict[str, Any] = {}
26
+ return api.delete_task_template(task_template)
27
+
28
+
29
+ @task_templates_group.command("get-task-template")
30
+ @click.option("--task-template", required=True, help="Globally unique identifier for the task template.")
31
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
32
+ @formatted
33
+ def get_task_template(task_template: str, opt_fields: str | None) -> Any:
34
+ """Get a task template"""
35
+ session = AsanaSession.from_env()
36
+ api = TaskTemplatesApi(session.client)
37
+ opts: dict[str, Any] = {}
38
+ if opt_fields is not None:
39
+ opts["opt_fields"] = opt_fields
40
+ return api.get_task_template(task_template, opts)
41
+
42
+
43
+ @task_templates_group.command("get-task-templates")
44
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
45
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
46
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
47
+ @click.option("--project", default=None, help="The project to filter task templates on.")
48
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
49
+ @formatted
50
+ def get_task_templates(limit: int | None, offset: str | None, opt_fields: str | None, project: str | None, paginate: bool) -> Any:
51
+ """Get multiple task templates"""
52
+ session = AsanaSession.from_env(paginate=paginate)
53
+ api = TaskTemplatesApi(session.client)
54
+ opts: dict[str, Any] = {}
55
+ if limit is not None:
56
+ opts["limit"] = limit
57
+ if offset is not None:
58
+ opts["offset"] = offset
59
+ if opt_fields is not None:
60
+ opts["opt_fields"] = opt_fields
61
+ if project is not None:
62
+ opts["project"] = project
63
+ return api.get_task_templates(opts)
64
+
65
+
66
+ @task_templates_group.command("instantiate-task")
67
+ @click.option("--task-template", required=True, help="Globally unique identifier for the task template.")
68
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
69
+ @formatted
70
+ def instantiate_task(task_template: str, opt_fields: str | None) -> Any:
71
+ """Instantiate a task from a task template"""
72
+ session = AsanaSession.from_env()
73
+ api = TaskTemplatesApi(session.client)
74
+ opts: dict[str, Any] = {}
75
+ if opt_fields is not None:
76
+ opts["opt_fields"] = opt_fields
77
+ return api.instantiate_task(task_template, opts)
@@ -0,0 +1,520 @@
1
+ # This file is auto-generated by tools/codegen.py — do not edit manually.
2
+ from __future__ import annotations
3
+
4
+ from typing import Any
5
+
6
+ import click
7
+ from asana import TasksApi
8
+
9
+ from asana_api_cli.formatter import formatted
10
+ from asana_api_cli.session import AsanaSession, resolve_body, resolve_workspace
11
+
12
+
13
+ @click.group("tasks")
14
+ def tasks_group() -> None:
15
+ """Tasks commands."""
16
+
17
+
18
+ @tasks_group.command("add-dependencies-for-task")
19
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
20
+ @click.option("--body", required=True, help="The list of tasks to set as dependencies.")
21
+ @formatted
22
+ def add_dependencies_for_task(task: str, body: str) -> Any:
23
+ """Set dependencies for a task"""
24
+ parsed_body = resolve_body(body)
25
+ session = AsanaSession.from_env()
26
+ api = TasksApi(session.client)
27
+ opts: dict[str, Any] = {}
28
+ return api.add_dependencies_for_task(parsed_body, task)
29
+
30
+
31
+ @tasks_group.command("add-dependents-for-task")
32
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
33
+ @click.option("--body", required=True, help="The list of tasks to add as dependents.")
34
+ @formatted
35
+ def add_dependents_for_task(task: str, body: str) -> Any:
36
+ """Set dependents for a task"""
37
+ parsed_body = resolve_body(body)
38
+ session = AsanaSession.from_env()
39
+ api = TasksApi(session.client)
40
+ opts: dict[str, Any] = {}
41
+ return api.add_dependents_for_task(parsed_body, task)
42
+
43
+
44
+ @tasks_group.command("add-followers-for-task")
45
+ @click.option("--task", required=True, help="The task to operate on.")
46
+ @click.option("--body", required=True, help="The followers to add to the task.")
47
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
48
+ @formatted
49
+ def add_followers_for_task(task: str, body: str, opt_fields: str | None) -> Any:
50
+ """Add followers to a task"""
51
+ parsed_body = resolve_body(body)
52
+ session = AsanaSession.from_env()
53
+ api = TasksApi(session.client)
54
+ opts: dict[str, Any] = {}
55
+ if opt_fields is not None:
56
+ opts["opt_fields"] = opt_fields
57
+ return api.add_followers_for_task(parsed_body, task, opts)
58
+
59
+
60
+ @tasks_group.command("add-project-for-task")
61
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
62
+ @click.option("--body", required=True, help="The project to add the task to.")
63
+ @formatted
64
+ def add_project_for_task(task: str, body: str) -> Any:
65
+ """Add a project to a task"""
66
+ parsed_body = resolve_body(body)
67
+ session = AsanaSession.from_env()
68
+ api = TasksApi(session.client)
69
+ opts: dict[str, Any] = {}
70
+ return api.add_project_for_task(parsed_body, task)
71
+
72
+
73
+ @tasks_group.command("add-tag-for-task")
74
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
75
+ @click.option("--body", required=True, help="The tag to add to the task.")
76
+ @formatted
77
+ def add_tag_for_task(task: str, body: str) -> Any:
78
+ """Add a tag to a task"""
79
+ parsed_body = resolve_body(body)
80
+ session = AsanaSession.from_env()
81
+ api = TasksApi(session.client)
82
+ opts: dict[str, Any] = {}
83
+ return api.add_tag_for_task(parsed_body, task)
84
+
85
+
86
+ @tasks_group.command("create-subtask-for-task")
87
+ @click.option("--task", required=True, help="The task to operate on.")
88
+ @click.option("--body", required=True, help="The new subtask to create.")
89
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
90
+ @formatted
91
+ def create_subtask_for_task(task: str, body: str, opt_fields: str | None) -> Any:
92
+ """Create a subtask"""
93
+ parsed_body = resolve_body(body)
94
+ session = AsanaSession.from_env()
95
+ api = TasksApi(session.client)
96
+ opts: dict[str, Any] = {}
97
+ if opt_fields is not None:
98
+ opts["opt_fields"] = opt_fields
99
+ return api.create_subtask_for_task(parsed_body, task, opts)
100
+
101
+
102
+ @tasks_group.command("create-task")
103
+ @click.option("--body", required=True, help="The task to create.")
104
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
105
+ @formatted
106
+ def create_task(body: str, opt_fields: str | None) -> Any:
107
+ """Create a task"""
108
+ parsed_body = resolve_body(body)
109
+ session = AsanaSession.from_env()
110
+ api = TasksApi(session.client)
111
+ opts: dict[str, Any] = {}
112
+ if opt_fields is not None:
113
+ opts["opt_fields"] = opt_fields
114
+ return api.create_task(parsed_body, opts)
115
+
116
+
117
+ @tasks_group.command("delete-task")
118
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
119
+ @formatted
120
+ def delete_task(task: str) -> Any:
121
+ """Delete a task"""
122
+ session = AsanaSession.from_env()
123
+ api = TasksApi(session.client)
124
+ opts: dict[str, Any] = {}
125
+ return api.delete_task(task)
126
+
127
+
128
+ @tasks_group.command("duplicate-task")
129
+ @click.option("--task", required=True, help="The task to operate on.")
130
+ @click.option("--body", required=True, help="Describes the duplicate's name and the fields that will be duplicated.")
131
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
132
+ @formatted
133
+ def duplicate_task(task: str, body: str, opt_fields: str | None) -> Any:
134
+ """Duplicate a task"""
135
+ parsed_body = resolve_body(body)
136
+ session = AsanaSession.from_env()
137
+ api = TasksApi(session.client)
138
+ opts: dict[str, Any] = {}
139
+ if opt_fields is not None:
140
+ opts["opt_fields"] = opt_fields
141
+ return api.duplicate_task(parsed_body, task, opts)
142
+
143
+
144
+ @tasks_group.command("get-dependencies-for-task")
145
+ @click.option("--task", required=True, help="The task to operate on.")
146
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
147
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
148
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
149
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
150
+ @formatted
151
+ def get_dependencies_for_task(task: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
152
+ """Get dependencies from a task"""
153
+ session = AsanaSession.from_env(paginate=paginate)
154
+ api = TasksApi(session.client)
155
+ opts: dict[str, Any] = {}
156
+ if limit is not None:
157
+ opts["limit"] = limit
158
+ if offset is not None:
159
+ opts["offset"] = offset
160
+ if opt_fields is not None:
161
+ opts["opt_fields"] = opt_fields
162
+ return api.get_dependencies_for_task(task, opts)
163
+
164
+
165
+ @tasks_group.command("get-dependents-for-task")
166
+ @click.option("--task", required=True, help="The task to operate on.")
167
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
168
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
169
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
170
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
171
+ @formatted
172
+ def get_dependents_for_task(task: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
173
+ """Get dependents from a task"""
174
+ session = AsanaSession.from_env(paginate=paginate)
175
+ api = TasksApi(session.client)
176
+ opts: dict[str, Any] = {}
177
+ if limit is not None:
178
+ opts["limit"] = limit
179
+ if offset is not None:
180
+ opts["offset"] = offset
181
+ if opt_fields is not None:
182
+ opts["opt_fields"] = opt_fields
183
+ return api.get_dependents_for_task(task, opts)
184
+
185
+
186
+ @tasks_group.command("get-subtasks-for-task")
187
+ @click.option("--task", required=True, help="The task to operate on.")
188
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
189
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
190
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
191
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
192
+ @formatted
193
+ def get_subtasks_for_task(task: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
194
+ """Get subtasks from a task"""
195
+ session = AsanaSession.from_env(paginate=paginate)
196
+ api = TasksApi(session.client)
197
+ opts: dict[str, Any] = {}
198
+ if limit is not None:
199
+ opts["limit"] = limit
200
+ if offset is not None:
201
+ opts["offset"] = offset
202
+ if opt_fields is not None:
203
+ opts["opt_fields"] = opt_fields
204
+ return api.get_subtasks_for_task(task, opts)
205
+
206
+
207
+ @tasks_group.command("get-task")
208
+ @click.option("--task", required=True, help="The task to operate on.")
209
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
210
+ @formatted
211
+ def get_task(task: str, opt_fields: str | None) -> Any:
212
+ """Get a task"""
213
+ session = AsanaSession.from_env()
214
+ api = TasksApi(session.client)
215
+ opts: dict[str, Any] = {}
216
+ if opt_fields is not None:
217
+ opts["opt_fields"] = opt_fields
218
+ return api.get_task(task, opts)
219
+
220
+
221
+ @tasks_group.command("get-task-for-custom-id")
222
+ @click.option("--custom-id", required=True, help="Generated custom ID for a task. If the method is called asynchronously, returns the request thread.")
223
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
224
+ @formatted
225
+ def get_task_for_custom_id(custom_id: str, workspace: str | None) -> Any:
226
+ """Get a task for a given custom ID"""
227
+ resolved_workspace = resolve_workspace(workspace, required=True)
228
+ session = AsanaSession.from_env()
229
+ api = TasksApi(session.client)
230
+ opts: dict[str, Any] = {}
231
+ return api.get_task_for_custom_id(resolved_workspace, custom_id)
232
+
233
+
234
+ @tasks_group.command("get-tasks")
235
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
236
+ @click.option("--assignee", default=None, help="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.*")
237
+ @click.option("--completed-since", default=None, help="Only return tasks that are either incomplete or that have been completed since this time.")
238
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
239
+ @click.option("--modified-since", default=None, help="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....")
240
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
241
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
242
+ @click.option("--project", default=None, help="The project to filter tasks on.")
243
+ @click.option("--section", default=None, help="The section to filter tasks on.")
244
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
245
+ @formatted
246
+ def get_tasks(workspace: str | None, assignee: str | None, completed_since: str | None, limit: int | None, modified_since: str | None, offset: str | None, opt_fields: str | None, project: str | None, section: str | None, paginate: bool) -> Any:
247
+ """Get multiple tasks"""
248
+ resolved_workspace = resolve_workspace(workspace, required=False)
249
+ session = AsanaSession.from_env(paginate=paginate)
250
+ api = TasksApi(session.client)
251
+ opts: dict[str, Any] = {}
252
+ if assignee is not None:
253
+ opts["assignee"] = assignee
254
+ if completed_since is not None:
255
+ opts["completed_since"] = completed_since
256
+ if limit is not None:
257
+ opts["limit"] = limit
258
+ if modified_since is not None:
259
+ opts["modified_since"] = modified_since
260
+ if offset is not None:
261
+ opts["offset"] = offset
262
+ if opt_fields is not None:
263
+ opts["opt_fields"] = opt_fields
264
+ if project is not None:
265
+ opts["project"] = project
266
+ if section is not None:
267
+ opts["section"] = section
268
+ if resolved_workspace is not None:
269
+ opts["workspace"] = resolved_workspace
270
+ return api.get_tasks(opts)
271
+
272
+
273
+ @tasks_group.command("get-tasks-for-project")
274
+ @click.option("--project", required=True, help="Globally unique identifier for the project.")
275
+ @click.option("--completed-since", default=None, help="Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.")
276
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
277
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
278
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
279
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
280
+ @formatted
281
+ def get_tasks_for_project(project: str, completed_since: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
282
+ """Get tasks from a project"""
283
+ session = AsanaSession.from_env(paginate=paginate)
284
+ api = TasksApi(session.client)
285
+ opts: dict[str, Any] = {}
286
+ if completed_since is not None:
287
+ opts["completed_since"] = completed_since
288
+ if limit is not None:
289
+ opts["limit"] = limit
290
+ if offset is not None:
291
+ opts["offset"] = offset
292
+ if opt_fields is not None:
293
+ opts["opt_fields"] = opt_fields
294
+ return api.get_tasks_for_project(project, opts)
295
+
296
+
297
+ @tasks_group.command("get-tasks-for-section")
298
+ @click.option("--section", required=True, help="The globally unique identifier for the section.")
299
+ @click.option("--completed-since", default=None, help="Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.")
300
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
301
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
302
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
303
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
304
+ @formatted
305
+ def get_tasks_for_section(section: str, completed_since: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
306
+ """Get tasks from a section"""
307
+ session = AsanaSession.from_env(paginate=paginate)
308
+ api = TasksApi(session.client)
309
+ opts: dict[str, Any] = {}
310
+ if completed_since is not None:
311
+ opts["completed_since"] = completed_since
312
+ if limit is not None:
313
+ opts["limit"] = limit
314
+ if offset is not None:
315
+ opts["offset"] = offset
316
+ if opt_fields is not None:
317
+ opts["opt_fields"] = opt_fields
318
+ return api.get_tasks_for_section(section, opts)
319
+
320
+
321
+ @tasks_group.command("get-tasks-for-tag")
322
+ @click.option("--tag", required=True, help="Globally unique identifier for the tag.")
323
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
324
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
325
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
326
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
327
+ @formatted
328
+ def get_tasks_for_tag(tag: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
329
+ """Get tasks from a tag"""
330
+ session = AsanaSession.from_env(paginate=paginate)
331
+ api = TasksApi(session.client)
332
+ opts: dict[str, Any] = {}
333
+ if limit is not None:
334
+ opts["limit"] = limit
335
+ if offset is not None:
336
+ opts["offset"] = offset
337
+ if opt_fields is not None:
338
+ opts["opt_fields"] = opt_fields
339
+ return api.get_tasks_for_tag(tag, opts)
340
+
341
+
342
+ @tasks_group.command("get-tasks-for-user-task-list")
343
+ @click.option("--user-task-list", required=True, help="Globally unique identifier for the user task list.")
344
+ @click.option("--completed-since", default=None, help="Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.")
345
+ @click.option("--limit", type=int, default=None, help="Results per page. The number of objects to return per page. The value must be between 1 and 100.")
346
+ @click.option("--offset", default=None, help="Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not pass...")
347
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
348
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
349
+ @formatted
350
+ def get_tasks_for_user_task_list(user_task_list: str, completed_since: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
351
+ """Get tasks from a user task list"""
352
+ session = AsanaSession.from_env(paginate=paginate)
353
+ api = TasksApi(session.client)
354
+ opts: dict[str, Any] = {}
355
+ if completed_since is not None:
356
+ opts["completed_since"] = completed_since
357
+ if limit is not None:
358
+ opts["limit"] = limit
359
+ if offset is not None:
360
+ opts["offset"] = offset
361
+ if opt_fields is not None:
362
+ opts["opt_fields"] = opt_fields
363
+ return api.get_tasks_for_user_task_list(user_task_list, opts)
364
+
365
+
366
+ @tasks_group.command("remove-dependencies-for-task")
367
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
368
+ @click.option("--body", required=True, help="The list of tasks to unlink as dependencies.")
369
+ @formatted
370
+ def remove_dependencies_for_task(task: str, body: str) -> Any:
371
+ """Unlink dependencies from a task"""
372
+ parsed_body = resolve_body(body)
373
+ session = AsanaSession.from_env()
374
+ api = TasksApi(session.client)
375
+ opts: dict[str, Any] = {}
376
+ return api.remove_dependencies_for_task(parsed_body, task)
377
+
378
+
379
+ @tasks_group.command("remove-dependents-for-task")
380
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
381
+ @click.option("--body", required=True, help="The list of tasks to remove as dependents.")
382
+ @formatted
383
+ def remove_dependents_for_task(task: str, body: str) -> Any:
384
+ """Unlink dependents from a task"""
385
+ parsed_body = resolve_body(body)
386
+ session = AsanaSession.from_env()
387
+ api = TasksApi(session.client)
388
+ opts: dict[str, Any] = {}
389
+ return api.remove_dependents_for_task(parsed_body, task)
390
+
391
+
392
+ @tasks_group.command("remove-follower-for-task")
393
+ @click.option("--task", required=True, help="The task to operate on.")
394
+ @click.option("--body", required=True, help="The followers to remove from the task.")
395
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
396
+ @formatted
397
+ def remove_follower_for_task(task: str, body: str, opt_fields: str | None) -> Any:
398
+ """Remove followers from a task"""
399
+ parsed_body = resolve_body(body)
400
+ session = AsanaSession.from_env()
401
+ api = TasksApi(session.client)
402
+ opts: dict[str, Any] = {}
403
+ if opt_fields is not None:
404
+ opts["opt_fields"] = opt_fields
405
+ return api.remove_follower_for_task(parsed_body, task, opts)
406
+
407
+
408
+ @tasks_group.command("remove-project-for-task")
409
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
410
+ @click.option("--body", required=True, help="The project to remove the task from.")
411
+ @formatted
412
+ def remove_project_for_task(task: str, body: str) -> Any:
413
+ """Remove a project from a task"""
414
+ parsed_body = resolve_body(body)
415
+ session = AsanaSession.from_env()
416
+ api = TasksApi(session.client)
417
+ opts: dict[str, Any] = {}
418
+ return api.remove_project_for_task(parsed_body, task)
419
+
420
+
421
+ @tasks_group.command("remove-tag-for-task")
422
+ @click.option("--task", required=True, help="The task to operate on. If the method is called asynchronously, returns the request thread.")
423
+ @click.option("--body", required=True, help="The tag to remove from the task.")
424
+ @formatted
425
+ def remove_tag_for_task(task: str, body: str) -> Any:
426
+ """Remove a tag from a task"""
427
+ parsed_body = resolve_body(body)
428
+ session = AsanaSession.from_env()
429
+ api = TasksApi(session.client)
430
+ opts: dict[str, Any] = {}
431
+ return api.remove_tag_for_task(parsed_body, task)
432
+
433
+
434
+ @tasks_group.command("search-tasks-for-workspace")
435
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
436
+ @click.option("--completed", type=bool, default=None, help="Filter to completed tasks")
437
+ @click.option("--completed-on", default=None, help="ISO 8601 date string or `null`")
438
+ @click.option("--created-on", default=None, help="ISO 8601 date string or `null`")
439
+ @click.option("--due-on", default=None, help="ISO 8601 date string or `null`")
440
+ @click.option("--has-attachment", type=bool, default=None, help="Filter to tasks with attachments")
441
+ @click.option("--is-blocked", type=bool, default=None, help="Filter to tasks with incomplete dependencies")
442
+ @click.option("--is-blocking", type=bool, default=None, help="Filter to incomplete tasks with dependents")
443
+ @click.option("--is-subtask", type=bool, default=None, help="Filter to subtasks")
444
+ @click.option("--modified-on", default=None, help="ISO 8601 date string or `null`")
445
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
446
+ @click.option("--resource-subtype", default=None, help="Filters results by the task's resource_subtype")
447
+ @click.option("--sort-ascending", type=bool, default=None, help="Default `false`")
448
+ @click.option("--sort-by", default=None, help="One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at`")
449
+ @click.option("--start-on", default=None, help="ISO 8601 date string or `null`")
450
+ @click.option("--text", default=None, help="Performs full-text search on both task name and description")
451
+ @formatted
452
+ def search_tasks_for_workspace(workspace: str | None, completed: bool | None, completed_on: str | None, created_on: str | None, due_on: str | None, has_attachment: bool | None, is_blocked: bool | None, is_blocking: bool | None, is_subtask: bool | None, modified_on: str | None, opt_fields: str | None, resource_subtype: str | None, sort_ascending: bool | None, sort_by: str | None, start_on: str | None, text: str | None) -> Any:
453
+ """Search tasks in a workspace"""
454
+ resolved_workspace = resolve_workspace(workspace, required=True)
455
+ session = AsanaSession.from_env()
456
+ api = TasksApi(session.client)
457
+ opts: dict[str, Any] = {}
458
+ if completed is not None:
459
+ opts["completed"] = completed
460
+ if completed_on is not None:
461
+ opts["completed_on"] = completed_on
462
+ if created_on is not None:
463
+ opts["created_on"] = created_on
464
+ if due_on is not None:
465
+ opts["due_on"] = due_on
466
+ if has_attachment is not None:
467
+ opts["has_attachment"] = has_attachment
468
+ if is_blocked is not None:
469
+ opts["is_blocked"] = is_blocked
470
+ if is_blocking is not None:
471
+ opts["is_blocking"] = is_blocking
472
+ if is_subtask is not None:
473
+ opts["is_subtask"] = is_subtask
474
+ if modified_on is not None:
475
+ opts["modified_on"] = modified_on
476
+ if opt_fields is not None:
477
+ opts["opt_fields"] = opt_fields
478
+ if resource_subtype is not None:
479
+ opts["resource_subtype"] = resource_subtype
480
+ if sort_ascending is not None:
481
+ opts["sort_ascending"] = sort_ascending
482
+ if sort_by is not None:
483
+ opts["sort_by"] = sort_by
484
+ if start_on is not None:
485
+ opts["start_on"] = start_on
486
+ if text is not None:
487
+ opts["text"] = text
488
+ return api.search_tasks_for_workspace(resolved_workspace, opts)
489
+
490
+
491
+ @tasks_group.command("set-parent-for-task")
492
+ @click.option("--task", required=True, help="The task to operate on.")
493
+ @click.option("--body", required=True, help="The new parent of the subtask.")
494
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
495
+ @formatted
496
+ def set_parent_for_task(task: str, body: str, opt_fields: str | None) -> Any:
497
+ """Set the parent of a task"""
498
+ parsed_body = resolve_body(body)
499
+ session = AsanaSession.from_env()
500
+ api = TasksApi(session.client)
501
+ opts: dict[str, Any] = {}
502
+ if opt_fields is not None:
503
+ opts["opt_fields"] = opt_fields
504
+ return api.set_parent_for_task(parsed_body, task, opts)
505
+
506
+
507
+ @tasks_group.command("update-task")
508
+ @click.option("--task", required=True, help="The task to operate on.")
509
+ @click.option("--body", required=True, help="The task to update.")
510
+ @click.option("--opt-fields", default=None, help="This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to in...")
511
+ @formatted
512
+ def update_task(task: str, body: str, opt_fields: str | None) -> Any:
513
+ """Update a task"""
514
+ parsed_body = resolve_body(body)
515
+ session = AsanaSession.from_env()
516
+ api = TasksApi(session.client)
517
+ opts: dict[str, Any] = {}
518
+ if opt_fields is not None:
519
+ opts["opt_fields"] = opt_fields
520
+ return api.update_task(parsed_body, task, opts)