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,140 @@
|
|
|
1
|
+
# This file is auto-generated by tools/codegen.py — do not edit manually.
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import click
|
|
5
|
+
|
|
6
|
+
from asana_api_cli.version import version_string
|
|
7
|
+
|
|
8
|
+
from asana_api_cli.session import runtime
|
|
9
|
+
from asana_api_cli.cli.access_requests import access_requests_group
|
|
10
|
+
from asana_api_cli.cli.allocations import allocations_group
|
|
11
|
+
from asana_api_cli.cli.attachments import attachments_group
|
|
12
|
+
from asana_api_cli.cli.audit_log_api import audit_log_api_group
|
|
13
|
+
from asana_api_cli.cli.batch_api import batch_api_group
|
|
14
|
+
from asana_api_cli.cli.budgets import budgets_group
|
|
15
|
+
from asana_api_cli.cli.custom_field_settings import custom_field_settings_group
|
|
16
|
+
from asana_api_cli.cli.custom_fields import custom_fields_group
|
|
17
|
+
from asana_api_cli.cli.custom_types import custom_types_group
|
|
18
|
+
from asana_api_cli.cli.events import events_group
|
|
19
|
+
from asana_api_cli.cli.exports import exports_group
|
|
20
|
+
from asana_api_cli.cli.goal_relationships import goal_relationships_group
|
|
21
|
+
from asana_api_cli.cli.goals import goals_group
|
|
22
|
+
from asana_api_cli.cli.jobs import jobs_group
|
|
23
|
+
from asana_api_cli.cli.memberships import memberships_group
|
|
24
|
+
from asana_api_cli.cli.organization_exports import organization_exports_group
|
|
25
|
+
from asana_api_cli.cli.portfolio_memberships import portfolio_memberships_group
|
|
26
|
+
from asana_api_cli.cli.portfolios import portfolios_group
|
|
27
|
+
from asana_api_cli.cli.project_briefs import project_briefs_group
|
|
28
|
+
from asana_api_cli.cli.project_memberships import project_memberships_group
|
|
29
|
+
from asana_api_cli.cli.project_portfolio_settings import project_portfolio_settings_group
|
|
30
|
+
from asana_api_cli.cli.project_statuses import project_statuses_group
|
|
31
|
+
from asana_api_cli.cli.project_templates import project_templates_group
|
|
32
|
+
from asana_api_cli.cli.projects import projects_group
|
|
33
|
+
from asana_api_cli.cli.rates import rates_group
|
|
34
|
+
from asana_api_cli.cli.reactions import reactions_group
|
|
35
|
+
from asana_api_cli.cli.roles import roles_group
|
|
36
|
+
from asana_api_cli.cli.rules import rules_group
|
|
37
|
+
from asana_api_cli.cli.sections import sections_group
|
|
38
|
+
from asana_api_cli.cli.status_updates import status_updates_group
|
|
39
|
+
from asana_api_cli.cli.stories import stories_group
|
|
40
|
+
from asana_api_cli.cli.tags import tags_group
|
|
41
|
+
from asana_api_cli.cli.task_templates import task_templates_group
|
|
42
|
+
from asana_api_cli.cli.tasks import tasks_group
|
|
43
|
+
from asana_api_cli.cli.team_memberships import team_memberships_group
|
|
44
|
+
from asana_api_cli.cli.teams import teams_group
|
|
45
|
+
from asana_api_cli.cli.time_periods import time_periods_group
|
|
46
|
+
from asana_api_cli.cli.time_tracking_categories import time_tracking_categories_group
|
|
47
|
+
from asana_api_cli.cli.time_tracking_entries import time_tracking_entries_group
|
|
48
|
+
from asana_api_cli.cli.timesheet_approval_statuses import timesheet_approval_statuses_group
|
|
49
|
+
from asana_api_cli.cli.typeahead import typeahead_group
|
|
50
|
+
from asana_api_cli.cli.user_task_lists import user_task_lists_group
|
|
51
|
+
from asana_api_cli.cli.users import users_group
|
|
52
|
+
from asana_api_cli.cli.webhooks import webhooks_group
|
|
53
|
+
from asana_api_cli.cli.workspace_memberships import workspace_memberships_group
|
|
54
|
+
from asana_api_cli.cli.workspaces import workspaces_group
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@click.group()
|
|
58
|
+
@click.version_option(version_string(), prog_name="asana-api")
|
|
59
|
+
@click.option("--host", default=None, help="Override API base URL (default: https://app.asana.com/api/1.0)")
|
|
60
|
+
@click.option("--proxy", default=None, help="HTTP/HTTPS proxy URL")
|
|
61
|
+
@click.option("--no-verify-ssl", is_flag=True, default=False, help="Disable TLS certificate verification (insecure)")
|
|
62
|
+
@click.option("--ca-cert", "ca_cert", default=None, type=click.Path(exists=True, dir_okay=False), help="Path to a PEM bundle of trusted CA certificates")
|
|
63
|
+
@click.option("--page-limit", "page_limit", type=int, default=None, help="Default per-page size for paginated endpoints")
|
|
64
|
+
@click.option("--retries", type=int, default=None, help="Number of retries on 429/5xx responses (default: 5)")
|
|
65
|
+
@click.option("--timeout", type=float, default=None, help="Per-request timeout in seconds")
|
|
66
|
+
@click.option("--token-env", "token_env", default=None, help="Environment variable name holding the Asana access token (default: ASANA_ACCESS_TOKEN)")
|
|
67
|
+
@click.option("--temp-dir", "temp_dir", default=None, type=click.Path(file_okay=False), help="Directory for temporary downloads")
|
|
68
|
+
@click.option("--debug", is_flag=True, default=False, help="Print HTTP request/response to stderr for troubleshooting")
|
|
69
|
+
def main(
|
|
70
|
+
host: str | None,
|
|
71
|
+
proxy: str | None,
|
|
72
|
+
no_verify_ssl: bool,
|
|
73
|
+
ca_cert: str | None,
|
|
74
|
+
page_limit: int | None,
|
|
75
|
+
retries: int | None,
|
|
76
|
+
timeout: float | None,
|
|
77
|
+
token_env: str | None,
|
|
78
|
+
temp_dir: str | None,
|
|
79
|
+
debug: bool,
|
|
80
|
+
) -> None:
|
|
81
|
+
"""Asana API CLI (SDK-backed wrapper)."""
|
|
82
|
+
runtime.host = host
|
|
83
|
+
runtime.proxy = proxy
|
|
84
|
+
runtime.verify_ssl = not no_verify_ssl
|
|
85
|
+
runtime.ssl_ca_cert = ca_cert
|
|
86
|
+
runtime.page_limit = page_limit
|
|
87
|
+
runtime.retries = retries
|
|
88
|
+
runtime.timeout = timeout
|
|
89
|
+
if token_env:
|
|
90
|
+
runtime.token_env = token_env
|
|
91
|
+
runtime.temp_dir = temp_dir
|
|
92
|
+
runtime.debug = debug
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
main.add_command(access_requests_group)
|
|
96
|
+
main.add_command(allocations_group)
|
|
97
|
+
main.add_command(attachments_group)
|
|
98
|
+
main.add_command(audit_log_api_group)
|
|
99
|
+
main.add_command(batch_api_group)
|
|
100
|
+
main.add_command(budgets_group)
|
|
101
|
+
main.add_command(custom_field_settings_group)
|
|
102
|
+
main.add_command(custom_fields_group)
|
|
103
|
+
main.add_command(custom_types_group)
|
|
104
|
+
main.add_command(events_group)
|
|
105
|
+
main.add_command(exports_group)
|
|
106
|
+
main.add_command(goal_relationships_group)
|
|
107
|
+
main.add_command(goals_group)
|
|
108
|
+
main.add_command(jobs_group)
|
|
109
|
+
main.add_command(memberships_group)
|
|
110
|
+
main.add_command(organization_exports_group)
|
|
111
|
+
main.add_command(portfolio_memberships_group)
|
|
112
|
+
main.add_command(portfolios_group)
|
|
113
|
+
main.add_command(project_briefs_group)
|
|
114
|
+
main.add_command(project_memberships_group)
|
|
115
|
+
main.add_command(project_portfolio_settings_group)
|
|
116
|
+
main.add_command(project_statuses_group)
|
|
117
|
+
main.add_command(project_templates_group)
|
|
118
|
+
main.add_command(projects_group)
|
|
119
|
+
main.add_command(rates_group)
|
|
120
|
+
main.add_command(reactions_group)
|
|
121
|
+
main.add_command(roles_group)
|
|
122
|
+
main.add_command(rules_group)
|
|
123
|
+
main.add_command(sections_group)
|
|
124
|
+
main.add_command(status_updates_group)
|
|
125
|
+
main.add_command(stories_group)
|
|
126
|
+
main.add_command(tags_group)
|
|
127
|
+
main.add_command(task_templates_group)
|
|
128
|
+
main.add_command(tasks_group)
|
|
129
|
+
main.add_command(team_memberships_group)
|
|
130
|
+
main.add_command(teams_group)
|
|
131
|
+
main.add_command(time_periods_group)
|
|
132
|
+
main.add_command(time_tracking_categories_group)
|
|
133
|
+
main.add_command(time_tracking_entries_group)
|
|
134
|
+
main.add_command(timesheet_approval_statuses_group)
|
|
135
|
+
main.add_command(typeahead_group)
|
|
136
|
+
main.add_command(user_task_lists_group)
|
|
137
|
+
main.add_command(users_group)
|
|
138
|
+
main.add_command(webhooks_group)
|
|
139
|
+
main.add_command(workspace_memberships_group)
|
|
140
|
+
main.add_command(workspaces_group)
|
|
@@ -0,0 +1,66 @@
|
|
|
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 AccessRequestsApi
|
|
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("access-requests")
|
|
14
|
+
def access_requests_group() -> None:
|
|
15
|
+
"""AccessRequests commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@access_requests_group.command("approve-access-request")
|
|
19
|
+
@click.option("--access-request", required=True, help="Globally unique identifier for the access request. If the method is called asynchronously, returns the request thread.")
|
|
20
|
+
@formatted
|
|
21
|
+
def approve_access_request(access_request: str) -> Any:
|
|
22
|
+
"""Approve an access request"""
|
|
23
|
+
session = AsanaSession.from_env()
|
|
24
|
+
api = AccessRequestsApi(session.client)
|
|
25
|
+
opts: dict[str, Any] = {}
|
|
26
|
+
return api.approve_access_request(access_request)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@access_requests_group.command("create-access-request")
|
|
30
|
+
@click.option("--body", required=True, help="If the method is called asynchronously, returns the request thread.")
|
|
31
|
+
@formatted
|
|
32
|
+
def create_access_request(body: str) -> Any:
|
|
33
|
+
"""Create an access request"""
|
|
34
|
+
parsed_body = resolve_body(body)
|
|
35
|
+
session = AsanaSession.from_env()
|
|
36
|
+
api = AccessRequestsApi(session.client)
|
|
37
|
+
opts: dict[str, Any] = {}
|
|
38
|
+
return api.create_access_request(parsed_body)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@access_requests_group.command("get-access-requests")
|
|
42
|
+
@click.option("--target", required=True, help="Globally unique identifier for the target object.")
|
|
43
|
+
@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...")
|
|
44
|
+
@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.")
|
|
45
|
+
@formatted
|
|
46
|
+
def get_access_requests(target: str, opt_fields: str | None, user: str | None) -> Any:
|
|
47
|
+
"""Get access requests"""
|
|
48
|
+
session = AsanaSession.from_env()
|
|
49
|
+
api = AccessRequestsApi(session.client)
|
|
50
|
+
opts: dict[str, Any] = {}
|
|
51
|
+
if opt_fields is not None:
|
|
52
|
+
opts["opt_fields"] = opt_fields
|
|
53
|
+
if user is not None:
|
|
54
|
+
opts["user"] = user
|
|
55
|
+
return api.get_access_requests(target, opts)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@access_requests_group.command("reject-access-request")
|
|
59
|
+
@click.option("--access-request", required=True, help="Globally unique identifier for the access request. If the method is called asynchronously, returns the request thread.")
|
|
60
|
+
@formatted
|
|
61
|
+
def reject_access_request(access_request: str) -> Any:
|
|
62
|
+
"""Reject an access request"""
|
|
63
|
+
session = AsanaSession.from_env()
|
|
64
|
+
api = AccessRequestsApi(session.client)
|
|
65
|
+
opts: dict[str, Any] = {}
|
|
66
|
+
return api.reject_access_request(access_request)
|
|
@@ -0,0 +1,101 @@
|
|
|
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 AllocationsApi
|
|
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("allocations")
|
|
14
|
+
def allocations_group() -> None:
|
|
15
|
+
"""Allocations commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@allocations_group.command("create-allocation")
|
|
19
|
+
@click.option("--body", required=True, help="The allocation 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_allocation(body: str, opt_fields: str | None) -> Any:
|
|
23
|
+
"""Create an allocation"""
|
|
24
|
+
parsed_body = resolve_body(body)
|
|
25
|
+
session = AsanaSession.from_env()
|
|
26
|
+
api = AllocationsApi(session.client)
|
|
27
|
+
opts: dict[str, Any] = {}
|
|
28
|
+
if opt_fields is not None:
|
|
29
|
+
opts["opt_fields"] = opt_fields
|
|
30
|
+
return api.create_allocation(parsed_body, opts)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@allocations_group.command("delete-allocation")
|
|
34
|
+
@click.option("--allocation", required=True, help="Globally unique identifier for the allocation. If the method is called asynchronously, returns the request thread.")
|
|
35
|
+
@formatted
|
|
36
|
+
def delete_allocation(allocation: str) -> Any:
|
|
37
|
+
"""Delete an allocation"""
|
|
38
|
+
session = AsanaSession.from_env()
|
|
39
|
+
api = AllocationsApi(session.client)
|
|
40
|
+
opts: dict[str, Any] = {}
|
|
41
|
+
return api.delete_allocation(allocation)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@allocations_group.command("get-allocation")
|
|
45
|
+
@click.option("--allocation", required=True, help="Globally unique identifier for the allocation.")
|
|
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_allocation(allocation: str, opt_fields: str | None) -> Any:
|
|
49
|
+
"""Get an allocation"""
|
|
50
|
+
session = AsanaSession.from_env()
|
|
51
|
+
api = AllocationsApi(session.client)
|
|
52
|
+
opts: dict[str, Any] = {}
|
|
53
|
+
if opt_fields is not None:
|
|
54
|
+
opts["opt_fields"] = opt_fields
|
|
55
|
+
return api.get_allocation(allocation, opts)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@allocations_group.command("get-allocations")
|
|
59
|
+
@click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
|
|
60
|
+
@click.option("--assignee", default=None, help="Globally unique identifier for the user or placeholder the allocation is assigned to.")
|
|
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("--parent", default=None, help="Globally unique identifier for the project to filter allocations by.")
|
|
65
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
66
|
+
@formatted
|
|
67
|
+
def get_allocations(workspace: str | None, assignee: str | None, limit: int | None, offset: str | None, opt_fields: str | None, parent: str | None, paginate: bool) -> Any:
|
|
68
|
+
"""Get multiple allocations"""
|
|
69
|
+
resolved_workspace = resolve_workspace(workspace, required=False)
|
|
70
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
71
|
+
api = AllocationsApi(session.client)
|
|
72
|
+
opts: dict[str, Any] = {}
|
|
73
|
+
if assignee is not None:
|
|
74
|
+
opts["assignee"] = assignee
|
|
75
|
+
if limit is not None:
|
|
76
|
+
opts["limit"] = limit
|
|
77
|
+
if offset is not None:
|
|
78
|
+
opts["offset"] = offset
|
|
79
|
+
if opt_fields is not None:
|
|
80
|
+
opts["opt_fields"] = opt_fields
|
|
81
|
+
if parent is not None:
|
|
82
|
+
opts["parent"] = parent
|
|
83
|
+
if resolved_workspace is not None:
|
|
84
|
+
opts["workspace"] = resolved_workspace
|
|
85
|
+
return api.get_allocations(opts)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@allocations_group.command("update-allocation")
|
|
89
|
+
@click.option("--allocation", required=True, help="Globally unique identifier for the allocation.")
|
|
90
|
+
@click.option("--body", required=True, help="The updated fields for the allocation.")
|
|
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 update_allocation(allocation: str, body: str, opt_fields: str | None) -> Any:
|
|
94
|
+
"""Update an allocation"""
|
|
95
|
+
parsed_body = resolve_body(body)
|
|
96
|
+
session = AsanaSession.from_env()
|
|
97
|
+
api = AllocationsApi(session.client)
|
|
98
|
+
opts: dict[str, Any] = {}
|
|
99
|
+
if opt_fields is not None:
|
|
100
|
+
opts["opt_fields"] = opt_fields
|
|
101
|
+
return api.update_allocation(parsed_body, allocation, opts)
|
|
@@ -0,0 +1,92 @@
|
|
|
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 AttachmentsApi
|
|
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("attachments")
|
|
14
|
+
def attachments_group() -> None:
|
|
15
|
+
"""Attachments commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@attachments_group.command("create-attachment-for-object")
|
|
19
|
+
@click.option("--connect-to-app", type=bool, default=None, help="")
|
|
20
|
+
@click.option("--file", default=None, help="")
|
|
21
|
+
@click.option("--name", default=None, help="")
|
|
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("--parent", default=None, help="")
|
|
24
|
+
@click.option("--resource-subtype", default=None, help="")
|
|
25
|
+
@click.option("--url", default=None, help="")
|
|
26
|
+
@formatted
|
|
27
|
+
def create_attachment_for_object(connect_to_app: bool | None, file: str | None, name: str | None, opt_fields: str | None, parent: str | None, resource_subtype: str | None, url: str | None) -> Any:
|
|
28
|
+
"""Upload an attachment"""
|
|
29
|
+
session = AsanaSession.from_env()
|
|
30
|
+
api = AttachmentsApi(session.client)
|
|
31
|
+
opts: dict[str, Any] = {}
|
|
32
|
+
if connect_to_app is not None:
|
|
33
|
+
opts["connect_to_app"] = connect_to_app
|
|
34
|
+
if file is not None:
|
|
35
|
+
opts["file"] = file
|
|
36
|
+
if name is not None:
|
|
37
|
+
opts["name"] = name
|
|
38
|
+
if opt_fields is not None:
|
|
39
|
+
opts["opt_fields"] = opt_fields
|
|
40
|
+
if parent is not None:
|
|
41
|
+
opts["parent"] = parent
|
|
42
|
+
if resource_subtype is not None:
|
|
43
|
+
opts["resource_subtype"] = resource_subtype
|
|
44
|
+
if url is not None:
|
|
45
|
+
opts["url"] = url
|
|
46
|
+
return api.create_attachment_for_object(opts)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@attachments_group.command("delete-attachment")
|
|
50
|
+
@click.option("--attachment", required=True, help="Globally unique identifier for the attachment. If the method is called asynchronously, returns the request thread.")
|
|
51
|
+
@formatted
|
|
52
|
+
def delete_attachment(attachment: str) -> Any:
|
|
53
|
+
"""Delete an attachment"""
|
|
54
|
+
session = AsanaSession.from_env()
|
|
55
|
+
api = AttachmentsApi(session.client)
|
|
56
|
+
opts: dict[str, Any] = {}
|
|
57
|
+
return api.delete_attachment(attachment)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@attachments_group.command("get-attachment")
|
|
61
|
+
@click.option("--attachment", required=True, help="Globally unique identifier for the attachment.")
|
|
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
|
+
@formatted
|
|
64
|
+
def get_attachment(attachment: str, opt_fields: str | None) -> Any:
|
|
65
|
+
"""Get an attachment"""
|
|
66
|
+
session = AsanaSession.from_env()
|
|
67
|
+
api = AttachmentsApi(session.client)
|
|
68
|
+
opts: dict[str, Any] = {}
|
|
69
|
+
if opt_fields is not None:
|
|
70
|
+
opts["opt_fields"] = opt_fields
|
|
71
|
+
return api.get_attachment(attachment, opts)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@attachments_group.command("get-attachments-for-object")
|
|
75
|
+
@click.option("--parent", required=True, help="Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`.")
|
|
76
|
+
@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.")
|
|
77
|
+
@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...")
|
|
78
|
+
@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...")
|
|
79
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
80
|
+
@formatted
|
|
81
|
+
def get_attachments_for_object(parent: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
|
|
82
|
+
"""Get attachments from an object"""
|
|
83
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
84
|
+
api = AttachmentsApi(session.client)
|
|
85
|
+
opts: dict[str, Any] = {}
|
|
86
|
+
if limit is not None:
|
|
87
|
+
opts["limit"] = limit
|
|
88
|
+
if offset is not None:
|
|
89
|
+
opts["offset"] = offset
|
|
90
|
+
if opt_fields is not None:
|
|
91
|
+
opts["opt_fields"] = opt_fields
|
|
92
|
+
return api.get_attachments_for_object(parent, opts)
|
|
@@ -0,0 +1,52 @@
|
|
|
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 AuditLogAPIApi
|
|
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("audit-log-api")
|
|
14
|
+
def audit_log_api_group() -> None:
|
|
15
|
+
"""AuditLogAPI commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@audit_log_api_group.command("get-audit-log-events")
|
|
19
|
+
@click.option("--workspace", default=None, help="Workspace GID (falls back to ASANA_DEFAULT_WORKSPACE)")
|
|
20
|
+
@click.option("--actor-gid", default=None, help="Filter to events triggered by the actor with this ID.")
|
|
21
|
+
@click.option("--actor-type", default=None, help="Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded.")
|
|
22
|
+
@click.option("--end-at", default=None, help="Filter to events created before this time (exclusive).")
|
|
23
|
+
@click.option("--event-type", default=None, help="Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values.")
|
|
24
|
+
@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.")
|
|
25
|
+
@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...")
|
|
26
|
+
@click.option("--resource-gid", default=None, help="Filter to events with this resource ID.")
|
|
27
|
+
@click.option("--start-at", default=None, help="Filter to events created after this time (inclusive).")
|
|
28
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
29
|
+
@formatted
|
|
30
|
+
def get_audit_log_events(workspace: str | None, actor_gid: str | None, actor_type: str | None, end_at: str | None, event_type: str | None, limit: int | None, offset: str | None, resource_gid: str | None, start_at: str | None, paginate: bool) -> Any:
|
|
31
|
+
"""Get audit log events"""
|
|
32
|
+
resolved_workspace = resolve_workspace(workspace, required=True)
|
|
33
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
34
|
+
api = AuditLogAPIApi(session.client)
|
|
35
|
+
opts: dict[str, Any] = {}
|
|
36
|
+
if actor_gid is not None:
|
|
37
|
+
opts["actor_gid"] = actor_gid
|
|
38
|
+
if actor_type is not None:
|
|
39
|
+
opts["actor_type"] = actor_type
|
|
40
|
+
if end_at is not None:
|
|
41
|
+
opts["end_at"] = end_at
|
|
42
|
+
if event_type is not None:
|
|
43
|
+
opts["event_type"] = event_type
|
|
44
|
+
if limit is not None:
|
|
45
|
+
opts["limit"] = limit
|
|
46
|
+
if offset is not None:
|
|
47
|
+
opts["offset"] = offset
|
|
48
|
+
if resource_gid is not None:
|
|
49
|
+
opts["resource_gid"] = resource_gid
|
|
50
|
+
if start_at is not None:
|
|
51
|
+
opts["start_at"] = start_at
|
|
52
|
+
return api.get_audit_log_events(resolved_workspace, opts)
|
|
@@ -0,0 +1,30 @@
|
|
|
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 BatchAPIApi
|
|
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("batch-api")
|
|
14
|
+
def batch_api_group() -> None:
|
|
15
|
+
"""BatchAPI commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@batch_api_group.command("create-batch-request")
|
|
19
|
+
@click.option("--body", required=True, help="The requests to batch together via the Batch API.")
|
|
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_batch_request(body: str, opt_fields: str | None) -> Any:
|
|
23
|
+
"""Submit parallel requests"""
|
|
24
|
+
parsed_body = resolve_body(body)
|
|
25
|
+
session = AsanaSession.from_env()
|
|
26
|
+
api = BatchAPIApi(session.client)
|
|
27
|
+
opts: dict[str, Any] = {}
|
|
28
|
+
if opt_fields is not None:
|
|
29
|
+
opts["opt_fields"] = opt_fields
|
|
30
|
+
return api.create_batch_request(parsed_body, opts)
|
|
@@ -0,0 +1,79 @@
|
|
|
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 BudgetsApi
|
|
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("budgets")
|
|
14
|
+
def budgets_group() -> None:
|
|
15
|
+
"""Budgets commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@budgets_group.command("create-budget")
|
|
19
|
+
@click.option("--body", required=True, help="The budget to create. If the method is called asynchronously, returns the request thread.")
|
|
20
|
+
@formatted
|
|
21
|
+
def create_budget(body: str) -> Any:
|
|
22
|
+
"""Create a budget"""
|
|
23
|
+
parsed_body = resolve_body(body)
|
|
24
|
+
session = AsanaSession.from_env()
|
|
25
|
+
api = BudgetsApi(session.client)
|
|
26
|
+
opts: dict[str, Any] = {}
|
|
27
|
+
return api.create_budget(parsed_body)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@budgets_group.command("delete-budget")
|
|
31
|
+
@click.option("--budget", required=True, help="Globally unique identifier for the budget. If the method is called asynchronously, returns the request thread.")
|
|
32
|
+
@formatted
|
|
33
|
+
def delete_budget(budget: str) -> Any:
|
|
34
|
+
"""Delete a budget"""
|
|
35
|
+
session = AsanaSession.from_env()
|
|
36
|
+
api = BudgetsApi(session.client)
|
|
37
|
+
opts: dict[str, Any] = {}
|
|
38
|
+
return api.delete_budget(budget)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@budgets_group.command("get-budget")
|
|
42
|
+
@click.option("--budget", required=True, help="Globally unique identifier for the budget.")
|
|
43
|
+
@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...")
|
|
44
|
+
@formatted
|
|
45
|
+
def get_budget(budget: str, opt_fields: str | None) -> Any:
|
|
46
|
+
"""Get a budget"""
|
|
47
|
+
session = AsanaSession.from_env()
|
|
48
|
+
api = BudgetsApi(session.client)
|
|
49
|
+
opts: dict[str, Any] = {}
|
|
50
|
+
if opt_fields is not None:
|
|
51
|
+
opts["opt_fields"] = opt_fields
|
|
52
|
+
return api.get_budget(budget, opts)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@budgets_group.command("get-budgets")
|
|
56
|
+
@click.option("--parent", required=True, help="Globally unique identifier for the budget's parent object. This currently can only be a `project`. If the method is called asynchronously, returns the request thread.")
|
|
57
|
+
@formatted
|
|
58
|
+
def get_budgets(parent: str) -> Any:
|
|
59
|
+
"""Get all budgets"""
|
|
60
|
+
session = AsanaSession.from_env()
|
|
61
|
+
api = BudgetsApi(session.client)
|
|
62
|
+
opts: dict[str, Any] = {}
|
|
63
|
+
return api.get_budgets(parent)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@budgets_group.command("update-budget")
|
|
67
|
+
@click.option("--budget", required=True, help="Globally unique identifier for the budget.")
|
|
68
|
+
@click.option("--body", required=True, help="The budget to update.")
|
|
69
|
+
@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...")
|
|
70
|
+
@formatted
|
|
71
|
+
def update_budget(budget: str, body: str, opt_fields: str | None) -> Any:
|
|
72
|
+
"""Update a budget"""
|
|
73
|
+
parsed_body = resolve_body(body)
|
|
74
|
+
session = AsanaSession.from_env()
|
|
75
|
+
api = BudgetsApi(session.client)
|
|
76
|
+
opts: dict[str, Any] = {}
|
|
77
|
+
if opt_fields is not None:
|
|
78
|
+
opts["opt_fields"] = opt_fields
|
|
79
|
+
return api.update_budget(parsed_body, budget, opts)
|
|
@@ -0,0 +1,92 @@
|
|
|
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 CustomFieldSettingsApi
|
|
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-field-settings")
|
|
14
|
+
def custom_field_settings_group() -> None:
|
|
15
|
+
"""CustomFieldSettings commands."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@custom_field_settings_group.command("get-custom-field-settings-for-goal")
|
|
19
|
+
@click.option("--goal", required=True, help="Globally unique identifier for the goal.")
|
|
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 get_custom_field_settings_for_goal(goal: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
|
|
26
|
+
"""Get a goal's custom fields"""
|
|
27
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
28
|
+
api = CustomFieldSettingsApi(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
|
+
if opt_fields is not None:
|
|
35
|
+
opts["opt_fields"] = opt_fields
|
|
36
|
+
return api.get_custom_field_settings_for_goal(goal, opts)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@custom_field_settings_group.command("get-custom-field-settings-for-portfolio")
|
|
40
|
+
@click.option("--portfolio", required=True, help="Globally unique identifier for the portfolio.")
|
|
41
|
+
@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.")
|
|
42
|
+
@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...")
|
|
43
|
+
@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...")
|
|
44
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
45
|
+
@formatted
|
|
46
|
+
def get_custom_field_settings_for_portfolio(portfolio: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
|
|
47
|
+
"""Get a portfolio's custom fields"""
|
|
48
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
49
|
+
api = CustomFieldSettingsApi(session.client)
|
|
50
|
+
opts: dict[str, Any] = {}
|
|
51
|
+
if limit is not None:
|
|
52
|
+
opts["limit"] = limit
|
|
53
|
+
if offset is not None:
|
|
54
|
+
opts["offset"] = offset
|
|
55
|
+
if opt_fields is not None:
|
|
56
|
+
opts["opt_fields"] = opt_fields
|
|
57
|
+
return api.get_custom_field_settings_for_portfolio(portfolio, opts)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@custom_field_settings_group.command("get-custom-field-settings-for-project")
|
|
61
|
+
@click.option("--project", required=True, help="Globally unique identifier for the project.")
|
|
62
|
+
@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.")
|
|
63
|
+
@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...")
|
|
64
|
+
@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...")
|
|
65
|
+
@click.option("--paginate", is_flag=True, default=False, help="Fetch all pages")
|
|
66
|
+
@formatted
|
|
67
|
+
def get_custom_field_settings_for_project(project: str, limit: int | None, offset: str | None, opt_fields: str | None, paginate: bool) -> Any:
|
|
68
|
+
"""Get a project's custom fields"""
|
|
69
|
+
session = AsanaSession.from_env(paginate=paginate)
|
|
70
|
+
api = CustomFieldSettingsApi(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
|
+
return api.get_custom_field_settings_for_project(project, opts)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@custom_field_settings_group.command("get-custom-field-settings-for-team")
|
|
82
|
+
@click.option("--team", required=True, help="Globally unique identifier for the team.")
|
|
83
|
+
@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...")
|
|
84
|
+
@formatted
|
|
85
|
+
def get_custom_field_settings_for_team(team: str, opt_fields: str | None) -> Any:
|
|
86
|
+
"""Get a team's custom fields"""
|
|
87
|
+
session = AsanaSession.from_env()
|
|
88
|
+
api = CustomFieldSettingsApi(session.client)
|
|
89
|
+
opts: dict[str, Any] = {}
|
|
90
|
+
if opt_fields is not None:
|
|
91
|
+
opts["opt_fields"] = opt_fields
|
|
92
|
+
return api.get_custom_field_settings_for_team(team, opts)
|