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/client.py
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import ssl
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from attrs import define, field, evolve
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@define
|
|
9
|
+
class Client:
|
|
10
|
+
"""A class for keeping track of data related to the API
|
|
11
|
+
|
|
12
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
13
|
+
|
|
14
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
15
|
+
|
|
16
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
17
|
+
|
|
18
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
19
|
+
|
|
20
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
21
|
+
httpx.TimeoutException if this is exceeded.
|
|
22
|
+
|
|
23
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
24
|
+
but can be set to False for testing purposes.
|
|
25
|
+
|
|
26
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
27
|
+
|
|
28
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Attributes:
|
|
32
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
33
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
|
+
argument to the constructor.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
|
+
_base_url: str = field(alias="base_url")
|
|
39
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
40
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
41
|
+
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
42
|
+
_verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl")
|
|
43
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
44
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
45
|
+
_client: httpx.Client | None = field(default=None, init=False)
|
|
46
|
+
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
|
47
|
+
|
|
48
|
+
def with_headers(self, headers: dict[str, str]) -> "Client":
|
|
49
|
+
"""Get a new client matching this one with additional headers"""
|
|
50
|
+
if self._client is not None:
|
|
51
|
+
self._client.headers.update(headers)
|
|
52
|
+
if self._async_client is not None:
|
|
53
|
+
self._async_client.headers.update(headers)
|
|
54
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
55
|
+
|
|
56
|
+
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
|
57
|
+
"""Get a new client matching this one with additional cookies"""
|
|
58
|
+
if self._client is not None:
|
|
59
|
+
self._client.cookies.update(cookies)
|
|
60
|
+
if self._async_client is not None:
|
|
61
|
+
self._async_client.cookies.update(cookies)
|
|
62
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
63
|
+
|
|
64
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
|
65
|
+
"""Get a new client matching this one with a new timeout configuration"""
|
|
66
|
+
if self._client is not None:
|
|
67
|
+
self._client.timeout = timeout
|
|
68
|
+
if self._async_client is not None:
|
|
69
|
+
self._async_client.timeout = timeout
|
|
70
|
+
return evolve(self, timeout=timeout)
|
|
71
|
+
|
|
72
|
+
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
|
73
|
+
"""Manually set the underlying httpx.Client
|
|
74
|
+
|
|
75
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
76
|
+
"""
|
|
77
|
+
self._client = client
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
81
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
82
|
+
if self._client is None:
|
|
83
|
+
self._client = httpx.Client(
|
|
84
|
+
base_url=self._base_url,
|
|
85
|
+
cookies=self._cookies,
|
|
86
|
+
headers=self._headers,
|
|
87
|
+
timeout=self._timeout,
|
|
88
|
+
verify=self._verify_ssl,
|
|
89
|
+
follow_redirects=self._follow_redirects,
|
|
90
|
+
**self._httpx_args,
|
|
91
|
+
)
|
|
92
|
+
return self._client
|
|
93
|
+
|
|
94
|
+
def __enter__(self) -> "Client":
|
|
95
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
96
|
+
self.get_httpx_client().__enter__()
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
100
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
101
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
102
|
+
|
|
103
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
|
104
|
+
"""Manually set the underlying httpx.AsyncClient
|
|
105
|
+
|
|
106
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
107
|
+
"""
|
|
108
|
+
self._async_client = async_client
|
|
109
|
+
return self
|
|
110
|
+
|
|
111
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
112
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
113
|
+
if self._async_client is None:
|
|
114
|
+
self._async_client = httpx.AsyncClient(
|
|
115
|
+
base_url=self._base_url,
|
|
116
|
+
cookies=self._cookies,
|
|
117
|
+
headers=self._headers,
|
|
118
|
+
timeout=self._timeout,
|
|
119
|
+
verify=self._verify_ssl,
|
|
120
|
+
follow_redirects=self._follow_redirects,
|
|
121
|
+
**self._httpx_args,
|
|
122
|
+
)
|
|
123
|
+
return self._async_client
|
|
124
|
+
|
|
125
|
+
async def __aenter__(self) -> "Client":
|
|
126
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
127
|
+
await self.get_async_httpx_client().__aenter__()
|
|
128
|
+
return self
|
|
129
|
+
|
|
130
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
131
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
132
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@define
|
|
136
|
+
class AuthenticatedClient:
|
|
137
|
+
"""A Client which has been authenticated for use on secured endpoints
|
|
138
|
+
|
|
139
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
140
|
+
|
|
141
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
142
|
+
|
|
143
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
144
|
+
|
|
145
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
146
|
+
|
|
147
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
148
|
+
httpx.TimeoutException if this is exceeded.
|
|
149
|
+
|
|
150
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
151
|
+
but can be set to False for testing purposes.
|
|
152
|
+
|
|
153
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
154
|
+
|
|
155
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Attributes:
|
|
159
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
160
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
161
|
+
argument to the constructor.
|
|
162
|
+
token: The token to use for authentication
|
|
163
|
+
prefix: The prefix to use for the Authorization header
|
|
164
|
+
auth_header_name: The name of the Authorization header
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
168
|
+
_base_url: str = field(alias="base_url")
|
|
169
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
170
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
171
|
+
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
172
|
+
_verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl")
|
|
173
|
+
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
|
174
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
175
|
+
_client: httpx.Client | None = field(default=None, init=False)
|
|
176
|
+
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
|
177
|
+
|
|
178
|
+
token: str
|
|
179
|
+
prefix: str = "Bearer"
|
|
180
|
+
auth_header_name: str = "Authorization"
|
|
181
|
+
|
|
182
|
+
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
|
183
|
+
"""Get a new client matching this one with additional headers"""
|
|
184
|
+
if self._client is not None:
|
|
185
|
+
self._client.headers.update(headers)
|
|
186
|
+
if self._async_client is not None:
|
|
187
|
+
self._async_client.headers.update(headers)
|
|
188
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
189
|
+
|
|
190
|
+
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
|
191
|
+
"""Get a new client matching this one with additional cookies"""
|
|
192
|
+
if self._client is not None:
|
|
193
|
+
self._client.cookies.update(cookies)
|
|
194
|
+
if self._async_client is not None:
|
|
195
|
+
self._async_client.cookies.update(cookies)
|
|
196
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
197
|
+
|
|
198
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
|
199
|
+
"""Get a new client matching this one with a new timeout configuration"""
|
|
200
|
+
if self._client is not None:
|
|
201
|
+
self._client.timeout = timeout
|
|
202
|
+
if self._async_client is not None:
|
|
203
|
+
self._async_client.timeout = timeout
|
|
204
|
+
return evolve(self, timeout=timeout)
|
|
205
|
+
|
|
206
|
+
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
|
207
|
+
"""Manually set the underlying httpx.Client
|
|
208
|
+
|
|
209
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
210
|
+
"""
|
|
211
|
+
self._client = client
|
|
212
|
+
return self
|
|
213
|
+
|
|
214
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
215
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
216
|
+
if self._client is None:
|
|
217
|
+
self._headers[self.auth_header_name] = (
|
|
218
|
+
f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
219
|
+
)
|
|
220
|
+
self._client = httpx.Client(
|
|
221
|
+
base_url=self._base_url,
|
|
222
|
+
cookies=self._cookies,
|
|
223
|
+
headers=self._headers,
|
|
224
|
+
timeout=self._timeout,
|
|
225
|
+
verify=self._verify_ssl,
|
|
226
|
+
follow_redirects=self._follow_redirects,
|
|
227
|
+
**self._httpx_args,
|
|
228
|
+
)
|
|
229
|
+
return self._client
|
|
230
|
+
|
|
231
|
+
def __enter__(self) -> "AuthenticatedClient":
|
|
232
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
233
|
+
self.get_httpx_client().__enter__()
|
|
234
|
+
return self
|
|
235
|
+
|
|
236
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
237
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
238
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
239
|
+
|
|
240
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
|
241
|
+
"""Manually set the underlying httpx.AsyncClient
|
|
242
|
+
|
|
243
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
244
|
+
"""
|
|
245
|
+
self._async_client = async_client
|
|
246
|
+
return self
|
|
247
|
+
|
|
248
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
249
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
250
|
+
if self._async_client is None:
|
|
251
|
+
self._headers[self.auth_header_name] = (
|
|
252
|
+
f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
253
|
+
)
|
|
254
|
+
self._async_client = httpx.AsyncClient(
|
|
255
|
+
base_url=self._base_url,
|
|
256
|
+
cookies=self._cookies,
|
|
257
|
+
headers=self._headers,
|
|
258
|
+
timeout=self._timeout,
|
|
259
|
+
verify=self._verify_ssl,
|
|
260
|
+
follow_redirects=self._follow_redirects,
|
|
261
|
+
**self._httpx_args,
|
|
262
|
+
)
|
|
263
|
+
return self._async_client
|
|
264
|
+
|
|
265
|
+
async def __aenter__(self) -> "AuthenticatedClient":
|
|
266
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
267
|
+
await self.get_async_httpx_client().__aenter__()
|
|
268
|
+
return self
|
|
269
|
+
|
|
270
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
271
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
272
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
docket/errors.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class UnexpectedStatus(Exception):
|
|
5
|
+
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, status_code: int, content: bytes):
|
|
8
|
+
self.status_code = status_code
|
|
9
|
+
self.content = content
|
|
10
|
+
|
|
11
|
+
super().__init__(
|
|
12
|
+
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["UnexpectedStatus"]
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"""Contains all the data models used in inputs/outputs"""
|
|
2
|
+
|
|
3
|
+
from .access_role import AccessRole
|
|
4
|
+
from .access_role_nullable_type_1 import AccessRoleNullableType1
|
|
5
|
+
from .access_role_nullable_type_2_type_1 import AccessRoleNullableType2Type1
|
|
6
|
+
from .access_role_nullable_type_3_type_1 import AccessRoleNullableType3Type1
|
|
7
|
+
from .acquisition_variable import AcquisitionVariable
|
|
8
|
+
from .acquisition_warning import AcquisitionWarning
|
|
9
|
+
from .add_principal_request import AddPrincipalRequest
|
|
10
|
+
from .api_token_response import ApiTokenResponse
|
|
11
|
+
from .api_token_status import ApiTokenStatus
|
|
12
|
+
from .archive_recurring_acquisition_request import ArchiveRecurringAcquisitionRequest
|
|
13
|
+
from .archive_recurring_acquisition_response import ArchiveRecurringAcquisitionResponse
|
|
14
|
+
from .archive_scheduled_acquisition_request import ArchiveScheduledAcquisitionRequest
|
|
15
|
+
from .archive_template_request import ArchiveTemplateRequest
|
|
16
|
+
from .auth_mode import AuthMode
|
|
17
|
+
from .behavior_curriculum_push_settings_request import BehaviorCurriculumPushSettingsRequest
|
|
18
|
+
from .behavior_curriculum_settings import BehaviorCurriculumSettings
|
|
19
|
+
from .behavior_curriculum_settings_preview_response import BehaviorCurriculumSettingsPreviewResponse
|
|
20
|
+
from .behavior_curriculum_settings_preview_response_promoted import (
|
|
21
|
+
BehaviorCurriculumSettingsPreviewResponsePromoted,
|
|
22
|
+
)
|
|
23
|
+
from .behavior_curriculum_settings_version_response import BehaviorCurriculumSettingsVersionResponse
|
|
24
|
+
from .behavior_curriculum_settings_version_response_promoted import (
|
|
25
|
+
BehaviorCurriculumSettingsVersionResponsePromoted,
|
|
26
|
+
)
|
|
27
|
+
from .caller_kind import CallerKind
|
|
28
|
+
from .create_api_token_request import CreateApiTokenRequest
|
|
29
|
+
from .create_application_principal_request import CreateApplicationPrincipalRequest
|
|
30
|
+
from .create_personal_api_token_request import CreatePersonalApiTokenRequest
|
|
31
|
+
from .create_recurring_acquisition_request import CreateRecurringAcquisitionRequest
|
|
32
|
+
from .create_role_assignment_request import CreateRoleAssignmentRequest
|
|
33
|
+
from .create_scheduled_acquisition_request import CreateScheduledAcquisitionRequest
|
|
34
|
+
from .create_template_request import CreateTemplateRequest
|
|
35
|
+
from .created_api_token_response import CreatedApiTokenResponse
|
|
36
|
+
from .effective_status import EffectiveStatus
|
|
37
|
+
from .fip_color import FipColor
|
|
38
|
+
from .fip_fiber import FipFiber
|
|
39
|
+
from .fip_mode import FipMode
|
|
40
|
+
from .fip_push_settings_request import FipPushSettingsRequest
|
|
41
|
+
from .fip_settings import FipSettings
|
|
42
|
+
from .fip_settings_preview_response import FipSettingsPreviewResponse
|
|
43
|
+
from .fip_settings_preview_response_promoted import FipSettingsPreviewResponsePromoted
|
|
44
|
+
from .fip_settings_version_response import FipSettingsVersionResponse
|
|
45
|
+
from .fip_settings_version_response_promoted import FipSettingsVersionResponsePromoted
|
|
46
|
+
from .future_occurrences import FutureOccurrences
|
|
47
|
+
from .get_resolved_settings_response_200 import GetResolvedSettingsResponse200
|
|
48
|
+
from .held_role_response import HeldRoleResponse
|
|
49
|
+
from .http_validation_problem_details import HttpValidationProblemDetails
|
|
50
|
+
from .http_validation_problem_details_errors import HttpValidationProblemDetailsErrors
|
|
51
|
+
from .instrument_response import InstrumentResponse
|
|
52
|
+
from .kept_occurrence import KeptOccurrence
|
|
53
|
+
from .kept_occurrence_reason import KeptOccurrenceReason
|
|
54
|
+
from .list_active_acquisitions_effective_status_item import (
|
|
55
|
+
ListActiveAcquisitionsEffectiveStatusItem,
|
|
56
|
+
)
|
|
57
|
+
from .list_scheduled_acquisitions_planning_status import ListScheduledAcquisitionsPlanningStatus
|
|
58
|
+
from .me_caller import MeCaller
|
|
59
|
+
from .me_permission import MePermission
|
|
60
|
+
from .me_response import MeResponse
|
|
61
|
+
from .me_role import MeRole
|
|
62
|
+
from .occurrence_preview import OccurrencePreview
|
|
63
|
+
from .occurrence_summary import OccurrenceSummary
|
|
64
|
+
from .occurrence_warnings import OccurrenceWarnings
|
|
65
|
+
from .permission_action import PermissionAction
|
|
66
|
+
from .person_assignment import PersonAssignment
|
|
67
|
+
from .person_lookup_response import PersonLookupResponse
|
|
68
|
+
from .person_response import PersonResponse
|
|
69
|
+
from .person_role import PersonRole
|
|
70
|
+
from .personal_token_limits import PersonalTokenLimits
|
|
71
|
+
from .planning_status import PlanningStatus
|
|
72
|
+
from .principal_kind import PrincipalKind
|
|
73
|
+
from .principal_response import PrincipalResponse
|
|
74
|
+
from .problem_details import ProblemDetails
|
|
75
|
+
from .project_response import ProjectResponse
|
|
76
|
+
from .recurrence_exception_kind import RecurrenceExceptionKind
|
|
77
|
+
from .recurrence_exception_response import RecurrenceExceptionResponse
|
|
78
|
+
from .recurrence_frequency import RecurrenceFrequency
|
|
79
|
+
from .recurrence_preview_response import RecurrencePreviewResponse
|
|
80
|
+
from .recurrence_rule import RecurrenceRule
|
|
81
|
+
from .recurring_acquisition_created_response import RecurringAcquisitionCreatedResponse
|
|
82
|
+
from .recurring_acquisition_detail_response import RecurringAcquisitionDetailResponse
|
|
83
|
+
from .recurring_acquisition_response import RecurringAcquisitionResponse
|
|
84
|
+
from .report_run_outcome_request import ReportRunOutcomeRequest
|
|
85
|
+
from .resolution_mode import ResolutionMode
|
|
86
|
+
from .resolved_settings import ResolvedSettings
|
|
87
|
+
from .role_assignment_response import RoleAssignmentResponse
|
|
88
|
+
from .role_origin import RoleOrigin
|
|
89
|
+
from .role_source_kind import RoleSourceKind
|
|
90
|
+
from .run_origin import RunOrigin
|
|
91
|
+
from .run_outcome import RunOutcome
|
|
92
|
+
from .run_response import RunResponse
|
|
93
|
+
from .run_settings_snapshot import RunSettingsSnapshot
|
|
94
|
+
from .run_start_response import RunStartResponse
|
|
95
|
+
from .run_start_response_settings import RunStartResponseSettings
|
|
96
|
+
from .run_status import RunStatus
|
|
97
|
+
from .scheduled_acquisition_edit_preview_response import ScheduledAcquisitionEditPreviewResponse
|
|
98
|
+
from .scheduled_acquisition_response import ScheduledAcquisitionResponse
|
|
99
|
+
from .set_planning_status_request import SetPlanningStatusRequest
|
|
100
|
+
from .settings_selector import SettingsSelector
|
|
101
|
+
from .skipped_occurrence import SkippedOccurrence
|
|
102
|
+
from .split_preview_response import SplitPreviewResponse
|
|
103
|
+
from .split_recurring_acquisition_request import SplitRecurringAcquisitionRequest
|
|
104
|
+
from .split_recurring_acquisition_response import SplitRecurringAcquisitionResponse
|
|
105
|
+
from .start_run_request import StartRunRequest
|
|
106
|
+
from .subject_lookup_response import SubjectLookupResponse
|
|
107
|
+
from .subject_response import SubjectResponse
|
|
108
|
+
from .sync_counts import SyncCounts
|
|
109
|
+
from .sync_response import SyncResponse
|
|
110
|
+
from .template_response import TemplateResponse
|
|
111
|
+
from .update_scheduled_acquisition_request import UpdateScheduledAcquisitionRequest
|
|
112
|
+
from .update_template_request import UpdateTemplateRequest
|
|
113
|
+
from .weekday import Weekday
|
|
114
|
+
|
|
115
|
+
__all__ = (
|
|
116
|
+
"AccessRole",
|
|
117
|
+
"AccessRoleNullableType1",
|
|
118
|
+
"AccessRoleNullableType2Type1",
|
|
119
|
+
"AccessRoleNullableType3Type1",
|
|
120
|
+
"AcquisitionVariable",
|
|
121
|
+
"AcquisitionWarning",
|
|
122
|
+
"AddPrincipalRequest",
|
|
123
|
+
"ApiTokenResponse",
|
|
124
|
+
"ApiTokenStatus",
|
|
125
|
+
"ArchiveRecurringAcquisitionRequest",
|
|
126
|
+
"ArchiveRecurringAcquisitionResponse",
|
|
127
|
+
"ArchiveScheduledAcquisitionRequest",
|
|
128
|
+
"ArchiveTemplateRequest",
|
|
129
|
+
"AuthMode",
|
|
130
|
+
"BehaviorCurriculumPushSettingsRequest",
|
|
131
|
+
"BehaviorCurriculumSettings",
|
|
132
|
+
"BehaviorCurriculumSettingsPreviewResponse",
|
|
133
|
+
"BehaviorCurriculumSettingsPreviewResponsePromoted",
|
|
134
|
+
"BehaviorCurriculumSettingsVersionResponse",
|
|
135
|
+
"BehaviorCurriculumSettingsVersionResponsePromoted",
|
|
136
|
+
"CallerKind",
|
|
137
|
+
"CreateApiTokenRequest",
|
|
138
|
+
"CreateApplicationPrincipalRequest",
|
|
139
|
+
"CreatedApiTokenResponse",
|
|
140
|
+
"CreatePersonalApiTokenRequest",
|
|
141
|
+
"CreateRecurringAcquisitionRequest",
|
|
142
|
+
"CreateRoleAssignmentRequest",
|
|
143
|
+
"CreateScheduledAcquisitionRequest",
|
|
144
|
+
"CreateTemplateRequest",
|
|
145
|
+
"EffectiveStatus",
|
|
146
|
+
"FipColor",
|
|
147
|
+
"FipFiber",
|
|
148
|
+
"FipMode",
|
|
149
|
+
"FipPushSettingsRequest",
|
|
150
|
+
"FipSettings",
|
|
151
|
+
"FipSettingsPreviewResponse",
|
|
152
|
+
"FipSettingsPreviewResponsePromoted",
|
|
153
|
+
"FipSettingsVersionResponse",
|
|
154
|
+
"FipSettingsVersionResponsePromoted",
|
|
155
|
+
"FutureOccurrences",
|
|
156
|
+
"GetResolvedSettingsResponse200",
|
|
157
|
+
"HeldRoleResponse",
|
|
158
|
+
"HttpValidationProblemDetails",
|
|
159
|
+
"HttpValidationProblemDetailsErrors",
|
|
160
|
+
"InstrumentResponse",
|
|
161
|
+
"KeptOccurrence",
|
|
162
|
+
"KeptOccurrenceReason",
|
|
163
|
+
"ListActiveAcquisitionsEffectiveStatusItem",
|
|
164
|
+
"ListScheduledAcquisitionsPlanningStatus",
|
|
165
|
+
"MeCaller",
|
|
166
|
+
"MePermission",
|
|
167
|
+
"MeResponse",
|
|
168
|
+
"MeRole",
|
|
169
|
+
"OccurrencePreview",
|
|
170
|
+
"OccurrenceSummary",
|
|
171
|
+
"OccurrenceWarnings",
|
|
172
|
+
"PermissionAction",
|
|
173
|
+
"PersonalTokenLimits",
|
|
174
|
+
"PersonAssignment",
|
|
175
|
+
"PersonLookupResponse",
|
|
176
|
+
"PersonResponse",
|
|
177
|
+
"PersonRole",
|
|
178
|
+
"PlanningStatus",
|
|
179
|
+
"PrincipalKind",
|
|
180
|
+
"PrincipalResponse",
|
|
181
|
+
"ProblemDetails",
|
|
182
|
+
"ProjectResponse",
|
|
183
|
+
"RecurrenceExceptionKind",
|
|
184
|
+
"RecurrenceExceptionResponse",
|
|
185
|
+
"RecurrenceFrequency",
|
|
186
|
+
"RecurrencePreviewResponse",
|
|
187
|
+
"RecurrenceRule",
|
|
188
|
+
"RecurringAcquisitionCreatedResponse",
|
|
189
|
+
"RecurringAcquisitionDetailResponse",
|
|
190
|
+
"RecurringAcquisitionResponse",
|
|
191
|
+
"ReportRunOutcomeRequest",
|
|
192
|
+
"ResolutionMode",
|
|
193
|
+
"ResolvedSettings",
|
|
194
|
+
"RoleAssignmentResponse",
|
|
195
|
+
"RoleOrigin",
|
|
196
|
+
"RoleSourceKind",
|
|
197
|
+
"RunOrigin",
|
|
198
|
+
"RunOutcome",
|
|
199
|
+
"RunResponse",
|
|
200
|
+
"RunSettingsSnapshot",
|
|
201
|
+
"RunStartResponse",
|
|
202
|
+
"RunStartResponseSettings",
|
|
203
|
+
"RunStatus",
|
|
204
|
+
"ScheduledAcquisitionEditPreviewResponse",
|
|
205
|
+
"ScheduledAcquisitionResponse",
|
|
206
|
+
"SetPlanningStatusRequest",
|
|
207
|
+
"SettingsSelector",
|
|
208
|
+
"SkippedOccurrence",
|
|
209
|
+
"SplitPreviewResponse",
|
|
210
|
+
"SplitRecurringAcquisitionRequest",
|
|
211
|
+
"SplitRecurringAcquisitionResponse",
|
|
212
|
+
"StartRunRequest",
|
|
213
|
+
"SubjectLookupResponse",
|
|
214
|
+
"SubjectResponse",
|
|
215
|
+
"SyncCounts",
|
|
216
|
+
"SyncResponse",
|
|
217
|
+
"TemplateResponse",
|
|
218
|
+
"UpdateScheduledAcquisitionRequest",
|
|
219
|
+
"UpdateTemplateRequest",
|
|
220
|
+
"Weekday",
|
|
221
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AccessRole(str, Enum):
|
|
5
|
+
ACQUISITION_SETTINGS_MAINTAINER = "acquisition_settings_maintainer"
|
|
6
|
+
ADMIN = "admin"
|
|
7
|
+
MACHINE = "machine"
|
|
8
|
+
SCHEDULE_MAINTAINER = "schedule_maintainer"
|
|
9
|
+
USER = "user"
|
|
10
|
+
|
|
11
|
+
def __str__(self) -> str:
|
|
12
|
+
return str(self.value)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AccessRoleNullableType1(str, Enum):
|
|
5
|
+
ACQUISITION_SETTINGS_MAINTAINER = "acquisition_settings_maintainer"
|
|
6
|
+
ADMIN = "admin"
|
|
7
|
+
MACHINE = "machine"
|
|
8
|
+
SCHEDULE_MAINTAINER = "schedule_maintainer"
|
|
9
|
+
USER = "user"
|
|
10
|
+
|
|
11
|
+
def __str__(self) -> str:
|
|
12
|
+
return str(self.value)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AccessRoleNullableType2Type1(str, Enum):
|
|
5
|
+
ACQUISITION_SETTINGS_MAINTAINER = "acquisition_settings_maintainer"
|
|
6
|
+
ADMIN = "admin"
|
|
7
|
+
MACHINE = "machine"
|
|
8
|
+
SCHEDULE_MAINTAINER = "schedule_maintainer"
|
|
9
|
+
USER = "user"
|
|
10
|
+
|
|
11
|
+
def __str__(self) -> str:
|
|
12
|
+
return str(self.value)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AccessRoleNullableType3Type1(str, Enum):
|
|
5
|
+
ACQUISITION_SETTINGS_MAINTAINER = "acquisition_settings_maintainer"
|
|
6
|
+
ADMIN = "admin"
|
|
7
|
+
MACHINE = "machine"
|
|
8
|
+
SCHEDULE_MAINTAINER = "schedule_maintainer"
|
|
9
|
+
USER = "user"
|
|
10
|
+
|
|
11
|
+
def __str__(self) -> str:
|
|
12
|
+
return str(self.value)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="AcquisitionVariable")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class AcquisitionVariable:
|
|
17
|
+
"""
|
|
18
|
+
Attributes:
|
|
19
|
+
key (str): Variable name; trimmed, unique per acquisition.
|
|
20
|
+
value (Any):
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
key: str
|
|
24
|
+
value: Any
|
|
25
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
26
|
+
|
|
27
|
+
def to_dict(self) -> dict[str, Any]:
|
|
28
|
+
key = self.key
|
|
29
|
+
|
|
30
|
+
value = self.value
|
|
31
|
+
|
|
32
|
+
field_dict: dict[str, Any] = {}
|
|
33
|
+
field_dict.update(self.additional_properties)
|
|
34
|
+
field_dict.update(
|
|
35
|
+
{
|
|
36
|
+
"key": key,
|
|
37
|
+
"value": value,
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return field_dict
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
45
|
+
d = dict(src_dict)
|
|
46
|
+
key = d.pop("key")
|
|
47
|
+
|
|
48
|
+
value = d.pop("value")
|
|
49
|
+
|
|
50
|
+
acquisition_variable = cls(
|
|
51
|
+
key=key,
|
|
52
|
+
value=value,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
acquisition_variable.additional_properties = d
|
|
56
|
+
return acquisition_variable
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def additional_keys(self) -> list[str]:
|
|
60
|
+
return list(self.additional_properties.keys())
|
|
61
|
+
|
|
62
|
+
def __getitem__(self, key: str) -> Any:
|
|
63
|
+
return self.additional_properties[key]
|
|
64
|
+
|
|
65
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
66
|
+
self.additional_properties[key] = value
|
|
67
|
+
|
|
68
|
+
def __delitem__(self, key: str) -> None:
|
|
69
|
+
del self.additional_properties[key]
|
|
70
|
+
|
|
71
|
+
def __contains__(self, key: str) -> bool:
|
|
72
|
+
return key in self.additional_properties
|