docket-client 0.3.2__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.
- docket/__init__.py +8 -0
- docket/api/__init__.py +1 -0
- docket/api/access/__init__.py +1 -0
- docket/api/access/add_principal.py +193 -0
- docket/api/access/archive_role_assignment.py +182 -0
- docket/api/access/create_api_token.py +198 -0
- docket/api/access/create_application_principal.py +188 -0
- docket/api/access/create_role_assignment.py +194 -0
- docket/api/access/list_api_tokens.py +184 -0
- docket/api/access/list_principals.py +184 -0
- docket/api/access/list_role_assignments.py +200 -0
- docket/api/access/revoke_api_token.py +173 -0
- docket/api/identity/__init__.py +1 -0
- docket/api/identity/create_my_api_token.py +206 -0
- docket/api/identity/get_me.py +127 -0
- docket/api/identity/list_my_api_tokens.py +151 -0
- docket/api/identity/revoke_my_api_token.py +178 -0
- docket/api/recurring_acquisitions/__init__.py +1 -0
- docket/api/recurring_acquisitions/archive_recurring_acquisition.py +207 -0
- docket/api/recurring_acquisitions/create_recurring_acquisition.py +218 -0
- docket/api/recurring_acquisitions/get_recurring_acquisition.py +163 -0
- docket/api/recurring_acquisitions/list_recurring_acquisitions.py +248 -0
- docket/api/recurring_acquisitions/preview_recurring_acquisition.py +187 -0
- docket/api/recurring_acquisitions/preview_split_recurring_acquisition.py +232 -0
- docket/api/recurring_acquisitions/split_recurring_acquisition.py +258 -0
- docket/api/runs/__init__.py +1 -0
- docket/api/runs/get_run.py +160 -0
- docket/api/runs/list_runs.py +180 -0
- docket/api/runs/report_run_outcome.py +206 -0
- docket/api/scheduled_acquisitions/__init__.py +1 -0
- docket/api/scheduled_acquisitions/archive_scheduled_acquisition.py +203 -0
- docket/api/scheduled_acquisitions/create_scheduled_acquisition.py +185 -0
- docket/api/scheduled_acquisitions/get_resolved_settings.py +169 -0
- docket/api/scheduled_acquisitions/get_scheduled_acquisition.py +159 -0
- docket/api/scheduled_acquisitions/list_active_acquisitions.py +297 -0
- docket/api/scheduled_acquisitions/list_runs_for_scheduled_acquisition.py +191 -0
- docket/api/scheduled_acquisitions/list_scheduled_acquisitions.py +332 -0
- docket/api/scheduled_acquisitions/preview_scheduled_acquisition_edit.py +224 -0
- docket/api/scheduled_acquisitions/set_planning_status.py +199 -0
- docket/api/scheduled_acquisitions/start_run.py +221 -0
- docket/api/scheduled_acquisitions/update_scheduled_acquisition.py +226 -0
- docket/api/settings/__init__.py +1 -0
- docket/api/settings/list_behavior_curriculum_discriminator_values.py +188 -0
- docket/api/settings/list_behavior_curriculum_settings.py +199 -0
- docket/api/settings/list_fip_discriminator_values.py +184 -0
- docket/api/settings/list_fip_settings.py +195 -0
- docket/api/settings/list_live_behavior_curriculum_settings.py +233 -0
- docket/api/settings/list_live_fip_settings.py +225 -0
- docket/api/settings/preview_behavior_curriculum_settings.py +191 -0
- docket/api/settings/preview_fip_settings.py +177 -0
- docket/api/settings/push_behavior_curriculum_settings.py +222 -0
- docket/api/settings/push_fip_settings.py +206 -0
- docket/api/templates/__init__.py +1 -0
- docket/api/templates/archive_template.py +203 -0
- docket/api/templates/create_template.py +206 -0
- docket/api/templates/get_template.py +159 -0
- docket/api/templates/list_templates.py +174 -0
- docket/api/templates/update_template.py +234 -0
- docket/api/vocabulary/__init__.py +1 -0
- docket/api/vocabulary/list_instruments.py +165 -0
- docket/api/vocabulary/list_persons.py +132 -0
- docket/api/vocabulary/list_projects.py +132 -0
- docket/api/vocabulary/list_subjects.py +132 -0
- docket/api/vocabulary/lookup_person.py +166 -0
- docket/api/vocabulary/lookup_subject.py +166 -0
- docket/api/vocabulary/sync_vocabulary.py +148 -0
- docket/client.py +272 -0
- docket/errors.py +16 -0
- docket/models/__init__.py +221 -0
- docket/models/access_role.py +12 -0
- docket/models/access_role_nullable_type_1.py +12 -0
- docket/models/access_role_nullable_type_2_type_1.py +12 -0
- docket/models/access_role_nullable_type_3_type_1.py +12 -0
- docket/models/acquisition_variable.py +72 -0
- docket/models/acquisition_warning.py +126 -0
- docket/models/add_principal_request.py +83 -0
- docket/models/api_token_response.py +271 -0
- docket/models/api_token_status.py +10 -0
- docket/models/archive_recurring_acquisition_request.py +77 -0
- docket/models/archive_recurring_acquisition_response.py +83 -0
- docket/models/archive_scheduled_acquisition_request.py +78 -0
- docket/models/archive_template_request.py +66 -0
- docket/models/auth_mode.py +10 -0
- docket/models/behavior_curriculum_push_settings_request.py +85 -0
- docket/models/behavior_curriculum_settings.py +55 -0
- docket/models/behavior_curriculum_settings_preview_response.py +102 -0
- docket/models/behavior_curriculum_settings_preview_response_promoted.py +50 -0
- docket/models/behavior_curriculum_settings_version_response.py +160 -0
- docket/models/behavior_curriculum_settings_version_response_promoted.py +50 -0
- docket/models/caller_kind.py +11 -0
- docket/models/create_api_token_request.py +97 -0
- docket/models/create_application_principal_request.py +65 -0
- docket/models/create_personal_api_token_request.py +167 -0
- docket/models/create_recurring_acquisition_request.py +269 -0
- docket/models/create_role_assignment_request.py +99 -0
- docket/models/create_scheduled_acquisition_request.py +265 -0
- docket/models/create_template_request.py +323 -0
- docket/models/created_api_token_response.py +82 -0
- docket/models/effective_status.py +15 -0
- docket/models/fip_color.py +13 -0
- docket/models/fip_fiber.py +93 -0
- docket/models/fip_mode.py +9 -0
- docket/models/fip_push_settings_request.py +82 -0
- docket/models/fip_settings.py +91 -0
- docket/models/fip_settings_preview_response.py +97 -0
- docket/models/fip_settings_preview_response_promoted.py +50 -0
- docket/models/fip_settings_version_response.py +155 -0
- docket/models/fip_settings_version_response_promoted.py +50 -0
- docket/models/future_occurrences.py +9 -0
- docket/models/get_resolved_settings_response_200.py +65 -0
- docket/models/held_role_response.py +116 -0
- docket/models/http_validation_problem_details.py +204 -0
- docket/models/http_validation_problem_details_errors.py +59 -0
- docket/models/instrument_response.py +91 -0
- docket/models/kept_occurrence.py +85 -0
- docket/models/kept_occurrence_reason.py +10 -0
- docket/models/list_active_acquisitions_effective_status_item.py +15 -0
- docket/models/list_scheduled_acquisitions_planning_status.py +11 -0
- docket/models/me_caller.py +118 -0
- docket/models/me_permission.py +98 -0
- docket/models/me_response.py +158 -0
- docket/models/me_role.py +75 -0
- docket/models/occurrence_preview.py +121 -0
- docket/models/occurrence_summary.py +126 -0
- docket/models/occurrence_warnings.py +91 -0
- docket/models/permission_action.py +12 -0
- docket/models/person_assignment.py +74 -0
- docket/models/person_lookup_response.py +131 -0
- docket/models/person_response.py +103 -0
- docket/models/person_role.py +9 -0
- docket/models/personal_token_limits.py +92 -0
- docket/models/planning_status.py +11 -0
- docket/models/principal_kind.py +9 -0
- docket/models/principal_response.py +216 -0
- docket/models/problem_details.py +177 -0
- docket/models/project_response.py +75 -0
- docket/models/recurrence_exception_kind.py +13 -0
- docket/models/recurrence_exception_response.py +103 -0
- docket/models/recurrence_frequency.py +9 -0
- docket/models/recurrence_preview_response.py +101 -0
- docket/models/recurrence_rule.py +207 -0
- docket/models/recurring_acquisition_created_response.py +123 -0
- docket/models/recurring_acquisition_detail_response.py +105 -0
- docket/models/recurring_acquisition_response.py +326 -0
- docket/models/report_run_outcome_request.py +89 -0
- docket/models/resolution_mode.py +10 -0
- docket/models/resolved_settings.py +73 -0
- docket/models/role_assignment_response.py +157 -0
- docket/models/role_origin.py +10 -0
- docket/models/role_source_kind.py +10 -0
- docket/models/run_origin.py +9 -0
- docket/models/run_outcome.py +9 -0
- docket/models/run_response.py +181 -0
- docket/models/run_settings_snapshot.py +72 -0
- docket/models/run_start_response.py +91 -0
- docket/models/run_start_response_settings.py +65 -0
- docket/models/run_status.py +11 -0
- docket/models/scheduled_acquisition_edit_preview_response.py +150 -0
- docket/models/scheduled_acquisition_response.py +366 -0
- docket/models/set_planning_status_request.py +90 -0
- docket/models/settings_selector.py +138 -0
- docket/models/skipped_occurrence.py +85 -0
- docket/models/split_preview_response.py +129 -0
- docket/models/split_recurring_acquisition_request.py +261 -0
- docket/models/split_recurring_acquisition_response.py +159 -0
- docket/models/start_run_request.py +73 -0
- docket/models/subject_lookup_response.py +149 -0
- docket/models/subject_response.py +128 -0
- docket/models/sync_counts.py +80 -0
- docket/models/sync_response.py +81 -0
- docket/models/template_response.py +302 -0
- docket/models/update_scheduled_acquisition_request.py +235 -0
- docket/models/update_template_request.py +279 -0
- docket/models/weekday.py +14 -0
- docket/types.py +54 -0
- docket_auth/__init__.py +239 -0
- docket_client-0.3.2.dist-info/METADATA +233 -0
- docket_client-0.3.2.dist-info/RECORD +188 -0
- docket_client-0.3.2.dist-info/WHEEL +4 -0
- docket_client-0.3.2.dist-info/entry_points.txt +2 -0
- docket_mcp/__init__.py +6 -0
- docket_mcp/api.py +207 -0
- docket_mcp/config.py +57 -0
- docket_mcp/server.py +78 -0
- docket_mcp/signin.py +155 -0
- docket_mcp/slots.py +80 -0
- docket_mcp/times.py +160 -0
- docket_mcp/tools.py +1202 -0
docket/__init__.py
ADDED
docket/api/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.add_principal_request import AddPrincipalRequest
|
|
12
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
13
|
+
from ...models.principal_response import PrincipalResponse
|
|
14
|
+
from ...models.problem_details import ProblemDetails
|
|
15
|
+
from typing import cast
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
body: AddPrincipalRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": "/api/v1/access/principals",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
39
|
+
) -> HttpValidationProblemDetails | PrincipalResponse | ProblemDetails | None:
|
|
40
|
+
if response.status_code == 201:
|
|
41
|
+
response_201 = PrincipalResponse.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_201
|
|
44
|
+
|
|
45
|
+
if response.status_code == 401:
|
|
46
|
+
response_401 = ProblemDetails.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_401
|
|
49
|
+
|
|
50
|
+
if response.status_code == 403:
|
|
51
|
+
response_403 = ProblemDetails.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_403
|
|
54
|
+
|
|
55
|
+
if response.status_code == 409:
|
|
56
|
+
response_409 = ProblemDetails.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_409
|
|
59
|
+
|
|
60
|
+
if response.status_code == 422:
|
|
61
|
+
response_422 = HttpValidationProblemDetails.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
return response_422
|
|
64
|
+
|
|
65
|
+
if client.raise_on_unexpected_status:
|
|
66
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
67
|
+
else:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _build_response(
|
|
72
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
73
|
+
) -> Response[HttpValidationProblemDetails | PrincipalResponse | ProblemDetails]:
|
|
74
|
+
return Response(
|
|
75
|
+
status_code=HTTPStatus(response.status_code),
|
|
76
|
+
content=response.content,
|
|
77
|
+
headers=response.headers,
|
|
78
|
+
parsed=_parse_response(client=client, response=response),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def sync_detailed(
|
|
83
|
+
*,
|
|
84
|
+
client: AuthenticatedClient,
|
|
85
|
+
body: AddPrincipalRequest,
|
|
86
|
+
) -> Response[HttpValidationProblemDetails | PrincipalResponse | ProblemDetails]:
|
|
87
|
+
"""Register a principal by Entra object id before it has signed in (how rig applications with an Entra
|
|
88
|
+
registration are added). Admin only.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
body (AddPrincipalRequest): Registers a principal before it has signed in (how rig
|
|
92
|
+
applications are added).
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
96
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Response[HttpValidationProblemDetails | PrincipalResponse | ProblemDetails]
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
kwargs = _get_kwargs(
|
|
103
|
+
body=body,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def sync(
|
|
114
|
+
*,
|
|
115
|
+
client: AuthenticatedClient,
|
|
116
|
+
body: AddPrincipalRequest,
|
|
117
|
+
) -> HttpValidationProblemDetails | PrincipalResponse | ProblemDetails | None:
|
|
118
|
+
"""Register a principal by Entra object id before it has signed in (how rig applications with an Entra
|
|
119
|
+
registration are added). Admin only.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
body (AddPrincipalRequest): Registers a principal before it has signed in (how rig
|
|
123
|
+
applications are added).
|
|
124
|
+
|
|
125
|
+
Raises:
|
|
126
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
127
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
HttpValidationProblemDetails | PrincipalResponse | ProblemDetails
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
return sync_detailed(
|
|
134
|
+
client=client,
|
|
135
|
+
body=body,
|
|
136
|
+
).parsed
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
async def asyncio_detailed(
|
|
140
|
+
*,
|
|
141
|
+
client: AuthenticatedClient,
|
|
142
|
+
body: AddPrincipalRequest,
|
|
143
|
+
) -> Response[HttpValidationProblemDetails | PrincipalResponse | ProblemDetails]:
|
|
144
|
+
"""Register a principal by Entra object id before it has signed in (how rig applications with an Entra
|
|
145
|
+
registration are added). Admin only.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
body (AddPrincipalRequest): Registers a principal before it has signed in (how rig
|
|
149
|
+
applications are added).
|
|
150
|
+
|
|
151
|
+
Raises:
|
|
152
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
153
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Response[HttpValidationProblemDetails | PrincipalResponse | ProblemDetails]
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
kwargs = _get_kwargs(
|
|
160
|
+
body=body,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
164
|
+
|
|
165
|
+
return _build_response(client=client, response=response)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
async def asyncio(
|
|
169
|
+
*,
|
|
170
|
+
client: AuthenticatedClient,
|
|
171
|
+
body: AddPrincipalRequest,
|
|
172
|
+
) -> HttpValidationProblemDetails | PrincipalResponse | ProblemDetails | None:
|
|
173
|
+
"""Register a principal by Entra object id before it has signed in (how rig applications with an Entra
|
|
174
|
+
registration are added). Admin only.
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
body (AddPrincipalRequest): Registers a principal before it has signed in (how rig
|
|
178
|
+
applications are added).
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
182
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
HttpValidationProblemDetails | PrincipalResponse | ProblemDetails
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
await asyncio_detailed(
|
|
190
|
+
client=client,
|
|
191
|
+
body=body,
|
|
192
|
+
)
|
|
193
|
+
).parsed
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.problem_details import ProblemDetails
|
|
12
|
+
from ...models.role_assignment_response import RoleAssignmentResponse
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
id: int,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/api/v1/access/assignments/{id}/archive".format(
|
|
23
|
+
id=quote(str(id), safe=""),
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return _kwargs
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _parse_response(
|
|
31
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
32
|
+
) -> ProblemDetails | RoleAssignmentResponse | None:
|
|
33
|
+
if response.status_code == 200:
|
|
34
|
+
response_200 = RoleAssignmentResponse.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_200
|
|
37
|
+
|
|
38
|
+
if response.status_code == 401:
|
|
39
|
+
response_401 = ProblemDetails.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_401
|
|
42
|
+
|
|
43
|
+
if response.status_code == 403:
|
|
44
|
+
response_403 = ProblemDetails.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_403
|
|
47
|
+
|
|
48
|
+
if response.status_code == 404:
|
|
49
|
+
response_404 = ProblemDetails.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_404
|
|
52
|
+
|
|
53
|
+
if response.status_code == 409:
|
|
54
|
+
response_409 = ProblemDetails.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_409
|
|
57
|
+
|
|
58
|
+
if client.raise_on_unexpected_status:
|
|
59
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
+
else:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _build_response(
|
|
65
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
66
|
+
) -> Response[ProblemDetails | RoleAssignmentResponse]:
|
|
67
|
+
return Response(
|
|
68
|
+
status_code=HTTPStatus(response.status_code),
|
|
69
|
+
content=response.content,
|
|
70
|
+
headers=response.headers,
|
|
71
|
+
parsed=_parse_response(client=client, response=response),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def sync_detailed(
|
|
76
|
+
id: int,
|
|
77
|
+
*,
|
|
78
|
+
client: AuthenticatedClient,
|
|
79
|
+
) -> Response[ProblemDetails | RoleAssignmentResponse]:
|
|
80
|
+
"""Remove a role (archive the assignment). The last Admin cannot be removed unless bootstrap admins are
|
|
81
|
+
configured (409 last_admin). Admin only.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
id (int):
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
88
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Response[ProblemDetails | RoleAssignmentResponse]
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs(
|
|
95
|
+
id=id,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
response = client.get_httpx_client().request(
|
|
99
|
+
**kwargs,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return _build_response(client=client, response=response)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def sync(
|
|
106
|
+
id: int,
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient,
|
|
109
|
+
) -> ProblemDetails | RoleAssignmentResponse | None:
|
|
110
|
+
"""Remove a role (archive the assignment). The last Admin cannot be removed unless bootstrap admins are
|
|
111
|
+
configured (409 last_admin). Admin only.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
id (int):
|
|
115
|
+
|
|
116
|
+
Raises:
|
|
117
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
ProblemDetails | RoleAssignmentResponse
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
return sync_detailed(
|
|
125
|
+
id=id,
|
|
126
|
+
client=client,
|
|
127
|
+
).parsed
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
async def asyncio_detailed(
|
|
131
|
+
id: int,
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient,
|
|
134
|
+
) -> Response[ProblemDetails | RoleAssignmentResponse]:
|
|
135
|
+
"""Remove a role (archive the assignment). The last Admin cannot be removed unless bootstrap admins are
|
|
136
|
+
configured (409 last_admin). Admin only.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
id (int):
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Response[ProblemDetails | RoleAssignmentResponse]
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
kwargs = _get_kwargs(
|
|
150
|
+
id=id,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
154
|
+
|
|
155
|
+
return _build_response(client=client, response=response)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
async def asyncio(
|
|
159
|
+
id: int,
|
|
160
|
+
*,
|
|
161
|
+
client: AuthenticatedClient,
|
|
162
|
+
) -> ProblemDetails | RoleAssignmentResponse | None:
|
|
163
|
+
"""Remove a role (archive the assignment). The last Admin cannot be removed unless bootstrap admins are
|
|
164
|
+
configured (409 last_admin). Admin only.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
id (int):
|
|
168
|
+
|
|
169
|
+
Raises:
|
|
170
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
171
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
172
|
+
|
|
173
|
+
Returns:
|
|
174
|
+
ProblemDetails | RoleAssignmentResponse
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
await asyncio_detailed(
|
|
179
|
+
id=id,
|
|
180
|
+
client=client,
|
|
181
|
+
)
|
|
182
|
+
).parsed
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.create_api_token_request import CreateApiTokenRequest
|
|
12
|
+
from ...models.created_api_token_response import CreatedApiTokenResponse
|
|
13
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
14
|
+
from ...models.problem_details import ProblemDetails
|
|
15
|
+
from typing import cast
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
body: CreateApiTokenRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": "/api/v1/access/tokens",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
39
|
+
) -> CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails | None:
|
|
40
|
+
if response.status_code == 201:
|
|
41
|
+
response_201 = CreatedApiTokenResponse.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_201
|
|
44
|
+
|
|
45
|
+
if response.status_code == 401:
|
|
46
|
+
response_401 = ProblemDetails.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_401
|
|
49
|
+
|
|
50
|
+
if response.status_code == 403:
|
|
51
|
+
response_403 = ProblemDetails.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_403
|
|
54
|
+
|
|
55
|
+
if response.status_code == 404:
|
|
56
|
+
response_404 = ProblemDetails.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_404
|
|
59
|
+
|
|
60
|
+
if response.status_code == 409:
|
|
61
|
+
response_409 = ProblemDetails.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
return response_409
|
|
64
|
+
|
|
65
|
+
if response.status_code == 422:
|
|
66
|
+
response_422 = HttpValidationProblemDetails.from_dict(response.json())
|
|
67
|
+
|
|
68
|
+
return response_422
|
|
69
|
+
|
|
70
|
+
if client.raise_on_unexpected_status:
|
|
71
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
72
|
+
else:
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _build_response(
|
|
77
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
78
|
+
) -> Response[CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails]:
|
|
79
|
+
return Response(
|
|
80
|
+
status_code=HTTPStatus(response.status_code),
|
|
81
|
+
content=response.content,
|
|
82
|
+
headers=response.headers,
|
|
83
|
+
parsed=_parse_response(client=client, response=response),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def sync_detailed(
|
|
88
|
+
*,
|
|
89
|
+
client: AuthenticatedClient,
|
|
90
|
+
body: CreateApiTokenRequest,
|
|
91
|
+
) -> Response[CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails]:
|
|
92
|
+
"""Issue an API token for a principal. The full token is in this response only; it is not stored and
|
|
93
|
+
cannot be shown again. It acts as the principal and has exactly its roles. Not available for
|
|
94
|
+
bootstrap admins. Admin only.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
body (CreateApiTokenRequest): Issues an API token.
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
101
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
Response[CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails]
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
kwargs = _get_kwargs(
|
|
108
|
+
body=body,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
response = client.get_httpx_client().request(
|
|
112
|
+
**kwargs,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return _build_response(client=client, response=response)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def sync(
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient,
|
|
121
|
+
body: CreateApiTokenRequest,
|
|
122
|
+
) -> CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails | None:
|
|
123
|
+
"""Issue an API token for a principal. The full token is in this response only; it is not stored and
|
|
124
|
+
cannot be shown again. It acts as the principal and has exactly its roles. Not available for
|
|
125
|
+
bootstrap admins. Admin only.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
body (CreateApiTokenRequest): Issues an API token.
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
return sync_detailed(
|
|
139
|
+
client=client,
|
|
140
|
+
body=body,
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio_detailed(
|
|
145
|
+
*,
|
|
146
|
+
client: AuthenticatedClient,
|
|
147
|
+
body: CreateApiTokenRequest,
|
|
148
|
+
) -> Response[CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails]:
|
|
149
|
+
"""Issue an API token for a principal. The full token is in this response only; it is not stored and
|
|
150
|
+
cannot be shown again. It acts as the principal and has exactly its roles. Not available for
|
|
151
|
+
bootstrap admins. Admin only.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
body (CreateApiTokenRequest): Issues an API token.
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
158
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
Response[CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails]
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
kwargs = _get_kwargs(
|
|
165
|
+
body=body,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
169
|
+
|
|
170
|
+
return _build_response(client=client, response=response)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
async def asyncio(
|
|
174
|
+
*,
|
|
175
|
+
client: AuthenticatedClient,
|
|
176
|
+
body: CreateApiTokenRequest,
|
|
177
|
+
) -> CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails | None:
|
|
178
|
+
"""Issue an API token for a principal. The full token is in this response only; it is not stored and
|
|
179
|
+
cannot be shown again. It acts as the principal and has exactly its roles. Not available for
|
|
180
|
+
bootstrap admins. Admin only.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
body (CreateApiTokenRequest): Issues an API token.
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
CreatedApiTokenResponse | HttpValidationProblemDetails | ProblemDetails
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
await asyncio_detailed(
|
|
195
|
+
client=client,
|
|
196
|
+
body=body,
|
|
197
|
+
)
|
|
198
|
+
).parsed
|