rapidata 0.4.0__py3-none-any.whl → 0.4.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.
- rapidata/api_client/__init__.py +29 -3
- rapidata/api_client/api/__init__.py +3 -0
- rapidata/api_client/api/compare_workflow_api.py +316 -0
- rapidata/api_client/api/dataset_api.py +24 -24
- rapidata/api_client/api/order_api.py +515 -289
- rapidata/api_client/api/rapid_api.py +6 -6
- rapidata/api_client/api/simple_workflow_api.py +350 -0
- rapidata/api_client/api/validation_api.py +6 -6
- rapidata/api_client/api/workflow_api.py +2386 -0
- rapidata/api_client/api_client.py +2 -2
- rapidata/api_client/models/__init__.py +26 -3
- rapidata/api_client/models/admin_order_model.py +8 -1
- rapidata/api_client/models/age_group.py +1 -1
- rapidata/api_client/models/age_user_filter_model.py +2 -2
- rapidata/api_client/models/campaign_user_filter_model.py +2 -2
- rapidata/api_client/models/compare_workflow_get_result_overview_get200_response.py +137 -0
- rapidata/api_client/models/compare_workflow_model1.py +146 -0
- rapidata/api_client/models/completed_rapid_model.py +103 -0
- rapidata/api_client/models/country_user_filter_model.py +2 -2
- rapidata/api_client/models/create_demographic_rapid_model.py +3 -3
- rapidata/api_client/models/create_independent_workflow_model.py +93 -0
- rapidata/api_client/models/create_independent_workflow_model_workflow_config.py +140 -0
- rapidata/api_client/models/create_independent_workflow_result.py +89 -0
- rapidata/api_client/models/create_order_model.py +40 -31
- rapidata/api_client/models/create_order_model_selections_inner.py +24 -10
- rapidata/api_client/models/create_order_model_user_filters_inner.py +35 -35
- rapidata/api_client/models/customer_order_model.py +8 -1
- rapidata/api_client/models/demographic_rapid_selection_config.py +3 -3
- rapidata/api_client/models/demographic_selection.py +4 -4
- rapidata/api_client/models/feedback_model.py +1 -1
- rapidata/api_client/models/gender.py +1 -1
- rapidata/api_client/models/gender_user_filter_model.py +2 -2
- rapidata/api_client/models/get_attach_category_workflow_result_overview_result.py +144 -0
- rapidata/api_client/models/get_compare_workflow_result_overview_result.py +125 -0
- rapidata/api_client/models/get_compare_workflow_result_overview_small_result.py +114 -0
- rapidata/api_client/models/get_simple_workflow_result_overview_result.py +142 -0
- rapidata/api_client/models/get_workflow_by_id_result.py +91 -0
- rapidata/api_client/models/get_workflow_by_id_result_workflow.py +140 -0
- rapidata/api_client/models/get_workflow_progress_result.py +100 -0
- rapidata/api_client/models/get_workflow_result_overview_result.py +104 -0
- rapidata/api_client/models/i_workflow_model_paged_result.py +105 -0
- rapidata/api_client/models/in_progress_rapid_model.py +103 -0
- rapidata/api_client/models/labeling_selection.py +2 -2
- rapidata/api_client/models/language_user_filter_model.py +2 -2
- rapidata/api_client/models/not_started_rapid_model.py +93 -0
- rapidata/api_client/models/order_state.py +43 -0
- rapidata/api_client/models/query_workflows_model.py +112 -0
- rapidata/api_client/models/ranked_datapoint_model.py +95 -0
- rapidata/api_client/models/rapid_answer.py +97 -0
- rapidata/api_client/models/rapid_answer_result.py +252 -0
- rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +137 -0
- rapidata/api_client/models/simple_workflow_model1.py +140 -0
- rapidata/api_client/models/static_selection.py +96 -0
- rapidata/api_client/models/user_score_user_filter_model.py +3 -3
- rapidata/api_client/models/validation_selection.py +3 -3
- rapidata/api_client/models/workflow_state.py +41 -0
- rapidata/api_client/rest.py +1 -1
- rapidata/api_client_README.md +44 -8
- rapidata/rapidata_client/order/rapidata_order_builder.py +2 -1
- {rapidata-0.4.0.dist-info → rapidata-0.4.1.dist-info}/METADATA +1 -1
- {rapidata-0.4.0.dist-info → rapidata-0.4.1.dist-info}/RECORD +63 -34
- {rapidata-0.4.0.dist-info → rapidata-0.4.1.dist-info}/LICENSE +0 -0
- {rapidata-0.4.0.dist-info → rapidata-0.4.1.dist-info}/WHEEL +0 -0
|
@@ -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
|
+
|
|
@@ -0,0 +1,89 @@
|
|
|
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 typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class CreateIndependentWorkflowResult(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
CreateIndependentWorkflowResult
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
workflow_id: StrictStr = Field(alias="workflowId")
|
|
30
|
+
dataset_id: StrictStr = Field(alias="datasetId")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["workflowId", "datasetId"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of CreateIndependentWorkflowResult from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
return _dict
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
+
"""Create an instance of CreateIndependentWorkflowResult from a dict"""
|
|
77
|
+
if obj is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
if not isinstance(obj, dict):
|
|
81
|
+
return cls.model_validate(obj)
|
|
82
|
+
|
|
83
|
+
_obj = cls.model_validate({
|
|
84
|
+
"workflowId": obj.get("workflowId"),
|
|
85
|
+
"datasetId": obj.get("datasetId")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -31,16 +31,24 @@ class CreateOrderModel(BaseModel):
|
|
|
31
31
|
"""
|
|
32
32
|
This model is used to create a simple order
|
|
33
33
|
""" # noqa: E501
|
|
34
|
+
t: StrictStr = Field(description="Discriminator value for CreateOrderModel", alias="_t")
|
|
34
35
|
order_name: StrictStr = Field(description="The name is used as an identifier for an order and can be freely chosen.", alias="orderName")
|
|
35
|
-
user_filters: List[CreateOrderModelUserFiltersInner] = Field(description="The user filters are used to restrict the order to only collect votes from a specific demographic.", alias="userFilters")
|
|
36
36
|
workflow: CreateOrderModelWorkflow
|
|
37
37
|
referee: CreateOrderModelReferee
|
|
38
38
|
aggregator: Optional[StrictStr] = Field(default=None, description="The aggregator is used to determine how the data will be aggregated. The default behavior is enough for most cases")
|
|
39
|
-
validation_set_id: Optional[StrictStr] = Field(default=None, description="The validation set id can be changed to point to a specific validation set. if not provided a sane default will be used.", alias="validationSetId")
|
|
40
|
-
selections: Optional[List[CreateOrderModelSelectionsInner]] = Field(default=None, description="The selections are used to determine which tasks are shown to a user.")
|
|
41
39
|
feature_flags: Optional[List[FeatureFlagModel]] = Field(default=None, description="The feature flags are used to enable or disable certain features.", alias="featureFlags")
|
|
42
40
|
priority: Optional[StrictInt] = Field(default=None, description="The priority is used to prioritize over other orders.")
|
|
43
|
-
|
|
41
|
+
user_filters: List[CreateOrderModelUserFiltersInner] = Field(description="The user filters are used to restrict the order to only collect votes from a specific demographic.", alias="userFilters")
|
|
42
|
+
validation_set_id: Optional[StrictStr] = Field(default=None, description="The validation set id can be changed to point to a specific validation set. if not provided a sane default will be used.", alias="validationSetId")
|
|
43
|
+
selections: Optional[List[CreateOrderModelSelectionsInner]] = Field(default=None, description="The selections are used to determine which tasks are shown to a user.")
|
|
44
|
+
__properties: ClassVar[List[str]] = ["_t", "orderName", "workflow", "referee", "aggregator", "featureFlags", "priority", "userFilters", "validationSetId", "selections"]
|
|
45
|
+
|
|
46
|
+
@field_validator('t')
|
|
47
|
+
def t_validate_enum(cls, value):
|
|
48
|
+
"""Validates the enum"""
|
|
49
|
+
if value not in set(['CreateOrderModel']):
|
|
50
|
+
raise ValueError("must be one of enum values ('CreateOrderModel')")
|
|
51
|
+
return value
|
|
44
52
|
|
|
45
53
|
@field_validator('aggregator')
|
|
46
54
|
def aggregator_validate_enum(cls, value):
|
|
@@ -91,6 +99,19 @@ class CreateOrderModel(BaseModel):
|
|
|
91
99
|
exclude=excluded_fields,
|
|
92
100
|
exclude_none=True,
|
|
93
101
|
)
|
|
102
|
+
# override the default output from pydantic by calling `to_dict()` of workflow
|
|
103
|
+
if self.workflow:
|
|
104
|
+
_dict['workflow'] = self.workflow.to_dict()
|
|
105
|
+
# override the default output from pydantic by calling `to_dict()` of referee
|
|
106
|
+
if self.referee:
|
|
107
|
+
_dict['referee'] = self.referee.to_dict()
|
|
108
|
+
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
|
|
109
|
+
_items = []
|
|
110
|
+
if self.feature_flags:
|
|
111
|
+
for _item_feature_flags in self.feature_flags:
|
|
112
|
+
if _item_feature_flags:
|
|
113
|
+
_items.append(_item_feature_flags.to_dict())
|
|
114
|
+
_dict['featureFlags'] = _items
|
|
94
115
|
# override the default output from pydantic by calling `to_dict()` of each item in user_filters (list)
|
|
95
116
|
_items = []
|
|
96
117
|
if self.user_filters:
|
|
@@ -98,12 +119,6 @@ class CreateOrderModel(BaseModel):
|
|
|
98
119
|
if _item_user_filters:
|
|
99
120
|
_items.append(_item_user_filters.to_dict())
|
|
100
121
|
_dict['userFilters'] = _items
|
|
101
|
-
# override the default output from pydantic by calling `to_dict()` of workflow
|
|
102
|
-
if self.workflow:
|
|
103
|
-
_dict['workflow'] = self.workflow.to_dict()
|
|
104
|
-
# override the default output from pydantic by calling `to_dict()` of referee
|
|
105
|
-
if self.referee:
|
|
106
|
-
_dict['referee'] = self.referee.to_dict()
|
|
107
122
|
# override the default output from pydantic by calling `to_dict()` of each item in selections (list)
|
|
108
123
|
_items = []
|
|
109
124
|
if self.selections:
|
|
@@ -111,28 +126,11 @@ class CreateOrderModel(BaseModel):
|
|
|
111
126
|
if _item_selections:
|
|
112
127
|
_items.append(_item_selections.to_dict())
|
|
113
128
|
_dict['selections'] = _items
|
|
114
|
-
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
|
|
115
|
-
_items = []
|
|
116
|
-
if self.feature_flags:
|
|
117
|
-
for _item_feature_flags in self.feature_flags:
|
|
118
|
-
if _item_feature_flags:
|
|
119
|
-
_items.append(_item_feature_flags.to_dict())
|
|
120
|
-
_dict['featureFlags'] = _items
|
|
121
129
|
# set to None if aggregator (nullable) is None
|
|
122
130
|
# and model_fields_set contains the field
|
|
123
131
|
if self.aggregator is None and "aggregator" in self.model_fields_set:
|
|
124
132
|
_dict['aggregator'] = None
|
|
125
133
|
|
|
126
|
-
# set to None if validation_set_id (nullable) is None
|
|
127
|
-
# and model_fields_set contains the field
|
|
128
|
-
if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
|
|
129
|
-
_dict['validationSetId'] = None
|
|
130
|
-
|
|
131
|
-
# set to None if selections (nullable) is None
|
|
132
|
-
# and model_fields_set contains the field
|
|
133
|
-
if self.selections is None and "selections" in self.model_fields_set:
|
|
134
|
-
_dict['selections'] = None
|
|
135
|
-
|
|
136
134
|
# set to None if feature_flags (nullable) is None
|
|
137
135
|
# and model_fields_set contains the field
|
|
138
136
|
if self.feature_flags is None and "feature_flags" in self.model_fields_set:
|
|
@@ -143,6 +141,16 @@ class CreateOrderModel(BaseModel):
|
|
|
143
141
|
if self.priority is None and "priority" in self.model_fields_set:
|
|
144
142
|
_dict['priority'] = None
|
|
145
143
|
|
|
144
|
+
# set to None if validation_set_id (nullable) is None
|
|
145
|
+
# and model_fields_set contains the field
|
|
146
|
+
if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
|
|
147
|
+
_dict['validationSetId'] = None
|
|
148
|
+
|
|
149
|
+
# set to None if selections (nullable) is None
|
|
150
|
+
# and model_fields_set contains the field
|
|
151
|
+
if self.selections is None and "selections" in self.model_fields_set:
|
|
152
|
+
_dict['selections'] = None
|
|
153
|
+
|
|
146
154
|
return _dict
|
|
147
155
|
|
|
148
156
|
@classmethod
|
|
@@ -155,15 +163,16 @@ class CreateOrderModel(BaseModel):
|
|
|
155
163
|
return cls.model_validate(obj)
|
|
156
164
|
|
|
157
165
|
_obj = cls.model_validate({
|
|
166
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'CreateOrderModel',
|
|
158
167
|
"orderName": obj.get("orderName"),
|
|
159
|
-
"userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
|
|
160
168
|
"workflow": CreateOrderModelWorkflow.from_dict(obj["workflow"]) if obj.get("workflow") is not None else None,
|
|
161
169
|
"referee": CreateOrderModelReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
162
170
|
"aggregator": obj.get("aggregator"),
|
|
163
|
-
"validationSetId": obj.get("validationSetId"),
|
|
164
|
-
"selections": [CreateOrderModelSelectionsInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
|
|
165
171
|
"featureFlags": [FeatureFlagModel.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
166
|
-
"priority": obj.get("priority")
|
|
172
|
+
"priority": obj.get("priority"),
|
|
173
|
+
"userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
|
|
174
|
+
"validationSetId": obj.get("validationSetId"),
|
|
175
|
+
"selections": [CreateOrderModelSelectionsInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None
|
|
167
176
|
})
|
|
168
177
|
return _obj
|
|
169
178
|
|
|
@@ -19,25 +19,28 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, f
|
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
20
|
from rapidata.api_client.models.demographic_selection import DemographicSelection
|
|
21
21
|
from rapidata.api_client.models.labeling_selection import LabelingSelection
|
|
22
|
+
from rapidata.api_client.models.static_selection import StaticSelection
|
|
22
23
|
from rapidata.api_client.models.validation_selection import ValidationSelection
|
|
23
24
|
from pydantic import StrictStr, Field
|
|
24
25
|
from typing import Union, List, Set, Optional, Dict
|
|
25
26
|
from typing_extensions import Literal, Self
|
|
26
27
|
|
|
27
|
-
CREATEORDERMODELSELECTIONSINNER_ONE_OF_SCHEMAS = ["DemographicSelection", "LabelingSelection", "ValidationSelection"]
|
|
28
|
+
CREATEORDERMODELSELECTIONSINNER_ONE_OF_SCHEMAS = ["DemographicSelection", "LabelingSelection", "StaticSelection", "ValidationSelection"]
|
|
28
29
|
|
|
29
30
|
class CreateOrderModelSelectionsInner(BaseModel):
|
|
30
31
|
"""
|
|
31
|
-
|
|
32
|
+
CreateOrderModelSelectionsInner
|
|
32
33
|
"""
|
|
33
34
|
# data type: DemographicSelection
|
|
34
35
|
oneof_schema_1_validator: Optional[DemographicSelection] = None
|
|
35
36
|
# data type: LabelingSelection
|
|
36
37
|
oneof_schema_2_validator: Optional[LabelingSelection] = None
|
|
38
|
+
# data type: StaticSelection
|
|
39
|
+
oneof_schema_3_validator: Optional[StaticSelection] = None
|
|
37
40
|
# data type: ValidationSelection
|
|
38
|
-
|
|
39
|
-
actual_instance: Optional[Union[DemographicSelection, LabelingSelection, ValidationSelection]] = None
|
|
40
|
-
one_of_schemas: Set[str] = { "DemographicSelection", "LabelingSelection", "ValidationSelection" }
|
|
41
|
+
oneof_schema_4_validator: Optional[ValidationSelection] = None
|
|
42
|
+
actual_instance: Optional[Union[DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection]] = None
|
|
43
|
+
one_of_schemas: Set[str] = { "DemographicSelection", "LabelingSelection", "StaticSelection", "ValidationSelection" }
|
|
41
44
|
|
|
42
45
|
model_config = ConfigDict(
|
|
43
46
|
validate_assignment=True,
|
|
@@ -73,6 +76,11 @@ class CreateOrderModelSelectionsInner(BaseModel):
|
|
|
73
76
|
error_messages.append(f"Error! Input type `{type(v)}` is not `LabelingSelection`")
|
|
74
77
|
else:
|
|
75
78
|
match += 1
|
|
79
|
+
# validate data type: StaticSelection
|
|
80
|
+
if not isinstance(v, StaticSelection):
|
|
81
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `StaticSelection`")
|
|
82
|
+
else:
|
|
83
|
+
match += 1
|
|
76
84
|
# validate data type: ValidationSelection
|
|
77
85
|
if not isinstance(v, ValidationSelection):
|
|
78
86
|
error_messages.append(f"Error! Input type `{type(v)}` is not `ValidationSelection`")
|
|
@@ -80,10 +88,10 @@ class CreateOrderModelSelectionsInner(BaseModel):
|
|
|
80
88
|
match += 1
|
|
81
89
|
if match > 1:
|
|
82
90
|
# more than 1 match
|
|
83
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
91
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
84
92
|
elif match == 0:
|
|
85
93
|
# no match
|
|
86
|
-
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
94
|
+
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
87
95
|
else:
|
|
88
96
|
return v
|
|
89
97
|
|
|
@@ -110,6 +118,12 @@ class CreateOrderModelSelectionsInner(BaseModel):
|
|
|
110
118
|
match += 1
|
|
111
119
|
except (ValidationError, ValueError) as e:
|
|
112
120
|
error_messages.append(str(e))
|
|
121
|
+
# deserialize data into StaticSelection
|
|
122
|
+
try:
|
|
123
|
+
instance.actual_instance = StaticSelection.from_json(json_str)
|
|
124
|
+
match += 1
|
|
125
|
+
except (ValidationError, ValueError) as e:
|
|
126
|
+
error_messages.append(str(e))
|
|
113
127
|
# deserialize data into ValidationSelection
|
|
114
128
|
try:
|
|
115
129
|
instance.actual_instance = ValidationSelection.from_json(json_str)
|
|
@@ -119,10 +133,10 @@ class CreateOrderModelSelectionsInner(BaseModel):
|
|
|
119
133
|
|
|
120
134
|
if match > 1:
|
|
121
135
|
# more than 1 match
|
|
122
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
136
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
123
137
|
elif match == 0:
|
|
124
138
|
# no match
|
|
125
|
-
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
139
|
+
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelSelectionsInner with oneOf schemas: DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection. Details: " + ", ".join(error_messages))
|
|
126
140
|
else:
|
|
127
141
|
return instance
|
|
128
142
|
|
|
@@ -136,7 +150,7 @@ class CreateOrderModelSelectionsInner(BaseModel):
|
|
|
136
150
|
else:
|
|
137
151
|
return json.dumps(self.actual_instance)
|
|
138
152
|
|
|
139
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], DemographicSelection, LabelingSelection, ValidationSelection]]:
|
|
153
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], DemographicSelection, LabelingSelection, StaticSelection, ValidationSelection]]:
|
|
140
154
|
"""Returns the dict representation of the actual instance"""
|
|
141
155
|
if self.actual_instance is None:
|
|
142
156
|
return None
|
|
@@ -31,20 +31,20 @@ CREATEORDERMODELUSERFILTERSINNER_ONE_OF_SCHEMAS = ["AgeUserFilterModel", "Campai
|
|
|
31
31
|
|
|
32
32
|
class CreateOrderModelUserFiltersInner(BaseModel):
|
|
33
33
|
"""
|
|
34
|
-
|
|
34
|
+
CreateOrderModelUserFiltersInner
|
|
35
35
|
"""
|
|
36
|
-
# data type:
|
|
37
|
-
oneof_schema_1_validator: Optional[
|
|
38
|
-
# data type: LanguageUserFilterModel
|
|
39
|
-
oneof_schema_2_validator: Optional[LanguageUserFilterModel] = None
|
|
36
|
+
# data type: AgeUserFilterModel
|
|
37
|
+
oneof_schema_1_validator: Optional[AgeUserFilterModel] = None
|
|
40
38
|
# data type: CampaignUserFilterModel
|
|
41
|
-
|
|
39
|
+
oneof_schema_2_validator: Optional[CampaignUserFilterModel] = None
|
|
42
40
|
# data type: CountryUserFilterModel
|
|
43
|
-
|
|
44
|
-
# data type: AgeUserFilterModel
|
|
45
|
-
oneof_schema_5_validator: Optional[AgeUserFilterModel] = None
|
|
41
|
+
oneof_schema_3_validator: Optional[CountryUserFilterModel] = None
|
|
46
42
|
# data type: GenderUserFilterModel
|
|
47
|
-
|
|
43
|
+
oneof_schema_4_validator: Optional[GenderUserFilterModel] = None
|
|
44
|
+
# data type: LanguageUserFilterModel
|
|
45
|
+
oneof_schema_5_validator: Optional[LanguageUserFilterModel] = None
|
|
46
|
+
# data type: UserScoreUserFilterModel
|
|
47
|
+
oneof_schema_6_validator: Optional[UserScoreUserFilterModel] = None
|
|
48
48
|
actual_instance: Optional[Union[AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel]] = None
|
|
49
49
|
one_of_schemas: Set[str] = { "AgeUserFilterModel", "CampaignUserFilterModel", "CountryUserFilterModel", "GenderUserFilterModel", "LanguageUserFilterModel", "UserScoreUserFilterModel" }
|
|
50
50
|
|
|
@@ -72,14 +72,9 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
72
72
|
instance = CreateOrderModelUserFiltersInner.model_construct()
|
|
73
73
|
error_messages = []
|
|
74
74
|
match = 0
|
|
75
|
-
# validate data type:
|
|
76
|
-
if not isinstance(v,
|
|
77
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `
|
|
78
|
-
else:
|
|
79
|
-
match += 1
|
|
80
|
-
# validate data type: LanguageUserFilterModel
|
|
81
|
-
if not isinstance(v, LanguageUserFilterModel):
|
|
82
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `LanguageUserFilterModel`")
|
|
75
|
+
# validate data type: AgeUserFilterModel
|
|
76
|
+
if not isinstance(v, AgeUserFilterModel):
|
|
77
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AgeUserFilterModel`")
|
|
83
78
|
else:
|
|
84
79
|
match += 1
|
|
85
80
|
# validate data type: CampaignUserFilterModel
|
|
@@ -92,16 +87,21 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
92
87
|
error_messages.append(f"Error! Input type `{type(v)}` is not `CountryUserFilterModel`")
|
|
93
88
|
else:
|
|
94
89
|
match += 1
|
|
95
|
-
# validate data type: AgeUserFilterModel
|
|
96
|
-
if not isinstance(v, AgeUserFilterModel):
|
|
97
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `AgeUserFilterModel`")
|
|
98
|
-
else:
|
|
99
|
-
match += 1
|
|
100
90
|
# validate data type: GenderUserFilterModel
|
|
101
91
|
if not isinstance(v, GenderUserFilterModel):
|
|
102
92
|
error_messages.append(f"Error! Input type `{type(v)}` is not `GenderUserFilterModel`")
|
|
103
93
|
else:
|
|
104
94
|
match += 1
|
|
95
|
+
# validate data type: LanguageUserFilterModel
|
|
96
|
+
if not isinstance(v, LanguageUserFilterModel):
|
|
97
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LanguageUserFilterModel`")
|
|
98
|
+
else:
|
|
99
|
+
match += 1
|
|
100
|
+
# validate data type: UserScoreUserFilterModel
|
|
101
|
+
if not isinstance(v, UserScoreUserFilterModel):
|
|
102
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `UserScoreUserFilterModel`")
|
|
103
|
+
else:
|
|
104
|
+
match += 1
|
|
105
105
|
if match > 1:
|
|
106
106
|
# more than 1 match
|
|
107
107
|
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelUserFiltersInner with oneOf schemas: AgeUserFilterModel, CampaignUserFilterModel, CountryUserFilterModel, GenderUserFilterModel, LanguageUserFilterModel, UserScoreUserFilterModel. Details: " + ", ".join(error_messages))
|
|
@@ -122,15 +122,9 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
122
122
|
error_messages = []
|
|
123
123
|
match = 0
|
|
124
124
|
|
|
125
|
-
# deserialize data into
|
|
126
|
-
try:
|
|
127
|
-
instance.actual_instance = UserScoreUserFilterModel.from_json(json_str)
|
|
128
|
-
match += 1
|
|
129
|
-
except (ValidationError, ValueError) as e:
|
|
130
|
-
error_messages.append(str(e))
|
|
131
|
-
# deserialize data into LanguageUserFilterModel
|
|
125
|
+
# deserialize data into AgeUserFilterModel
|
|
132
126
|
try:
|
|
133
|
-
instance.actual_instance =
|
|
127
|
+
instance.actual_instance = AgeUserFilterModel.from_json(json_str)
|
|
134
128
|
match += 1
|
|
135
129
|
except (ValidationError, ValueError) as e:
|
|
136
130
|
error_messages.append(str(e))
|
|
@@ -146,15 +140,21 @@ class CreateOrderModelUserFiltersInner(BaseModel):
|
|
|
146
140
|
match += 1
|
|
147
141
|
except (ValidationError, ValueError) as e:
|
|
148
142
|
error_messages.append(str(e))
|
|
149
|
-
# deserialize data into
|
|
143
|
+
# deserialize data into GenderUserFilterModel
|
|
150
144
|
try:
|
|
151
|
-
instance.actual_instance =
|
|
145
|
+
instance.actual_instance = GenderUserFilterModel.from_json(json_str)
|
|
152
146
|
match += 1
|
|
153
147
|
except (ValidationError, ValueError) as e:
|
|
154
148
|
error_messages.append(str(e))
|
|
155
|
-
# deserialize data into
|
|
149
|
+
# deserialize data into LanguageUserFilterModel
|
|
156
150
|
try:
|
|
157
|
-
instance.actual_instance =
|
|
151
|
+
instance.actual_instance = LanguageUserFilterModel.from_json(json_str)
|
|
152
|
+
match += 1
|
|
153
|
+
except (ValidationError, ValueError) as e:
|
|
154
|
+
error_messages.append(str(e))
|
|
155
|
+
# deserialize data into UserScoreUserFilterModel
|
|
156
|
+
try:
|
|
157
|
+
instance.actual_instance = UserScoreUserFilterModel.from_json(json_str)
|
|
158
158
|
match += 1
|
|
159
159
|
except (ValidationError, ValueError) as e:
|
|
160
160
|
error_messages.append(str(e))
|