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,248 @@
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.recurring_acquisition_response import RecurringAcquisitionResponse
12
+ from ...types import UNSET, Unset
13
+ from typing import cast
14
+
15
+
16
+ def _get_kwargs(
17
+ *,
18
+ subject_id: str | Unset = UNSET,
19
+ instrument_id: str | Unset = UNSET,
20
+ include_archived: bool | None | Unset = UNSET,
21
+ include_superseded: bool | None | Unset = UNSET,
22
+ limit: int | None | Unset = UNSET,
23
+ ) -> dict[str, Any]:
24
+
25
+ params: dict[str, Any] = {}
26
+
27
+ params["subject_id"] = subject_id
28
+
29
+ params["instrument_id"] = instrument_id
30
+
31
+ json_include_archived: bool | None | Unset
32
+ if isinstance(include_archived, Unset):
33
+ json_include_archived = UNSET
34
+ else:
35
+ json_include_archived = include_archived
36
+ params["include_archived"] = json_include_archived
37
+
38
+ json_include_superseded: bool | None | Unset
39
+ if isinstance(include_superseded, Unset):
40
+ json_include_superseded = UNSET
41
+ else:
42
+ json_include_superseded = include_superseded
43
+ params["include_superseded"] = json_include_superseded
44
+
45
+ json_limit: int | None | Unset
46
+ if isinstance(limit, Unset):
47
+ json_limit = UNSET
48
+ else:
49
+ json_limit = limit
50
+ params["limit"] = json_limit
51
+
52
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
53
+
54
+ _kwargs: dict[str, Any] = {
55
+ "method": "get",
56
+ "url": "/api/v1/recurring-acquisitions",
57
+ "params": params,
58
+ }
59
+
60
+ return _kwargs
61
+
62
+
63
+ def _parse_response(
64
+ *, client: AuthenticatedClient | Client, response: httpx.Response
65
+ ) -> list[RecurringAcquisitionResponse] | None:
66
+ if response.status_code == 200:
67
+ response_200 = []
68
+ _response_200 = response.json()
69
+ for response_200_item_data in _response_200:
70
+ response_200_item = RecurringAcquisitionResponse.from_dict(response_200_item_data)
71
+
72
+ response_200.append(response_200_item)
73
+
74
+ return response_200
75
+
76
+ if client.raise_on_unexpected_status:
77
+ raise errors.UnexpectedStatus(response.status_code, response.content)
78
+ else:
79
+ return None
80
+
81
+
82
+ def _build_response(
83
+ *, client: AuthenticatedClient | Client, response: httpx.Response
84
+ ) -> Response[list[RecurringAcquisitionResponse]]:
85
+ return Response(
86
+ status_code=HTTPStatus(response.status_code),
87
+ content=response.content,
88
+ headers=response.headers,
89
+ parsed=_parse_response(client=client, response=response),
90
+ )
91
+
92
+
93
+ def sync_detailed(
94
+ *,
95
+ client: AuthenticatedClient,
96
+ subject_id: str | Unset = UNSET,
97
+ instrument_id: str | Unset = UNSET,
98
+ include_archived: bool | None | Unset = UNSET,
99
+ include_superseded: bool | None | Unset = UNSET,
100
+ limit: int | None | Unset = UNSET,
101
+ ) -> Response[list[RecurringAcquisitionResponse]]:
102
+ """Recurring definitions, newest first. Definitions replaced by a split are left out unless
103
+ include_superseded=true.
104
+
105
+ Args:
106
+ subject_id (str | Unset):
107
+ instrument_id (str | Unset):
108
+ include_archived (bool | None | Unset):
109
+ include_superseded (bool | None | Unset):
110
+ limit (int | None | Unset):
111
+
112
+ Raises:
113
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
114
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
115
+
116
+ Returns:
117
+ Response[list[RecurringAcquisitionResponse]]
118
+ """
119
+
120
+ kwargs = _get_kwargs(
121
+ subject_id=subject_id,
122
+ instrument_id=instrument_id,
123
+ include_archived=include_archived,
124
+ include_superseded=include_superseded,
125
+ limit=limit,
126
+ )
127
+
128
+ response = client.get_httpx_client().request(
129
+ **kwargs,
130
+ )
131
+
132
+ return _build_response(client=client, response=response)
133
+
134
+
135
+ def sync(
136
+ *,
137
+ client: AuthenticatedClient,
138
+ subject_id: str | Unset = UNSET,
139
+ instrument_id: str | Unset = UNSET,
140
+ include_archived: bool | None | Unset = UNSET,
141
+ include_superseded: bool | None | Unset = UNSET,
142
+ limit: int | None | Unset = UNSET,
143
+ ) -> list[RecurringAcquisitionResponse] | None:
144
+ """Recurring definitions, newest first. Definitions replaced by a split are left out unless
145
+ include_superseded=true.
146
+
147
+ Args:
148
+ subject_id (str | Unset):
149
+ instrument_id (str | Unset):
150
+ include_archived (bool | None | Unset):
151
+ include_superseded (bool | None | Unset):
152
+ limit (int | None | Unset):
153
+
154
+ Raises:
155
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
156
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
157
+
158
+ Returns:
159
+ list[RecurringAcquisitionResponse]
160
+ """
161
+
162
+ return sync_detailed(
163
+ client=client,
164
+ subject_id=subject_id,
165
+ instrument_id=instrument_id,
166
+ include_archived=include_archived,
167
+ include_superseded=include_superseded,
168
+ limit=limit,
169
+ ).parsed
170
+
171
+
172
+ async def asyncio_detailed(
173
+ *,
174
+ client: AuthenticatedClient,
175
+ subject_id: str | Unset = UNSET,
176
+ instrument_id: str | Unset = UNSET,
177
+ include_archived: bool | None | Unset = UNSET,
178
+ include_superseded: bool | None | Unset = UNSET,
179
+ limit: int | None | Unset = UNSET,
180
+ ) -> Response[list[RecurringAcquisitionResponse]]:
181
+ """Recurring definitions, newest first. Definitions replaced by a split are left out unless
182
+ include_superseded=true.
183
+
184
+ Args:
185
+ subject_id (str | Unset):
186
+ instrument_id (str | Unset):
187
+ include_archived (bool | None | Unset):
188
+ include_superseded (bool | None | Unset):
189
+ limit (int | None | Unset):
190
+
191
+ Raises:
192
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
193
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
194
+
195
+ Returns:
196
+ Response[list[RecurringAcquisitionResponse]]
197
+ """
198
+
199
+ kwargs = _get_kwargs(
200
+ subject_id=subject_id,
201
+ instrument_id=instrument_id,
202
+ include_archived=include_archived,
203
+ include_superseded=include_superseded,
204
+ limit=limit,
205
+ )
206
+
207
+ response = await client.get_async_httpx_client().request(**kwargs)
208
+
209
+ return _build_response(client=client, response=response)
210
+
211
+
212
+ async def asyncio(
213
+ *,
214
+ client: AuthenticatedClient,
215
+ subject_id: str | Unset = UNSET,
216
+ instrument_id: str | Unset = UNSET,
217
+ include_archived: bool | None | Unset = UNSET,
218
+ include_superseded: bool | None | Unset = UNSET,
219
+ limit: int | None | Unset = UNSET,
220
+ ) -> list[RecurringAcquisitionResponse] | None:
221
+ """Recurring definitions, newest first. Definitions replaced by a split are left out unless
222
+ include_superseded=true.
223
+
224
+ Args:
225
+ subject_id (str | Unset):
226
+ instrument_id (str | Unset):
227
+ include_archived (bool | None | Unset):
228
+ include_superseded (bool | None | Unset):
229
+ limit (int | None | Unset):
230
+
231
+ Raises:
232
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
233
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
234
+
235
+ Returns:
236
+ list[RecurringAcquisitionResponse]
237
+ """
238
+
239
+ return (
240
+ await asyncio_detailed(
241
+ client=client,
242
+ subject_id=subject_id,
243
+ instrument_id=instrument_id,
244
+ include_archived=include_archived,
245
+ include_superseded=include_superseded,
246
+ limit=limit,
247
+ )
248
+ ).parsed
@@ -0,0 +1,187 @@
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_recurring_acquisition_request import CreateRecurringAcquisitionRequest
12
+ from ...models.http_validation_problem_details import HttpValidationProblemDetails
13
+ from ...models.problem_details import ProblemDetails
14
+ from ...models.recurrence_preview_response import RecurrencePreviewResponse
15
+ from typing import cast
16
+
17
+
18
+ def _get_kwargs(
19
+ *,
20
+ body: CreateRecurringAcquisitionRequest,
21
+ ) -> dict[str, Any]:
22
+ headers: dict[str, Any] = {}
23
+
24
+ _kwargs: dict[str, Any] = {
25
+ "method": "post",
26
+ "url": "/api/v1/recurring-acquisitions/preview",
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 | ProblemDetails | RecurrencePreviewResponse | None:
40
+ if response.status_code == 200:
41
+ response_200 = RecurrencePreviewResponse.from_dict(response.json())
42
+
43
+ return response_200
44
+
45
+ if response.status_code == 422:
46
+ response_422 = HttpValidationProblemDetails.from_dict(response.json())
47
+
48
+ return response_422
49
+
50
+ if response.status_code == 503:
51
+ response_503 = ProblemDetails.from_dict(response.json())
52
+
53
+ return response_503
54
+
55
+ if client.raise_on_unexpected_status:
56
+ raise errors.UnexpectedStatus(response.status_code, response.content)
57
+ else:
58
+ return None
59
+
60
+
61
+ def _build_response(
62
+ *, client: AuthenticatedClient | Client, response: httpx.Response
63
+ ) -> Response[HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse]:
64
+ return Response(
65
+ status_code=HTTPStatus(response.status_code),
66
+ content=response.content,
67
+ headers=response.headers,
68
+ parsed=_parse_response(client=client, response=response),
69
+ )
70
+
71
+
72
+ def sync_detailed(
73
+ *,
74
+ client: AuthenticatedClient,
75
+ body: CreateRecurringAcquisitionRequest,
76
+ ) -> Response[HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse]:
77
+ """What creating this series would schedule: occurrences, DST-skipped dates and per-occurrence overlap
78
+ warnings. Writes nothing.
79
+
80
+ Args:
81
+ body (CreateRecurringAcquisitionRequest): Plan a finite series. The acquisition fields
82
+ mean what they do on
83
+ CreateScheduledAcquisitionRequest and are copied onto every occurrence.
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[HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse]
91
+ """
92
+
93
+ kwargs = _get_kwargs(
94
+ body=body,
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
+ *,
106
+ client: AuthenticatedClient,
107
+ body: CreateRecurringAcquisitionRequest,
108
+ ) -> HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse | None:
109
+ """What creating this series would schedule: occurrences, DST-skipped dates and per-occurrence overlap
110
+ warnings. Writes nothing.
111
+
112
+ Args:
113
+ body (CreateRecurringAcquisitionRequest): Plan a finite series. The acquisition fields
114
+ mean what they do on
115
+ CreateScheduledAcquisitionRequest and are copied onto every occurrence.
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
+ HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse
123
+ """
124
+
125
+ return sync_detailed(
126
+ client=client,
127
+ body=body,
128
+ ).parsed
129
+
130
+
131
+ async def asyncio_detailed(
132
+ *,
133
+ client: AuthenticatedClient,
134
+ body: CreateRecurringAcquisitionRequest,
135
+ ) -> Response[HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse]:
136
+ """What creating this series would schedule: occurrences, DST-skipped dates and per-occurrence overlap
137
+ warnings. Writes nothing.
138
+
139
+ Args:
140
+ body (CreateRecurringAcquisitionRequest): Plan a finite series. The acquisition fields
141
+ mean what they do on
142
+ CreateScheduledAcquisitionRequest and are copied onto every occurrence.
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ Response[HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse]
150
+ """
151
+
152
+ kwargs = _get_kwargs(
153
+ body=body,
154
+ )
155
+
156
+ response = await client.get_async_httpx_client().request(**kwargs)
157
+
158
+ return _build_response(client=client, response=response)
159
+
160
+
161
+ async def asyncio(
162
+ *,
163
+ client: AuthenticatedClient,
164
+ body: CreateRecurringAcquisitionRequest,
165
+ ) -> HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse | None:
166
+ """What creating this series would schedule: occurrences, DST-skipped dates and per-occurrence overlap
167
+ warnings. Writes nothing.
168
+
169
+ Args:
170
+ body (CreateRecurringAcquisitionRequest): Plan a finite series. The acquisition fields
171
+ mean what they do on
172
+ CreateScheduledAcquisitionRequest and are copied onto every occurrence.
173
+
174
+ Raises:
175
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
176
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
177
+
178
+ Returns:
179
+ HttpValidationProblemDetails | ProblemDetails | RecurrencePreviewResponse
180
+ """
181
+
182
+ return (
183
+ await asyncio_detailed(
184
+ client=client,
185
+ body=body,
186
+ )
187
+ ).parsed
@@ -0,0 +1,232 @@
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.http_validation_problem_details import HttpValidationProblemDetails
12
+ from ...models.problem_details import ProblemDetails
13
+ from ...models.split_preview_response import SplitPreviewResponse
14
+ from ...models.split_recurring_acquisition_request import SplitRecurringAcquisitionRequest
15
+ from typing import cast
16
+
17
+
18
+ def _get_kwargs(
19
+ id: int,
20
+ *,
21
+ body: SplitRecurringAcquisitionRequest,
22
+ ) -> dict[str, Any]:
23
+ headers: dict[str, Any] = {}
24
+
25
+ _kwargs: dict[str, Any] = {
26
+ "method": "post",
27
+ "url": "/api/v1/recurring-acquisitions/{id}/split/preview".format(
28
+ id=quote(str(id), safe=""),
29
+ ),
30
+ }
31
+
32
+ _kwargs["json"] = body.to_dict()
33
+
34
+ headers["Content-Type"] = "application/json"
35
+
36
+ _kwargs["headers"] = headers
37
+ return _kwargs
38
+
39
+
40
+ def _parse_response(
41
+ *, client: AuthenticatedClient | Client, response: httpx.Response
42
+ ) -> HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse | None:
43
+ if response.status_code == 200:
44
+ response_200 = SplitPreviewResponse.from_dict(response.json())
45
+
46
+ return response_200
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 response.status_code == 422:
59
+ response_422 = HttpValidationProblemDetails.from_dict(response.json())
60
+
61
+ return response_422
62
+
63
+ if response.status_code == 503:
64
+ response_503 = ProblemDetails.from_dict(response.json())
65
+
66
+ return response_503
67
+
68
+ if client.raise_on_unexpected_status:
69
+ raise errors.UnexpectedStatus(response.status_code, response.content)
70
+ else:
71
+ return None
72
+
73
+
74
+ def _build_response(
75
+ *, client: AuthenticatedClient | Client, response: httpx.Response
76
+ ) -> Response[HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse]:
77
+ return Response(
78
+ status_code=HTTPStatus(response.status_code),
79
+ content=response.content,
80
+ headers=response.headers,
81
+ parsed=_parse_response(client=client, response=response),
82
+ )
83
+
84
+
85
+ def sync_detailed(
86
+ id: int,
87
+ *,
88
+ client: AuthenticatedClient,
89
+ body: SplitRecurringAcquisitionRequest,
90
+ ) -> Response[HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse]:
91
+ """What splitting this series from effective_date would do: new occurrences, skipped dates, overlap
92
+ warnings, the old occurrences that would be archived (replaced) and those that stay (kept). Writes
93
+ nothing.
94
+
95
+ Args:
96
+ id (int):
97
+ body (SplitRecurringAcquisitionRequest): Edit a series from a date onward: end the old
98
+ series the day before
99
+ `effective_date` and start a new one from it. Carries the complete new definition (the
100
+ same fields as
101
+ CreateRecurringAcquisitionRequest), not a patch; clients prefill it from the old one.
102
+ `rule.start_date` must equal `effective_date`. For a `count` rule, `count` is the number
103
+ of occurrences of the new part.
104
+
105
+ Raises:
106
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
107
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
108
+
109
+ Returns:
110
+ Response[HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse]
111
+ """
112
+
113
+ kwargs = _get_kwargs(
114
+ id=id,
115
+ body=body,
116
+ )
117
+
118
+ response = client.get_httpx_client().request(
119
+ **kwargs,
120
+ )
121
+
122
+ return _build_response(client=client, response=response)
123
+
124
+
125
+ def sync(
126
+ id: int,
127
+ *,
128
+ client: AuthenticatedClient,
129
+ body: SplitRecurringAcquisitionRequest,
130
+ ) -> HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse | None:
131
+ """What splitting this series from effective_date would do: new occurrences, skipped dates, overlap
132
+ warnings, the old occurrences that would be archived (replaced) and those that stay (kept). Writes
133
+ nothing.
134
+
135
+ Args:
136
+ id (int):
137
+ body (SplitRecurringAcquisitionRequest): Edit a series from a date onward: end the old
138
+ series the day before
139
+ `effective_date` and start a new one from it. Carries the complete new definition (the
140
+ same fields as
141
+ CreateRecurringAcquisitionRequest), not a patch; clients prefill it from the old one.
142
+ `rule.start_date` must equal `effective_date`. For a `count` rule, `count` is the number
143
+ of occurrences of the new part.
144
+
145
+ Raises:
146
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
147
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
148
+
149
+ Returns:
150
+ HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse
151
+ """
152
+
153
+ return sync_detailed(
154
+ id=id,
155
+ client=client,
156
+ body=body,
157
+ ).parsed
158
+
159
+
160
+ async def asyncio_detailed(
161
+ id: int,
162
+ *,
163
+ client: AuthenticatedClient,
164
+ body: SplitRecurringAcquisitionRequest,
165
+ ) -> Response[HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse]:
166
+ """What splitting this series from effective_date would do: new occurrences, skipped dates, overlap
167
+ warnings, the old occurrences that would be archived (replaced) and those that stay (kept). Writes
168
+ nothing.
169
+
170
+ Args:
171
+ id (int):
172
+ body (SplitRecurringAcquisitionRequest): Edit a series from a date onward: end the old
173
+ series the day before
174
+ `effective_date` and start a new one from it. Carries the complete new definition (the
175
+ same fields as
176
+ CreateRecurringAcquisitionRequest), not a patch; clients prefill it from the old one.
177
+ `rule.start_date` must equal `effective_date`. For a `count` rule, `count` is the number
178
+ of occurrences of the new part.
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
+ Response[HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse]
186
+ """
187
+
188
+ kwargs = _get_kwargs(
189
+ id=id,
190
+ body=body,
191
+ )
192
+
193
+ response = await client.get_async_httpx_client().request(**kwargs)
194
+
195
+ return _build_response(client=client, response=response)
196
+
197
+
198
+ async def asyncio(
199
+ id: int,
200
+ *,
201
+ client: AuthenticatedClient,
202
+ body: SplitRecurringAcquisitionRequest,
203
+ ) -> HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse | None:
204
+ """What splitting this series from effective_date would do: new occurrences, skipped dates, overlap
205
+ warnings, the old occurrences that would be archived (replaced) and those that stay (kept). Writes
206
+ nothing.
207
+
208
+ Args:
209
+ id (int):
210
+ body (SplitRecurringAcquisitionRequest): Edit a series from a date onward: end the old
211
+ series the day before
212
+ `effective_date` and start a new one from it. Carries the complete new definition (the
213
+ same fields as
214
+ CreateRecurringAcquisitionRequest), not a patch; clients prefill it from the old one.
215
+ `rule.start_date` must equal `effective_date`. For a `count` rule, `count` is the number
216
+ of occurrences of the new part.
217
+
218
+ Raises:
219
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
220
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
221
+
222
+ Returns:
223
+ HttpValidationProblemDetails | ProblemDetails | SplitPreviewResponse
224
+ """
225
+
226
+ return (
227
+ await asyncio_detailed(
228
+ id=id,
229
+ client=client,
230
+ body=body,
231
+ )
232
+ ).parsed