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.
- asana_api_cli/__init__.py +3 -0
- asana_api_cli/cli/__init__.py +140 -0
- asana_api_cli/cli/access_requests.py +66 -0
- asana_api_cli/cli/allocations.py +101 -0
- asana_api_cli/cli/attachments.py +92 -0
- asana_api_cli/cli/audit_log_api.py +52 -0
- asana_api_cli/cli/batch_api.py +30 -0
- asana_api_cli/cli/budgets.py +79 -0
- asana_api_cli/cli/custom_field_settings.py +92 -0
- asana_api_cli/cli/custom_fields.py +133 -0
- asana_api_cli/cli/custom_types.py +50 -0
- asana_api_cli/cli/events.py +32 -0
- asana_api_cli/cli/exports.py +39 -0
- asana_api_cli/cli/goal_relationships.py +98 -0
- asana_api_cli/cli/goals.py +217 -0
- asana_api_cli/cli/jobs.py +29 -0
- asana_api_cli/cli/memberships.py +89 -0
- asana_api_cli/cli/organization_exports.py +44 -0
- asana_api_cli/cli/portfolio_memberships.py +83 -0
- asana_api_cli/cli/portfolios.py +215 -0
- asana_api_cli/cli/project_briefs.py +72 -0
- asana_api_cli/cli/project_memberships.py +53 -0
- asana_api_cli/cli/project_portfolio_settings.py +87 -0
- asana_api_cli/cli/project_statuses.py +77 -0
- asana_api_cli/cli/project_templates.py +102 -0
- asana_api_cli/cli/projects.py +380 -0
- asana_api_cli/cli/rates.py +97 -0
- asana_api_cli/cli/reactions.py +34 -0
- asana_api_cli/cli/roles.py +98 -0
- asana_api_cli/cli/rules.py +28 -0
- asana_api_cli/cli/sections.py +111 -0
- asana_api_cli/cli/status_updates.py +86 -0
- asana_api_cli/cli/stories.py +130 -0
- asana_api_cli/cli/tags.py +155 -0
- asana_api_cli/cli/task_templates.py +77 -0
- asana_api_cli/cli/tasks.py +520 -0
- asana_api_cli/cli/team_memberships.py +103 -0
- asana_api_cli/cli/teams.py +133 -0
- asana_api_cli/cli/time_periods.py +57 -0
- asana_api_cli/cli/time_tracking_categories.py +123 -0
- asana_api_cli/cli/time_tracking_entries.py +138 -0
- asana_api_cli/cli/timesheet_approval_statuses.py +94 -0
- asana_api_cli/cli/typeahead.py +40 -0
- asana_api_cli/cli/user_task_lists.py +45 -0
- asana_api_cli/cli/users.py +173 -0
- asana_api_cli/cli/webhooks.py +96 -0
- asana_api_cli/cli/workspace_memberships.py +75 -0
- asana_api_cli/cli/workspaces.py +113 -0
- asana_api_cli/formatter.py +161 -0
- asana_api_cli/session.py +173 -0
- asana_api_cli/version.py +11 -0
- asana_api_cli-1.2.0.dist-info/METADATA +105 -0
- asana_api_cli-1.2.0.dist-info/RECORD +57 -0
- asana_api_cli-1.2.0.dist-info/WHEEL +5 -0
- asana_api_cli-1.2.0.dist-info/entry_points.txt +2 -0
- asana_api_cli-1.2.0.dist-info/licenses/LICENSE +190 -0
- asana_api_cli-1.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,133 @@
|
|
|
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 CustomFieldsApi
|
|
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("custom-fields")
|
|
14
|
+
def custom_fields_group() -> None:
|
|
15
|
+
"""CustomFields commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@custom_fields_group.command("create-custom-field")
|
|
19
|
+
@click.option("--body", required=True, help="The custom field object 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_custom_field(body: str, opt_fields: str | None) -> Any:
|
|
23
|
+
"""Create a custom field"""
|
|
24
|
+
parsed_body = resolve_body(body)
|
|
25
|
+
session = AsanaSession.from_env()
|
|
26
|
+
api = CustomFieldsApi(session.client)
|
|
27
|
+
opts: dict[str, Any] = {}
|
|
28
|
+
if opt_fields is not None:
|
|
29
|
+
opts["opt_fields"] = opt_fields
|
|
30
|
+
return api.create_custom_field(parsed_body, opts)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@custom_fields_group.command("create-enum-option-for-custom-field")
|
|
34
|
+
@click.option("--custom-field", required=True, help="Globally unique identifier for the custom field.")
|
|
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 create_enum_option_for_custom_field(custom_field: str, opt_fields: str | None) -> Any:
|
|
38
|
+
"""Create an enum option"""
|
|
39
|
+
session = AsanaSession.from_env()
|
|
40
|
+
api = CustomFieldsApi(session.client)
|
|
41
|
+
opts: dict[str, Any] = {}
|
|
42
|
+
if opt_fields is not None:
|
|
43
|
+
opts["opt_fields"] = opt_fields
|
|
44
|
+
return api.create_enum_option_for_custom_field(custom_field, opts)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@custom_fields_group.command("delete-custom-field")
|
|
48
|
+
@click.option("--custom-field", required=True, help="Globally unique identifier for the custom field. If the method is called asynchronously, returns the request thread.")
|
|
49
|
+
@formatted
|
|
50
|
+
def delete_custom_field(custom_field: str) -> Any:
|
|
51
|
+
"""Delete a custom field"""
|
|
52
|
+
session = AsanaSession.from_env()
|
|
53
|
+
api = CustomFieldsApi(session.client)
|
|
54
|
+
opts: dict[str, Any] = {}
|
|
55
|
+
return api.delete_custom_field(custom_field)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@custom_fields_group.command("get-custom-field")
|
|
59
|
+
@click.option("--custom-field", required=True, help="Globally unique identifier for the custom field.")
|
|
60
|
+
@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...")
|
|
61
|
+
@formatted
|
|
62
|
+
def get_custom_field(custom_field: str, opt_fields: str | None) -> Any:
|
|
63
|
+
"""Get a custom field"""
|
|
64
|
+
session = AsanaSession.from_env()
|
|
65
|
+
api = CustomFieldsApi(session.client)
|
|
66
|
+
opts: dict[str, Any] = {}
|
|
67
|
+
if opt_fields is not None:
|
|
68
|
+
opts["opt_fields"] = opt_fields
|
|
69
|
+
return api.get_custom_field(custom_field, opts)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@custom_fields_group.command("get-custom-fields-for-workspace")
|
|
73
|
+
@click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
|
|
74
|
+
@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.")
|
|
75
|
+
@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...")
|
|
76
|
+
@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...")
|
|
77
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
78
|
+
@formatted
|
|
79
|
+
def get_custom_fields_for_workspace(workspace: str | None, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
|
|
80
|
+
"""Get a workspace's custom fields"""
|
|
81
|
+
resolved_workspace = resolve_workspace(workspace, required=True)
|
|
82
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
83
|
+
api = CustomFieldsApi(session.client)
|
|
84
|
+
opts: dict[str, Any] = {}
|
|
85
|
+
if limit is not None:
|
|
86
|
+
opts["limit"] = limit
|
|
87
|
+
if offset is not None:
|
|
88
|
+
opts["offset"] = offset
|
|
89
|
+
if opt_fields is not None:
|
|
90
|
+
opts["opt_fields"] = opt_fields
|
|
91
|
+
return api.get_custom_fields_for_workspace(resolved_workspace, opts)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@custom_fields_group.command("insert-enum-option-for-custom-field")
|
|
95
|
+
@click.option("--custom-field", required=True, help="Globally unique identifier for the custom field.")
|
|
96
|
+
@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...")
|
|
97
|
+
@formatted
|
|
98
|
+
def insert_enum_option_for_custom_field(custom_field: str, opt_fields: str | None) -> Any:
|
|
99
|
+
"""Reorder a custom field's enum"""
|
|
100
|
+
session = AsanaSession.from_env()
|
|
101
|
+
api = CustomFieldsApi(session.client)
|
|
102
|
+
opts: dict[str, Any] = {}
|
|
103
|
+
if opt_fields is not None:
|
|
104
|
+
opts["opt_fields"] = opt_fields
|
|
105
|
+
return api.insert_enum_option_for_custom_field(custom_field, opts)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@custom_fields_group.command("update-custom-field")
|
|
109
|
+
@click.option("--custom-field", required=True, help="Globally unique identifier for the custom field.")
|
|
110
|
+
@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...")
|
|
111
|
+
@formatted
|
|
112
|
+
def update_custom_field(custom_field: str, opt_fields: str | None) -> Any:
|
|
113
|
+
"""Update a custom field"""
|
|
114
|
+
session = AsanaSession.from_env()
|
|
115
|
+
api = CustomFieldsApi(session.client)
|
|
116
|
+
opts: dict[str, Any] = {}
|
|
117
|
+
if opt_fields is not None:
|
|
118
|
+
opts["opt_fields"] = opt_fields
|
|
119
|
+
return api.update_custom_field(custom_field, opts)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@custom_fields_group.command("update-enum-option")
|
|
123
|
+
@click.option("--enum-option", required=True, help="Globally unique identifier for the enum option.")
|
|
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
|
+
@formatted
|
|
126
|
+
def update_enum_option(enum_option: str, opt_fields: str | None) -> Any:
|
|
127
|
+
"""Update an enum option"""
|
|
128
|
+
session = AsanaSession.from_env()
|
|
129
|
+
api = CustomFieldsApi(session.client)
|
|
130
|
+
opts: dict[str, Any] = {}
|
|
131
|
+
if opt_fields is not None:
|
|
132
|
+
opts["opt_fields"] = opt_fields
|
|
133
|
+
return api.update_enum_option(enum_option, opts)
|
|
@@ -0,0 +1,50 @@
|
|
|
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 CustomTypesApi
|
|
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("custom-types")
|
|
14
|
+
def custom_types_group() -> None:
|
|
15
|
+
"""CustomTypes commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@custom_types_group.command("get-custom-type")
|
|
19
|
+
@click.option("--custom-type", required=True, help="Globally unique identifier for the custom type.")
|
|
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_custom_type(custom_type: str, opt_fields: str | None) -> Any:
|
|
23
|
+
"""Get a custom type"""
|
|
24
|
+
session = AsanaSession.from_env()
|
|
25
|
+
api = CustomTypesApi(session.client)
|
|
26
|
+
opts: dict[str, Any] = {}
|
|
27
|
+
if opt_fields is not None:
|
|
28
|
+
opts["opt_fields"] = opt_fields
|
|
29
|
+
return api.get_custom_type(custom_type, opts)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@custom_types_group.command("get-custom-types")
|
|
33
|
+
@click.option("--project", required=True, help="Globally unique identifier for the project, which is used as a filter when retrieving all custom types.")
|
|
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_custom_types(project: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
|
|
40
|
+
"""Get all custom types associated with an object"""
|
|
41
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
42
|
+
api = CustomTypesApi(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_custom_types(project, opts)
|
|
@@ -0,0 +1,32 @@
|
|
|
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 EventsApi
|
|
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("events")
|
|
14
|
+
def events_group() -> None:
|
|
15
|
+
"""Events commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@events_group.command("get-events")
|
|
19
|
+
@click.option("--resource", required=True, help="A resource ID to subscribe to. The resource can be a task, project, or goal.")
|
|
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
|
+
@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...")
|
|
22
|
+
@formatted
|
|
23
|
+
def get_events(resource: str, opt_fields: str | None, sync: str | None) -> Any:
|
|
24
|
+
"""Get events on a resource"""
|
|
25
|
+
session = AsanaSession.from_env()
|
|
26
|
+
api = EventsApi(session.client)
|
|
27
|
+
opts: dict[str, Any] = {}
|
|
28
|
+
if opt_fields is not None:
|
|
29
|
+
opts["opt_fields"] = opt_fields
|
|
30
|
+
if sync is not None:
|
|
31
|
+
opts["sync"] = sync
|
|
32
|
+
return api.get_events(resource, opts)
|
|
@@ -0,0 +1,39 @@
|
|
|
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 ExportsApi
|
|
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("exports")
|
|
14
|
+
def exports_group() -> None:
|
|
15
|
+
"""Exports commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@exports_group.command("create-graph-export")
|
|
19
|
+
@click.option("--body", required=True, help="A JSON payload specifying the parent object to export. If the method is called asynchronously, returns the request thread.")
|
|
20
|
+
@formatted
|
|
21
|
+
def create_graph_export(body: str) -> Any:
|
|
22
|
+
"""Initiate a graph export"""
|
|
23
|
+
parsed_body = resolve_body(body)
|
|
24
|
+
session = AsanaSession.from_env()
|
|
25
|
+
api = ExportsApi(session.client)
|
|
26
|
+
opts: dict[str, Any] = {}
|
|
27
|
+
return api.create_graph_export(parsed_body)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@exports_group.command("create-resource-export")
|
|
31
|
+
@click.option("--body", required=True, help="A JSON payload specifying the resources to export, including filters to apply and fields to be exported. If the method is called asynchronously, returns the request thread.")
|
|
32
|
+
@formatted
|
|
33
|
+
def create_resource_export(body: str) -> Any:
|
|
34
|
+
"""Initiate a resource export"""
|
|
35
|
+
parsed_body = resolve_body(body)
|
|
36
|
+
session = AsanaSession.from_env()
|
|
37
|
+
api = ExportsApi(session.client)
|
|
38
|
+
opts: dict[str, Any] = {}
|
|
39
|
+
return api.create_resource_export(parsed_body)
|
|
@@ -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 GoalRelationshipsApi
|
|
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("goal-relationships")
|
|
14
|
+
def goal_relationships_group() -> None:
|
|
15
|
+
"""GoalRelationships commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@goal_relationships_group.command("add-supporting-relationship")
|
|
19
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
20
|
+
@click.option("--body", required=True, help="The supporting resource to be added to the goal")
|
|
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_supporting_relationship(goal: str, body: str, opt_fields: str | None) -> Any:
|
|
24
|
+
"""Add a supporting goal relationship"""
|
|
25
|
+
parsed_body = resolve_body(body)
|
|
26
|
+
session = AsanaSession.from_env()
|
|
27
|
+
api = GoalRelationshipsApi(session.client)
|
|
28
|
+
opts: dict[str, Any] = {}
|
|
29
|
+
if opt_fields is not None:
|
|
30
|
+
opts["opt_fields"] = opt_fields
|
|
31
|
+
return api.add_supporting_relationship(parsed_body, goal, opts)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@goal_relationships_group.command("get-goal-relationship")
|
|
35
|
+
@click.option("--goal-relationship", required=True, help="Globally unique identifier for the goal relationship.")
|
|
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 get_goal_relationship(goal_relationship: str, opt_fields: str | None) -> Any:
|
|
39
|
+
"""Get a goal relationship"""
|
|
40
|
+
session = AsanaSession.from_env()
|
|
41
|
+
api = GoalRelationshipsApi(session.client)
|
|
42
|
+
opts: dict[str, Any] = {}
|
|
43
|
+
if opt_fields is not None:
|
|
44
|
+
opts["opt_fields"] = opt_fields
|
|
45
|
+
return api.get_goal_relationship(goal_relationship, opts)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@goal_relationships_group.command("get-goal-relationships")
|
|
49
|
+
@click.option("--supported-goal", required=True, help="Globally unique identifier for the supported goal in the goal relationship.")
|
|
50
|
+
@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.")
|
|
51
|
+
@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...")
|
|
52
|
+
@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...")
|
|
53
|
+
@click.option("--resource-subtype", default=None, help="If provided, filter to goal relationships with a given resource_subtype.")
|
|
54
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
55
|
+
@formatted
|
|
56
|
+
def get_goal_relationships(supported_goal: str, limit: int | None, offset: str | None, opt_fields: str | None, resource_subtype: str | None, paginate: bool) -> Any:
|
|
57
|
+
"""Get goal relationships"""
|
|
58
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
59
|
+
api = GoalRelationshipsApi(session.client)
|
|
60
|
+
opts: dict[str, Any] = {}
|
|
61
|
+
if limit is not None:
|
|
62
|
+
opts["limit"] = limit
|
|
63
|
+
if offset is not None:
|
|
64
|
+
opts["offset"] = offset
|
|
65
|
+
if opt_fields is not None:
|
|
66
|
+
opts["opt_fields"] = opt_fields
|
|
67
|
+
if resource_subtype is not None:
|
|
68
|
+
opts["resource_subtype"] = resource_subtype
|
|
69
|
+
return api.get_goal_relationships(supported_goal, opts)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@goal_relationships_group.command("remove-supporting-relationship")
|
|
73
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal. If the method is called asynchronously, returns the request thread.")
|
|
74
|
+
@click.option("--body", required=True, help="The supporting resource to be removed from the goal")
|
|
75
|
+
@formatted
|
|
76
|
+
def remove_supporting_relationship(goal: str, body: str) -> Any:
|
|
77
|
+
"""Removes a supporting goal relationship"""
|
|
78
|
+
parsed_body = resolve_body(body)
|
|
79
|
+
session = AsanaSession.from_env()
|
|
80
|
+
api = GoalRelationshipsApi(session.client)
|
|
81
|
+
opts: dict[str, Any] = {}
|
|
82
|
+
return api.remove_supporting_relationship(parsed_body, goal)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@goal_relationships_group.command("update-goal-relationship")
|
|
86
|
+
@click.option("--goal-relationship", required=True, help="Globally unique identifier for the goal relationship.")
|
|
87
|
+
@click.option("--body", required=True, help="The updated fields for the goal relationship.")
|
|
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_goal_relationship(goal_relationship: str, body: str, opt_fields: str | None) -> Any:
|
|
91
|
+
"""Update a goal relationship"""
|
|
92
|
+
parsed_body = resolve_body(body)
|
|
93
|
+
session = AsanaSession.from_env()
|
|
94
|
+
api = GoalRelationshipsApi(session.client)
|
|
95
|
+
opts: dict[str, Any] = {}
|
|
96
|
+
if opt_fields is not None:
|
|
97
|
+
opts["opt_fields"] = opt_fields
|
|
98
|
+
return api.update_goal_relationship(parsed_body, goal_relationship, opts)
|
|
@@ -0,0 +1,217 @@
|
|
|
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 GoalsApi
|
|
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("goals")
|
|
14
|
+
def goals_group() -> None:
|
|
15
|
+
"""Goals commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@goals_group.command("add-custom-field-setting-for-goal")
|
|
19
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal. If the method is called asynchronously, returns the request thread.")
|
|
20
|
+
@click.option("--body", required=True, help="Information about the custom field setting.")
|
|
21
|
+
@formatted
|
|
22
|
+
def add_custom_field_setting_for_goal(goal: str, body: str) -> Any:
|
|
23
|
+
"""Add a custom field to a goal"""
|
|
24
|
+
parsed_body = resolve_body(body)
|
|
25
|
+
session = AsanaSession.from_env()
|
|
26
|
+
api = GoalsApi(session.client)
|
|
27
|
+
opts: dict[str, Any] = {}
|
|
28
|
+
return api.add_custom_field_setting_for_goal(parsed_body, goal)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@goals_group.command("add-followers")
|
|
32
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
33
|
+
@click.option("--body", required=True, help="The followers to be added as collaborators")
|
|
34
|
+
@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...")
|
|
35
|
+
@formatted
|
|
36
|
+
def add_followers(goal: str, body: str, opt_fields: str | None) -> Any:
|
|
37
|
+
"""Add a collaborator to a goal"""
|
|
38
|
+
parsed_body = resolve_body(body)
|
|
39
|
+
session = AsanaSession.from_env()
|
|
40
|
+
api = GoalsApi(session.client)
|
|
41
|
+
opts: dict[str, Any] = {}
|
|
42
|
+
if opt_fields is not None:
|
|
43
|
+
opts["opt_fields"] = opt_fields
|
|
44
|
+
return api.add_followers(parsed_body, goal, opts)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@goals_group.command("create-goal")
|
|
48
|
+
@click.option("--body", required=True, help="The goal to create.")
|
|
49
|
+
@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...")
|
|
50
|
+
@formatted
|
|
51
|
+
def create_goal(body: str, opt_fields: str | None) -> Any:
|
|
52
|
+
"""Create a goal"""
|
|
53
|
+
parsed_body = resolve_body(body)
|
|
54
|
+
session = AsanaSession.from_env()
|
|
55
|
+
api = GoalsApi(session.client)
|
|
56
|
+
opts: dict[str, Any] = {}
|
|
57
|
+
if opt_fields is not None:
|
|
58
|
+
opts["opt_fields"] = opt_fields
|
|
59
|
+
return api.create_goal(parsed_body, opts)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@goals_group.command("create-goal-metric")
|
|
63
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
64
|
+
@click.option("--body", required=True, help="The goal metric to create.")
|
|
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
|
+
@formatted
|
|
67
|
+
def create_goal_metric(goal: str, body: str, opt_fields: str | None) -> Any:
|
|
68
|
+
"""Create a goal metric"""
|
|
69
|
+
parsed_body = resolve_body(body)
|
|
70
|
+
session = AsanaSession.from_env()
|
|
71
|
+
api = GoalsApi(session.client)
|
|
72
|
+
opts: dict[str, Any] = {}
|
|
73
|
+
if opt_fields is not None:
|
|
74
|
+
opts["opt_fields"] = opt_fields
|
|
75
|
+
return api.create_goal_metric(parsed_body, goal, opts)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@goals_group.command("delete-goal")
|
|
79
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal. If the method is called asynchronously, returns the request thread.")
|
|
80
|
+
@formatted
|
|
81
|
+
def delete_goal(goal: str) -> Any:
|
|
82
|
+
"""Delete a goal"""
|
|
83
|
+
session = AsanaSession.from_env()
|
|
84
|
+
api = GoalsApi(session.client)
|
|
85
|
+
opts: dict[str, Any] = {}
|
|
86
|
+
return api.delete_goal(goal)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@goals_group.command("get-goal")
|
|
90
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
91
|
+
@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...")
|
|
92
|
+
@formatted
|
|
93
|
+
def get_goal(goal: str, opt_fields: str | None) -> Any:
|
|
94
|
+
"""Get a goal"""
|
|
95
|
+
session = AsanaSession.from_env()
|
|
96
|
+
api = GoalsApi(session.client)
|
|
97
|
+
opts: dict[str, Any] = {}
|
|
98
|
+
if opt_fields is not None:
|
|
99
|
+
opts["opt_fields"] = opt_fields
|
|
100
|
+
return api.get_goal(goal, opts)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@goals_group.command("get-goals")
|
|
104
|
+
@click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
|
|
105
|
+
@click.option("--is-workspace-level", type=bool, default=None, help="Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter.")
|
|
106
|
+
@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.")
|
|
107
|
+
@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...")
|
|
108
|
+
@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...")
|
|
109
|
+
@click.option("--portfolio", default=None, help="Globally unique identifier for supporting portfolio.")
|
|
110
|
+
@click.option("--project", default=None, help="Globally unique identifier for supporting project.")
|
|
111
|
+
@click.option("--task", default=None, help="Globally unique identifier for supporting task.")
|
|
112
|
+
@click.option("--team", default=None, help="Globally unique identifier for the team.")
|
|
113
|
+
@click.option("--time-periods", default=None, help="Globally unique identifiers for the time periods.")
|
|
114
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
115
|
+
@formatted
|
|
116
|
+
def get_goals(workspace: str | None, is_workspace_level: bool | None, limit: int | None, offset: str | None, opt_fields: str | None, portfolio: str | None, project: str | None, task: str | None, team: str | None, time_periods: str | None, paginate: bool) -> Any:
|
|
117
|
+
"""Get goals"""
|
|
118
|
+
resolved_workspace = resolve_workspace(workspace, required=False)
|
|
119
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
120
|
+
api = GoalsApi(session.client)
|
|
121
|
+
opts: dict[str, Any] = {}
|
|
122
|
+
if is_workspace_level is not None:
|
|
123
|
+
opts["is_workspace_level"] = is_workspace_level
|
|
124
|
+
if limit is not None:
|
|
125
|
+
opts["limit"] = limit
|
|
126
|
+
if offset is not None:
|
|
127
|
+
opts["offset"] = offset
|
|
128
|
+
if opt_fields is not None:
|
|
129
|
+
opts["opt_fields"] = opt_fields
|
|
130
|
+
if portfolio is not None:
|
|
131
|
+
opts["portfolio"] = portfolio
|
|
132
|
+
if project is not None:
|
|
133
|
+
opts["project"] = project
|
|
134
|
+
if task is not None:
|
|
135
|
+
opts["task"] = task
|
|
136
|
+
if team is not None:
|
|
137
|
+
opts["team"] = team
|
|
138
|
+
if time_periods is not None:
|
|
139
|
+
opts["time_periods"] = time_periods
|
|
140
|
+
if resolved_workspace is not None:
|
|
141
|
+
opts["workspace"] = resolved_workspace
|
|
142
|
+
return api.get_goals(opts)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@goals_group.command("get-parent-goals-for-goal")
|
|
146
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
147
|
+
@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...")
|
|
148
|
+
@formatted
|
|
149
|
+
def get_parent_goals_for_goal(goal: str, opt_fields: str | None) -> Any:
|
|
150
|
+
"""Get parent goals from a goal"""
|
|
151
|
+
session = AsanaSession.from_env()
|
|
152
|
+
api = GoalsApi(session.client)
|
|
153
|
+
opts: dict[str, Any] = {}
|
|
154
|
+
if opt_fields is not None:
|
|
155
|
+
opts["opt_fields"] = opt_fields
|
|
156
|
+
return api.get_parent_goals_for_goal(goal, opts)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@goals_group.command("remove-custom-field-setting-for-goal")
|
|
160
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal. If the method is called asynchronously, returns the request thread.")
|
|
161
|
+
@click.option("--body", required=True, help="Information about the custom field setting being removed.")
|
|
162
|
+
@formatted
|
|
163
|
+
def remove_custom_field_setting_for_goal(goal: str, body: str) -> Any:
|
|
164
|
+
"""Remove a custom field from a goal"""
|
|
165
|
+
parsed_body = resolve_body(body)
|
|
166
|
+
session = AsanaSession.from_env()
|
|
167
|
+
api = GoalsApi(session.client)
|
|
168
|
+
opts: dict[str, Any] = {}
|
|
169
|
+
return api.remove_custom_field_setting_for_goal(parsed_body, goal)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@goals_group.command("remove-followers")
|
|
173
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
174
|
+
@click.option("--body", required=True, help="The followers to be removed as collaborators")
|
|
175
|
+
@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...")
|
|
176
|
+
@formatted
|
|
177
|
+
def remove_followers(goal: str, body: str, opt_fields: str | None) -> Any:
|
|
178
|
+
"""Remove a collaborator from a goal"""
|
|
179
|
+
parsed_body = resolve_body(body)
|
|
180
|
+
session = AsanaSession.from_env()
|
|
181
|
+
api = GoalsApi(session.client)
|
|
182
|
+
opts: dict[str, Any] = {}
|
|
183
|
+
if opt_fields is not None:
|
|
184
|
+
opts["opt_fields"] = opt_fields
|
|
185
|
+
return api.remove_followers(parsed_body, goal, opts)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@goals_group.command("update-goal")
|
|
189
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
190
|
+
@click.option("--body", required=True, help="The updated fields for the goal.")
|
|
191
|
+
@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...")
|
|
192
|
+
@formatted
|
|
193
|
+
def update_goal(goal: str, body: str, opt_fields: str | None) -> Any:
|
|
194
|
+
"""Update a goal"""
|
|
195
|
+
parsed_body = resolve_body(body)
|
|
196
|
+
session = AsanaSession.from_env()
|
|
197
|
+
api = GoalsApi(session.client)
|
|
198
|
+
opts: dict[str, Any] = {}
|
|
199
|
+
if opt_fields is not None:
|
|
200
|
+
opts["opt_fields"] = opt_fields
|
|
201
|
+
return api.update_goal(parsed_body, goal, opts)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@goals_group.command("update-goal-metric")
|
|
205
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
206
|
+
@click.option("--body", required=True, help="The updated fields for the goal metric.")
|
|
207
|
+
@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...")
|
|
208
|
+
@formatted
|
|
209
|
+
def update_goal_metric(goal: str, body: str, opt_fields: str | None) -> Any:
|
|
210
|
+
"""Update a goal metric"""
|
|
211
|
+
parsed_body = resolve_body(body)
|
|
212
|
+
session = AsanaSession.from_env()
|
|
213
|
+
api = GoalsApi(session.client)
|
|
214
|
+
opts: dict[str, Any] = {}
|
|
215
|
+
if opt_fields is not None:
|
|
216
|
+
opts["opt_fields"] = opt_fields
|
|
217
|
+
return api.update_goal_metric(parsed_body, goal, opts)
|
|
@@ -0,0 +1,29 @@
|
|
|
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 JobsApi
|
|
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("jobs")
|
|
14
|
+
def jobs_group() -> None:
|
|
15
|
+
"""Jobs commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@jobs_group.command("get-job")
|
|
19
|
+
@click.option("--job", required=True, help="Globally unique identifier for the job.")
|
|
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_job(job: str, opt_fields: str | None) -> Any:
|
|
23
|
+
"""Get a job by id"""
|
|
24
|
+
session = AsanaSession.from_env()
|
|
25
|
+
api = JobsApi(session.client)
|
|
26
|
+
opts: dict[str, Any] = {}
|
|
27
|
+
if opt_fields is not None:
|
|
28
|
+
opts["opt_fields"] = opt_fields
|
|
29
|
+
return api.get_job(job, opts)
|