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,40 @@
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 TypeaheadApi
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("typeahead")
14
+ def typeahead_group() -> None:
15
+ """Typeahead commands."""
16
+
17
+
18
+ @typeahead_group.command("typeahead-for-workspace")
19
+ @click.option("--resource-type", required=True, help="The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note...")
20
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
21
+ @click.option("--count", type=int, default=None, help="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.")
22
+ @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...")
23
+ @click.option("--query", default=None, help="The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.")
24
+ @click.option("--type", default=None, help="*Deprecated: new integrations should prefer the resource_type field.*")
25
+ @formatted
26
+ def typeahead_for_workspace(resource_type: str, workspace: str | None, count: int | None, opt_fields: str | None, query: str | None, type: str | None) -> Any:
27
+ """Get objects via typeahead"""
28
+ resolved_workspace = resolve_workspace(workspace, required=True)
29
+ session = AsanaSession.from_env()
30
+ api = TypeaheadApi(session.client)
31
+ opts: dict[str, Any] = {}
32
+ if count is not None:
33
+ opts["count"] = count
34
+ if opt_fields is not None:
35
+ opts["opt_fields"] = opt_fields
36
+ if query is not None:
37
+ opts["query"] = query
38
+ if type is not None:
39
+ opts["type"] = type
40
+ return api.typeahead_for_workspace(resolved_workspace, resource_type, opts)
@@ -0,0 +1,45 @@
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 UserTaskListsApi
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("user-task-lists")
14
+ def user_task_lists_group() -> None:
15
+ """UserTaskLists commands."""
16
+
17
+
18
+ @user_task_lists_group.command("get-user-task-list")
19
+ @click.option("--user-task-list", required=True, help="Globally unique identifier for the user task list.")
20
+ @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...")
21
+ @formatted
22
+ def get_user_task_list(user_task_list: str, opt_fields: str | None) -> Any:
23
+ """Get a user task list"""
24
+ session = AsanaSession.from_env()
25
+ api = UserTaskListsApi(session.client)
26
+ opts: dict[str, Any] = {}
27
+ if opt_fields is not None:
28
+ opts["opt_fields"] = opt_fields
29
+ return api.get_user_task_list(user_task_list, opts)
30
+
31
+
32
+ @user_task_lists_group.command("get-user-task-list-for-user")
33
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
34
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
35
+ @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...")
36
+ @formatted
37
+ def get_user_task_list_for_user(user: str, workspace: str | None, opt_fields: str | None) -> Any:
38
+ """Get a user's task list"""
39
+ resolved_workspace = resolve_workspace(workspace, required=True)
40
+ session = AsanaSession.from_env()
41
+ api = UserTaskListsApi(session.client)
42
+ opts: dict[str, Any] = {}
43
+ if opt_fields is not None:
44
+ opts["opt_fields"] = opt_fields
45
+ return api.get_user_task_list_for_user(user, resolved_workspace, opts)
@@ -0,0 +1,173 @@
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 UsersApi
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("users")
14
+ def users_group() -> None:
15
+ """Users commands."""
16
+
17
+
18
+ @users_group.command("get-favorites-for-user")
19
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
20
+ @click.option("--resource-type", required=True, help="The resource type of favorites to be returned.")
21
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
22
+ @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.")
23
+ @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...")
24
+ @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...")
25
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
26
+ @formatted
27
+ def get_favorites_for_user(user: str, resource_type: str, workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
28
+ """Get a user's favorites"""
29
+ resolved_workspace = resolve_workspace(workspace, required=True)
30
+ session = AsanaSession.from_env(paginate=paginate)
31
+ api = UsersApi(session.client)
32
+ opts: dict[str, Any] = {}
33
+ if limit is not None:
34
+ opts["limit"] = limit
35
+ if offset is not None:
36
+ opts["offset"] = offset
37
+ if opt_fields is not None:
38
+ opts["opt_fields"] = opt_fields
39
+ return api.get_favorites_for_user(user, resource_type, resolved_workspace, opts)
40
+
41
+
42
+ @users_group.command("get-user")
43
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
44
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
45
+ @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...")
46
+ @formatted
47
+ def get_user(user: str, workspace: str | None, opt_fields: str | None) -> Any:
48
+ """Get a user"""
49
+ resolved_workspace = resolve_workspace(workspace, required=False)
50
+ session = AsanaSession.from_env()
51
+ api = UsersApi(session.client)
52
+ opts: dict[str, Any] = {}
53
+ if opt_fields is not None:
54
+ opts["opt_fields"] = opt_fields
55
+ if resolved_workspace is not None:
56
+ opts["workspace"] = resolved_workspace
57
+ return api.get_user(user, opts)
58
+
59
+
60
+ @users_group.command("get-user-for-workspace")
61
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
62
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
63
+ @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...")
64
+ @formatted
65
+ def get_user_for_workspace(user: str, workspace: str | None, opt_fields: str | None) -> Any:
66
+ """Get a user in a workspace or organization"""
67
+ resolved_workspace = resolve_workspace(workspace, required=True)
68
+ session = AsanaSession.from_env()
69
+ api = UsersApi(session.client)
70
+ opts: dict[str, Any] = {}
71
+ if opt_fields is not None:
72
+ opts["opt_fields"] = opt_fields
73
+ return api.get_user_for_workspace(resolved_workspace, user, opts)
74
+
75
+
76
+ @users_group.command("get-users")
77
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
78
+ @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.")
79
+ @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...")
80
+ @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...")
81
+ @click.option("--team", default=None, help="The team ID to filter users on.")
82
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
83
+ @formatted
84
+ def get_users(workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, team: str | None, paginate: bool) -> Any:
85
+ """Get multiple users"""
86
+ resolved_workspace = resolve_workspace(workspace, required=False)
87
+ session = AsanaSession.from_env(paginate=paginate)
88
+ api = UsersApi(session.client)
89
+ opts: dict[str, Any] = {}
90
+ if limit is not None:
91
+ opts["limit"] = limit
92
+ if offset is not None:
93
+ opts["offset"] = offset
94
+ if opt_fields is not None:
95
+ opts["opt_fields"] = opt_fields
96
+ if team is not None:
97
+ opts["team"] = team
98
+ if resolved_workspace is not None:
99
+ opts["workspace"] = resolved_workspace
100
+ return api.get_users(opts)
101
+
102
+
103
+ @users_group.command("get-users-for-team")
104
+ @click.option("--team", required=True, help="Globally unique identifier for the team.")
105
+ @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...")
106
+ @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...")
107
+ @formatted
108
+ def get_users_for_team(team: str, offset: str | None, opt_fields: str | None) -> Any:
109
+ """Get users in a team"""
110
+ session = AsanaSession.from_env()
111
+ api = UsersApi(session.client)
112
+ opts: dict[str, Any] = {}
113
+ if offset is not None:
114
+ opts["offset"] = offset
115
+ if opt_fields is not None:
116
+ opts["opt_fields"] = opt_fields
117
+ return api.get_users_for_team(team, opts)
118
+
119
+
120
+ @users_group.command("get-users-for-workspace")
121
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
122
+ @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...")
123
+ @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...")
124
+ @formatted
125
+ def get_users_for_workspace(workspace: str | None, offset: str | None, opt_fields: str | None) -> Any:
126
+ """Get users in a workspace or organization"""
127
+ resolved_workspace = resolve_workspace(workspace, required=True)
128
+ session = AsanaSession.from_env()
129
+ api = UsersApi(session.client)
130
+ opts: dict[str, Any] = {}
131
+ if offset is not None:
132
+ opts["offset"] = offset
133
+ if opt_fields is not None:
134
+ opts["opt_fields"] = opt_fields
135
+ return api.get_users_for_workspace(resolved_workspace, opts)
136
+
137
+
138
+ @users_group.command("update-user")
139
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
140
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
141
+ @click.option("--body", required=True, help="The user to update.")
142
+ @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...")
143
+ @formatted
144
+ def update_user(user: str, workspace: str | None, body: str, opt_fields: str | None) -> Any:
145
+ """Update a user"""
146
+ parsed_body = resolve_body(body)
147
+ resolved_workspace = resolve_workspace(workspace, required=False)
148
+ session = AsanaSession.from_env()
149
+ api = UsersApi(session.client)
150
+ opts: dict[str, Any] = {}
151
+ if opt_fields is not None:
152
+ opts["opt_fields"] = opt_fields
153
+ if resolved_workspace is not None:
154
+ opts["workspace"] = resolved_workspace
155
+ return api.update_user(parsed_body, user, opts)
156
+
157
+
158
+ @users_group.command("update-user-for-workspace")
159
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
160
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
161
+ @click.option("--body", required=True, help="The user to update.")
162
+ @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...")
163
+ @formatted
164
+ def update_user_for_workspace(user: str, workspace: str | None, body: str, opt_fields: str | None) -> Any:
165
+ """Update a user in a workspace or organization"""
166
+ parsed_body = resolve_body(body)
167
+ resolved_workspace = resolve_workspace(workspace, required=True)
168
+ session = AsanaSession.from_env()
169
+ api = UsersApi(session.client)
170
+ opts: dict[str, Any] = {}
171
+ if opt_fields is not None:
172
+ opts["opt_fields"] = opt_fields
173
+ return api.update_user_for_workspace(parsed_body, resolved_workspace, user, opts)
@@ -0,0 +1,96 @@
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 WebhooksApi
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("webhooks")
14
+ def webhooks_group() -> None:
15
+ """Webhooks commands."""
16
+
17
+
18
+ @webhooks_group.command("create-webhook")
19
+ @click.option("--body", required=True, help="The webhook workspace and target.")
20
+ @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...")
21
+ @formatted
22
+ def create_webhook(body: str, opt_fields: str | None) -> Any:
23
+ """Establish a webhook"""
24
+ parsed_body = resolve_body(body)
25
+ session = AsanaSession.from_env()
26
+ api = WebhooksApi(session.client)
27
+ opts: dict[str, Any] = {}
28
+ if opt_fields is not None:
29
+ opts["opt_fields"] = opt_fields
30
+ return api.create_webhook(parsed_body, opts)
31
+
32
+
33
+ @webhooks_group.command("delete-webhook")
34
+ @click.option("--webhook", required=True, help="Globally unique identifier for the webhook. If the method is called asynchronously, returns the request thread.")
35
+ @formatted
36
+ def delete_webhook(webhook: str) -> Any:
37
+ """Delete a webhook"""
38
+ session = AsanaSession.from_env()
39
+ api = WebhooksApi(session.client)
40
+ opts: dict[str, Any] = {}
41
+ return api.delete_webhook(webhook)
42
+
43
+
44
+ @webhooks_group.command("get-webhook")
45
+ @click.option("--webhook", required=True, help="Globally unique identifier for the webhook.")
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
+ @formatted
48
+ def get_webhook(webhook: str, opt_fields: str | None) -> Any:
49
+ """Get a webhook"""
50
+ session = AsanaSession.from_env()
51
+ api = WebhooksApi(session.client)
52
+ opts: dict[str, Any] = {}
53
+ if opt_fields is not None:
54
+ opts["opt_fields"] = opt_fields
55
+ return api.get_webhook(webhook, opts)
56
+
57
+
58
+ @webhooks_group.command("get-webhooks")
59
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
60
+ @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.")
61
+ @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...")
62
+ @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...")
63
+ @click.option("--resource", default=None, help="Only return webhooks for the given resource.")
64
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
65
+ @formatted
66
+ def get_webhooks(workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, resource: str | None, paginate: bool) -> Any:
67
+ """Get multiple webhooks"""
68
+ resolved_workspace = resolve_workspace(workspace, required=True)
69
+ session = AsanaSession.from_env(paginate=paginate)
70
+ api = WebhooksApi(session.client)
71
+ opts: dict[str, Any] = {}
72
+ if limit is not None:
73
+ opts["limit"] = limit
74
+ if offset is not None:
75
+ opts["offset"] = offset
76
+ if opt_fields is not None:
77
+ opts["opt_fields"] = opt_fields
78
+ if resource is not None:
79
+ opts["resource"] = resource
80
+ return api.get_webhooks(resolved_workspace, opts)
81
+
82
+
83
+ @webhooks_group.command("update-webhook")
84
+ @click.option("--webhook", required=True, help="Globally unique identifier for the webhook.")
85
+ @click.option("--body", required=True, help="The updated filters for the webhook.")
86
+ @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...")
87
+ @formatted
88
+ def update_webhook(webhook: str, body: str, opt_fields: str | None) -> Any:
89
+ """Update a webhook"""
90
+ parsed_body = resolve_body(body)
91
+ session = AsanaSession.from_env()
92
+ api = WebhooksApi(session.client)
93
+ opts: dict[str, Any] = {}
94
+ if opt_fields is not None:
95
+ opts["opt_fields"] = opt_fields
96
+ return api.update_webhook(parsed_body, webhook, opts)
@@ -0,0 +1,75 @@
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 WorkspaceMembershipsApi
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("workspace-memberships")
14
+ def workspace_memberships_group() -> None:
15
+ """WorkspaceMemberships commands."""
16
+
17
+
18
+ @workspace_memberships_group.command("get-workspace-membership")
19
+ @click.option("--workspace-membership", required=True)
20
+ @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...")
21
+ @formatted
22
+ def get_workspace_membership(workspace_membership: str, opt_fields: str | None) -> Any:
23
+ """Get a workspace membership"""
24
+ session = AsanaSession.from_env()
25
+ api = WorkspaceMembershipsApi(session.client)
26
+ opts: dict[str, Any] = {}
27
+ if opt_fields is not None:
28
+ opts["opt_fields"] = opt_fields
29
+ return api.get_workspace_membership(workspace_membership, opts)
30
+
31
+
32
+ @workspace_memberships_group.command("get-workspace-memberships-for-user")
33
+ @click.option("--user", required=True, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
34
+ @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.")
35
+ @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...")
36
+ @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...")
37
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
38
+ @formatted
39
+ def get_workspace_memberships_for_user(user: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
40
+ """Get workspace memberships for a user"""
41
+ session = AsanaSession.from_env(paginate=paginate)
42
+ api = WorkspaceMembershipsApi(session.client)
43
+ opts: dict[str, Any] = {}
44
+ if limit is not None:
45
+ opts["limit"] = limit
46
+ if offset is not None:
47
+ opts["offset"] = offset
48
+ if opt_fields is not None:
49
+ opts["opt_fields"] = opt_fields
50
+ return api.get_workspace_memberships_for_user(user, opts)
51
+
52
+
53
+ @workspace_memberships_group.command("get-workspace-memberships-for-workspace")
54
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
55
+ @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.")
56
+ @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...")
57
+ @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...")
58
+ @click.option("--user", default=None, help="A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.")
59
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
60
+ @formatted
61
+ def get_workspace_memberships_for_workspace(workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, user: str | None, paginate: bool) -> Any:
62
+ """Get the workspace memberships for a workspace"""
63
+ resolved_workspace = resolve_workspace(workspace, required=True)
64
+ session = AsanaSession.from_env(paginate=paginate)
65
+ api = WorkspaceMembershipsApi(session.client)
66
+ opts: dict[str, Any] = {}
67
+ if limit is not None:
68
+ opts["limit"] = limit
69
+ if offset is not None:
70
+ opts["offset"] = offset
71
+ if opt_fields is not None:
72
+ opts["opt_fields"] = opt_fields
73
+ if user is not None:
74
+ opts["user"] = user
75
+ return api.get_workspace_memberships_for_workspace(resolved_workspace, opts)
@@ -0,0 +1,113 @@
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 WorkspacesApi
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("workspaces")
14
+ def workspaces_group() -> None:
15
+ """Workspaces commands."""
16
+
17
+
18
+ @workspaces_group.command("add-user-for-workspace")
19
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
20
+ @click.option("--body", required=True, help="The user to add to the workspace.")
21
+ @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...")
22
+ @formatted
23
+ def add_user_for_workspace(workspace: str | None, body: str, opt_fields: str | None) -> Any:
24
+ """Add a user to a workspace or organization"""
25
+ parsed_body = resolve_body(body)
26
+ resolved_workspace = resolve_workspace(workspace, required=True)
27
+ session = AsanaSession.from_env()
28
+ api = WorkspacesApi(session.client)
29
+ opts: dict[str, Any] = {}
30
+ if opt_fields is not None:
31
+ opts["opt_fields"] = opt_fields
32
+ return api.add_user_for_workspace(parsed_body, resolved_workspace, opts)
33
+
34
+
35
+ @workspaces_group.command("get-workspace")
36
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
37
+ @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...")
38
+ @formatted
39
+ def get_workspace(workspace: str | None, opt_fields: str | None) -> Any:
40
+ """Get a workspace"""
41
+ resolved_workspace = resolve_workspace(workspace, required=True)
42
+ session = AsanaSession.from_env()
43
+ api = WorkspacesApi(session.client)
44
+ opts: dict[str, Any] = {}
45
+ if opt_fields is not None:
46
+ opts["opt_fields"] = opt_fields
47
+ return api.get_workspace(resolved_workspace, opts)
48
+
49
+
50
+ @workspaces_group.command("get-workspace-events")
51
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
52
+ @click.option("--sync", default=None, help="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 tok...")
53
+ @formatted
54
+ def get_workspace_events(workspace: str | None, sync: str | None) -> Any:
55
+ """Get workspace events"""
56
+ resolved_workspace = resolve_workspace(workspace, required=True)
57
+ session = AsanaSession.from_env()
58
+ api = WorkspacesApi(session.client)
59
+ opts: dict[str, Any] = {}
60
+ if sync is not None:
61
+ opts["sync"] = sync
62
+ return api.get_workspace_events(resolved_workspace, opts)
63
+
64
+
65
+ @workspaces_group.command("get-workspaces")
66
+ @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.")
67
+ @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...")
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
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
70
+ @formatted
71
+ def get_workspaces(limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
72
+ """Get multiple workspaces"""
73
+ session = AsanaSession.from_env(paginate=paginate)
74
+ api = WorkspacesApi(session.client)
75
+ opts: dict[str, Any] = {}
76
+ if limit is not None:
77
+ opts["limit"] = limit
78
+ if offset is not None:
79
+ opts["offset"] = offset
80
+ if opt_fields is not None:
81
+ opts["opt_fields"] = opt_fields
82
+ return api.get_workspaces(opts)
83
+
84
+
85
+ @workspaces_group.command("remove-user-for-workspace")
86
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
87
+ @click.option("--body", required=True, help="The user to remove from the workspace.")
88
+ @formatted
89
+ def remove_user_for_workspace(workspace: str | None, body: str) -> Any:
90
+ """Remove a user from a workspace or organization"""
91
+ parsed_body = resolve_body(body)
92
+ resolved_workspace = resolve_workspace(workspace, required=True)
93
+ session = AsanaSession.from_env()
94
+ api = WorkspacesApi(session.client)
95
+ opts: dict[str, Any] = {}
96
+ return api.remove_user_for_workspace(parsed_body, resolved_workspace)
97
+
98
+
99
+ @workspaces_group.command("update-workspace")
100
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
101
+ @click.option("--body", required=True, help="The workspace object with all updated properties.")
102
+ @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...")
103
+ @formatted
104
+ def update_workspace(workspace: str | None, body: str, opt_fields: str | None) -> Any:
105
+ """Update a workspace"""
106
+ parsed_body = resolve_body(body)
107
+ resolved_workspace = resolve_workspace(workspace, required=True)
108
+ session = AsanaSession.from_env()
109
+ api = WorkspacesApi(session.client)
110
+ opts: dict[str, Any] = {}
111
+ if opt_fields is not None:
112
+ opts["opt_fields"] = opt_fields
113
+ return api.update_workspace(parsed_body, resolved_workspace, opts)