UncountablePythonSDK 0.0.20__py3-none-any.whl → 0.0.21__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.

Potentially problematic release.


This version of UncountablePythonSDK might be problematic. Click here for more details.

Files changed (50) hide show
  1. {UncountablePythonSDK-0.0.20.dist-info → UncountablePythonSDK-0.0.21.dist-info}/METADATA +3 -1
  2. {UncountablePythonSDK-0.0.20.dist-info → UncountablePythonSDK-0.0.21.dist-info}/RECORD +50 -31
  3. examples/upload_files.py +19 -0
  4. pkgs/type_spec/actions_registry/__main__.py +35 -23
  5. pkgs/type_spec/actions_registry/emit_typescript.py +71 -9
  6. pkgs/type_spec/builder.py +13 -0
  7. pkgs/type_spec/config.py +1 -0
  8. pkgs/type_spec/emit_open_api.py +11 -0
  9. pkgs/type_spec/emit_open_api_util.py +1 -0
  10. pkgs/type_spec/emit_python.py +241 -55
  11. pkgs/type_spec/type_info/emit_type_info.py +129 -8
  12. type_spec/external/api/entity/create_entities.yaml +12 -1
  13. type_spec/external/api/entity/create_entity.yaml +12 -1
  14. type_spec/external/api/entity/transition_entity_phase.yaml +44 -0
  15. type_spec/external/api/permissions/set_core_permissions.yaml +69 -0
  16. type_spec/external/api/recipes/associate_recipe_as_input.yaml +4 -4
  17. type_spec/external/api/recipes/create_recipe.yaml +2 -1
  18. type_spec/external/api/recipes/disassociate_recipe_as_input.yaml +16 -0
  19. type_spec/external/api/recipes/edit_recipe_inputs.yaml +88 -0
  20. type_spec/external/api/recipes/get_curve.yaml +4 -1
  21. type_spec/external/api/recipes/get_recipes_data.yaml +6 -0
  22. type_spec/external/api/recipes/set_recipe_metadata.yaml +1 -0
  23. type_spec/external/api/recipes/set_recipe_tags.yaml +62 -0
  24. uncountable/core/__init__.py +2 -1
  25. uncountable/core/client.py +11 -9
  26. uncountable/core/file_upload.py +95 -0
  27. uncountable/core/types.py +22 -0
  28. uncountable/types/__init__.py +18 -0
  29. uncountable/types/api/entity/create_entities.py +1 -1
  30. uncountable/types/api/entity/create_entity.py +1 -1
  31. uncountable/types/api/entity/transition_entity_phase.py +66 -0
  32. uncountable/types/api/permissions/__init__.py +1 -0
  33. uncountable/types/api/permissions/set_core_permissions.py +89 -0
  34. uncountable/types/api/recipes/associate_recipe_as_input.py +4 -3
  35. uncountable/types/api/recipes/create_recipe.py +1 -1
  36. uncountable/types/api/recipes/disassociate_recipe_as_input.py +35 -0
  37. uncountable/types/api/recipes/edit_recipe_inputs.py +107 -0
  38. uncountable/types/api/recipes/get_curve.py +2 -1
  39. uncountable/types/api/recipes/get_recipes_data.py +2 -0
  40. uncountable/types/api/recipes/set_recipe_tags.py +91 -0
  41. uncountable/types/async_batch.py +9 -0
  42. uncountable/types/async_batch_processor.py +154 -0
  43. uncountable/types/client_base.py +113 -48
  44. uncountable/types/permissions.py +46 -0
  45. uncountable/types/post_base.py +30 -0
  46. uncountable/types/recipe_inputs.py +30 -0
  47. uncountable/types/recipe_metadata.py +2 -0
  48. uncountable/types/recipe_workflow_steps.py +77 -0
  49. {UncountablePythonSDK-0.0.20.dist-info → UncountablePythonSDK-0.0.21.dist-info}/WHEEL +0 -0
  50. {UncountablePythonSDK-0.0.20.dist-info → UncountablePythonSDK-0.0.21.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,89 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402
4
+ # fmt: off
5
+ # isort: skip_file
6
+ from __future__ import annotations
7
+ import typing # noqa: F401
8
+ import datetime # noqa: F401
9
+ from decimal import Decimal # noqa: F401
10
+ from dataclasses import dataclass
11
+ from pkgs.serialization import serial_class
12
+ from ... import identifier as identifier_t
13
+ from ... import permissions as permissions_t
14
+ from ... import post_base as post_base_t
15
+
16
+ __all__: list[str] = [
17
+ "Arguments",
18
+ "Data",
19
+ "ENDPOINT_METHOD",
20
+ "ENDPOINT_PATH",
21
+ "PermissionsScope",
22
+ "PermissionsScopeAllMaterialFamilies",
23
+ "PermissionsScopeMaterialFamily",
24
+ "PermissionsScopeProject",
25
+ "PermissionsScopeRecipe",
26
+ ]
27
+
28
+ ENDPOINT_METHOD = "POST"
29
+ ENDPOINT_PATH = "api/external/permissions/external_set_core_permissions"
30
+
31
+
32
+ # DO NOT MODIFY -- This file is generated by type_spec
33
+ @serial_class(
34
+ parse_require={"type"},
35
+ )
36
+ @dataclass(kw_only=True)
37
+ class PermissionsScopeProject:
38
+ type: typing.Literal["project"] = "project"
39
+ project_key: identifier_t.IdentifierKey
40
+
41
+
42
+ # DO NOT MODIFY -- This file is generated by type_spec
43
+ @serial_class(
44
+ parse_require={"type"},
45
+ )
46
+ @dataclass(kw_only=True)
47
+ class PermissionsScopeRecipe:
48
+ type: typing.Literal["recipe"] = "recipe"
49
+ recipe_key: identifier_t.IdentifierKey
50
+
51
+
52
+ # DO NOT MODIFY -- This file is generated by type_spec
53
+ @serial_class(
54
+ parse_require={"type"},
55
+ )
56
+ @dataclass(kw_only=True)
57
+ class PermissionsScopeMaterialFamily:
58
+ type: typing.Literal["material_family"] = "material_family"
59
+ material_family_key: identifier_t.IdentifierKey
60
+
61
+
62
+ # DO NOT MODIFY -- This file is generated by type_spec
63
+ @serial_class(
64
+ parse_require={"type"},
65
+ )
66
+ @dataclass(kw_only=True)
67
+ class PermissionsScopeAllMaterialFamilies:
68
+ type: typing.Literal["all_material_families"] = "all_material_families"
69
+
70
+
71
+ # DO NOT MODIFY -- This file is generated by type_spec
72
+ PermissionsScope = typing.Union[PermissionsScopeProject, PermissionsScopeRecipe, PermissionsScopeMaterialFamily, PermissionsScopeAllMaterialFamilies]
73
+
74
+
75
+ # DO NOT MODIFY -- This file is generated by type_spec
76
+ @dataclass(kw_only=True)
77
+ class Arguments:
78
+ scope: PermissionsScope
79
+ permissions_types: list[permissions_t.CorePermissionType]
80
+ update_type: post_base_t.UpdateType
81
+ user_group_ids: typing.Optional[list[int]] = None
82
+ user_ids: typing.Optional[list[int]] = None
83
+
84
+
85
+ # DO NOT MODIFY -- This file is generated by type_spec
86
+ @dataclass(kw_only=True)
87
+ class Data:
88
+ pass
89
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -8,7 +8,7 @@ import typing # noqa: F401
8
8
  import datetime # noqa: F401
9
9
  from decimal import Decimal # noqa: F401
10
10
  from dataclasses import dataclass
11
- from ... import base as base_t
11
+ from ... import async_batch as async_batch_t
12
12
  from ... import identifier as identifier_t
13
13
 
14
14
  __all__: list[str] = [
@@ -26,10 +26,11 @@ ENDPOINT_PATH = "api/external/recipes/associate_recipe_as_input"
26
26
  @dataclass(kw_only=True)
27
27
  class Arguments:
28
28
  recipe_key: identifier_t.IdentifierKey
29
+ input_key: typing.Optional[identifier_t.IdentifierKey] = None
29
30
 
30
31
 
31
32
  # DO NOT MODIFY -- This file is generated by type_spec
32
33
  @dataclass(kw_only=True)
33
- class Data:
34
- result_id: base_t.ObjectId
34
+ class Data(async_batch_t.AsyncBatchActionReturn):
35
+ pass
35
36
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -29,10 +29,10 @@ ENDPOINT_PATH = "api/external/recipes/create_recipe"
29
29
  class Arguments:
30
30
  material_family_id: base_t.ObjectId
31
31
  workflow_id: base_t.ObjectId
32
- identifiers: recipe_identifiers_t.RecipeIdentifiers
33
32
  name: typing.Optional[str] = None
34
33
  workflow_variant_id: typing.Optional[typing.Optional[base_t.ObjectId]] = None
35
34
  recipe_metadata: typing.Optional[list[recipe_metadata_t.MetadataValue]] = None
35
+ identifiers: typing.Optional[recipe_identifiers_t.RecipeIdentifiers] = None
36
36
  definition_key: typing.Optional[identifier_t.IdentifierKey] = None
37
37
 
38
38
 
@@ -0,0 +1,35 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402
4
+ # fmt: off
5
+ # isort: skip_file
6
+ from __future__ import annotations
7
+ import typing # noqa: F401
8
+ import datetime # noqa: F401
9
+ from decimal import Decimal # noqa: F401
10
+ from dataclasses import dataclass
11
+ from ... import async_batch as async_batch_t
12
+ from ... import identifier as identifier_t
13
+
14
+ __all__: list[str] = [
15
+ "Arguments",
16
+ "Data",
17
+ "ENDPOINT_METHOD",
18
+ "ENDPOINT_PATH",
19
+ ]
20
+
21
+ ENDPOINT_METHOD = "POST"
22
+ ENDPOINT_PATH = "api/external/recipes/disassociate_recipe_as_input"
23
+
24
+
25
+ # DO NOT MODIFY -- This file is generated by type_spec
26
+ @dataclass(kw_only=True)
27
+ class Arguments:
28
+ recipe_key: identifier_t.IdentifierKey
29
+
30
+
31
+ # DO NOT MODIFY -- This file is generated by type_spec
32
+ @dataclass(kw_only=True)
33
+ class Data(async_batch_t.AsyncBatchActionReturn):
34
+ pass
35
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -0,0 +1,107 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402
4
+ # fmt: off
5
+ # isort: skip_file
6
+ from __future__ import annotations
7
+ import typing # noqa: F401
8
+ import datetime # noqa: F401
9
+ from decimal import Decimal # noqa: F401
10
+ from pkgs.strenum_compat import StrEnum
11
+ from dataclasses import dataclass
12
+ from pkgs.serialization import serial_class
13
+ from ... import base as base_t
14
+ from ... import identifier as identifier_t
15
+ from ... import recipe_inputs as recipe_inputs_t
16
+ from ... import recipe_workflow_steps as recipe_workflow_steps_t
17
+
18
+ __all__: list[str] = [
19
+ "Arguments",
20
+ "Data",
21
+ "ENDPOINT_METHOD",
22
+ "ENDPOINT_PATH",
23
+ "RecipeInputEdit",
24
+ "RecipeInputEditAddInput",
25
+ "RecipeInputEditBase",
26
+ "RecipeInputEditClearInputs",
27
+ "RecipeInputEditInputBase",
28
+ "RecipeInputEditType",
29
+ "RecipeInputEditUpsertInput",
30
+ ]
31
+
32
+ ENDPOINT_METHOD = "POST"
33
+ ENDPOINT_PATH = "api/external/recipes/edit_recipe_inputs"
34
+
35
+
36
+ # DO NOT MODIFY -- This file is generated by type_spec
37
+ class RecipeInputEditType(StrEnum):
38
+ CLEAR_INPUTS = "clear_inputs"
39
+ UPSERT_INPUT = "upsert_input"
40
+ ADD_INPUT = "add_input"
41
+
42
+
43
+ # DO NOT MODIFY -- This file is generated by type_spec
44
+ @dataclass(kw_only=True)
45
+ class RecipeInputEditBase:
46
+ type: RecipeInputEditType
47
+
48
+
49
+ # DO NOT MODIFY -- This file is generated by type_spec
50
+ @serial_class(
51
+ parse_require={"type"},
52
+ )
53
+ @dataclass(kw_only=True)
54
+ class RecipeInputEditClearInputs(RecipeInputEditBase):
55
+ type: typing.Literal[RecipeInputEditType.CLEAR_INPUTS] = RecipeInputEditType.CLEAR_INPUTS
56
+
57
+
58
+ # DO NOT MODIFY -- This file is generated by type_spec
59
+ @serial_class(
60
+ to_string_values={"value_numeric"},
61
+ )
62
+ @dataclass(kw_only=True)
63
+ class RecipeInputEditInputBase(RecipeInputEditBase):
64
+ ingredient_key: identifier_t.IdentifierKey
65
+ quantity_basis: recipe_inputs_t.QuantityBasis = recipe_inputs_t.QuantityBasis.MASS
66
+ input_value_type: recipe_inputs_t.InputValueType = recipe_inputs_t.InputValueType.VALUE
67
+ value_numeric: typing.Optional[Decimal] = None
68
+ value_str: typing.Optional[str] = None
69
+ calculation_key: typing.Optional[identifier_t.IdentifierKey] = None
70
+
71
+
72
+ # DO NOT MODIFY -- This file is generated by type_spec
73
+ @serial_class(
74
+ parse_require={"type"},
75
+ )
76
+ @dataclass(kw_only=True)
77
+ class RecipeInputEditUpsertInput(RecipeInputEditInputBase):
78
+ type: typing.Literal[RecipeInputEditType.UPSERT_INPUT] = RecipeInputEditType.UPSERT_INPUT
79
+ clear_first: bool
80
+
81
+
82
+ # DO NOT MODIFY -- This file is generated by type_spec
83
+ @serial_class(
84
+ parse_require={"type"},
85
+ )
86
+ @dataclass(kw_only=True)
87
+ class RecipeInputEditAddInput(RecipeInputEditInputBase):
88
+ type: typing.Literal[RecipeInputEditType.ADD_INPUT] = RecipeInputEditType.ADD_INPUT
89
+
90
+
91
+ # DO NOT MODIFY -- This file is generated by type_spec
92
+ RecipeInputEdit = typing.Union[RecipeInputEditClearInputs, RecipeInputEditUpsertInput, RecipeInputEditAddInput]
93
+
94
+
95
+ # DO NOT MODIFY -- This file is generated by type_spec
96
+ @dataclass(kw_only=True)
97
+ class Arguments:
98
+ recipe_key: identifier_t.IdentifierKey
99
+ recipe_workflow_step_identifier: recipe_workflow_steps_t.RecipeWorkflowStepIdentifierType
100
+ edits: list[RecipeInputEdit]
101
+
102
+
103
+ # DO NOT MODIFY -- This file is generated by type_spec
104
+ @dataclass(kw_only=True)
105
+ class Data:
106
+ result_id: base_t.ObjectId
107
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -25,7 +25,8 @@ ENDPOINT_PATH = "api/external/recipes/external_get_curve"
25
25
  # DO NOT MODIFY -- This file is generated by type_spec
26
26
  @dataclass(kw_only=True)
27
27
  class Arguments:
28
- recipe_output_id: base_t.ObjectId
28
+ recipe_output_id: typing.Optional[base_t.ObjectId] = None
29
+ recipe_input_id: typing.Optional[base_t.ObjectId] = None
29
30
 
30
31
 
31
32
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -90,11 +90,13 @@ class SimpleOutputCondition:
90
90
  )
91
91
  @dataclass(kw_only=True)
92
92
  class RecipeInput:
93
+ id: base_t.ObjectId
93
94
  input_id: base_t.ObjectId
94
95
  input_lot_recipe_id: typing.Optional[base_t.ObjectId]
95
96
  recipe_step_id: base_t.ObjectId
96
97
  quantity_dec: Decimal
97
98
  quantity_json: base_t.JsonValue
99
+ curve_id: typing.Optional[base_t.ObjectId]
98
100
  actual_quantity_dec: Decimal
99
101
  actual_quantity_json: base_t.JsonValue
100
102
  input_type: str
@@ -0,0 +1,91 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402
4
+ # fmt: off
5
+ # isort: skip_file
6
+ from __future__ import annotations
7
+ import typing # noqa: F401
8
+ import datetime # noqa: F401
9
+ from decimal import Decimal # noqa: F401
10
+ from pkgs.strenum_compat import StrEnum
11
+ from dataclasses import dataclass
12
+ from pkgs.serialization import serial_class
13
+ from ... import base as base_t
14
+ from ... import identifier as identifier_t
15
+
16
+ __all__: list[str] = [
17
+ "Arguments",
18
+ "Data",
19
+ "ENDPOINT_METHOD",
20
+ "ENDPOINT_PATH",
21
+ "RecipeTagAppend",
22
+ "RecipeTagOverride",
23
+ "RecipeTagRemove",
24
+ "RecipeTagUpdate",
25
+ "RecipeTagUpdateBase",
26
+ "RecipeTagUpdateType",
27
+ ]
28
+
29
+ ENDPOINT_METHOD = "POST"
30
+ ENDPOINT_PATH = "api/external/recipes/set_recipe_tags"
31
+
32
+
33
+ # DO NOT MODIFY -- This file is generated by type_spec
34
+ class RecipeTagUpdateType(StrEnum):
35
+ APPEND = "append"
36
+ OVERRIDE = "override"
37
+ REMOVE = "remove"
38
+
39
+
40
+ # DO NOT MODIFY -- This file is generated by type_spec
41
+ @dataclass(kw_only=True)
42
+ class RecipeTagUpdateBase:
43
+ type: RecipeTagUpdateType
44
+
45
+
46
+ # DO NOT MODIFY -- This file is generated by type_spec
47
+ @serial_class(
48
+ parse_require={"type"},
49
+ )
50
+ @dataclass(kw_only=True)
51
+ class RecipeTagAppend(RecipeTagUpdateBase):
52
+ type: typing.Literal[RecipeTagUpdateType.APPEND] = RecipeTagUpdateType.APPEND
53
+ recipe_tag_ids: list[base_t.ObjectId]
54
+
55
+
56
+ # DO NOT MODIFY -- This file is generated by type_spec
57
+ @serial_class(
58
+ parse_require={"type"},
59
+ )
60
+ @dataclass(kw_only=True)
61
+ class RecipeTagRemove(RecipeTagUpdateBase):
62
+ type: typing.Literal[RecipeTagUpdateType.REMOVE] = RecipeTagUpdateType.REMOVE
63
+ recipe_tag_ids: list[base_t.ObjectId]
64
+
65
+
66
+ # DO NOT MODIFY -- This file is generated by type_spec
67
+ @serial_class(
68
+ parse_require={"type"},
69
+ )
70
+ @dataclass(kw_only=True)
71
+ class RecipeTagOverride(RecipeTagUpdateBase):
72
+ type: typing.Literal[RecipeTagUpdateType.OVERRIDE] = RecipeTagUpdateType.OVERRIDE
73
+ recipe_tag_ids: list[base_t.ObjectId]
74
+
75
+
76
+ # DO NOT MODIFY -- This file is generated by type_spec
77
+ RecipeTagUpdate = typing.Union[RecipeTagAppend, RecipeTagRemove, RecipeTagOverride]
78
+
79
+
80
+ # DO NOT MODIFY -- This file is generated by type_spec
81
+ @dataclass(kw_only=True)
82
+ class Arguments:
83
+ recipe_key: identifier_t.IdentifierKey
84
+ recipe_tag_update: RecipeTagUpdate
85
+
86
+
87
+ # DO NOT MODIFY -- This file is generated by type_spec
88
+ @dataclass(kw_only=True)
89
+ class Data:
90
+ pass
91
+ # DO NOT MODIFY -- This file is generated by type_spec
@@ -16,6 +16,7 @@ __all__: list[str] = [
16
16
  "AsyncBatchActionReturn",
17
17
  "AsyncBatchRequest",
18
18
  "AsyncBatchRequestPath",
19
+ "QueuedAsyncBatchRequest",
19
20
  ]
20
21
 
21
22
 
@@ -23,6 +24,7 @@ __all__: list[str] = [
23
24
  class AsyncBatchRequestPath(StrEnum):
24
25
  CREATE_RECIPE = "recipes/create_recipe"
25
26
  SET_RECIPE_METADATA = "recipes/set_recipe_metadata"
27
+ SET_RECIPE_TAGS = "recipes/set_recipe_tags"
26
28
 
27
29
 
28
30
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -42,4 +44,11 @@ class AsyncBatchRequest:
42
44
  class AsyncBatchActionReturn:
43
45
  modification_made: bool
44
46
  result_id: typing.Optional[base_t.ObjectId] = None
47
+
48
+
49
+ # DO NOT MODIFY -- This file is generated by type_spec
50
+ @dataclass(kw_only=True, frozen=True, eq=True)
51
+ class QueuedAsyncBatchRequest:
52
+ path: AsyncBatchRequestPath
53
+ batch_reference: str
45
54
  # DO NOT MODIFY -- This file is generated by type_spec
@@ -0,0 +1,154 @@
1
+ # DO NOT MODIFY -- This file is generated by type_spec
2
+ # flake8: noqa: F821
3
+ # ruff: noqa: E402
4
+ # fmt: off
5
+ # isort: skip_file
6
+ # ruff: noqa: PLR0904
7
+ from __future__ import annotations
8
+ import typing # noqa: F401
9
+ import datetime # noqa: F401
10
+ from decimal import Decimal # noqa: F401
11
+ from uncountable.types import async_batch as async_batch_t
12
+ from uncountable.types import base as base_t
13
+ import uncountable.types.api.recipes.create_recipe as create_recipe_t
14
+ import uncountable.types.api.recipes.edit_recipe_inputs as edit_recipe_inputs_t
15
+ from uncountable.types import identifier as identifier_t
16
+ from uncountable.types import recipe_identifiers as recipe_identifiers_t
17
+ from uncountable.types import recipe_metadata as recipe_metadata_t
18
+ from uncountable.types import recipe_workflow_steps as recipe_workflow_steps_t
19
+ import uncountable.types.api.recipes.set_recipe_metadata as set_recipe_metadata_t
20
+ import uuid
21
+ from abc import ABC, abstractmethod
22
+ from dataclasses import dataclass
23
+ from pkgs.serialization_util.serialization_helpers import serialize_for_api
24
+
25
+
26
+ class AsyncBatchProcessorBase(ABC):
27
+ @abstractmethod
28
+ def _enqueue(self, req: async_batch_t.AsyncBatchRequest) -> None:
29
+ ...
30
+
31
+ @abstractmethod
32
+ def send(self) -> base_t.ObjectId:
33
+ ...
34
+
35
+ def create_recipe(
36
+ self,
37
+ *,
38
+ material_family_id: base_t.ObjectId,
39
+ workflow_id: base_t.ObjectId,
40
+ name: typing.Optional[str] = None,
41
+ workflow_variant_id: typing.Optional[typing.Optional[base_t.ObjectId]] = None,
42
+ recipe_metadata: typing.Optional[list[recipe_metadata_t.MetadataValue]] = None,
43
+ identifiers: typing.Optional[recipe_identifiers_t.RecipeIdentifiers] = None,
44
+ definition_key: typing.Optional[identifier_t.IdentifierKey] = None,
45
+ depends_on: typing.Optional[list[str]] = None,
46
+ ) -> async_batch_t.QueuedBatchRequest:
47
+ """Returns the id of the recipe being created.
48
+
49
+ :param name: The name for the recipe
50
+ :param material_family_id: The material family for the recipe
51
+ :param workflow_id: The identifier of the workflow to create the recipe with
52
+ :param workflow_variant_id: The identifier of the workflow variant to create the recipe with
53
+ :param recipe_metadata: Metadata values to populate the recipe with
54
+ :param identifiers: A recipe won't be created if it matches the identifier. An identifier must be unique in the schema
55
+ :param definition_key: The entity definition identifier, default is used if not supplied
56
+ :param depends_on: A list of batch reference keys to process before processing this request
57
+ """
58
+ args = create_recipe_t.Arguments(
59
+ name=name,
60
+ material_family_id=material_family_id,
61
+ workflow_id=workflow_id,
62
+ workflow_variant_id=workflow_variant_id,
63
+ recipe_metadata=recipe_metadata,
64
+ identifiers=identifiers,
65
+ definition_key=definition_key,
66
+ )
67
+ json_data = serialize_for_api(args)
68
+
69
+ batch_reference = str(uuid.uuid4())
70
+
71
+ req = async_batch_t.AsyncBatchRequest(
72
+ path=async_batch_t.AsyncBatchRequestPath.CREATE_RECIPE,
73
+ data=json_data,
74
+ depends_on=depends_on,
75
+ batch_reference=batch_reference,
76
+ )
77
+
78
+ self._enqueue(req)
79
+
80
+ return async_batch_t.QueuedBatchRequest(
81
+ path=req.path,
82
+ batch_reference=req.batch_reference,
83
+ )
84
+
85
+ def edit_recipe_inputs(
86
+ self,
87
+ *,
88
+ recipe_key: identifier_t.IdentifierKey,
89
+ recipe_workflow_step_identifier: recipe_workflow_steps_t.RecipeWorkflowStepIdentifierType,
90
+ edits: list[edit_recipe_inputs_t.RecipeInputEdit],
91
+ depends_on: typing.Optional[list[str]] = None,
92
+ ) -> async_batch_t.QueuedBatchRequest:
93
+ """Clear, update, or add inputs on a recipe
94
+
95
+ :param recipe_key: Identifier for the recipe
96
+ :param depends_on: A list of batch reference keys to process before processing this request
97
+ """
98
+ args = edit_recipe_inputs_t.Arguments(
99
+ recipe_key=recipe_key,
100
+ recipe_workflow_step_identifier=recipe_workflow_step_identifier,
101
+ edits=edits,
102
+ )
103
+ json_data = serialize_for_api(args)
104
+
105
+ batch_reference = str(uuid.uuid4())
106
+
107
+ req = async_batch_t.AsyncBatchRequest(
108
+ path=async_batch_t.AsyncBatchRequestPath.EDIT_RECIPE_INPUTS,
109
+ data=json_data,
110
+ depends_on=depends_on,
111
+ batch_reference=batch_reference,
112
+ )
113
+
114
+ self._enqueue(req)
115
+
116
+ return async_batch_t.QueuedBatchRequest(
117
+ path=req.path,
118
+ batch_reference=req.batch_reference,
119
+ )
120
+
121
+ def set_recipe_metadata(
122
+ self,
123
+ *,
124
+ recipe_key: identifier_t.IdentifierKey,
125
+ recipe_metadata: list[recipe_metadata_t.MetadataValue],
126
+ depends_on: typing.Optional[list[str]] = None,
127
+ ) -> async_batch_t.QueuedBatchRequest:
128
+ """Set metadata values on a recipe
129
+
130
+ :param recipe_key: Identifier for the recipe
131
+ :param recipe_metadata: Metadata values to populate the recipe with
132
+ :param depends_on: A list of batch reference keys to process before processing this request
133
+ """
134
+ args = set_recipe_metadata_t.Arguments(
135
+ recipe_key=recipe_key,
136
+ recipe_metadata=recipe_metadata,
137
+ )
138
+ json_data = serialize_for_api(args)
139
+
140
+ batch_reference = str(uuid.uuid4())
141
+
142
+ req = async_batch_t.AsyncBatchRequest(
143
+ path=async_batch_t.AsyncBatchRequestPath.SET_RECIPE_METADATA,
144
+ data=json_data,
145
+ depends_on=depends_on,
146
+ batch_reference=batch_reference,
147
+ )
148
+
149
+ self._enqueue(req)
150
+
151
+ return async_batch_t.QueuedBatchRequest(
152
+ path=req.path,
153
+ batch_reference=req.batch_reference,
154
+ )