UncountablePythonSDK 0.0.25__py3-none-any.whl → 0.0.27__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 (42) hide show
  1. {UncountablePythonSDK-0.0.25.dist-info → UncountablePythonSDK-0.0.27.dist-info}/METADATA +15 -15
  2. {UncountablePythonSDK-0.0.25.dist-info → UncountablePythonSDK-0.0.27.dist-info}/RECORD +42 -26
  3. examples/create_entity.py +1 -2
  4. pkgs/argument_parser/argument_parser.py +41 -6
  5. pkgs/type_spec/builder.py +6 -1
  6. pkgs/type_spec/emit_open_api.py +15 -6
  7. pkgs/type_spec/emit_open_api_util.py +1 -0
  8. type_spec/external/api/entity/list_entities.yaml +2 -2
  9. type_spec/external/api/entity/lock_entity.yaml +21 -0
  10. type_spec/external/api/entity/unlock_entity.yaml +18 -0
  11. type_spec/external/api/field_options/upsert_field_options.yaml +37 -0
  12. type_spec/external/api/id_source/list_id_source.yaml +2 -2
  13. type_spec/external/api/inputs/get_input_data.yaml +2 -2
  14. type_spec/external/api/inputs/get_input_names.yaml +2 -2
  15. type_spec/external/api/inputs/set_input_category.yaml +23 -0
  16. type_spec/external/api/inputs/set_input_subcategories.yaml +23 -0
  17. type_spec/external/api/material_families/update_entity_material_families.yaml +33 -0
  18. type_spec/external/api/outputs/get_output_data.yaml +2 -2
  19. type_spec/external/api/outputs/get_output_names.yaml +2 -2
  20. type_spec/external/api/project/get_projects_data.yaml +2 -2
  21. type_spec/external/api/recipe_metadata/get_recipe_metadata_data.yaml +2 -2
  22. type_spec/external/api/recipes/create_recipe.yaml +3 -0
  23. type_spec/external/api/recipes/get_recipes_data.yaml +2 -2
  24. type_spec/external/api/recipes/unarchive_recipes.yaml +17 -0
  25. uncountable/core/client.py +3 -3
  26. uncountable/core/file_upload.py +7 -4
  27. uncountable/core/types.py +2 -1
  28. uncountable/types/__init__.py +14 -0
  29. uncountable/types/api/entity/lock_entity.py +38 -0
  30. uncountable/types/api/entity/unlock_entity.py +37 -0
  31. uncountable/types/api/field_options/__init__.py +1 -0
  32. uncountable/types/api/field_options/upsert_field_options.py +45 -0
  33. uncountable/types/api/inputs/set_input_category.py +37 -0
  34. uncountable/types/api/inputs/set_input_subcategories.py +38 -0
  35. uncountable/types/api/material_families/__init__.py +1 -0
  36. uncountable/types/api/material_families/update_entity_material_families.py +41 -0
  37. uncountable/types/api/recipes/create_recipe.py +1 -0
  38. uncountable/types/api/recipes/unarchive_recipes.py +34 -0
  39. uncountable/types/async_batch_processor.py +3 -0
  40. uncountable/types/client_base.py +192 -18
  41. {UncountablePythonSDK-0.0.25.dist-info → UncountablePythonSDK-0.0.27.dist-info}/WHEEL +0 -0
  42. {UncountablePythonSDK-0.0.25.dist-info → UncountablePythonSDK-0.0.27.dist-info}/top_level.txt +0 -0
@@ -47,6 +47,7 @@ from uncountable.types import id_source as id_source_t
47
47
  from uncountable.types import identifier as identifier_t
48
48
  import uncountable.types.api.entity.list_entities as list_entities_t
49
49
  import uncountable.types.api.id_source.list_id_source as list_id_source_t
50
+ import uncountable.types.api.entity.lock_entity as lock_entity_t
50
51
  import uncountable.types.api.id_source.match_id_source as match_id_source_t
51
52
  from uncountable.types import permissions as permissions_t
52
53
  from uncountable.types import post_base as post_base_t
@@ -59,12 +60,18 @@ import uncountable.types.api.outputs.resolve_output_conditions as resolve_output
59
60
  import uncountable.types.api.triggers.run_trigger as run_trigger_t
60
61
  import uncountable.types.api.permissions.set_core_permissions as set_core_permissions_t
61
62
  import uncountable.types.api.inputs.set_input_attribute_values as set_input_attribute_values_t
63
+ import uncountable.types.api.inputs.set_input_category as set_input_category_t
64
+ import uncountable.types.api.inputs.set_input_subcategories as set_input_subcategories_t
62
65
  import uncountable.types.api.recipes.set_recipe_inputs as set_recipe_inputs_t
63
66
  import uncountable.types.api.recipes.set_recipe_metadata as set_recipe_metadata_t
64
67
  import uncountable.types.api.recipes.set_recipe_outputs as set_recipe_outputs_t
65
68
  import uncountable.types.api.recipes.set_recipe_tags as set_recipe_tags_t
66
69
  import uncountable.types.api.entity.set_values as set_values_t
67
70
  import uncountable.types.api.entity.transition_entity_phase as transition_entity_phase_t
71
+ import uncountable.types.api.recipes.unarchive_recipes as unarchive_recipes_t
72
+ import uncountable.types.api.entity.unlock_entity as unlock_entity_t
73
+ import uncountable.types.api.material_families.update_entity_material_families as update_entity_material_families_t
74
+ import uncountable.types.api.field_options.upsert_field_options as upsert_field_options_t
68
75
  from abc import ABC, abstractmethod
69
76
  from dataclasses import dataclass
70
77
 
@@ -242,6 +249,7 @@ class ClientMethods(ABC):
242
249
  material_family_id: base_t.ObjectId,
243
250
  workflow_id: base_t.ObjectId,
244
251
  name: typing.Optional[str] = None,
252
+ project_id: typing.Optional[base_t.ObjectId] = None,
245
253
  workflow_variant_id: typing.Optional[typing.Optional[base_t.ObjectId]] = None,
246
254
  recipe_metadata: typing.Optional[list[recipe_metadata_t.MetadataValue]] = None,
247
255
  identifiers: typing.Optional[recipe_identifiers_t.RecipeIdentifiers] = None,
@@ -251,6 +259,7 @@ class ClientMethods(ABC):
251
259
 
252
260
  :param name: The name for the recipe
253
261
  :param material_family_id: The material family for the recipe
262
+ :param project_id: The identifier of the project to create the recipe in
254
263
  :param workflow_id: The identifier of the workflow to create the recipe with
255
264
  :param workflow_variant_id: The identifier of the workflow variant to create the recipe with
256
265
  :param recipe_metadata: Metadata values to populate the recipe with
@@ -260,6 +269,7 @@ class ClientMethods(ABC):
260
269
  args = create_recipe_t.Arguments(
261
270
  name=name,
262
271
  material_family_id=material_family_id,
272
+ project_id=project_id,
263
273
  workflow_id=workflow_id,
264
274
  workflow_variant_id=workflow_variant_id,
265
275
  recipe_metadata=recipe_metadata,
@@ -460,9 +470,9 @@ class ClientMethods(ABC):
460
470
 
461
471
  :param material_family_id: The material family ID to get the input values from.
462
472
  :param input_ids: The input IDs to get the data from. If this is not filled in, all inputs from a material family will be returned (in paginated form).
463
- :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the input ID
473
+ :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the input ID. [Pagination More Info](#pagination)
464
474
  :param is_parameter: Whether to get parameters or ingredients. By default both are returned. When set to true, only parameters are returned, and when set to false, only ingredients are returned
465
- :param limit: The maximum number of results to return. By default this is set to 1,000 and it cannot be set higher than 1,000
475
+ :param limit: The maximum number of results to return. By default this is set to 1,000 and it cannot be set higher than 1,000. [Pagination More Info](#pagination)
466
476
  """
467
477
  args = get_input_data_t.Arguments(
468
478
  material_family_id=material_family_id,
@@ -508,9 +518,9 @@ class ClientMethods(ABC):
508
518
  """Gets the name of all inputs for a material family. An input is either an ingredient or process parameter, with metadata and calculations assigned separately
509
519
 
510
520
  :param material_family_id: The material family ID to get the input values from
511
- :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the input ID
521
+ :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the input ID. [Pagination More Info](#pagination)
512
522
  :param is_parameter: Whether to get parameters or ingredients. By default both are returned. When set to true, only parameters are returned, and when set to false, only ingredients are returned
513
- :param limit: The maximum number of results to return. By default this is set to 20,000 and it cannot be set higher than 20,000
523
+ :param limit: The maximum number of results to return. By default this is set to 20,000 and it cannot be set higher than 20,000. [Pagination More Info](#pagination)
514
524
  """
515
525
  args = get_input_names_t.Arguments(
516
526
  material_family_id=material_family_id,
@@ -556,8 +566,8 @@ class ClientMethods(ABC):
556
566
 
557
567
  :param material_family_id: The material family ID to get the output values from.
558
568
  :param output_ids: The output IDs to get the data from. If this is not filled in, all outputs from a material family will be returned (in paginated form).
559
- :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the output ID
560
- :param limit: The maximum number of results to return. By default this is set to 1,000 and it cannot be set higher than 1,000
569
+ :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the output ID. [Pagination More Info](#pagination)
570
+ :param limit: The maximum number of results to return. By default this is set to 1,000 and it cannot be set higher than 1,000. [Pagination More Info](#pagination)
561
571
  """
562
572
  args = get_output_data_t.Arguments(
563
573
  material_family_id=material_family_id,
@@ -582,8 +592,8 @@ class ClientMethods(ABC):
582
592
  """Gets the name of all outputs for a material family. An output represents a measurement value of any time (numeric, text, curve, etc). This includes calculations based off of other outputs, such as a calculated change over time
583
593
 
584
594
  :param material_family_id: The material family ID to get the output values from
585
- :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the output ID
586
- :param limit: The maximum number of results to return. By default this is set to 20,000 and it cannot be set higher than 20,000
595
+ :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the output ID. [Pagination More Info](#pagination)
596
+ :param limit: The maximum number of results to return. By default this is set to 20,000 and it cannot be set higher than 20,000. [Pagination More Info](#pagination)
587
597
  """
588
598
  args = get_output_names_t.Arguments(
589
599
  material_family_id=material_family_id,
@@ -629,8 +639,8 @@ class ClientMethods(ABC):
629
639
  """Gets either all data associated with a set of projects created in the platform. Because Uncountables recipe structure is complex, various data values are exploded out to increase efficiency in parsing, and this page is paginated to prevent too large of return values
630
640
 
631
641
  :param project_ids: The projects to get the data from
632
- :param offset: Used for pagination. All pagination is done in order of Project ID
633
- :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100
642
+ :param offset: Used for pagination. All pagination is done in order of Project ID. [Pagination More Info](#pagination)
643
+ :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100. [Pagination More Info](#pagination)
634
644
  """
635
645
  args = get_projects_data_t.Arguments(
636
646
  project_ids=project_ids,
@@ -703,8 +713,8 @@ class ClientMethods(ABC):
703
713
 
704
714
  :param material_family_id: The material family ID to get the recipe metadata values from.
705
715
  :param recipe_metadata_ids: The recipe metadata IDs to get the data from. If this is not filled in, all metadata from a material family will be returned (in paginated form).
706
- :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the metadata ID
707
- :param limit: The maximum number of results to return. By default this is set to 1,000 and it cannot be set higher than 1,000
716
+ :param offset: Used for pagination, where the number of results returned exceeds the limit. Results are always ordered by the metadata ID. [Pagination More Info](#pagination)
717
+ :param limit: The maximum number of results to return. By default this is set to 1,000 and it cannot be set higher than 1,000. [Pagination More Info](#pagination)
708
718
  """
709
719
  args = get_recipe_metadata_data_t.Arguments(
710
720
  material_family_id=material_family_id,
@@ -769,8 +779,8 @@ class ClientMethods(ABC):
769
779
 
770
780
  :param recipe_ids: The recipes to get the data from. Either these or project_id must be filled in
771
781
  :param project_id: The projects to get the data from. Either these or recipe_ids must be filled in
772
- :param offset: Used for pagination. All pagination is done in order of Recipe ID
773
- :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100
782
+ :param offset: Used for pagination. All pagination is done in order of Recipe ID. [Pagination More Info](#pagination)
783
+ :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100. [Pagination More Info](#pagination)
774
784
  """
775
785
  args = get_recipes_data_t.Arguments(
776
786
  recipe_ids=recipe_ids,
@@ -799,8 +809,8 @@ class ClientMethods(ABC):
799
809
  :param entity_type: The type of the entities requested, e.g. lab_request, recipe
800
810
  :param config_reference: The configuration reference name for the listing config
801
811
  :param attributes: Attributes to pass to the configuration for parameterizing filters
802
- :param offset: Used for pagination. Pagination is done based on the sorting of the config
803
- :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100
812
+ :param offset: Used for pagination. Pagination is done based on the sorting of the config. [Pagination More Info](#pagination)
813
+ :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100. [Pagination More Info](#pagination)
804
814
  """
805
815
  args = list_entities_t.Arguments(
806
816
  entity_type=entity_type,
@@ -828,8 +838,8 @@ class ClientMethods(ABC):
828
838
 
829
839
  :param spec: The id source spec to use
830
840
  :param search_label: Text to search within the labels to search matches
831
- :param offset: Used for pagination. Pagination is done based on the sorting of the config
832
- :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100
841
+ :param offset: Used for pagination. Pagination is done based on the sorting of the config. [Pagination More Info](#pagination)
842
+ :param limit: The number of data points to return. If not filled in, it will be set to 100, and cannot be set higher than 100. [Pagination More Info](#pagination)
833
843
  """
834
844
  args = list_id_source_t.Arguments(
835
845
  spec=spec,
@@ -844,6 +854,30 @@ class ClientMethods(ABC):
844
854
  )
845
855
  return self.do_request(api_request=api_request, return_type=list_id_source_t.Data)
846
856
 
857
+ def external_lock_entity(
858
+ self,
859
+ *,
860
+ entity_key: identifier_t.IdentifierKey,
861
+ entity_type: entity_t.EntityType,
862
+ globally_removable: typing.Optional[bool] = None,
863
+ ) -> lock_entity_t.Data:
864
+ """Lock an entity
865
+
866
+ :param entity_key: Identifier for the entity
867
+ :param globally_removable: Should the lock be removable by any user or just admins
868
+ """
869
+ args = lock_entity_t.Arguments(
870
+ entity_key=entity_key,
871
+ entity_type=entity_type,
872
+ globally_removable=globally_removable,
873
+ )
874
+ api_request = APIRequest(
875
+ method=lock_entity_t.ENDPOINT_METHOD,
876
+ endpoint=lock_entity_t.ENDPOINT_PATH,
877
+ args=args,
878
+ )
879
+ return self.do_request(api_request=api_request, return_type=lock_entity_t.Data)
880
+
847
881
  def match_id_source(
848
882
  self,
849
883
  *,
@@ -975,6 +1009,56 @@ class ClientMethods(ABC):
975
1009
  )
976
1010
  return self.do_request(api_request=api_request, return_type=set_input_attribute_values_t.Data)
977
1011
 
1012
+ def external_set_input_category(
1013
+ self,
1014
+ *,
1015
+ input_key: identifier_t.IdentifierKey,
1016
+ category_id: int,
1017
+ material_family_ids: typing.Optional[list[int]] = None,
1018
+ ) -> set_input_category_t.Data:
1019
+ """Sets subcategories for an input
1020
+
1021
+ :param input_key: Identifier for the input
1022
+ :param category_id: The subcategory identifiers to set
1023
+ :param material_family_ids: The material families to perform the update in
1024
+ """
1025
+ args = set_input_category_t.Arguments(
1026
+ input_key=input_key,
1027
+ category_id=category_id,
1028
+ material_family_ids=material_family_ids,
1029
+ )
1030
+ api_request = APIRequest(
1031
+ method=set_input_category_t.ENDPOINT_METHOD,
1032
+ endpoint=set_input_category_t.ENDPOINT_PATH,
1033
+ args=args,
1034
+ )
1035
+ return self.do_request(api_request=api_request, return_type=set_input_category_t.Data)
1036
+
1037
+ def external_set_input_subcategories(
1038
+ self,
1039
+ *,
1040
+ input_key: identifier_t.IdentifierKey,
1041
+ subcategory_ids: list[int],
1042
+ update_type: post_base_t.UpdateType,
1043
+ ) -> set_input_subcategories_t.Data:
1044
+ """Sets subcategories for an input
1045
+
1046
+ :param input_key: Identifier for the input
1047
+ :param subcategory_ids: The subcategory identifiers to set
1048
+ :param update_type: The type of update to perform
1049
+ """
1050
+ args = set_input_subcategories_t.Arguments(
1051
+ input_key=input_key,
1052
+ subcategory_ids=subcategory_ids,
1053
+ update_type=update_type,
1054
+ )
1055
+ api_request = APIRequest(
1056
+ method=set_input_subcategories_t.ENDPOINT_METHOD,
1057
+ endpoint=set_input_subcategories_t.ENDPOINT_PATH,
1058
+ args=args,
1059
+ )
1060
+ return self.do_request(api_request=api_request, return_type=set_input_subcategories_t.Data)
1061
+
978
1062
  def set_recipe_inputs(
979
1063
  self,
980
1064
  *,
@@ -1096,3 +1180,93 @@ class ClientMethods(ABC):
1096
1180
  args=args,
1097
1181
  )
1098
1182
  return self.do_request(api_request=api_request, return_type=transition_entity_phase_t.Data)
1183
+
1184
+ def unarchive_recipes(
1185
+ self,
1186
+ *,
1187
+ recipes: list[identifier_t.IdentifierKey],
1188
+ ) -> unarchive_recipes_t.Data:
1189
+ """Unarchive/restore the provided recipes
1190
+
1191
+ :param recipes: Identifier for the recipe
1192
+ """
1193
+ args = unarchive_recipes_t.Arguments(
1194
+ recipes=recipes,
1195
+ )
1196
+ api_request = APIRequest(
1197
+ method=unarchive_recipes_t.ENDPOINT_METHOD,
1198
+ endpoint=unarchive_recipes_t.ENDPOINT_PATH,
1199
+ args=args,
1200
+ )
1201
+ return self.do_request(api_request=api_request, return_type=unarchive_recipes_t.Data)
1202
+
1203
+ def external_unlock_entity(
1204
+ self,
1205
+ *,
1206
+ entity_key: identifier_t.IdentifierKey,
1207
+ entity_type: entity_t.EntityType,
1208
+ ) -> unlock_entity_t.Data:
1209
+ """Unlock an entity
1210
+
1211
+ :param entity_key: Identifier for the entity
1212
+ """
1213
+ args = unlock_entity_t.Arguments(
1214
+ entity_key=entity_key,
1215
+ entity_type=entity_type,
1216
+ )
1217
+ api_request = APIRequest(
1218
+ method=unlock_entity_t.ENDPOINT_METHOD,
1219
+ endpoint=unlock_entity_t.ENDPOINT_PATH,
1220
+ args=args,
1221
+ )
1222
+ return self.do_request(api_request=api_request, return_type=unlock_entity_t.Data)
1223
+
1224
+ def update_entity_material_families(
1225
+ self,
1226
+ *,
1227
+ entity_key: identifier_t.IdentifierKey,
1228
+ entity_type: typing.Union[typing.Literal[entity_t.EntityType.RECIPE_METADATA], typing.Literal[entity_t.EntityType.INGREDIENT], typing.Literal[entity_t.EntityType.OUTPUT], typing.Literal[entity_t.EntityType.CONDITION_PARAMETER], typing.Literal[entity_t.EntityType.INGREDIENT_ATTRIBUTE]],
1229
+ material_family_ids: list[base_t.ObjectId],
1230
+ update_type: post_base_t.UpdateType,
1231
+ ) -> update_entity_material_families_t.Data:
1232
+ """Updates the material families that the entity is available in
1233
+
1234
+ :param entity_key: The identifier for the entity to update across material families
1235
+ :param entity_type: The type of the entities requested
1236
+ :param material_family_ids: The material families to update
1237
+ :param update_type: The type of update to make
1238
+ """
1239
+ args = update_entity_material_families_t.Arguments(
1240
+ entity_key=entity_key,
1241
+ entity_type=entity_type,
1242
+ material_family_ids=material_family_ids,
1243
+ update_type=update_type,
1244
+ )
1245
+ api_request = APIRequest(
1246
+ method=update_entity_material_families_t.ENDPOINT_METHOD,
1247
+ endpoint=update_entity_material_families_t.ENDPOINT_PATH,
1248
+ args=args,
1249
+ )
1250
+ return self.do_request(api_request=api_request, return_type=update_entity_material_families_t.Data)
1251
+
1252
+ def upsert_field_options(
1253
+ self,
1254
+ *,
1255
+ option_set_key: identifier_t.IdentifierKey,
1256
+ field_options: list[upsert_field_options_t.FieldOption],
1257
+ ) -> upsert_field_options_t.Data:
1258
+ """Creates or updates field options for an option set
1259
+
1260
+ :param option_set_key: Identifier for the field option set
1261
+ :param field_options: Field options to upsert
1262
+ """
1263
+ args = upsert_field_options_t.Arguments(
1264
+ option_set_key=option_set_key,
1265
+ field_options=field_options,
1266
+ )
1267
+ api_request = APIRequest(
1268
+ method=upsert_field_options_t.ENDPOINT_METHOD,
1269
+ endpoint=upsert_field_options_t.ENDPOINT_PATH,
1270
+ args=args,
1271
+ )
1272
+ return self.do_request(api_request=api_request, return_type=upsert_field_options_t.Data)