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,30 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ import typing_extensions
7
+ from ....core.pydantic_utilities import UniversalBaseModel
8
+ from ....core.serialization import FieldMetadata
9
+ from ....types.job import Job
10
+ from .list_jobs_jobs_response_pagination import ListJobsJobsResponsePagination
11
+
12
+
13
+ class ListJobsJobsResponse(UniversalBaseModel):
14
+ data: typing.List[Job]
15
+ ahead_count: typing_extensions.Annotated[
16
+ typing.Optional[int],
17
+ FieldMetadata(alias="aheadCount"),
18
+ pydantic.Field(
19
+ alias="aheadCount",
20
+ default=None,
21
+ description="Number of other users' queued jobs ahead of the caller's jobs.",
22
+ ),
23
+ ]
24
+ """
25
+ Number of other users' queued jobs ahead of the caller's jobs.
26
+ """
27
+
28
+ pagination: ListJobsJobsResponsePagination
29
+
30
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ....core.pydantic_utilities import UniversalBaseModel
7
+
8
+
9
+ class ListJobsJobsResponsePagination(UniversalBaseModel):
10
+ page: int
11
+ limit: int
12
+ total: int = pydantic.Field()
13
+ """
14
+ Total number of matching jobs.
15
+ """
16
+
17
+ pages: int = pydantic.Field()
18
+ """
19
+ Total number of pages (1 when limit is 0).
20
+ """
21
+
22
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
@@ -0,0 +1,16 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ....core.pydantic_utilities import UniversalBaseModel
7
+
8
+
9
+ class RetryJobJobsResponse(UniversalBaseModel):
10
+ ok: typing.Optional[bool] = None
11
+ key: typing.Optional[str] = pydantic.Field(default=None)
12
+ """
13
+ Key of the newly created retry job.
14
+ """
15
+
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)
@@ -0,0 +1,49 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ ApplyOpsPlanningRequestNamespace,
11
+ ApplyOpsPlanningRequestOpsItem,
12
+ ApplyOpsPlanningRequestOpsItemOp,
13
+ ApplyOpsPlanningResponse,
14
+ )
15
+ _dynamic_imports: typing.Dict[str, str] = {
16
+ "ApplyOpsPlanningRequestNamespace": ".types",
17
+ "ApplyOpsPlanningRequestOpsItem": ".types",
18
+ "ApplyOpsPlanningRequestOpsItemOp": ".types",
19
+ "ApplyOpsPlanningResponse": ".types",
20
+ }
21
+
22
+
23
+ def __getattr__(attr_name: str) -> typing.Any:
24
+ module_name = _dynamic_imports.get(attr_name)
25
+ if module_name is None:
26
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
27
+ try:
28
+ module = import_module(module_name, __package__)
29
+ if module_name == f".{attr_name}":
30
+ return module
31
+ else:
32
+ return getattr(module, attr_name)
33
+ except ImportError as e:
34
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
35
+ except AttributeError as e:
36
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
37
+
38
+
39
+ def __dir__():
40
+ lazy_attrs = list(_dynamic_imports.keys())
41
+ return sorted(lazy_attrs)
42
+
43
+
44
+ __all__ = [
45
+ "ApplyOpsPlanningRequestNamespace",
46
+ "ApplyOpsPlanningRequestOpsItem",
47
+ "ApplyOpsPlanningRequestOpsItemOp",
48
+ "ApplyOpsPlanningResponse",
49
+ ]
@@ -0,0 +1,201 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ...core.request_options import RequestOptions
7
+ from .raw_client import AsyncRawPlanningClient, RawPlanningClient
8
+ from .types.apply_ops_planning_request_namespace import ApplyOpsPlanningRequestNamespace
9
+ from .types.apply_ops_planning_request_ops_item import ApplyOpsPlanningRequestOpsItem
10
+ from .types.apply_ops_planning_response import ApplyOpsPlanningResponse
11
+
12
+ # this is used as the default value for optional parameters
13
+ OMIT = typing.cast(typing.Any, ...)
14
+
15
+
16
+ class PlanningClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._raw_client = RawPlanningClient(client_wrapper=client_wrapper)
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawPlanningClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawPlanningClient
28
+ """
29
+ return self._raw_client
30
+
31
+ def apply_ops(
32
+ self,
33
+ namespace: ApplyOpsPlanningRequestNamespace,
34
+ id: str,
35
+ mpp_id: str,
36
+ *,
37
+ version: int,
38
+ ops: typing.Sequence[ApplyOpsPlanningRequestOpsItem],
39
+ group_id: typing.Optional[str] = OMIT,
40
+ request_options: typing.Optional[RequestOptions] = None,
41
+ ) -> ApplyOpsPlanningResponse:
42
+ """
43
+ Apply a batch of domain ops to the process plan. Supply the current `version` to detect concurrent edits.
44
+ Returns a JSON Patch (RFC 6902) the client can apply to its local copy.
45
+
46
+ `setStationFeasibility` and `setStationDfa` belong to the validation and DFA workflows and
47
+ are refused with `400 server_owned_op`.
48
+
49
+ A sever excuses one subassembly from another that obstructs it, and is what the next
50
+ planning run is given (`resolutions` on the document). Accept one with `addSever`, withdraw
51
+ it with `removeSever`, or let the server derive it: `allowPath` names a mover (`moving`),
52
+ the whole station inputs it may be excused against (`context`), and optionally one
53
+ extraction path (`path`, an id from the extraction-paths endpoint).
54
+
55
+ Parameters
56
+ ----------
57
+ namespace : ApplyOpsPlanningRequestNamespace
58
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
59
+
60
+ id : str
61
+ Assembly ID.
62
+
63
+ mpp_id : str
64
+ Manufacturing Process Plan ID.
65
+
66
+ version : int
67
+
68
+ ops : typing.Sequence[ApplyOpsPlanningRequestOpsItem]
69
+
70
+ group_id : typing.Optional[str]
71
+
72
+ request_options : typing.Optional[RequestOptions]
73
+ Request-specific configuration.
74
+
75
+ Returns
76
+ -------
77
+ ApplyOpsPlanningResponse
78
+ Patch applied successfully.
79
+
80
+ Examples
81
+ --------
82
+ from autoassembler import AutoAssembler
83
+ from autoassembler.alpha.planning import ApplyOpsPlanningRequestOpsItem
84
+
85
+ client = AutoAssembler(
86
+ token="YOUR_TOKEN",
87
+ )
88
+ client.alpha.planning.apply_ops(
89
+ namespace="user",
90
+ id="id",
91
+ mpp_id="mppId",
92
+ version=1,
93
+ ops=[
94
+ ApplyOpsPlanningRequestOpsItem(
95
+ op="addTool",
96
+ )
97
+ ],
98
+ )
99
+ """
100
+ _response = self._raw_client.apply_ops(
101
+ namespace, id, mpp_id, version=version, ops=ops, group_id=group_id, request_options=request_options
102
+ )
103
+ return _response.data
104
+
105
+
106
+ class AsyncPlanningClient:
107
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
108
+ self._raw_client = AsyncRawPlanningClient(client_wrapper=client_wrapper)
109
+
110
+ @property
111
+ def with_raw_response(self) -> AsyncRawPlanningClient:
112
+ """
113
+ Retrieves a raw implementation of this client that returns raw responses.
114
+
115
+ Returns
116
+ -------
117
+ AsyncRawPlanningClient
118
+ """
119
+ return self._raw_client
120
+
121
+ async def apply_ops(
122
+ self,
123
+ namespace: ApplyOpsPlanningRequestNamespace,
124
+ id: str,
125
+ mpp_id: str,
126
+ *,
127
+ version: int,
128
+ ops: typing.Sequence[ApplyOpsPlanningRequestOpsItem],
129
+ group_id: typing.Optional[str] = OMIT,
130
+ request_options: typing.Optional[RequestOptions] = None,
131
+ ) -> ApplyOpsPlanningResponse:
132
+ """
133
+ Apply a batch of domain ops to the process plan. Supply the current `version` to detect concurrent edits.
134
+ Returns a JSON Patch (RFC 6902) the client can apply to its local copy.
135
+
136
+ `setStationFeasibility` and `setStationDfa` belong to the validation and DFA workflows and
137
+ are refused with `400 server_owned_op`.
138
+
139
+ A sever excuses one subassembly from another that obstructs it, and is what the next
140
+ planning run is given (`resolutions` on the document). Accept one with `addSever`, withdraw
141
+ it with `removeSever`, or let the server derive it: `allowPath` names a mover (`moving`),
142
+ the whole station inputs it may be excused against (`context`), and optionally one
143
+ extraction path (`path`, an id from the extraction-paths endpoint).
144
+
145
+ Parameters
146
+ ----------
147
+ namespace : ApplyOpsPlanningRequestNamespace
148
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
149
+
150
+ id : str
151
+ Assembly ID.
152
+
153
+ mpp_id : str
154
+ Manufacturing Process Plan ID.
155
+
156
+ version : int
157
+
158
+ ops : typing.Sequence[ApplyOpsPlanningRequestOpsItem]
159
+
160
+ group_id : typing.Optional[str]
161
+
162
+ request_options : typing.Optional[RequestOptions]
163
+ Request-specific configuration.
164
+
165
+ Returns
166
+ -------
167
+ ApplyOpsPlanningResponse
168
+ Patch applied successfully.
169
+
170
+ Examples
171
+ --------
172
+ import asyncio
173
+
174
+ from autoassembler import AsyncAutoAssembler
175
+ from autoassembler.alpha.planning import ApplyOpsPlanningRequestOpsItem
176
+
177
+ client = AsyncAutoAssembler(
178
+ token="YOUR_TOKEN",
179
+ )
180
+
181
+
182
+ async def main() -> None:
183
+ await client.alpha.planning.apply_ops(
184
+ namespace="user",
185
+ id="id",
186
+ mpp_id="mppId",
187
+ version=1,
188
+ ops=[
189
+ ApplyOpsPlanningRequestOpsItem(
190
+ op="addTool",
191
+ )
192
+ ],
193
+ )
194
+
195
+
196
+ asyncio.run(main())
197
+ """
198
+ _response = await self._raw_client.apply_ops(
199
+ namespace, id, mpp_id, version=version, ops=ops, group_id=group_id, request_options=request_options
200
+ )
201
+ return _response.data
@@ -0,0 +1,268 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ...core.api_error import ApiError
7
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ...core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ...core.jsonable_encoder import encode_path_param
10
+ from ...core.parse_error import ParsingError
11
+ from ...core.pydantic_utilities import parse_obj_as
12
+ from ...core.request_options import RequestOptions
13
+ from ...core.serialization import convert_and_respect_annotation_metadata
14
+ from ...errors.bad_request_error import BadRequestError
15
+ from ...errors.conflict_error import ConflictError
16
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
17
+ from ...types.error_response import ErrorResponse
18
+ from .types.apply_ops_planning_request_namespace import ApplyOpsPlanningRequestNamespace
19
+ from .types.apply_ops_planning_request_ops_item import ApplyOpsPlanningRequestOpsItem
20
+ from .types.apply_ops_planning_response import ApplyOpsPlanningResponse
21
+ from pydantic import ValidationError
22
+
23
+ # this is used as the default value for optional parameters
24
+ OMIT = typing.cast(typing.Any, ...)
25
+
26
+
27
+ class RawPlanningClient:
28
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
29
+ self._client_wrapper = client_wrapper
30
+
31
+ def apply_ops(
32
+ self,
33
+ namespace: ApplyOpsPlanningRequestNamespace,
34
+ id: str,
35
+ mpp_id: str,
36
+ *,
37
+ version: int,
38
+ ops: typing.Sequence[ApplyOpsPlanningRequestOpsItem],
39
+ group_id: typing.Optional[str] = OMIT,
40
+ request_options: typing.Optional[RequestOptions] = None,
41
+ ) -> HttpResponse[ApplyOpsPlanningResponse]:
42
+ """
43
+ Apply a batch of domain ops to the process plan. Supply the current `version` to detect concurrent edits.
44
+ Returns a JSON Patch (RFC 6902) the client can apply to its local copy.
45
+
46
+ `setStationFeasibility` and `setStationDfa` belong to the validation and DFA workflows and
47
+ are refused with `400 server_owned_op`.
48
+
49
+ A sever excuses one subassembly from another that obstructs it, and is what the next
50
+ planning run is given (`resolutions` on the document). Accept one with `addSever`, withdraw
51
+ it with `removeSever`, or let the server derive it: `allowPath` names a mover (`moving`),
52
+ the whole station inputs it may be excused against (`context`), and optionally one
53
+ extraction path (`path`, an id from the extraction-paths endpoint).
54
+
55
+ Parameters
56
+ ----------
57
+ namespace : ApplyOpsPlanningRequestNamespace
58
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
59
+
60
+ id : str
61
+ Assembly ID.
62
+
63
+ mpp_id : str
64
+ Manufacturing Process Plan ID.
65
+
66
+ version : int
67
+
68
+ ops : typing.Sequence[ApplyOpsPlanningRequestOpsItem]
69
+
70
+ group_id : typing.Optional[str]
71
+
72
+ request_options : typing.Optional[RequestOptions]
73
+ Request-specific configuration.
74
+
75
+ Returns
76
+ -------
77
+ HttpResponse[ApplyOpsPlanningResponse]
78
+ Patch applied successfully.
79
+ """
80
+ _response = self._client_wrapper.httpx_client.request(
81
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/mpps/{encode_path_param(mpp_id)}",
82
+ method="PATCH",
83
+ json={
84
+ "version": version,
85
+ "ops": convert_and_respect_annotation_metadata(
86
+ object_=ops, annotation=typing.Sequence[ApplyOpsPlanningRequestOpsItem], direction="write"
87
+ ),
88
+ "groupId": group_id,
89
+ },
90
+ headers={
91
+ "content-type": "application/json",
92
+ },
93
+ request_options=request_options,
94
+ omit=OMIT,
95
+ )
96
+ try:
97
+ if 200 <= _response.status_code < 300:
98
+ _data = typing.cast(
99
+ ApplyOpsPlanningResponse,
100
+ parse_obj_as(
101
+ type_=ApplyOpsPlanningResponse, # type: ignore
102
+ object_=_response.json(),
103
+ ),
104
+ )
105
+ return HttpResponse(response=_response, data=_data)
106
+ if _response.status_code == 400:
107
+ raise BadRequestError(
108
+ headers=dict(_response.headers),
109
+ body=typing.cast(
110
+ typing.Any,
111
+ parse_obj_as(
112
+ type_=typing.Any, # type: ignore
113
+ object_=_response.json(),
114
+ ),
115
+ ),
116
+ )
117
+ if _response.status_code == 409:
118
+ raise ConflictError(
119
+ headers=dict(_response.headers),
120
+ body=typing.cast(
121
+ typing.Any,
122
+ parse_obj_as(
123
+ type_=typing.Any, # type: ignore
124
+ object_=_response.json(),
125
+ ),
126
+ ),
127
+ )
128
+ if _response.status_code == 422:
129
+ raise UnprocessableEntityError(
130
+ headers=dict(_response.headers),
131
+ body=typing.cast(
132
+ ErrorResponse,
133
+ parse_obj_as(
134
+ type_=ErrorResponse, # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ ),
138
+ )
139
+ _response_json = _response.json()
140
+ except JSONDecodeError:
141
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
142
+ except ValidationError as e:
143
+ raise ParsingError(
144
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
145
+ )
146
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
147
+
148
+
149
+ class AsyncRawPlanningClient:
150
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
151
+ self._client_wrapper = client_wrapper
152
+
153
+ async def apply_ops(
154
+ self,
155
+ namespace: ApplyOpsPlanningRequestNamespace,
156
+ id: str,
157
+ mpp_id: str,
158
+ *,
159
+ version: int,
160
+ ops: typing.Sequence[ApplyOpsPlanningRequestOpsItem],
161
+ group_id: typing.Optional[str] = OMIT,
162
+ request_options: typing.Optional[RequestOptions] = None,
163
+ ) -> AsyncHttpResponse[ApplyOpsPlanningResponse]:
164
+ """
165
+ Apply a batch of domain ops to the process plan. Supply the current `version` to detect concurrent edits.
166
+ Returns a JSON Patch (RFC 6902) the client can apply to its local copy.
167
+
168
+ `setStationFeasibility` and `setStationDfa` belong to the validation and DFA workflows and
169
+ are refused with `400 server_owned_op`.
170
+
171
+ A sever excuses one subassembly from another that obstructs it, and is what the next
172
+ planning run is given (`resolutions` on the document). Accept one with `addSever`, withdraw
173
+ it with `removeSever`, or let the server derive it: `allowPath` names a mover (`moving`),
174
+ the whole station inputs it may be excused against (`context`), and optionally one
175
+ extraction path (`path`, an id from the extraction-paths endpoint).
176
+
177
+ Parameters
178
+ ----------
179
+ namespace : ApplyOpsPlanningRequestNamespace
180
+ Assembly URL namespace. `user`, `shared`, and `public` are routed through the same assembly lookup.
181
+
182
+ id : str
183
+ Assembly ID.
184
+
185
+ mpp_id : str
186
+ Manufacturing Process Plan ID.
187
+
188
+ version : int
189
+
190
+ ops : typing.Sequence[ApplyOpsPlanningRequestOpsItem]
191
+
192
+ group_id : typing.Optional[str]
193
+
194
+ request_options : typing.Optional[RequestOptions]
195
+ Request-specific configuration.
196
+
197
+ Returns
198
+ -------
199
+ AsyncHttpResponse[ApplyOpsPlanningResponse]
200
+ Patch applied successfully.
201
+ """
202
+ _response = await self._client_wrapper.httpx_client.request(
203
+ f"api/v4/assemblies/{encode_path_param(namespace)}/{encode_path_param(id)}/mpps/{encode_path_param(mpp_id)}",
204
+ method="PATCH",
205
+ json={
206
+ "version": version,
207
+ "ops": convert_and_respect_annotation_metadata(
208
+ object_=ops, annotation=typing.Sequence[ApplyOpsPlanningRequestOpsItem], direction="write"
209
+ ),
210
+ "groupId": group_id,
211
+ },
212
+ headers={
213
+ "content-type": "application/json",
214
+ },
215
+ request_options=request_options,
216
+ omit=OMIT,
217
+ )
218
+ try:
219
+ if 200 <= _response.status_code < 300:
220
+ _data = typing.cast(
221
+ ApplyOpsPlanningResponse,
222
+ parse_obj_as(
223
+ type_=ApplyOpsPlanningResponse, # type: ignore
224
+ object_=_response.json(),
225
+ ),
226
+ )
227
+ return AsyncHttpResponse(response=_response, data=_data)
228
+ if _response.status_code == 400:
229
+ raise BadRequestError(
230
+ headers=dict(_response.headers),
231
+ body=typing.cast(
232
+ typing.Any,
233
+ parse_obj_as(
234
+ type_=typing.Any, # type: ignore
235
+ object_=_response.json(),
236
+ ),
237
+ ),
238
+ )
239
+ if _response.status_code == 409:
240
+ raise ConflictError(
241
+ headers=dict(_response.headers),
242
+ body=typing.cast(
243
+ typing.Any,
244
+ parse_obj_as(
245
+ type_=typing.Any, # type: ignore
246
+ object_=_response.json(),
247
+ ),
248
+ ),
249
+ )
250
+ if _response.status_code == 422:
251
+ raise UnprocessableEntityError(
252
+ headers=dict(_response.headers),
253
+ body=typing.cast(
254
+ ErrorResponse,
255
+ parse_obj_as(
256
+ type_=ErrorResponse, # type: ignore
257
+ object_=_response.json(),
258
+ ),
259
+ ),
260
+ )
261
+ _response_json = _response.json()
262
+ except JSONDecodeError:
263
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
264
+ except ValidationError as e:
265
+ raise ParsingError(
266
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
267
+ )
268
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,47 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .apply_ops_planning_request_namespace import ApplyOpsPlanningRequestNamespace
10
+ from .apply_ops_planning_request_ops_item import ApplyOpsPlanningRequestOpsItem
11
+ from .apply_ops_planning_request_ops_item_op import ApplyOpsPlanningRequestOpsItemOp
12
+ from .apply_ops_planning_response import ApplyOpsPlanningResponse
13
+ _dynamic_imports: typing.Dict[str, str] = {
14
+ "ApplyOpsPlanningRequestNamespace": ".apply_ops_planning_request_namespace",
15
+ "ApplyOpsPlanningRequestOpsItem": ".apply_ops_planning_request_ops_item",
16
+ "ApplyOpsPlanningRequestOpsItemOp": ".apply_ops_planning_request_ops_item_op",
17
+ "ApplyOpsPlanningResponse": ".apply_ops_planning_response",
18
+ }
19
+
20
+
21
+ def __getattr__(attr_name: str) -> typing.Any:
22
+ module_name = _dynamic_imports.get(attr_name)
23
+ if module_name is None:
24
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
25
+ try:
26
+ module = import_module(module_name, __package__)
27
+ if module_name == f".{attr_name}":
28
+ return module
29
+ else:
30
+ return getattr(module, attr_name)
31
+ except ImportError as e:
32
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
33
+ except AttributeError as e:
34
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
35
+
36
+
37
+ def __dir__():
38
+ lazy_attrs = list(_dynamic_imports.keys())
39
+ return sorted(lazy_attrs)
40
+
41
+
42
+ __all__ = [
43
+ "ApplyOpsPlanningRequestNamespace",
44
+ "ApplyOpsPlanningRequestOpsItem",
45
+ "ApplyOpsPlanningRequestOpsItemOp",
46
+ "ApplyOpsPlanningResponse",
47
+ ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ ApplyOpsPlanningRequestNamespace = typing.Union[typing.Literal["user", "shared", "public"], typing.Any]
@@ -0,0 +1,13 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ....core.pydantic_utilities import UniversalBaseModel
7
+ from .apply_ops_planning_request_ops_item_op import ApplyOpsPlanningRequestOpsItemOp
8
+
9
+
10
+ class ApplyOpsPlanningRequestOpsItem(UniversalBaseModel):
11
+ op: ApplyOpsPlanningRequestOpsItemOp
12
+
13
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)