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