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,34 @@
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 ReactionsApi
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("reactions")
14
+ def reactions_group() -> None:
15
+ """Reactions commands."""
16
+
17
+
18
+ @reactions_group.command("get-reactions-on-object")
19
+ @click.option("--target", required=True, help="Globally unique identifier for object to fetch reactions from. Must be a GID for a status update or story.")
20
+ @click.option("--emoji-base", required=True, help="Only return reactions with this emoji base character.")
21
+ @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.")
22
+ @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...")
23
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
24
+ @formatted
25
+ def get_reactions_on_object(target: str, emoji_base: str, limit: int | None, offset: str | None, paginate: bool) -> Any:
26
+ """Get reactions with an emoji base on an object."""
27
+ session = AsanaSession.from_env(paginate=paginate)
28
+ api = ReactionsApi(session.client)
29
+ opts: dict[str, Any] = {}
30
+ if limit is not None:
31
+ opts["limit"] = limit
32
+ if offset is not None:
33
+ opts["offset"] = offset
34
+ return api.get_reactions_on_object(target, emoji_base, opts)
@@ -0,0 +1,98 @@
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 RolesApi
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("roles")
14
+ def roles_group() -> None:
15
+ """Roles commands."""
16
+
17
+
18
+ @roles_group.command("create-role")
19
+ @click.option("--body", required=True, help="The role to create.")
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_role(body: str, opt_fields: str | None) -> Any:
23
+ """Create a role"""
24
+ parsed_body = resolve_body(body)
25
+ session = AsanaSession.from_env()
26
+ api = RolesApi(session.client)
27
+ opts: dict[str, Any] = {}
28
+ if opt_fields is not None:
29
+ opts["opt_fields"] = opt_fields
30
+ return api.create_role(parsed_body, opts)
31
+
32
+
33
+ @roles_group.command("delete-role")
34
+ @click.option("--role", required=True, help="Globally unique identifier for the role. If the method is called asynchronously, returns the request thread.")
35
+ @formatted
36
+ def delete_role(role: str) -> Any:
37
+ """Delete a role"""
38
+ session = AsanaSession.from_env()
39
+ api = RolesApi(session.client)
40
+ opts: dict[str, Any] = {}
41
+ return api.delete_role(role)
42
+
43
+
44
+ @roles_group.command("get-role")
45
+ @click.option("--role", required=True, help="Globally unique identifier for the role.")
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_role(role: str, opt_fields: str | None) -> Any:
49
+ """Get a role"""
50
+ session = AsanaSession.from_env()
51
+ api = RolesApi(session.client)
52
+ opts: dict[str, Any] = {}
53
+ if opt_fields is not None:
54
+ opts["opt_fields"] = opt_fields
55
+ return api.get_role(role, opts)
56
+
57
+
58
+ @roles_group.command("get-roles")
59
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
60
+ @click.option("--archived", type=bool, default=None, help="Only return projects whose `archived` field takes on the value of this parameter.")
61
+ @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.")
62
+ @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...")
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
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
65
+ @formatted
66
+ def get_roles(workspace: str | None, archived: bool | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
67
+ """Get multiple roles"""
68
+ resolved_workspace = resolve_workspace(workspace, required=False)
69
+ session = AsanaSession.from_env(paginate=paginate)
70
+ api = RolesApi(session.client)
71
+ opts: dict[str, Any] = {}
72
+ if archived is not None:
73
+ opts["archived"] = archived
74
+ if limit is not None:
75
+ opts["limit"] = limit
76
+ if offset is not None:
77
+ opts["offset"] = offset
78
+ if opt_fields is not None:
79
+ opts["opt_fields"] = opt_fields
80
+ if resolved_workspace is not None:
81
+ opts["workspace"] = resolved_workspace
82
+ return api.get_roles(opts)
83
+
84
+
85
+ @roles_group.command("update-role")
86
+ @click.option("--role", required=True, help="Globally unique identifier for the role.")
87
+ @click.option("--body", required=True, help="The updated fields for the role.")
88
+ @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...")
89
+ @formatted
90
+ def update_role(role: str, body: str, opt_fields: str | None) -> Any:
91
+ """Update a role"""
92
+ parsed_body = resolve_body(body)
93
+ session = AsanaSession.from_env()
94
+ api = RolesApi(session.client)
95
+ opts: dict[str, Any] = {}
96
+ if opt_fields is not None:
97
+ opts["opt_fields"] = opt_fields
98
+ return api.update_role(parsed_body, role, opts)
@@ -0,0 +1,28 @@
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 RulesApi
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("rules")
14
+ def rules_group() -> None:
15
+ """Rules commands."""
16
+
17
+
18
+ @rules_group.command("trigger-rule")
19
+ @click.option("--rule-trigger", required=True, help="The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. If the method is called asynchronously, returns the request thread.")
20
+ @click.option("--body", required=True, help="A dictionary of variables accessible from within the rule.")
21
+ @formatted
22
+ def trigger_rule(rule_trigger: str, body: str) -> Any:
23
+ """Trigger a rule"""
24
+ parsed_body = resolve_body(body)
25
+ session = AsanaSession.from_env()
26
+ api = RulesApi(session.client)
27
+ opts: dict[str, Any] = {}
28
+ return api.trigger_rule(parsed_body, rule_trigger)
@@ -0,0 +1,111 @@
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 SectionsApi
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("sections")
14
+ def sections_group() -> None:
15
+ """Sections commands."""
16
+
17
+
18
+ @sections_group.command("add-task-for-section")
19
+ @click.option("--section", required=True, help="The globally unique identifier for the section.")
20
+ @formatted
21
+ def add_task_for_section(section: str) -> Any:
22
+ """Add task to section"""
23
+ session = AsanaSession.from_env()
24
+ api = SectionsApi(session.client)
25
+ opts: dict[str, Any] = {}
26
+ return api.add_task_for_section(section, opts)
27
+
28
+
29
+ @sections_group.command("create-section-for-project")
30
+ @click.option("--project", required=True, help="Globally unique identifier for the project.")
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 create_section_for_project(project: str, opt_fields: str | None) -> Any:
34
+ """Create a section in a project"""
35
+ session = AsanaSession.from_env()
36
+ api = SectionsApi(session.client)
37
+ opts: dict[str, Any] = {}
38
+ if opt_fields is not None:
39
+ opts["opt_fields"] = opt_fields
40
+ return api.create_section_for_project(project, opts)
41
+
42
+
43
+ @sections_group.command("delete-section")
44
+ @click.option("--section", required=True, help="The globally unique identifier for the section. If the method is called asynchronously, returns the request thread.")
45
+ @formatted
46
+ def delete_section(section: str) -> Any:
47
+ """Delete a section"""
48
+ session = AsanaSession.from_env()
49
+ api = SectionsApi(session.client)
50
+ opts: dict[str, Any] = {}
51
+ return api.delete_section(section)
52
+
53
+
54
+ @sections_group.command("get-section")
55
+ @click.option("--section", required=True, help="The globally unique identifier for the section.")
56
+ @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...")
57
+ @formatted
58
+ def get_section(section: str, opt_fields: str | None) -> Any:
59
+ """Get a section"""
60
+ session = AsanaSession.from_env()
61
+ api = SectionsApi(session.client)
62
+ opts: dict[str, Any] = {}
63
+ if opt_fields is not None:
64
+ opts["opt_fields"] = opt_fields
65
+ return api.get_section(section, opts)
66
+
67
+
68
+ @sections_group.command("get-sections-for-project")
69
+ @click.option("--project", required=True, help="Globally unique identifier for the project.")
70
+ @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.")
71
+ @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...")
72
+ @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...")
73
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
74
+ @formatted
75
+ def get_sections_for_project(project: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
76
+ """Get sections in a project"""
77
+ session = AsanaSession.from_env(paginate=paginate)
78
+ api = SectionsApi(session.client)
79
+ opts: dict[str, Any] = {}
80
+ if limit is not None:
81
+ opts["limit"] = limit
82
+ if offset is not None:
83
+ opts["offset"] = offset
84
+ if opt_fields is not None:
85
+ opts["opt_fields"] = opt_fields
86
+ return api.get_sections_for_project(project, opts)
87
+
88
+
89
+ @sections_group.command("insert-section-for-project")
90
+ @click.option("--project", required=True, help="Globally unique identifier for the project.")
91
+ @formatted
92
+ def insert_section_for_project(project: str) -> Any:
93
+ """Move or Insert sections"""
94
+ session = AsanaSession.from_env()
95
+ api = SectionsApi(session.client)
96
+ opts: dict[str, Any] = {}
97
+ return api.insert_section_for_project(project, opts)
98
+
99
+
100
+ @sections_group.command("update-section")
101
+ @click.option("--section", required=True, help="The globally unique identifier for the section.")
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_section(section: str, opt_fields: str | None) -> Any:
105
+ """Update a section"""
106
+ session = AsanaSession.from_env()
107
+ api = SectionsApi(session.client)
108
+ opts: dict[str, Any] = {}
109
+ if opt_fields is not None:
110
+ opts["opt_fields"] = opt_fields
111
+ return api.update_section(section, opts)
@@ -0,0 +1,86 @@
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 StatusUpdatesApi
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("status-updates")
14
+ def status_updates_group() -> None:
15
+ """StatusUpdates commands."""
16
+
17
+
18
+ @status_updates_group.command("create-status-for-object")
19
+ @click.option("--body", required=True, help="The status update to create.")
20
+ @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.")
21
+ @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...")
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("--paginate", is_flag=True, default=False, help="Fetch all pages")
24
+ @formatted
25
+ def create_status_for_object(body: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
26
+ """Create a status update"""
27
+ parsed_body = resolve_body(body)
28
+ session = AsanaSession.from_env(paginate=paginate)
29
+ api = StatusUpdatesApi(session.client)
30
+ opts: dict[str, Any] = {}
31
+ if limit is not None:
32
+ opts["limit"] = limit
33
+ if offset is not None:
34
+ opts["offset"] = offset
35
+ if opt_fields is not None:
36
+ opts["opt_fields"] = opt_fields
37
+ return api.create_status_for_object(parsed_body, opts)
38
+
39
+
40
+ @status_updates_group.command("delete-status")
41
+ @click.option("--status-update", required=True, help="The status update to get. If the method is called asynchronously, returns the request thread.")
42
+ @formatted
43
+ def delete_status(status_update: str) -> Any:
44
+ """Delete a status update"""
45
+ session = AsanaSession.from_env()
46
+ api = StatusUpdatesApi(session.client)
47
+ opts: dict[str, Any] = {}
48
+ return api.delete_status(status_update)
49
+
50
+
51
+ @status_updates_group.command("get-status")
52
+ @click.option("--status-update", required=True, help="The status update to get.")
53
+ @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...")
54
+ @formatted
55
+ def get_status(status_update: str, opt_fields: str | None) -> Any:
56
+ """Get a status update"""
57
+ session = AsanaSession.from_env()
58
+ api = StatusUpdatesApi(session.client)
59
+ opts: dict[str, Any] = {}
60
+ if opt_fields is not None:
61
+ opts["opt_fields"] = opt_fields
62
+ return api.get_status(status_update, opts)
63
+
64
+
65
+ @status_updates_group.command("get-statuses-for-object")
66
+ @click.option("--parent", required=True, help="Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal.")
67
+ @click.option("--created-since", default=None, help="Only return statuses that have been created since the given time.")
68
+ @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.")
69
+ @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...")
70
+ @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...")
71
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
72
+ @formatted
73
+ def get_statuses_for_object(parent: str, created_since: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
74
+ """Get status updates from an object"""
75
+ session = AsanaSession.from_env(paginate=paginate)
76
+ api = StatusUpdatesApi(session.client)
77
+ opts: dict[str, Any] = {}
78
+ if created_since is not None:
79
+ opts["created_since"] = created_since
80
+ if limit is not None:
81
+ opts["limit"] = limit
82
+ if offset is not None:
83
+ opts["offset"] = offset
84
+ if opt_fields is not None:
85
+ opts["opt_fields"] = opt_fields
86
+ return api.get_statuses_for_object(parent, opts)
@@ -0,0 +1,130 @@
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 StoriesApi
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("stories")
14
+ def stories_group() -> None:
15
+ """Stories commands."""
16
+
17
+
18
+ @stories_group.command("create-story-for-goal")
19
+ @click.option("--goal", required=True, help="Globally unique identifier for the goal.")
20
+ @click.option("--body", required=True, help="The story to create.")
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 create_story_for_goal(goal: str, body: str, opt_fields: str | None) -> Any:
24
+ """Create a story on a goal"""
25
+ parsed_body = resolve_body(body)
26
+ session = AsanaSession.from_env()
27
+ api = StoriesApi(session.client)
28
+ opts: dict[str, Any] = {}
29
+ if opt_fields is not None:
30
+ opts["opt_fields"] = opt_fields
31
+ return api.create_story_for_goal(parsed_body, goal, opts)
32
+
33
+
34
+ @stories_group.command("create-story-for-task")
35
+ @click.option("--task", required=True, help="The task to operate on.")
36
+ @click.option("--body", required=True, help="The story to create.")
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 create_story_for_task(task: str, body: str, opt_fields: str | None) -> Any:
40
+ """Create a story on a task"""
41
+ parsed_body = resolve_body(body)
42
+ session = AsanaSession.from_env()
43
+ api = StoriesApi(session.client)
44
+ opts: dict[str, Any] = {}
45
+ if opt_fields is not None:
46
+ opts["opt_fields"] = opt_fields
47
+ return api.create_story_for_task(parsed_body, task, opts)
48
+
49
+
50
+ @stories_group.command("delete-story")
51
+ @click.option("--story", required=True, help="Globally unique identifier for the story. If the method is called asynchronously, returns the request thread.")
52
+ @formatted
53
+ def delete_story(story: str) -> Any:
54
+ """Delete a story"""
55
+ session = AsanaSession.from_env()
56
+ api = StoriesApi(session.client)
57
+ opts: dict[str, Any] = {}
58
+ return api.delete_story(story)
59
+
60
+
61
+ @stories_group.command("get-stories-for-goal")
62
+ @click.option("--goal", required=True, help="Globally unique identifier for the goal.")
63
+ @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.")
64
+ @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...")
65
+ @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...")
66
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
67
+ @formatted
68
+ def get_stories_for_goal(goal: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
69
+ """Get stories from a goal"""
70
+ session = AsanaSession.from_env(paginate=paginate)
71
+ api = StoriesApi(session.client)
72
+ opts: dict[str, Any] = {}
73
+ if limit is not None:
74
+ opts["limit"] = limit
75
+ if offset is not None:
76
+ opts["offset"] = offset
77
+ if opt_fields is not None:
78
+ opts["opt_fields"] = opt_fields
79
+ return api.get_stories_for_goal(goal, opts)
80
+
81
+
82
+ @stories_group.command("get-stories-for-task")
83
+ @click.option("--task", required=True, help="The task to operate on.")
84
+ @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.")
85
+ @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...")
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
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
88
+ @formatted
89
+ def get_stories_for_task(task: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
90
+ """Get stories from a task"""
91
+ session = AsanaSession.from_env(paginate=paginate)
92
+ api = StoriesApi(session.client)
93
+ opts: dict[str, Any] = {}
94
+ if limit is not None:
95
+ opts["limit"] = limit
96
+ if offset is not None:
97
+ opts["offset"] = offset
98
+ if opt_fields is not None:
99
+ opts["opt_fields"] = opt_fields
100
+ return api.get_stories_for_task(task, opts)
101
+
102
+
103
+ @stories_group.command("get-story")
104
+ @click.option("--story", required=True, help="Globally unique identifier for the story.")
105
+ @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...")
106
+ @formatted
107
+ def get_story(story: str, opt_fields: str | None) -> Any:
108
+ """Get a story"""
109
+ session = AsanaSession.from_env()
110
+ api = StoriesApi(session.client)
111
+ opts: dict[str, Any] = {}
112
+ if opt_fields is not None:
113
+ opts["opt_fields"] = opt_fields
114
+ return api.get_story(story, opts)
115
+
116
+
117
+ @stories_group.command("update-story")
118
+ @click.option("--story", required=True, help="Globally unique identifier for the story.")
119
+ @click.option("--body", required=True, help="The comment story to update.")
120
+ @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...")
121
+ @formatted
122
+ def update_story(story: str, body: str, opt_fields: str | None) -> Any:
123
+ """Update a story"""
124
+ parsed_body = resolve_body(body)
125
+ session = AsanaSession.from_env()
126
+ api = StoriesApi(session.client)
127
+ opts: dict[str, Any] = {}
128
+ if opt_fields is not None:
129
+ opts["opt_fields"] = opt_fields
130
+ return api.update_story(parsed_body, story, opts)
@@ -0,0 +1,155 @@
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 TagsApi
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("tags")
14
+ def tags_group() -> None:
15
+ """Tags commands."""
16
+
17
+
18
+ @tags_group.command("create-tag")
19
+ @click.option("--body", required=True, help="The tag to create.")
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_tag(body: str, opt_fields: str | None) -> Any:
23
+ """Create a tag"""
24
+ parsed_body = resolve_body(body)
25
+ session = AsanaSession.from_env()
26
+ api = TagsApi(session.client)
27
+ opts: dict[str, Any] = {}
28
+ if opt_fields is not None:
29
+ opts["opt_fields"] = opt_fields
30
+ return api.create_tag(parsed_body, opts)
31
+
32
+
33
+ @tags_group.command("create-tag-for-workspace")
34
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
35
+ @click.option("--body", required=True, help="The tag to create.")
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
+ @formatted
38
+ def create_tag_for_workspace(workspace: str | None, body: str, opt_fields: str | None) -> Any:
39
+ """Create a tag in a workspace"""
40
+ parsed_body = resolve_body(body)
41
+ resolved_workspace = resolve_workspace(workspace, required=True)
42
+ session = AsanaSession.from_env()
43
+ api = TagsApi(session.client)
44
+ opts: dict[str, Any] = {}
45
+ if opt_fields is not None:
46
+ opts["opt_fields"] = opt_fields
47
+ return api.create_tag_for_workspace(parsed_body, resolved_workspace, opts)
48
+
49
+
50
+ @tags_group.command("delete-tag")
51
+ @click.option("--tag", required=True, help="Globally unique identifier for the tag. If the method is called asynchronously, returns the request thread.")
52
+ @formatted
53
+ def delete_tag(tag: str) -> Any:
54
+ """Delete a tag"""
55
+ session = AsanaSession.from_env()
56
+ api = TagsApi(session.client)
57
+ opts: dict[str, Any] = {}
58
+ return api.delete_tag(tag)
59
+
60
+
61
+ @tags_group.command("get-tag")
62
+ @click.option("--tag", required=True, help="Globally unique identifier for the tag.")
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_tag(tag: str, opt_fields: str | None) -> Any:
66
+ """Get a tag"""
67
+ session = AsanaSession.from_env()
68
+ api = TagsApi(session.client)
69
+ opts: dict[str, Any] = {}
70
+ if opt_fields is not None:
71
+ opts["opt_fields"] = opt_fields
72
+ return api.get_tag(tag, opts)
73
+
74
+
75
+ @tags_group.command("get-tags")
76
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
77
+ @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.")
78
+ @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...")
79
+ @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...")
80
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
81
+ @formatted
82
+ def get_tags(workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
83
+ """Get multiple tags"""
84
+ resolved_workspace = resolve_workspace(workspace, required=False)
85
+ session = AsanaSession.from_env(paginate=paginate)
86
+ api = TagsApi(session.client)
87
+ opts: dict[str, Any] = {}
88
+ if limit is not None:
89
+ opts["limit"] = limit
90
+ if offset is not None:
91
+ opts["offset"] = offset
92
+ if opt_fields is not None:
93
+ opts["opt_fields"] = opt_fields
94
+ if resolved_workspace is not None:
95
+ opts["workspace"] = resolved_workspace
96
+ return api.get_tags(opts)
97
+
98
+
99
+ @tags_group.command("get-tags-for-task")
100
+ @click.option("--task", required=True, help="The task to operate on.")
101
+ @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.")
102
+ @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...")
103
+ @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...")
104
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
105
+ @formatted
106
+ def get_tags_for_task(task: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
107
+ """Get a task's tags"""
108
+ session = AsanaSession.from_env(paginate=paginate)
109
+ api = TagsApi(session.client)
110
+ opts: dict[str, Any] = {}
111
+ if limit is not None:
112
+ opts["limit"] = limit
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_tags_for_task(task, opts)
118
+
119
+
120
+ @tags_group.command("get-tags-for-workspace")
121
+ @click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
122
+ @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.")
123
+ @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...")
124
+ @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...")
125
+ @click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
126
+ @formatted
127
+ def get_tags_for_workspace(workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
128
+ """Get tags in a workspace"""
129
+ resolved_workspace = resolve_workspace(workspace, required=True)
130
+ session = AsanaSession.from_env(paginate=paginate)
131
+ api = TagsApi(session.client)
132
+ opts: dict[str, Any] = {}
133
+ if limit is not None:
134
+ opts["limit"] = limit
135
+ if offset is not None:
136
+ opts["offset"] = offset
137
+ if opt_fields is not None:
138
+ opts["opt_fields"] = opt_fields
139
+ return api.get_tags_for_workspace(resolved_workspace, opts)
140
+
141
+
142
+ @tags_group.command("update-tag")
143
+ @click.option("--tag", required=True, help="Globally unique identifier for the tag.")
144
+ @click.option("--body", required=True, help="The tag to update.")
145
+ @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...")
146
+ @formatted
147
+ def update_tag(tag: str, body: str, opt_fields: str | None) -> Any:
148
+ """Update a tag"""
149
+ parsed_body = resolve_body(body)
150
+ session = AsanaSession.from_env()
151
+ api = TagsApi(session.client)
152
+ opts: dict[str, Any] = {}
153
+ if opt_fields is not None:
154
+ opts["opt_fields"] = opt_fields
155
+ return api.update_tag(parsed_body, tag, opts)