rapidata 0.4.0__py3-none-any.whl → 0.5.0__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 rapidata might be problematic. Click here for more details.

Files changed (92) hide show
  1. rapidata/__init__.py +4 -3
  2. rapidata/api_client/__init__.py +51 -15
  3. rapidata/api_client/api/__init__.py +5 -0
  4. rapidata/api_client/api/campaign_api.py +1044 -0
  5. rapidata/api_client/api/compare_workflow_api.py +316 -0
  6. rapidata/api_client/api/dataset_api.py +24 -24
  7. rapidata/api_client/api/order_api.py +206 -536
  8. rapidata/api_client/api/pipeline_api.py +843 -0
  9. rapidata/api_client/api/rapid_api.py +6 -6
  10. rapidata/api_client/api/simple_workflow_api.py +350 -0
  11. rapidata/api_client/api/validation_api.py +6 -6
  12. rapidata/api_client/api/workflow_api.py +2386 -0
  13. rapidata/api_client/api_client.py +2 -2
  14. rapidata/api_client/models/__init__.py +46 -15
  15. rapidata/api_client/models/add_campaign_artifact_result.py +87 -0
  16. rapidata/api_client/models/add_campaign_model.py +149 -0
  17. rapidata/api_client/models/admin_order_model.py +8 -1
  18. rapidata/api_client/models/age_group.py +1 -1
  19. rapidata/api_client/models/age_user_filter_model.py +2 -2
  20. rapidata/api_client/models/campaign_artifact_model.py +98 -0
  21. rapidata/api_client/models/campaign_query_model.py +105 -0
  22. rapidata/api_client/models/campaign_query_model_paged_result.py +105 -0
  23. rapidata/api_client/models/campaign_status.py +39 -0
  24. rapidata/api_client/models/campaign_user_filter_model.py +2 -2
  25. rapidata/api_client/models/compare_workflow_config.py +2 -12
  26. rapidata/api_client/models/compare_workflow_config_model.py +138 -0
  27. rapidata/api_client/models/compare_workflow_get_result_overview_get200_response.py +137 -0
  28. rapidata/api_client/models/compare_workflow_model1.py +146 -0
  29. rapidata/api_client/models/completed_rapid_model.py +103 -0
  30. rapidata/api_client/models/conditional_validation_selection.py +106 -0
  31. rapidata/api_client/models/country_user_filter_model.py +2 -2
  32. rapidata/api_client/models/create_demographic_rapid_model.py +3 -3
  33. rapidata/api_client/models/create_independent_workflow_model.py +93 -0
  34. rapidata/api_client/models/create_independent_workflow_model_workflow_config.py +140 -0
  35. rapidata/api_client/models/create_independent_workflow_result.py +89 -0
  36. rapidata/api_client/models/create_order_model.py +40 -31
  37. rapidata/api_client/models/create_order_model_selections_inner.py +40 -12
  38. rapidata/api_client/models/create_order_model_user_filters_inner.py +35 -35
  39. rapidata/api_client/models/customer_order_model.py +8 -1
  40. rapidata/api_client/models/dataset_artifact_model.py +98 -0
  41. rapidata/api_client/models/demographic_rapid_selection_config.py +7 -5
  42. rapidata/api_client/models/demographic_selection.py +8 -6
  43. rapidata/api_client/models/feedback_model.py +1 -1
  44. rapidata/api_client/models/file_artifact_model.py +98 -0
  45. rapidata/api_client/models/gender.py +1 -1
  46. rapidata/api_client/models/gender_user_filter_model.py +2 -2
  47. rapidata/api_client/models/get_attach_category_workflow_result_overview_result.py +144 -0
  48. rapidata/api_client/models/get_compare_workflow_result_overview_result.py +125 -0
  49. rapidata/api_client/models/get_compare_workflow_result_overview_small_result.py +114 -0
  50. rapidata/api_client/models/get_pipeline_by_id_result.py +100 -0
  51. rapidata/api_client/models/get_pipeline_by_id_result_artifacts_value.py +182 -0
  52. rapidata/api_client/models/get_simple_workflow_result_overview_result.py +142 -0
  53. rapidata/api_client/models/get_workflow_by_id_result.py +91 -0
  54. rapidata/api_client/models/get_workflow_by_id_result_workflow.py +140 -0
  55. rapidata/api_client/models/get_workflow_progress_result.py +100 -0
  56. rapidata/api_client/models/get_workflow_result_overview_result.py +104 -0
  57. rapidata/api_client/models/i_workflow_model_paged_result.py +105 -0
  58. rapidata/api_client/models/in_progress_rapid_model.py +103 -0
  59. rapidata/api_client/models/labeling_selection.py +2 -2
  60. rapidata/api_client/models/language_user_filter_model.py +2 -2
  61. rapidata/api_client/models/not_started_rapid_model.py +93 -0
  62. rapidata/api_client/models/order_state.py +43 -0
  63. rapidata/api_client/models/query_campaigns_model.py +112 -0
  64. rapidata/api_client/models/query_workflows_model.py +112 -0
  65. rapidata/api_client/models/ranked_datapoint_model.py +95 -0
  66. rapidata/api_client/models/rapid_answer.py +97 -0
  67. rapidata/api_client/models/rapid_answer_result.py +252 -0
  68. rapidata/api_client/models/simple_workflow_config.py +2 -12
  69. rapidata/api_client/models/simple_workflow_config_model.py +132 -0
  70. rapidata/api_client/models/simple_workflow_config_model_blueprint.py +238 -0
  71. rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +137 -0
  72. rapidata/api_client/models/simple_workflow_model1.py +140 -0
  73. rapidata/api_client/models/static_selection.py +96 -0
  74. rapidata/api_client/models/update_workflow_config_request.py +107 -0
  75. rapidata/api_client/models/update_workflow_config_request_config.py +140 -0
  76. rapidata/api_client/models/user_score_user_filter_model.py +3 -3
  77. rapidata/api_client/models/validation_selection.py +3 -3
  78. rapidata/api_client/models/workflow_artifact_model.py +98 -0
  79. rapidata/api_client/models/workflow_config_artifact_model.py +102 -0
  80. rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py +140 -0
  81. rapidata/api_client/models/workflow_state.py +41 -0
  82. rapidata/api_client/rest.py +1 -1
  83. rapidata/api_client_README.md +75 -29
  84. rapidata/rapidata_client/__init__.py +6 -1
  85. rapidata/rapidata_client/order/rapidata_order_builder.py +2 -1
  86. rapidata/rapidata_client/selection/__init__.py +1 -0
  87. rapidata/rapidata_client/selection/conditional_validation_rapid_selection.py +41 -0
  88. rapidata/rapidata_client/selection/demographic_selection.py +3 -5
  89. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/METADATA +1 -1
  90. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/RECORD +92 -40
  91. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/LICENSE +0 -0
  92. {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,146 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.compare_workflow_config_referee import CompareWorkflowConfigReferee
23
+ from rapidata.api_client.models.feature_flag import FeatureFlag
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CompareWorkflowModel1(BaseModel):
28
+ """
29
+ CompareWorkflowModel1
30
+ """ # noqa: E501
31
+ t: StrictStr = Field(description="Discriminator value for CompareWorkflowModel", alias="_t")
32
+ id: StrictStr
33
+ dataset_id: Optional[StrictStr] = Field(alias="datasetId")
34
+ target_country_codes: List[StrictStr] = Field(alias="targetCountryCodes")
35
+ feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
36
+ referee: CompareWorkflowConfigReferee
37
+ state: StrictStr
38
+ priority: StrictStr
39
+ criteria: StrictStr
40
+ name: StrictStr
41
+ owner_mail: Optional[StrictStr] = Field(alias="ownerMail")
42
+ starting_elo: StrictInt = Field(alias="startingElo")
43
+ k_factor: StrictInt = Field(alias="kFactor")
44
+ match_size: StrictInt = Field(alias="matchSize")
45
+ scaling_factor: StrictInt = Field(alias="scalingFactor")
46
+ matches_until_completed: StrictInt = Field(alias="matchesUntilCompleted")
47
+ __properties: ClassVar[List[str]] = ["_t", "id", "datasetId", "targetCountryCodes", "featureFlags", "referee", "state", "priority", "criteria", "name", "ownerMail", "startingElo", "kFactor", "matchSize", "scalingFactor", "matchesUntilCompleted"]
48
+
49
+ @field_validator('t')
50
+ def t_validate_enum(cls, value):
51
+ """Validates the enum"""
52
+ if value not in set(['CompareWorkflowModel']):
53
+ raise ValueError("must be one of enum values ('CompareWorkflowModel')")
54
+ return value
55
+
56
+ model_config = ConfigDict(
57
+ populate_by_name=True,
58
+ validate_assignment=True,
59
+ protected_namespaces=(),
60
+ )
61
+
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of CompareWorkflowModel1 from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
96
+ _items = []
97
+ if self.feature_flags:
98
+ for _item_feature_flags in self.feature_flags:
99
+ if _item_feature_flags:
100
+ _items.append(_item_feature_flags.to_dict())
101
+ _dict['featureFlags'] = _items
102
+ # override the default output from pydantic by calling `to_dict()` of referee
103
+ if self.referee:
104
+ _dict['referee'] = self.referee.to_dict()
105
+ # set to None if dataset_id (nullable) is None
106
+ # and model_fields_set contains the field
107
+ if self.dataset_id is None and "dataset_id" in self.model_fields_set:
108
+ _dict['datasetId'] = None
109
+
110
+ # set to None if owner_mail (nullable) is None
111
+ # and model_fields_set contains the field
112
+ if self.owner_mail is None and "owner_mail" in self.model_fields_set:
113
+ _dict['ownerMail'] = None
114
+
115
+ return _dict
116
+
117
+ @classmethod
118
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
119
+ """Create an instance of CompareWorkflowModel1 from a dict"""
120
+ if obj is None:
121
+ return None
122
+
123
+ if not isinstance(obj, dict):
124
+ return cls.model_validate(obj)
125
+
126
+ _obj = cls.model_validate({
127
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'CompareWorkflowModel',
128
+ "id": obj.get("id"),
129
+ "datasetId": obj.get("datasetId"),
130
+ "targetCountryCodes": obj.get("targetCountryCodes"),
131
+ "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
132
+ "referee": CompareWorkflowConfigReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
133
+ "state": obj.get("state"),
134
+ "priority": obj.get("priority"),
135
+ "criteria": obj.get("criteria"),
136
+ "name": obj.get("name"),
137
+ "ownerMail": obj.get("ownerMail"),
138
+ "startingElo": obj.get("startingElo"),
139
+ "kFactor": obj.get("kFactor"),
140
+ "matchSize": obj.get("matchSize"),
141
+ "scalingFactor": obj.get("scalingFactor"),
142
+ "matchesUntilCompleted": obj.get("matchesUntilCompleted")
143
+ })
144
+ return _obj
145
+
146
+
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from rapidata.api_client.models.datapoint_model_asset import DatapointModelAsset
23
+ from rapidata.api_client.models.rapid_answer import RapidAnswer
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CompletedRapidModel(BaseModel):
28
+ """
29
+ CompletedRapidModel
30
+ """ # noqa: E501
31
+ rapid_id: StrictStr = Field(alias="rapidId")
32
+ asset: DatapointModelAsset
33
+ answers: List[RapidAnswer]
34
+ __properties: ClassVar[List[str]] = ["rapidId", "asset", "answers"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of CompletedRapidModel from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of asset
76
+ if self.asset:
77
+ _dict['asset'] = self.asset.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of each item in answers (list)
79
+ _items = []
80
+ if self.answers:
81
+ for _item_answers in self.answers:
82
+ if _item_answers:
83
+ _items.append(_item_answers.to_dict())
84
+ _dict['answers'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of CompletedRapidModel from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "rapidId": obj.get("rapidId"),
98
+ "asset": DatapointModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
99
+ "answers": [RapidAnswer.from_dict(_item) for _item in obj["answers"]] if obj.get("answers") is not None else None
100
+ })
101
+ return _obj
102
+
103
+
@@ -0,0 +1,106 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from rapidata.api_client.models.validation_chance import ValidationChance
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ConditionalValidationSelection(BaseModel):
27
+ """
28
+ ConditionalValidationSelection
29
+ """ # noqa: E501
30
+ t: StrictStr = Field(description="Discriminator value for ConditionalValidationSelection", alias="_t")
31
+ validation_set_id: StrictStr = Field(alias="validationSetId")
32
+ validation_chances: List[ValidationChance] = Field(alias="validationChances")
33
+ __properties: ClassVar[List[str]] = ["_t", "validationSetId", "validationChances"]
34
+
35
+ @field_validator('t')
36
+ def t_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['ConditionalValidationSelection']):
39
+ raise ValueError("must be one of enum values ('ConditionalValidationSelection')")
40
+ return value
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of ConditionalValidationSelection from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # override the default output from pydantic by calling `to_dict()` of each item in validation_chances (list)
82
+ _items = []
83
+ if self.validation_chances:
84
+ for _item_validation_chances in self.validation_chances:
85
+ if _item_validation_chances:
86
+ _items.append(_item_validation_chances.to_dict())
87
+ _dict['validationChances'] = _items
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of ConditionalValidationSelection from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'ConditionalValidationSelection',
101
+ "validationSetId": obj.get("validationSetId"),
102
+ "validationChances": [ValidationChance.from_dict(_item) for _item in obj["validationChances"]] if obj.get("validationChances") is not None else None
103
+ })
104
+ return _obj
105
+
106
+
@@ -24,10 +24,10 @@ from typing_extensions import Self
24
24
 
25
25
  class CountryUserFilterModel(BaseModel):
26
26
  """
27
- The CountryUserFilter is used to restrict users to specific countries.
27
+ CountryUserFilterModel
28
28
  """ # noqa: E501
29
29
  t: StrictStr = Field(description="Discriminator value for CountryFilter", alias="_t")
30
- countries: List[StrictStr] = Field(description="A whitelist for countries in the ISO 3166-1 alpha-2 format.")
30
+ countries: List[StrictStr]
31
31
  __properties: ClassVar[List[str]] = ["_t", "countries"]
32
32
 
33
33
  @field_validator('t')
@@ -27,9 +27,9 @@ class CreateDemographicRapidModel(BaseModel):
27
27
  """
28
28
  The model for creating a demographic rapid.
29
29
  """ # noqa: E501
30
- identifier: StrictStr = Field(description="The identifier of the demographic classification.")
30
+ key: StrictStr = Field(description="The identifier of the demographic classification.")
31
31
  payload: ClassifyPayload
32
- __properties: ClassVar[List[str]] = ["identifier", "payload"]
32
+ __properties: ClassVar[List[str]] = ["key", "payload"]
33
33
 
34
34
  model_config = ConfigDict(
35
35
  populate_by_name=True,
@@ -85,7 +85,7 @@ class CreateDemographicRapidModel(BaseModel):
85
85
  return cls.model_validate(obj)
86
86
 
87
87
  _obj = cls.model_validate({
88
- "identifier": obj.get("identifier"),
88
+ "key": obj.get("key"),
89
89
  "payload": ClassifyPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None
90
90
  })
91
91
  return _obj
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from rapidata.api_client.models.create_independent_workflow_model_workflow_config import CreateIndependentWorkflowModelWorkflowConfig
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CreateIndependentWorkflowModel(BaseModel):
27
+ """
28
+ Model for creating an independent workflow.
29
+ """ # noqa: E501
30
+ workflow_name: StrictStr = Field(description="The name of the workflow.", alias="workflowName")
31
+ workflow_config: CreateIndependentWorkflowModelWorkflowConfig = Field(alias="workflowConfig")
32
+ __properties: ClassVar[List[str]] = ["workflowName", "workflowConfig"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of CreateIndependentWorkflowModel from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of workflow_config
74
+ if self.workflow_config:
75
+ _dict['workflowConfig'] = self.workflow_config.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of CreateIndependentWorkflowModel from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "workflowName": obj.get("workflowName"),
89
+ "workflowConfig": CreateIndependentWorkflowModelWorkflowConfig.from_dict(obj["workflowConfig"]) if obj.get("workflowConfig") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,140 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ import pprint
18
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
19
+ from typing import Any, List, Optional
20
+ from rapidata.api_client.models.compare_workflow_config import CompareWorkflowConfig
21
+ from rapidata.api_client.models.simple_workflow_config import SimpleWorkflowConfig
22
+ from pydantic import StrictStr, Field
23
+ from typing import Union, List, Set, Optional, Dict
24
+ from typing_extensions import Literal, Self
25
+
26
+ CREATEINDEPENDENTWORKFLOWMODELWORKFLOWCONFIG_ONE_OF_SCHEMAS = ["CompareWorkflowConfig", "SimpleWorkflowConfig"]
27
+
28
+ class CreateIndependentWorkflowModelWorkflowConfig(BaseModel):
29
+ """
30
+ The configuration of the workflow.
31
+ """
32
+ # data type: CompareWorkflowConfig
33
+ oneof_schema_1_validator: Optional[CompareWorkflowConfig] = None
34
+ # data type: SimpleWorkflowConfig
35
+ oneof_schema_2_validator: Optional[SimpleWorkflowConfig] = None
36
+ actual_instance: Optional[Union[CompareWorkflowConfig, SimpleWorkflowConfig]] = None
37
+ one_of_schemas: Set[str] = { "CompareWorkflowConfig", "SimpleWorkflowConfig" }
38
+
39
+ model_config = ConfigDict(
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ discriminator_value_class_map: Dict[str, str] = {
46
+ }
47
+
48
+ def __init__(self, *args, **kwargs) -> None:
49
+ if args:
50
+ if len(args) > 1:
51
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
52
+ if kwargs:
53
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
54
+ super().__init__(actual_instance=args[0])
55
+ else:
56
+ super().__init__(**kwargs)
57
+
58
+ @field_validator('actual_instance')
59
+ def actual_instance_must_validate_oneof(cls, v):
60
+ instance = CreateIndependentWorkflowModelWorkflowConfig.model_construct()
61
+ error_messages = []
62
+ match = 0
63
+ # validate data type: CompareWorkflowConfig
64
+ if not isinstance(v, CompareWorkflowConfig):
65
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CompareWorkflowConfig`")
66
+ else:
67
+ match += 1
68
+ # validate data type: SimpleWorkflowConfig
69
+ if not isinstance(v, SimpleWorkflowConfig):
70
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleWorkflowConfig`")
71
+ else:
72
+ match += 1
73
+ if match > 1:
74
+ # more than 1 match
75
+ raise ValueError("Multiple matches found when setting `actual_instance` in CreateIndependentWorkflowModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
76
+ elif match == 0:
77
+ # no match
78
+ raise ValueError("No match found when setting `actual_instance` in CreateIndependentWorkflowModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
79
+ else:
80
+ return v
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
84
+ return cls.from_json(json.dumps(obj))
85
+
86
+ @classmethod
87
+ def from_json(cls, json_str: str) -> Self:
88
+ """Returns the object represented by the json string"""
89
+ instance = cls.model_construct()
90
+ error_messages = []
91
+ match = 0
92
+
93
+ # deserialize data into CompareWorkflowConfig
94
+ try:
95
+ instance.actual_instance = CompareWorkflowConfig.from_json(json_str)
96
+ match += 1
97
+ except (ValidationError, ValueError) as e:
98
+ error_messages.append(str(e))
99
+ # deserialize data into SimpleWorkflowConfig
100
+ try:
101
+ instance.actual_instance = SimpleWorkflowConfig.from_json(json_str)
102
+ match += 1
103
+ except (ValidationError, ValueError) as e:
104
+ error_messages.append(str(e))
105
+
106
+ if match > 1:
107
+ # more than 1 match
108
+ raise ValueError("Multiple matches found when deserializing the JSON string into CreateIndependentWorkflowModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
109
+ elif match == 0:
110
+ # no match
111
+ raise ValueError("No match found when deserializing the JSON string into CreateIndependentWorkflowModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
112
+ else:
113
+ return instance
114
+
115
+ def to_json(self) -> str:
116
+ """Returns the JSON representation of the actual instance"""
117
+ if self.actual_instance is None:
118
+ return "null"
119
+
120
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
121
+ return self.actual_instance.to_json()
122
+ else:
123
+ return json.dumps(self.actual_instance)
124
+
125
+ def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowConfig, SimpleWorkflowConfig]]:
126
+ """Returns the dict representation of the actual instance"""
127
+ if self.actual_instance is None:
128
+ return None
129
+
130
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
131
+ return self.actual_instance.to_dict()
132
+ else:
133
+ # primitive type
134
+ return self.actual_instance
135
+
136
+ def to_str(self) -> str:
137
+ """Returns the string representation of the actual instance"""
138
+ return pprint.pformat(self.model_dump())
139
+
140
+