autoassembler 0.3.1__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 (198) hide show
  1. autoassembler/.fernignore +7 -0
  2. autoassembler/__init__.py +537 -0
  3. autoassembler/_custom/__init__.py +56 -0
  4. autoassembler/_custom/assemblies.py +226 -0
  5. autoassembler/_custom/assemblies_api.py +188 -0
  6. autoassembler/_custom/credentials.py +248 -0
  7. autoassembler/_custom/http.py +42 -0
  8. autoassembler/_custom/operations.py +258 -0
  9. autoassembler/_custom/planning.py +598 -0
  10. autoassembler/_custom/planning_api.py +225 -0
  11. autoassembler/_default_clients.py +32 -0
  12. autoassembler/_version.py +8 -0
  13. autoassembler/alpha/__init__.py +63 -0
  14. autoassembler/alpha/client.py +82 -0
  15. autoassembler/alpha/jobs/__init__.py +39 -0
  16. autoassembler/alpha/jobs/client.py +338 -0
  17. autoassembler/alpha/jobs/raw_client.py +641 -0
  18. autoassembler/alpha/jobs/types/__init__.py +42 -0
  19. autoassembler/alpha/jobs/types/cancel_job_jobs_response.py +12 -0
  20. autoassembler/alpha/jobs/types/list_jobs_jobs_response.py +30 -0
  21. autoassembler/alpha/jobs/types/list_jobs_jobs_response_pagination.py +22 -0
  22. autoassembler/alpha/jobs/types/retry_job_jobs_response.py +16 -0
  23. autoassembler/alpha/planning/__init__.py +49 -0
  24. autoassembler/alpha/planning/client.py +201 -0
  25. autoassembler/alpha/planning/raw_client.py +268 -0
  26. autoassembler/alpha/planning/types/__init__.py +47 -0
  27. autoassembler/alpha/planning/types/apply_ops_planning_request_namespace.py +5 -0
  28. autoassembler/alpha/planning/types/apply_ops_planning_request_ops_item.py +13 -0
  29. autoassembler/alpha/planning/types/apply_ops_planning_request_ops_item_op.py +58 -0
  30. autoassembler/alpha/planning/types/apply_ops_planning_response.py +13 -0
  31. autoassembler/alpha/raw_client.py +13 -0
  32. autoassembler/assemblies/__init__.py +73 -0
  33. autoassembler/assemblies/client.py +1177 -0
  34. autoassembler/assemblies/raw_client.py +1557 -0
  35. autoassembler/assemblies/types/__init__.py +71 -0
  36. autoassembler/assemblies/types/delete_assembly_response.py +12 -0
  37. autoassembler/assemblies/types/download_assembly_cad_request_namespace.py +5 -0
  38. autoassembler/assemblies/types/get_assembly_info_request_namespace.py +5 -0
  39. autoassembler/assemblies/types/get_status_request_namespace.py +5 -0
  40. autoassembler/assemblies/types/get_status_response.py +16 -0
  41. autoassembler/assemblies/types/get_status_response_progress.py +13 -0
  42. autoassembler/assemblies/types/get_status_response_status.py +7 -0
  43. autoassembler/assemblies/types/get_structure_request_namespace.py +5 -0
  44. autoassembler/assemblies/types/list_assembly_versions_request_namespace.py +5 -0
  45. autoassembler/assemblies/types/list_connections_request_namespace.py +5 -0
  46. autoassembler/assemblies/types/process_request_namespace.py +5 -0
  47. autoassembler/assemblies/types/update_assembly_info_request_namespace.py +5 -0
  48. autoassembler/auth/__init__.py +34 -0
  49. autoassembler/auth/client.py +282 -0
  50. autoassembler/auth/raw_client.py +413 -0
  51. autoassembler/auth/types/__init__.py +36 -0
  52. autoassembler/auth/types/create_access_token_request_grant_type.py +7 -0
  53. autoassembler/base_client.py +328 -0
  54. autoassembler/client.py +262 -0
  55. autoassembler/core/__init__.py +127 -0
  56. autoassembler/core/api_error.py +23 -0
  57. autoassembler/core/client_wrapper.py +147 -0
  58. autoassembler/core/datetime_utils.py +70 -0
  59. autoassembler/core/file.py +67 -0
  60. autoassembler/core/force_multipart.py +18 -0
  61. autoassembler/core/http_client.py +965 -0
  62. autoassembler/core/http_response.py +63 -0
  63. autoassembler/core/http_sse/__init__.py +42 -0
  64. autoassembler/core/http_sse/_api.py +455 -0
  65. autoassembler/core/http_sse/_decoders.py +74 -0
  66. autoassembler/core/http_sse/_exceptions.py +7 -0
  67. autoassembler/core/http_sse/_models.py +17 -0
  68. autoassembler/core/jsonable_encoder.py +133 -0
  69. autoassembler/core/logging.py +107 -0
  70. autoassembler/core/parse_error.py +36 -0
  71. autoassembler/core/pydantic_utilities.py +486 -0
  72. autoassembler/core/query_encoder.py +58 -0
  73. autoassembler/core/remove_none_from_dict.py +11 -0
  74. autoassembler/core/request_options.py +40 -0
  75. autoassembler/core/serialization.py +347 -0
  76. autoassembler/environment.py +7 -0
  77. autoassembler/errors/__init__.py +56 -0
  78. autoassembler/errors/bad_request_error.py +10 -0
  79. autoassembler/errors/conflict_error.py +10 -0
  80. autoassembler/errors/forbidden_error.py +11 -0
  81. autoassembler/errors/internal_server_error.py +11 -0
  82. autoassembler/errors/not_found_error.py +11 -0
  83. autoassembler/errors/unauthorized_error.py +10 -0
  84. autoassembler/errors/unprocessable_entity_error.py +11 -0
  85. autoassembler/operation.py +196 -0
  86. autoassembler/operations/__init__.py +4 -0
  87. autoassembler/operations/client.py +209 -0
  88. autoassembler/operations/raw_client.py +343 -0
  89. autoassembler/planning/__init__.py +70 -0
  90. autoassembler/planning/client.py +1174 -0
  91. autoassembler/planning/raw_client.py +1349 -0
  92. autoassembler/planning/types/__init__.py +68 -0
  93. autoassembler/planning/types/adapt_request_namespace.py +5 -0
  94. autoassembler/planning/types/create_mpp_request_body.py +8 -0
  95. autoassembler/planning/types/create_mpp_request_namespace.py +5 -0
  96. autoassembler/planning/types/delete_mpp_request_namespace.py +5 -0
  97. autoassembler/planning/types/delete_mpp_response.py +12 -0
  98. autoassembler/planning/types/evaluate_dfa_request_namespace.py +5 -0
  99. autoassembler/planning/types/get_mpp_request_namespace.py +5 -0
  100. autoassembler/planning/types/get_mpp_response.py +27 -0
  101. autoassembler/planning/types/list_mpps_request_namespace.py +5 -0
  102. autoassembler/planning/types/plan_request_namespace.py +5 -0
  103. autoassembler/planning/types/validate_request_namespace.py +5 -0
  104. autoassembler/py.typed +0 -0
  105. autoassembler/sessions/__init__.py +4 -0
  106. autoassembler/sessions/client.py +102 -0
  107. autoassembler/sessions/raw_client.py +126 -0
  108. autoassembler/types/__init__.py +344 -0
  109. autoassembler/types/access_token_response.py +14 -0
  110. autoassembler/types/active_session.py +25 -0
  111. autoassembler/types/active_session_namespace.py +5 -0
  112. autoassembler/types/adapt_mpp_accepted.py +26 -0
  113. autoassembler/types/assembly.py +30 -0
  114. autoassembler/types/assembly_connection.py +21 -0
  115. autoassembler/types/assembly_connection_relationship.py +5 -0
  116. autoassembler/types/assembly_connections_response.py +13 -0
  117. autoassembler/types/assembly_diff_metadata.py +35 -0
  118. autoassembler/types/assembly_diff_response.py +34 -0
  119. autoassembler/types/assembly_info.py +36 -0
  120. autoassembler/types/assembly_json_response.py +15 -0
  121. autoassembler/types/assembly_process_metadata.py +32 -0
  122. autoassembler/types/assembly_process_response.py +18 -0
  123. autoassembler/types/assembly_search_hit.py +31 -0
  124. autoassembler/types/assembly_version_summary.py +27 -0
  125. autoassembler/types/conflict_error_body.py +19 -0
  126. autoassembler/types/conflict_error_body_error.py +5 -0
  127. autoassembler/types/create_mpp_request.py +13 -0
  128. autoassembler/types/device_authorization_response.py +17 -0
  129. autoassembler/types/diff_accepted.py +42 -0
  130. autoassembler/types/diff_context_node.py +20 -0
  131. autoassembler/types/diff_details.py +73 -0
  132. autoassembler/types/diff_error_response.py +38 -0
  133. autoassembler/types/diff_flags.py +74 -0
  134. autoassembler/types/diff_ml_semantics.py +55 -0
  135. autoassembler/types/diff_node.py +26 -0
  136. autoassembler/types/diff_node_pair_with_parts.py +90 -0
  137. autoassembler/types/diff_node_with_parent.py +15 -0
  138. autoassembler/types/diff_reference_target_nodes.py +25 -0
  139. autoassembler/types/diff_report.py +24 -0
  140. autoassembler/types/diff_rigid_alignment.py +30 -0
  141. autoassembler/types/diff_summary.py +121 -0
  142. autoassembler/types/diff_summary_assembly_labels.py +44 -0
  143. autoassembler/types/diff_summary_geometric_diffs.py +24 -0
  144. autoassembler/types/diff_summary_persistent_edges_congruence.py +24 -0
  145. autoassembler/types/diff_summary_persistent_edges_congruence_pose.py +24 -0
  146. autoassembler/types/diff_summary_persistent_nodes_congruence.py +24 -0
  147. autoassembler/types/diff_summary_persistent_nodes_congruence_pose.py +24 -0
  148. autoassembler/types/diff_summary_total_parts.py +24 -0
  149. autoassembler/types/diff_swap.py +65 -0
  150. autoassembler/types/diff_swap_confidence.py +5 -0
  151. autoassembler/types/diff_swap_group.py +92 -0
  152. autoassembler/types/diff_validation_issue.py +38 -0
  153. autoassembler/types/diff_validation_issue_severity.py +5 -0
  154. autoassembler/types/diff_validation_result.py +35 -0
  155. autoassembler/types/diff_warning.py +79 -0
  156. autoassembler/types/diff_warning_reason.py +18 -0
  157. autoassembler/types/diff_warning_severity.py +5 -0
  158. autoassembler/types/error_response.py +30 -0
  159. autoassembler/types/filter.py +19 -0
  160. autoassembler/types/filter_field.py +7 -0
  161. autoassembler/types/filter_operator.py +5 -0
  162. autoassembler/types/job.py +123 -0
  163. autoassembler/types/job_progress.py +24 -0
  164. autoassembler/types/job_status.py +5 -0
  165. autoassembler/types/list_operations_response.py +25 -0
  166. autoassembler/types/manufacturing_process_plan.py +57 -0
  167. autoassembler/types/mpp_adapt_metadata.py +48 -0
  168. autoassembler/types/mpp_adapt_response.py +22 -0
  169. autoassembler/types/mpp_evaluate_dfa_metadata.py +47 -0
  170. autoassembler/types/mpp_evaluate_dfa_response.py +22 -0
  171. autoassembler/types/mpp_plan_metadata.py +47 -0
  172. autoassembler/types/mpp_plan_response.py +22 -0
  173. autoassembler/types/mpp_summary.py +20 -0
  174. autoassembler/types/mpp_validate_metadata.py +47 -0
  175. autoassembler/types/mpp_validate_response.py +22 -0
  176. autoassembler/types/o_auth_error_response.py +14 -0
  177. autoassembler/types/o_auth_error_response_error.py +18 -0
  178. autoassembler/types/operation.py +27 -0
  179. autoassembler/types/operation_error.py +21 -0
  180. autoassembler/types/operation_metadata.py +148 -0
  181. autoassembler/types/operation_response.py +94 -0
  182. autoassembler/types/process_assembly_accepted.py +14 -0
  183. autoassembler/types/process_assembly_response.py +55 -0
  184. autoassembler/types/process_assembly_skipped.py +14 -0
  185. autoassembler/types/search_assemblies_response.py +14 -0
  186. autoassembler/types/seq_plan_accepted.py +24 -0
  187. autoassembler/types/sever.py +33 -0
  188. autoassembler/types/sever_kind.py +5 -0
  189. autoassembler/types/sever_source.py +5 -0
  190. autoassembler/types/sort.py +8 -0
  191. autoassembler/types/upload_response.py +19 -0
  192. autoassembler/types/user_info.py +19 -0
  193. autoassembler/types/user_info_response.py +23 -0
  194. autoassembler/types/user_info_response_providers.py +14 -0
  195. autoassembler-0.3.1.dist-info/METADATA +209 -0
  196. autoassembler-0.3.1.dist-info/RECORD +198 -0
  197. autoassembler-0.3.1.dist-info/WHEEL +4 -0
  198. autoassembler-0.3.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1557 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import contextlib
4
+ import typing
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from .. import core
8
+ from ..core.api_error import ApiError
9
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
11
+ from ..core.jsonable_encoder import encode_path_param
12
+ from ..core.parse_error import ParsingError
13
+ from ..core.pydantic_utilities import parse_obj_as
14
+ from ..core.request_options import RequestOptions
15
+ from ..core.serialization import convert_and_respect_annotation_metadata
16
+ from ..errors.bad_request_error import BadRequestError
17
+ from ..errors.forbidden_error import ForbiddenError
18
+ from ..errors.not_found_error import NotFoundError
19
+ from ..types.assembly import Assembly
20
+ from ..types.assembly_connections_response import AssemblyConnectionsResponse
21
+ from ..types.assembly_info import AssemblyInfo
22
+ from ..types.assembly_json_response import AssemblyJsonResponse
23
+ from ..types.assembly_version_summary import AssemblyVersionSummary
24
+ from ..types.diff_report import DiffReport
25
+ from ..types.error_response import ErrorResponse
26
+ from ..types.filter import Filter
27
+ from ..types.process_assembly_response import ProcessAssemblyResponse
28
+ from ..types.search_assemblies_response import SearchAssembliesResponse
29
+ from ..types.sort import Sort
30
+ from ..types.upload_response import UploadResponse
31
+ from .types.delete_assembly_response import DeleteAssemblyResponse
32
+ from .types.download_assembly_cad_request_namespace import DownloadAssemblyCadRequestNamespace
33
+ from .types.get_assembly_info_request_namespace import GetAssemblyInfoRequestNamespace
34
+ from .types.get_status_request_namespace import GetStatusRequestNamespace
35
+ from .types.get_status_response import GetStatusResponse
36
+ from .types.get_structure_request_namespace import GetStructureRequestNamespace
37
+ from .types.list_assembly_versions_request_namespace import ListAssemblyVersionsRequestNamespace
38
+ from .types.list_connections_request_namespace import ListConnectionsRequestNamespace
39
+ from .types.process_request_namespace import ProcessRequestNamespace
40
+ from .types.update_assembly_info_request_namespace import UpdateAssemblyInfoRequestNamespace
41
+ from pydantic import ValidationError
42
+
43
+ # this is used as the default value for optional parameters
44
+ OMIT = typing.cast(typing.Any, ...)
45
+
46
+
47
+ class RawAssembliesClient:
48
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
49
+ self._client_wrapper = client_wrapper
50
+
51
+ def upload(
52
+ self, *, file: typing.Optional[core.File] = OMIT, request_options: typing.Optional[RequestOptions] = None
53
+ ) -> HttpResponse[UploadResponse]:
54
+ """
55
+ Parameters
56
+ ----------
57
+ file : typing.Optional[core.File]
58
+ See core.File for more documentation
59
+
60
+ request_options : typing.Optional[RequestOptions]
61
+ Request-specific configuration.
62
+
63
+ Returns
64
+ -------
65
+ HttpResponse[UploadResponse]
66
+ Successful upload
67
+ """
68
+ _response = self._client_wrapper.httpx_client.request(
69
+ "api/v4/assemblies",
70
+ method="POST",
71
+ data={},
72
+ files={
73
+ **({"file": file} if file is not None else {}),
74
+ },
75
+ request_options=request_options,
76
+ omit=OMIT,
77
+ force_multipart=True,
78
+ )
79
+ try:
80
+ if 200 <= _response.status_code < 300:
81
+ _data = typing.cast(
82
+ UploadResponse,
83
+ parse_obj_as(
84
+ type_=UploadResponse, # type: ignore
85
+ object_=_response.json(),
86
+ ),
87
+ )
88
+ return HttpResponse(response=_response, data=_data)
89
+ if _response.status_code == 400:
90
+ raise BadRequestError(
91
+ headers=dict(_response.headers),
92
+ body=typing.cast(
93
+ typing.Any,
94
+ parse_obj_as(
95
+ type_=typing.Any, # type: ignore
96
+ object_=_response.json(),
97
+ ),
98
+ ),
99
+ )
100
+ _response_json = _response.json()
101
+ except JSONDecodeError:
102
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
103
+ except ValidationError as e:
104
+ raise ParsingError(
105
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
106
+ )
107
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
108
+
109
+ def search(
110
+ self,
111
+ *,
112
+ offset: typing.Optional[int] = OMIT,
113
+ limit: typing.Optional[int] = OMIT,
114
+ filters: typing.Optional[typing.Sequence[Filter]] = OMIT,
115
+ sort: typing.Optional[Sort] = OMIT,
116
+ request_options: typing.Optional[RequestOptions] = None,
117
+ ) -> HttpResponse[SearchAssembliesResponse]:
118
+ """
119
+ Parameters
120
+ ----------
121
+ offset : typing.Optional[int]
122
+
123
+ limit : typing.Optional[int]
124
+
125
+ filters : typing.Optional[typing.Sequence[Filter]]
126
+
127
+ sort : typing.Optional[Sort]
128
+
129
+ request_options : typing.Optional[RequestOptions]
130
+ Request-specific configuration.
131
+
132
+ Returns
133
+ -------
134
+ HttpResponse[SearchAssembliesResponse]
135
+ Search results
136
+ """
137
+ _response = self._client_wrapper.httpx_client.request(
138
+ "api/v4/assemblies/search",
139
+ method="POST",
140
+ json={
141
+ "offset": offset,
142
+ "limit": limit,
143
+ "filters": convert_and_respect_annotation_metadata(
144
+ object_=filters, annotation=typing.Sequence[Filter], direction="write"
145
+ ),
146
+ "sort": sort,
147
+ },
148
+ headers={
149
+ "content-type": "application/json",
150
+ },
151
+ request_options=request_options,
152
+ omit=OMIT,
153
+ )
154
+ try:
155
+ if 200 <= _response.status_code < 300:
156
+ _data = typing.cast(
157
+ SearchAssembliesResponse,
158
+ parse_obj_as(
159
+ type_=SearchAssembliesResponse, # type: ignore
160
+ object_=_response.json(),
161
+ ),
162
+ )
163
+ return HttpResponse(response=_response, data=_data)
164
+ _response_json = _response.json()
165
+ except JSONDecodeError:
166
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
167
+ except ValidationError as e:
168
+ raise ParsingError(
169
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
170
+ )
171
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
172
+
173
+ def diff(
174
+ self,
175
+ *,
176
+ reference_id: str,
177
+ target_id: str,
178
+ context_n_hops: typing.Optional[int] = OMIT,
179
+ async_: typing.Optional[bool] = OMIT,
180
+ request_options: typing.Optional[RequestOptions] = None,
181
+ ) -> HttpResponse[DiffReport]:
182
+ """
183
+ Compares a baseline assembly (`referenceId`) with another assembly
184
+ revision (`targetId`) and returns a structured report describing what
185
+ changed.
186
+
187
+ Typical UI mapping:
188
+ - Use `summary` for aggregate counts and badges.
189
+ - Use `details.geomDiffNodes.reference` for parts present only in the baseline.
190
+ - Use `details.geomDiffNodes.target` for parts present only in the target.
191
+ - Use `details.movedPosePairs` for matching parts that changed position or orientation.
192
+ - Use `details.swaps` for likely replacements, swaps, or renamed parts.
193
+ - Treat `flags` as supporting metadata for explanations, filters, or diagnostics.
194
+
195
+ Set `async` to `true` to get `202` with the operation computing the diff
196
+ (AIP-151): poll `GET /api/v4/operations/{id}` until it is `done`, then fetch
197
+ `resultUrl` for the `DiffReport`.
198
+
199
+ **Deprecated:** calling without `async: true`, which blocks until the diff is
200
+ computed and answers `200` with the report, with a `Deprecation` header
201
+ (RFC 9745). Pass `async: true` and wait on the operation instead; a later
202
+ version will always answer `202`.
203
+
204
+ Parameters
205
+ ----------
206
+ reference_id : str
207
+ Baseline assembly ID.
208
+
209
+ target_id : str
210
+ Target assembly ID.
211
+
212
+ context_n_hops : typing.Optional[int]
213
+ Graph radius used to collect surviving parts that define each added, removed, or swapped part's liaison context.
214
+
215
+ async_ : typing.Optional[bool]
216
+ When true, queues the diff and returns 202 with the operation computing it. Omitting it (or `false`) is deprecated.
217
+
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ HttpResponse[DiffReport]
224
+ Deprecated: the diff report, when called without `async: true`. Pass `async: true` and wait on the operation instead.
225
+ """
226
+ _response = self._client_wrapper.httpx_client.request(
227
+ "api/v4/assemblies/diff",
228
+ method="POST",
229
+ json={
230
+ "referenceId": reference_id,
231
+ "targetId": target_id,
232
+ "contextNHops": context_n_hops,
233
+ "async": async_,
234
+ },
235
+ headers={
236
+ "content-type": "application/json",
237
+ },
238
+ request_options=request_options,
239
+ omit=OMIT,
240
+ )
241
+ try:
242
+ if 200 <= _response.status_code < 300:
243
+ _data = typing.cast(
244
+ DiffReport,
245
+ parse_obj_as(
246
+ type_=DiffReport, # type: ignore
247
+ object_=_response.json(),
248
+ ),
249
+ )
250
+ return HttpResponse(response=_response, data=_data)
251
+ if _response.status_code == 400:
252
+ raise BadRequestError(
253
+ headers=dict(_response.headers),
254
+ body=typing.cast(
255
+ typing.Any,
256
+ parse_obj_as(
257
+ type_=typing.Any, # type: ignore
258
+ object_=_response.json(),
259
+ ),
260
+ ),
261
+ )
262
+ if _response.status_code == 404:
263
+ raise NotFoundError(
264
+ headers=dict(_response.headers),
265
+ body=typing.cast(
266
+ ErrorResponse,
267
+ parse_obj_as(
268
+ type_=ErrorResponse, # type: ignore
269
+ object_=_response.json(),
270
+ ),
271
+ ),
272
+ )
273
+ _response_json = _response.json()
274
+ except JSONDecodeError:
275
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
276
+ except ValidationError as e:
277
+ raise ParsingError(
278
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
279
+ )
280
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
281
+
282
+ def delete_assembly(
283
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
284
+ ) -> HttpResponse[DeleteAssemblyResponse]:
285
+ """
286
+ Parameters
287
+ ----------
288
+ id : str
289
+ Assembly ID.
290
+
291
+ request_options : typing.Optional[RequestOptions]
292
+ Request-specific configuration.
293
+
294
+ Returns
295
+ -------
296
+ HttpResponse[DeleteAssemblyResponse]
297
+ Assembly deleted successfully
298
+ """
299
+ _response = self._client_wrapper.httpx_client.request(
300
+ f"api/v4/assemblies/{encode_path_param(id)}",
301
+ method="DELETE",
302
+ request_options=request_options,
303
+ )
304
+ try:
305
+ if 200 <= _response.status_code < 300:
306
+ _data = typing.cast(
307
+ DeleteAssemblyResponse,
308
+ parse_obj_as(
309
+ type_=DeleteAssemblyResponse, # type: ignore
310
+ object_=_response.json(),
311
+ ),
312
+ )
313
+ return HttpResponse(response=_response, data=_data)
314
+ _response_json = _response.json()
315
+ except JSONDecodeError:
316
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
317
+ except ValidationError as e:
318
+ raise ParsingError(
319
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
320
+ )
321
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
322
+
323
+ def process(
324
+ self,
325
+ namespace: ProcessRequestNamespace,
326
+ id: str,
327
+ *,
328
+ attributes: typing.Optional[typing.Dict[str, typing.Sequence[str]]] = OMIT,
329
+ force: typing.Optional[bool] = OMIT,
330
+ clear_cache: typing.Optional[bool] = OMIT,
331
+ request_options: typing.Optional[RequestOptions] = None,
332
+ ) -> HttpResponse[ProcessAssemblyResponse]:
333
+ """
334
+ Parameters
335
+ ----------
336
+ namespace : ProcessRequestNamespace
337
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
338
+
339
+ id : str
340
+ Assembly ID.
341
+
342
+ attributes : typing.Optional[typing.Dict[str, typing.Sequence[str]]]
343
+ Attribute patterns for marking occurrences during parsing. Keys are attribute names (e.g. `consolidated`); values are glob patterns.
344
+
345
+ force : typing.Optional[bool]
346
+ Force reprocessing even if already processed.
347
+
348
+ clear_cache : typing.Optional[bool]
349
+ Clear cached planning data for this assembly.
350
+
351
+ request_options : typing.Optional[RequestOptions]
352
+ Request-specific configuration.
353
+
354
+ Returns
355
+ -------
356
+ HttpResponse[ProcessAssemblyResponse]
357
+ Processing request accepted or skipped
358
+ """
359
+ _response = self._client_wrapper.httpx_client.request(
360
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/process",
361
+ method="POST",
362
+ json={
363
+ "attributes": attributes,
364
+ "force": force,
365
+ "clearCache": clear_cache,
366
+ },
367
+ headers={
368
+ "content-type": "application/json",
369
+ },
370
+ request_options=request_options,
371
+ omit=OMIT,
372
+ )
373
+ try:
374
+ if 200 <= _response.status_code < 300:
375
+ _data = typing.cast(
376
+ ProcessAssemblyResponse,
377
+ parse_obj_as(
378
+ type_=ProcessAssemblyResponse, # type: ignore
379
+ object_=_response.json(),
380
+ ),
381
+ )
382
+ return HttpResponse(response=_response, data=_data)
383
+ if _response.status_code == 400:
384
+ raise BadRequestError(
385
+ headers=dict(_response.headers),
386
+ body=typing.cast(
387
+ typing.Any,
388
+ parse_obj_as(
389
+ type_=typing.Any, # type: ignore
390
+ object_=_response.json(),
391
+ ),
392
+ ),
393
+ )
394
+ if _response.status_code == 403:
395
+ raise ForbiddenError(
396
+ headers=dict(_response.headers),
397
+ body=typing.cast(
398
+ ErrorResponse,
399
+ parse_obj_as(
400
+ type_=ErrorResponse, # type: ignore
401
+ object_=_response.json(),
402
+ ),
403
+ ),
404
+ )
405
+ if _response.status_code == 404:
406
+ raise NotFoundError(
407
+ headers=dict(_response.headers),
408
+ body=typing.cast(
409
+ ErrorResponse,
410
+ parse_obj_as(
411
+ type_=ErrorResponse, # type: ignore
412
+ object_=_response.json(),
413
+ ),
414
+ ),
415
+ )
416
+ _response_json = _response.json()
417
+ except JSONDecodeError:
418
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
419
+ except ValidationError as e:
420
+ raise ParsingError(
421
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
422
+ )
423
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
424
+
425
+ def get_status(
426
+ self, namespace: GetStatusRequestNamespace, id: str, *, request_options: typing.Optional[RequestOptions] = None
427
+ ) -> HttpResponse[GetStatusResponse]:
428
+ """
429
+ Parameters
430
+ ----------
431
+ namespace : GetStatusRequestNamespace
432
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
433
+
434
+ id : str
435
+ Assembly ID.
436
+
437
+ request_options : typing.Optional[RequestOptions]
438
+ Request-specific configuration.
439
+
440
+ Returns
441
+ -------
442
+ HttpResponse[GetStatusResponse]
443
+ Current processing status of the assembly
444
+ """
445
+ _response = self._client_wrapper.httpx_client.request(
446
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/status.json",
447
+ method="GET",
448
+ request_options=request_options,
449
+ )
450
+ try:
451
+ if 200 <= _response.status_code < 300:
452
+ _data = typing.cast(
453
+ GetStatusResponse,
454
+ parse_obj_as(
455
+ type_=GetStatusResponse, # type: ignore
456
+ object_=_response.json(),
457
+ ),
458
+ )
459
+ return HttpResponse(response=_response, data=_data)
460
+ _response_json = _response.json()
461
+ except JSONDecodeError:
462
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
463
+ except ValidationError as e:
464
+ raise ParsingError(
465
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
466
+ )
467
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
468
+
469
+ def get_structure(
470
+ self,
471
+ namespace: GetStructureRequestNamespace,
472
+ id: str,
473
+ *,
474
+ request_options: typing.Optional[RequestOptions] = None,
475
+ ) -> HttpResponse[AssemblyJsonResponse]:
476
+ """
477
+ Parameters
478
+ ----------
479
+ namespace : GetStructureRequestNamespace
480
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
481
+
482
+ id : str
483
+ Assembly ID.
484
+
485
+ request_options : typing.Optional[RequestOptions]
486
+ Request-specific configuration.
487
+
488
+ Returns
489
+ -------
490
+ HttpResponse[AssemblyJsonResponse]
491
+ Assembly metadata and structure.
492
+ """
493
+ _response = self._client_wrapper.httpx_client.request(
494
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/assembly.json",
495
+ method="GET",
496
+ request_options=request_options,
497
+ )
498
+ try:
499
+ if 200 <= _response.status_code < 300:
500
+ _data = typing.cast(
501
+ AssemblyJsonResponse,
502
+ parse_obj_as(
503
+ type_=AssemblyJsonResponse, # type: ignore
504
+ object_=_response.json(),
505
+ ),
506
+ )
507
+ return HttpResponse(response=_response, data=_data)
508
+ _response_json = _response.json()
509
+ except JSONDecodeError:
510
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
511
+ except ValidationError as e:
512
+ raise ParsingError(
513
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
514
+ )
515
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
516
+
517
+ def list_connections(
518
+ self,
519
+ namespace: ListConnectionsRequestNamespace,
520
+ id: str,
521
+ *,
522
+ request_options: typing.Optional[RequestOptions] = None,
523
+ ) -> HttpResponse[AssemblyConnectionsResponse]:
524
+ """
525
+ Returns physical connections between occurrences. Each connection is a contact or interference relationship.
526
+
527
+ Parameters
528
+ ----------
529
+ namespace : ListConnectionsRequestNamespace
530
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
531
+
532
+ id : str
533
+ Assembly ID.
534
+
535
+ request_options : typing.Optional[RequestOptions]
536
+ Request-specific configuration.
537
+
538
+ Returns
539
+ -------
540
+ HttpResponse[AssemblyConnectionsResponse]
541
+ Assembly connections.
542
+ """
543
+ _response = self._client_wrapper.httpx_client.request(
544
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/connections.json",
545
+ method="GET",
546
+ request_options=request_options,
547
+ )
548
+ try:
549
+ if 200 <= _response.status_code < 300:
550
+ _data = typing.cast(
551
+ AssemblyConnectionsResponse,
552
+ parse_obj_as(
553
+ type_=AssemblyConnectionsResponse, # type: ignore
554
+ object_=_response.json(),
555
+ ),
556
+ )
557
+ return HttpResponse(response=_response, data=_data)
558
+ _response_json = _response.json()
559
+ except JSONDecodeError:
560
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
561
+ except ValidationError as e:
562
+ raise ParsingError(
563
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
564
+ )
565
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
566
+
567
+ def get_assembly_info(
568
+ self,
569
+ namespace: GetAssemblyInfoRequestNamespace,
570
+ id: str,
571
+ *,
572
+ request_options: typing.Optional[RequestOptions] = None,
573
+ ) -> HttpResponse[AssemblyInfo]:
574
+ """
575
+ Parameters
576
+ ----------
577
+ namespace : GetAssemblyInfoRequestNamespace
578
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
579
+
580
+ id : str
581
+ Assembly ID.
582
+
583
+ request_options : typing.Optional[RequestOptions]
584
+ Request-specific configuration.
585
+
586
+ Returns
587
+ -------
588
+ HttpResponse[AssemblyInfo]
589
+ Assembly metadata fields.
590
+ """
591
+ _response = self._client_wrapper.httpx_client.request(
592
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/info.json",
593
+ method="GET",
594
+ request_options=request_options,
595
+ )
596
+ try:
597
+ if 200 <= _response.status_code < 300:
598
+ _data = typing.cast(
599
+ AssemblyInfo,
600
+ parse_obj_as(
601
+ type_=AssemblyInfo, # type: ignore
602
+ object_=_response.json(),
603
+ ),
604
+ )
605
+ return HttpResponse(response=_response, data=_data)
606
+ _response_json = _response.json()
607
+ except JSONDecodeError:
608
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
609
+ except ValidationError as e:
610
+ raise ParsingError(
611
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
612
+ )
613
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
614
+
615
+ def update_assembly_info(
616
+ self,
617
+ namespace: UpdateAssemblyInfoRequestNamespace,
618
+ id: str,
619
+ *,
620
+ name: typing.Optional[str] = OMIT,
621
+ request_options: typing.Optional[RequestOptions] = None,
622
+ ) -> HttpResponse[Assembly]:
623
+ """
624
+ Currently only `name` is writable.
625
+
626
+ Parameters
627
+ ----------
628
+ namespace : UpdateAssemblyInfoRequestNamespace
629
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
630
+
631
+ id : str
632
+ Assembly ID.
633
+
634
+ name : typing.Optional[str]
635
+
636
+ request_options : typing.Optional[RequestOptions]
637
+ Request-specific configuration.
638
+
639
+ Returns
640
+ -------
641
+ HttpResponse[Assembly]
642
+ Updated assembly record.
643
+ """
644
+ _response = self._client_wrapper.httpx_client.request(
645
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/info.json",
646
+ method="PUT",
647
+ json={
648
+ "name": name,
649
+ },
650
+ headers={
651
+ "content-type": "application/json",
652
+ },
653
+ request_options=request_options,
654
+ omit=OMIT,
655
+ )
656
+ try:
657
+ if 200 <= _response.status_code < 300:
658
+ _data = typing.cast(
659
+ Assembly,
660
+ parse_obj_as(
661
+ type_=Assembly, # type: ignore
662
+ object_=_response.json(),
663
+ ),
664
+ )
665
+ return HttpResponse(response=_response, data=_data)
666
+ if _response.status_code == 400:
667
+ raise BadRequestError(
668
+ headers=dict(_response.headers),
669
+ body=typing.cast(
670
+ typing.Any,
671
+ parse_obj_as(
672
+ type_=typing.Any, # type: ignore
673
+ object_=_response.json(),
674
+ ),
675
+ ),
676
+ )
677
+ _response_json = _response.json()
678
+ except JSONDecodeError:
679
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
680
+ except ValidationError as e:
681
+ raise ParsingError(
682
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
683
+ )
684
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
685
+
686
+ def list_assembly_versions(
687
+ self,
688
+ namespace: ListAssemblyVersionsRequestNamespace,
689
+ id: str,
690
+ *,
691
+ request_options: typing.Optional[RequestOptions] = None,
692
+ ) -> HttpResponse[typing.List[AssemblyVersionSummary]]:
693
+ """
694
+ Returns other assemblies that share this assembly's `externalId` (for example an Onshape document). Empty when `externalId` is unset.
695
+
696
+ Parameters
697
+ ----------
698
+ namespace : ListAssemblyVersionsRequestNamespace
699
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
700
+
701
+ id : str
702
+ Assembly ID.
703
+
704
+ request_options : typing.Optional[RequestOptions]
705
+ Request-specific configuration.
706
+
707
+ Returns
708
+ -------
709
+ HttpResponse[typing.List[AssemblyVersionSummary]]
710
+ Version list.
711
+ """
712
+ _response = self._client_wrapper.httpx_client.request(
713
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/versions.json",
714
+ method="GET",
715
+ request_options=request_options,
716
+ )
717
+ try:
718
+ if 200 <= _response.status_code < 300:
719
+ _data = typing.cast(
720
+ typing.List[AssemblyVersionSummary],
721
+ parse_obj_as(
722
+ type_=typing.List[AssemblyVersionSummary], # type: ignore
723
+ object_=_response.json(),
724
+ ),
725
+ )
726
+ return HttpResponse(response=_response, data=_data)
727
+ _response_json = _response.json()
728
+ except JSONDecodeError:
729
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
730
+ except ValidationError as e:
731
+ raise ParsingError(
732
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
733
+ )
734
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
735
+
736
+ @contextlib.contextmanager
737
+ def download_assembly_cad(
738
+ self,
739
+ namespace: DownloadAssemblyCadRequestNamespace,
740
+ id: str,
741
+ *,
742
+ request_options: typing.Optional[RequestOptions] = None,
743
+ ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]:
744
+ """
745
+ Parameters
746
+ ----------
747
+ namespace : DownloadAssemblyCadRequestNamespace
748
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
749
+
750
+ id : str
751
+ Assembly ID.
752
+
753
+ request_options : typing.Optional[RequestOptions]
754
+ Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
755
+
756
+ Returns
757
+ -------
758
+ typing.Iterator[HttpResponse[typing.Iterator[bytes]]]
759
+ CAD file bytes (attachment download).
760
+ """
761
+ with self._client_wrapper.httpx_client.stream(
762
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/download",
763
+ method="GET",
764
+ request_options=request_options,
765
+ ) as _response:
766
+
767
+ def _stream() -> HttpResponse[typing.Iterator[bytes]]:
768
+ try:
769
+ if 200 <= _response.status_code < 300:
770
+ _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
771
+ return HttpResponse(
772
+ response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size))
773
+ )
774
+ _response.read()
775
+ if _response.status_code == 404:
776
+ raise NotFoundError(
777
+ headers=dict(_response.headers),
778
+ body=typing.cast(
779
+ ErrorResponse,
780
+ parse_obj_as(
781
+ type_=ErrorResponse, # type: ignore
782
+ object_=_response.json(),
783
+ ),
784
+ ),
785
+ )
786
+ _response_json = _response.json()
787
+ except JSONDecodeError:
788
+ raise ApiError(
789
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
790
+ )
791
+ except ValidationError as e:
792
+ raise ParsingError(
793
+ status_code=_response.status_code,
794
+ headers=dict(_response.headers),
795
+ body=_response.json(),
796
+ cause=e,
797
+ )
798
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
799
+
800
+ yield _stream()
801
+
802
+
803
+ class AsyncRawAssembliesClient:
804
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
805
+ self._client_wrapper = client_wrapper
806
+
807
+ async def upload(
808
+ self, *, file: typing.Optional[core.File] = OMIT, request_options: typing.Optional[RequestOptions] = None
809
+ ) -> AsyncHttpResponse[UploadResponse]:
810
+ """
811
+ Parameters
812
+ ----------
813
+ file : typing.Optional[core.File]
814
+ See core.File for more documentation
815
+
816
+ request_options : typing.Optional[RequestOptions]
817
+ Request-specific configuration.
818
+
819
+ Returns
820
+ -------
821
+ AsyncHttpResponse[UploadResponse]
822
+ Successful upload
823
+ """
824
+ _response = await self._client_wrapper.httpx_client.request(
825
+ "api/v4/assemblies",
826
+ method="POST",
827
+ data={},
828
+ files={
829
+ **({"file": file} if file is not None else {}),
830
+ },
831
+ request_options=request_options,
832
+ omit=OMIT,
833
+ force_multipart=True,
834
+ )
835
+ try:
836
+ if 200 <= _response.status_code < 300:
837
+ _data = typing.cast(
838
+ UploadResponse,
839
+ parse_obj_as(
840
+ type_=UploadResponse, # type: ignore
841
+ object_=_response.json(),
842
+ ),
843
+ )
844
+ return AsyncHttpResponse(response=_response, data=_data)
845
+ if _response.status_code == 400:
846
+ raise BadRequestError(
847
+ headers=dict(_response.headers),
848
+ body=typing.cast(
849
+ typing.Any,
850
+ parse_obj_as(
851
+ type_=typing.Any, # type: ignore
852
+ object_=_response.json(),
853
+ ),
854
+ ),
855
+ )
856
+ _response_json = _response.json()
857
+ except JSONDecodeError:
858
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
859
+ except ValidationError as e:
860
+ raise ParsingError(
861
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
862
+ )
863
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
864
+
865
+ async def search(
866
+ self,
867
+ *,
868
+ offset: typing.Optional[int] = OMIT,
869
+ limit: typing.Optional[int] = OMIT,
870
+ filters: typing.Optional[typing.Sequence[Filter]] = OMIT,
871
+ sort: typing.Optional[Sort] = OMIT,
872
+ request_options: typing.Optional[RequestOptions] = None,
873
+ ) -> AsyncHttpResponse[SearchAssembliesResponse]:
874
+ """
875
+ Parameters
876
+ ----------
877
+ offset : typing.Optional[int]
878
+
879
+ limit : typing.Optional[int]
880
+
881
+ filters : typing.Optional[typing.Sequence[Filter]]
882
+
883
+ sort : typing.Optional[Sort]
884
+
885
+ request_options : typing.Optional[RequestOptions]
886
+ Request-specific configuration.
887
+
888
+ Returns
889
+ -------
890
+ AsyncHttpResponse[SearchAssembliesResponse]
891
+ Search results
892
+ """
893
+ _response = await self._client_wrapper.httpx_client.request(
894
+ "api/v4/assemblies/search",
895
+ method="POST",
896
+ json={
897
+ "offset": offset,
898
+ "limit": limit,
899
+ "filters": convert_and_respect_annotation_metadata(
900
+ object_=filters, annotation=typing.Sequence[Filter], direction="write"
901
+ ),
902
+ "sort": sort,
903
+ },
904
+ headers={
905
+ "content-type": "application/json",
906
+ },
907
+ request_options=request_options,
908
+ omit=OMIT,
909
+ )
910
+ try:
911
+ if 200 <= _response.status_code < 300:
912
+ _data = typing.cast(
913
+ SearchAssembliesResponse,
914
+ parse_obj_as(
915
+ type_=SearchAssembliesResponse, # type: ignore
916
+ object_=_response.json(),
917
+ ),
918
+ )
919
+ return AsyncHttpResponse(response=_response, data=_data)
920
+ _response_json = _response.json()
921
+ except JSONDecodeError:
922
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
923
+ except ValidationError as e:
924
+ raise ParsingError(
925
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
926
+ )
927
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
928
+
929
+ async def diff(
930
+ self,
931
+ *,
932
+ reference_id: str,
933
+ target_id: str,
934
+ context_n_hops: typing.Optional[int] = OMIT,
935
+ async_: typing.Optional[bool] = OMIT,
936
+ request_options: typing.Optional[RequestOptions] = None,
937
+ ) -> AsyncHttpResponse[DiffReport]:
938
+ """
939
+ Compares a baseline assembly (`referenceId`) with another assembly
940
+ revision (`targetId`) and returns a structured report describing what
941
+ changed.
942
+
943
+ Typical UI mapping:
944
+ - Use `summary` for aggregate counts and badges.
945
+ - Use `details.geomDiffNodes.reference` for parts present only in the baseline.
946
+ - Use `details.geomDiffNodes.target` for parts present only in the target.
947
+ - Use `details.movedPosePairs` for matching parts that changed position or orientation.
948
+ - Use `details.swaps` for likely replacements, swaps, or renamed parts.
949
+ - Treat `flags` as supporting metadata for explanations, filters, or diagnostics.
950
+
951
+ Set `async` to `true` to get `202` with the operation computing the diff
952
+ (AIP-151): poll `GET /api/v4/operations/{id}` until it is `done`, then fetch
953
+ `resultUrl` for the `DiffReport`.
954
+
955
+ **Deprecated:** calling without `async: true`, which blocks until the diff is
956
+ computed and answers `200` with the report, with a `Deprecation` header
957
+ (RFC 9745). Pass `async: true` and wait on the operation instead; a later
958
+ version will always answer `202`.
959
+
960
+ Parameters
961
+ ----------
962
+ reference_id : str
963
+ Baseline assembly ID.
964
+
965
+ target_id : str
966
+ Target assembly ID.
967
+
968
+ context_n_hops : typing.Optional[int]
969
+ Graph radius used to collect surviving parts that define each added, removed, or swapped part's liaison context.
970
+
971
+ async_ : typing.Optional[bool]
972
+ When true, queues the diff and returns 202 with the operation computing it. Omitting it (or `false`) is deprecated.
973
+
974
+ request_options : typing.Optional[RequestOptions]
975
+ Request-specific configuration.
976
+
977
+ Returns
978
+ -------
979
+ AsyncHttpResponse[DiffReport]
980
+ Deprecated: the diff report, when called without `async: true`. Pass `async: true` and wait on the operation instead.
981
+ """
982
+ _response = await self._client_wrapper.httpx_client.request(
983
+ "api/v4/assemblies/diff",
984
+ method="POST",
985
+ json={
986
+ "referenceId": reference_id,
987
+ "targetId": target_id,
988
+ "contextNHops": context_n_hops,
989
+ "async": async_,
990
+ },
991
+ headers={
992
+ "content-type": "application/json",
993
+ },
994
+ request_options=request_options,
995
+ omit=OMIT,
996
+ )
997
+ try:
998
+ if 200 <= _response.status_code < 300:
999
+ _data = typing.cast(
1000
+ DiffReport,
1001
+ parse_obj_as(
1002
+ type_=DiffReport, # type: ignore
1003
+ object_=_response.json(),
1004
+ ),
1005
+ )
1006
+ return AsyncHttpResponse(response=_response, data=_data)
1007
+ if _response.status_code == 400:
1008
+ raise BadRequestError(
1009
+ headers=dict(_response.headers),
1010
+ body=typing.cast(
1011
+ typing.Any,
1012
+ parse_obj_as(
1013
+ type_=typing.Any, # type: ignore
1014
+ object_=_response.json(),
1015
+ ),
1016
+ ),
1017
+ )
1018
+ if _response.status_code == 404:
1019
+ raise NotFoundError(
1020
+ headers=dict(_response.headers),
1021
+ body=typing.cast(
1022
+ ErrorResponse,
1023
+ parse_obj_as(
1024
+ type_=ErrorResponse, # type: ignore
1025
+ object_=_response.json(),
1026
+ ),
1027
+ ),
1028
+ )
1029
+ _response_json = _response.json()
1030
+ except JSONDecodeError:
1031
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1032
+ except ValidationError as e:
1033
+ raise ParsingError(
1034
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1035
+ )
1036
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1037
+
1038
+ async def delete_assembly(
1039
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1040
+ ) -> AsyncHttpResponse[DeleteAssemblyResponse]:
1041
+ """
1042
+ Parameters
1043
+ ----------
1044
+ id : str
1045
+ Assembly ID.
1046
+
1047
+ request_options : typing.Optional[RequestOptions]
1048
+ Request-specific configuration.
1049
+
1050
+ Returns
1051
+ -------
1052
+ AsyncHttpResponse[DeleteAssemblyResponse]
1053
+ Assembly deleted successfully
1054
+ """
1055
+ _response = await self._client_wrapper.httpx_client.request(
1056
+ f"api/v4/assemblies/{encode_path_param(id)}",
1057
+ method="DELETE",
1058
+ request_options=request_options,
1059
+ )
1060
+ try:
1061
+ if 200 <= _response.status_code < 300:
1062
+ _data = typing.cast(
1063
+ DeleteAssemblyResponse,
1064
+ parse_obj_as(
1065
+ type_=DeleteAssemblyResponse, # type: ignore
1066
+ object_=_response.json(),
1067
+ ),
1068
+ )
1069
+ return AsyncHttpResponse(response=_response, data=_data)
1070
+ _response_json = _response.json()
1071
+ except JSONDecodeError:
1072
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1073
+ except ValidationError as e:
1074
+ raise ParsingError(
1075
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1076
+ )
1077
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1078
+
1079
+ async def process(
1080
+ self,
1081
+ namespace: ProcessRequestNamespace,
1082
+ id: str,
1083
+ *,
1084
+ attributes: typing.Optional[typing.Dict[str, typing.Sequence[str]]] = OMIT,
1085
+ force: typing.Optional[bool] = OMIT,
1086
+ clear_cache: typing.Optional[bool] = OMIT,
1087
+ request_options: typing.Optional[RequestOptions] = None,
1088
+ ) -> AsyncHttpResponse[ProcessAssemblyResponse]:
1089
+ """
1090
+ Parameters
1091
+ ----------
1092
+ namespace : ProcessRequestNamespace
1093
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1094
+
1095
+ id : str
1096
+ Assembly ID.
1097
+
1098
+ attributes : typing.Optional[typing.Dict[str, typing.Sequence[str]]]
1099
+ Attribute patterns for marking occurrences during parsing. Keys are attribute names (e.g. `consolidated`); values are glob patterns.
1100
+
1101
+ force : typing.Optional[bool]
1102
+ Force reprocessing even if already processed.
1103
+
1104
+ clear_cache : typing.Optional[bool]
1105
+ Clear cached planning data for this assembly.
1106
+
1107
+ request_options : typing.Optional[RequestOptions]
1108
+ Request-specific configuration.
1109
+
1110
+ Returns
1111
+ -------
1112
+ AsyncHttpResponse[ProcessAssemblyResponse]
1113
+ Processing request accepted or skipped
1114
+ """
1115
+ _response = await self._client_wrapper.httpx_client.request(
1116
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/process",
1117
+ method="POST",
1118
+ json={
1119
+ "attributes": attributes,
1120
+ "force": force,
1121
+ "clearCache": clear_cache,
1122
+ },
1123
+ headers={
1124
+ "content-type": "application/json",
1125
+ },
1126
+ request_options=request_options,
1127
+ omit=OMIT,
1128
+ )
1129
+ try:
1130
+ if 200 <= _response.status_code < 300:
1131
+ _data = typing.cast(
1132
+ ProcessAssemblyResponse,
1133
+ parse_obj_as(
1134
+ type_=ProcessAssemblyResponse, # type: ignore
1135
+ object_=_response.json(),
1136
+ ),
1137
+ )
1138
+ return AsyncHttpResponse(response=_response, data=_data)
1139
+ if _response.status_code == 400:
1140
+ raise BadRequestError(
1141
+ headers=dict(_response.headers),
1142
+ body=typing.cast(
1143
+ typing.Any,
1144
+ parse_obj_as(
1145
+ type_=typing.Any, # type: ignore
1146
+ object_=_response.json(),
1147
+ ),
1148
+ ),
1149
+ )
1150
+ if _response.status_code == 403:
1151
+ raise ForbiddenError(
1152
+ headers=dict(_response.headers),
1153
+ body=typing.cast(
1154
+ ErrorResponse,
1155
+ parse_obj_as(
1156
+ type_=ErrorResponse, # type: ignore
1157
+ object_=_response.json(),
1158
+ ),
1159
+ ),
1160
+ )
1161
+ if _response.status_code == 404:
1162
+ raise NotFoundError(
1163
+ headers=dict(_response.headers),
1164
+ body=typing.cast(
1165
+ ErrorResponse,
1166
+ parse_obj_as(
1167
+ type_=ErrorResponse, # type: ignore
1168
+ object_=_response.json(),
1169
+ ),
1170
+ ),
1171
+ )
1172
+ _response_json = _response.json()
1173
+ except JSONDecodeError:
1174
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1175
+ except ValidationError as e:
1176
+ raise ParsingError(
1177
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1178
+ )
1179
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1180
+
1181
+ async def get_status(
1182
+ self, namespace: GetStatusRequestNamespace, id: str, *, request_options: typing.Optional[RequestOptions] = None
1183
+ ) -> AsyncHttpResponse[GetStatusResponse]:
1184
+ """
1185
+ Parameters
1186
+ ----------
1187
+ namespace : GetStatusRequestNamespace
1188
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1189
+
1190
+ id : str
1191
+ Assembly ID.
1192
+
1193
+ request_options : typing.Optional[RequestOptions]
1194
+ Request-specific configuration.
1195
+
1196
+ Returns
1197
+ -------
1198
+ AsyncHttpResponse[GetStatusResponse]
1199
+ Current processing status of the assembly
1200
+ """
1201
+ _response = await self._client_wrapper.httpx_client.request(
1202
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/status.json",
1203
+ method="GET",
1204
+ request_options=request_options,
1205
+ )
1206
+ try:
1207
+ if 200 <= _response.status_code < 300:
1208
+ _data = typing.cast(
1209
+ GetStatusResponse,
1210
+ parse_obj_as(
1211
+ type_=GetStatusResponse, # type: ignore
1212
+ object_=_response.json(),
1213
+ ),
1214
+ )
1215
+ return AsyncHttpResponse(response=_response, data=_data)
1216
+ _response_json = _response.json()
1217
+ except JSONDecodeError:
1218
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1219
+ except ValidationError as e:
1220
+ raise ParsingError(
1221
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1222
+ )
1223
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1224
+
1225
+ async def get_structure(
1226
+ self,
1227
+ namespace: GetStructureRequestNamespace,
1228
+ id: str,
1229
+ *,
1230
+ request_options: typing.Optional[RequestOptions] = None,
1231
+ ) -> AsyncHttpResponse[AssemblyJsonResponse]:
1232
+ """
1233
+ Parameters
1234
+ ----------
1235
+ namespace : GetStructureRequestNamespace
1236
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1237
+
1238
+ id : str
1239
+ Assembly ID.
1240
+
1241
+ request_options : typing.Optional[RequestOptions]
1242
+ Request-specific configuration.
1243
+
1244
+ Returns
1245
+ -------
1246
+ AsyncHttpResponse[AssemblyJsonResponse]
1247
+ Assembly metadata and structure.
1248
+ """
1249
+ _response = await self._client_wrapper.httpx_client.request(
1250
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/assembly.json",
1251
+ method="GET",
1252
+ request_options=request_options,
1253
+ )
1254
+ try:
1255
+ if 200 <= _response.status_code < 300:
1256
+ _data = typing.cast(
1257
+ AssemblyJsonResponse,
1258
+ parse_obj_as(
1259
+ type_=AssemblyJsonResponse, # type: ignore
1260
+ object_=_response.json(),
1261
+ ),
1262
+ )
1263
+ return AsyncHttpResponse(response=_response, data=_data)
1264
+ _response_json = _response.json()
1265
+ except JSONDecodeError:
1266
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1267
+ except ValidationError as e:
1268
+ raise ParsingError(
1269
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1270
+ )
1271
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1272
+
1273
+ async def list_connections(
1274
+ self,
1275
+ namespace: ListConnectionsRequestNamespace,
1276
+ id: str,
1277
+ *,
1278
+ request_options: typing.Optional[RequestOptions] = None,
1279
+ ) -> AsyncHttpResponse[AssemblyConnectionsResponse]:
1280
+ """
1281
+ Returns physical connections between occurrences. Each connection is a contact or interference relationship.
1282
+
1283
+ Parameters
1284
+ ----------
1285
+ namespace : ListConnectionsRequestNamespace
1286
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1287
+
1288
+ id : str
1289
+ Assembly ID.
1290
+
1291
+ request_options : typing.Optional[RequestOptions]
1292
+ Request-specific configuration.
1293
+
1294
+ Returns
1295
+ -------
1296
+ AsyncHttpResponse[AssemblyConnectionsResponse]
1297
+ Assembly connections.
1298
+ """
1299
+ _response = await self._client_wrapper.httpx_client.request(
1300
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/connections.json",
1301
+ method="GET",
1302
+ request_options=request_options,
1303
+ )
1304
+ try:
1305
+ if 200 <= _response.status_code < 300:
1306
+ _data = typing.cast(
1307
+ AssemblyConnectionsResponse,
1308
+ parse_obj_as(
1309
+ type_=AssemblyConnectionsResponse, # type: ignore
1310
+ object_=_response.json(),
1311
+ ),
1312
+ )
1313
+ return AsyncHttpResponse(response=_response, data=_data)
1314
+ _response_json = _response.json()
1315
+ except JSONDecodeError:
1316
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1317
+ except ValidationError as e:
1318
+ raise ParsingError(
1319
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1320
+ )
1321
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1322
+
1323
+ async def get_assembly_info(
1324
+ self,
1325
+ namespace: GetAssemblyInfoRequestNamespace,
1326
+ id: str,
1327
+ *,
1328
+ request_options: typing.Optional[RequestOptions] = None,
1329
+ ) -> AsyncHttpResponse[AssemblyInfo]:
1330
+ """
1331
+ Parameters
1332
+ ----------
1333
+ namespace : GetAssemblyInfoRequestNamespace
1334
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1335
+
1336
+ id : str
1337
+ Assembly ID.
1338
+
1339
+ request_options : typing.Optional[RequestOptions]
1340
+ Request-specific configuration.
1341
+
1342
+ Returns
1343
+ -------
1344
+ AsyncHttpResponse[AssemblyInfo]
1345
+ Assembly metadata fields.
1346
+ """
1347
+ _response = await self._client_wrapper.httpx_client.request(
1348
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/info.json",
1349
+ method="GET",
1350
+ request_options=request_options,
1351
+ )
1352
+ try:
1353
+ if 200 <= _response.status_code < 300:
1354
+ _data = typing.cast(
1355
+ AssemblyInfo,
1356
+ parse_obj_as(
1357
+ type_=AssemblyInfo, # type: ignore
1358
+ object_=_response.json(),
1359
+ ),
1360
+ )
1361
+ return AsyncHttpResponse(response=_response, data=_data)
1362
+ _response_json = _response.json()
1363
+ except JSONDecodeError:
1364
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1365
+ except ValidationError as e:
1366
+ raise ParsingError(
1367
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1368
+ )
1369
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1370
+
1371
+ async def update_assembly_info(
1372
+ self,
1373
+ namespace: UpdateAssemblyInfoRequestNamespace,
1374
+ id: str,
1375
+ *,
1376
+ name: typing.Optional[str] = OMIT,
1377
+ request_options: typing.Optional[RequestOptions] = None,
1378
+ ) -> AsyncHttpResponse[Assembly]:
1379
+ """
1380
+ Currently only `name` is writable.
1381
+
1382
+ Parameters
1383
+ ----------
1384
+ namespace : UpdateAssemblyInfoRequestNamespace
1385
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1386
+
1387
+ id : str
1388
+ Assembly ID.
1389
+
1390
+ name : typing.Optional[str]
1391
+
1392
+ request_options : typing.Optional[RequestOptions]
1393
+ Request-specific configuration.
1394
+
1395
+ Returns
1396
+ -------
1397
+ AsyncHttpResponse[Assembly]
1398
+ Updated assembly record.
1399
+ """
1400
+ _response = await self._client_wrapper.httpx_client.request(
1401
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/info.json",
1402
+ method="PUT",
1403
+ json={
1404
+ "name": name,
1405
+ },
1406
+ headers={
1407
+ "content-type": "application/json",
1408
+ },
1409
+ request_options=request_options,
1410
+ omit=OMIT,
1411
+ )
1412
+ try:
1413
+ if 200 <= _response.status_code < 300:
1414
+ _data = typing.cast(
1415
+ Assembly,
1416
+ parse_obj_as(
1417
+ type_=Assembly, # type: ignore
1418
+ object_=_response.json(),
1419
+ ),
1420
+ )
1421
+ return AsyncHttpResponse(response=_response, data=_data)
1422
+ if _response.status_code == 400:
1423
+ raise BadRequestError(
1424
+ headers=dict(_response.headers),
1425
+ body=typing.cast(
1426
+ typing.Any,
1427
+ parse_obj_as(
1428
+ type_=typing.Any, # type: ignore
1429
+ object_=_response.json(),
1430
+ ),
1431
+ ),
1432
+ )
1433
+ _response_json = _response.json()
1434
+ except JSONDecodeError:
1435
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1436
+ except ValidationError as e:
1437
+ raise ParsingError(
1438
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1439
+ )
1440
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1441
+
1442
+ async def list_assembly_versions(
1443
+ self,
1444
+ namespace: ListAssemblyVersionsRequestNamespace,
1445
+ id: str,
1446
+ *,
1447
+ request_options: typing.Optional[RequestOptions] = None,
1448
+ ) -> AsyncHttpResponse[typing.List[AssemblyVersionSummary]]:
1449
+ """
1450
+ Returns other assemblies that share this assembly's `externalId` (for example an Onshape document). Empty when `externalId` is unset.
1451
+
1452
+ Parameters
1453
+ ----------
1454
+ namespace : ListAssemblyVersionsRequestNamespace
1455
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1456
+
1457
+ id : str
1458
+ Assembly ID.
1459
+
1460
+ request_options : typing.Optional[RequestOptions]
1461
+ Request-specific configuration.
1462
+
1463
+ Returns
1464
+ -------
1465
+ AsyncHttpResponse[typing.List[AssemblyVersionSummary]]
1466
+ Version list.
1467
+ """
1468
+ _response = await self._client_wrapper.httpx_client.request(
1469
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/versions.json",
1470
+ method="GET",
1471
+ request_options=request_options,
1472
+ )
1473
+ try:
1474
+ if 200 <= _response.status_code < 300:
1475
+ _data = typing.cast(
1476
+ typing.List[AssemblyVersionSummary],
1477
+ parse_obj_as(
1478
+ type_=typing.List[AssemblyVersionSummary], # type: ignore
1479
+ object_=_response.json(),
1480
+ ),
1481
+ )
1482
+ return AsyncHttpResponse(response=_response, data=_data)
1483
+ _response_json = _response.json()
1484
+ except JSONDecodeError:
1485
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1486
+ except ValidationError as e:
1487
+ raise ParsingError(
1488
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1489
+ )
1490
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1491
+
1492
+ @contextlib.asynccontextmanager
1493
+ async def download_assembly_cad(
1494
+ self,
1495
+ namespace: DownloadAssemblyCadRequestNamespace,
1496
+ id: str,
1497
+ *,
1498
+ request_options: typing.Optional[RequestOptions] = None,
1499
+ ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]:
1500
+ """
1501
+ Parameters
1502
+ ----------
1503
+ namespace : DownloadAssemblyCadRequestNamespace
1504
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
1505
+
1506
+ id : str
1507
+ Assembly ID.
1508
+
1509
+ request_options : typing.Optional[RequestOptions]
1510
+ Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
1511
+
1512
+ Returns
1513
+ -------
1514
+ typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]
1515
+ CAD file bytes (attachment download).
1516
+ """
1517
+ async with self._client_wrapper.httpx_client.stream(
1518
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/download",
1519
+ method="GET",
1520
+ request_options=request_options,
1521
+ ) as _response:
1522
+
1523
+ async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]:
1524
+ try:
1525
+ if 200 <= _response.status_code < 300:
1526
+ _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
1527
+ return AsyncHttpResponse(
1528
+ response=_response,
1529
+ data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)),
1530
+ )
1531
+ await _response.aread()
1532
+ if _response.status_code == 404:
1533
+ raise NotFoundError(
1534
+ headers=dict(_response.headers),
1535
+ body=typing.cast(
1536
+ ErrorResponse,
1537
+ parse_obj_as(
1538
+ type_=ErrorResponse, # type: ignore
1539
+ object_=_response.json(),
1540
+ ),
1541
+ ),
1542
+ )
1543
+ _response_json = _response.json()
1544
+ except JSONDecodeError:
1545
+ raise ApiError(
1546
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
1547
+ )
1548
+ except ValidationError as e:
1549
+ raise ParsingError(
1550
+ status_code=_response.status_code,
1551
+ headers=dict(_response.headers),
1552
+ body=_response.json(),
1553
+ cause=e,
1554
+ )
1555
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1556
+
1557
+ yield await _stream()