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.
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,105 @@
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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CampaignQueryModel(BaseModel):
27
+ """
28
+ CampaignQueryModel
29
+ """ # noqa: E501
30
+ id: StrictStr
31
+ owner: StrictStr
32
+ name: StrictStr
33
+ status: StrictStr
34
+ priority: StrictInt
35
+ created_at: datetime = Field(alias="createdAt")
36
+ __properties: ClassVar[List[str]] = ["id", "owner", "name", "status", "priority", "createdAt"]
37
+
38
+ @field_validator('status')
39
+ def status_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value not in set(['Created', 'Active', 'Paused', 'Completed']):
42
+ raise ValueError("must be one of enum values ('Created', 'Active', 'Paused', 'Completed')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of CampaignQueryModel from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of CampaignQueryModel from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "id": obj.get("id"),
97
+ "owner": obj.get("owner"),
98
+ "name": obj.get("name"),
99
+ "status": obj.get("status"),
100
+ "priority": obj.get("priority"),
101
+ "createdAt": obj.get("createdAt")
102
+ })
103
+ return _obj
104
+
105
+
@@ -0,0 +1,105 @@
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.campaign_query_model import CampaignQueryModel
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CampaignQueryModelPagedResult(BaseModel):
27
+ """
28
+ CampaignQueryModelPagedResult
29
+ """ # noqa: E501
30
+ total: StrictInt
31
+ page: StrictInt
32
+ page_size: StrictInt = Field(alias="pageSize")
33
+ items: List[CampaignQueryModel]
34
+ total_pages: Optional[StrictInt] = Field(default=None, alias="totalPages")
35
+ __properties: ClassVar[List[str]] = ["total", "page", "pageSize", "items", "totalPages"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of CampaignQueryModelPagedResult from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ * OpenAPI `readOnly` fields are excluded.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "total_pages",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
79
+ _items = []
80
+ if self.items:
81
+ for _item_items in self.items:
82
+ if _item_items:
83
+ _items.append(_item_items.to_dict())
84
+ _dict['items'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of CampaignQueryModelPagedResult 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
+ "total": obj.get("total"),
98
+ "page": obj.get("page"),
99
+ "pageSize": obj.get("pageSize"),
100
+ "items": [CampaignQueryModel.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
101
+ "totalPages": obj.get("totalPages")
102
+ })
103
+ return _obj
104
+
105
+
@@ -0,0 +1,39 @@
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
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class CampaignStatus(str, Enum):
22
+ """
23
+ CampaignStatus
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ CREATED = 'Created'
30
+ ACTIVE = 'Active'
31
+ PAUSED = 'Paused'
32
+ COMPLETED = 'Completed'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of CampaignStatus from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -24,10 +24,10 @@ from typing_extensions import Self
24
24
 
25
25
  class CampaignUserFilterModel(BaseModel):
26
26
  """
27
- The CampaignFilter is used to restrict users to specific campaigns.
27
+ CampaignUserFilterModel
28
28
  """ # noqa: E501
29
29
  t: StrictStr = Field(description="Discriminator value for CampaignFilter", alias="_t")
30
- campaign_ids: List[StrictStr] = Field(description="A whitelist for external DSP campaign ids", alias="campaignIds")
30
+ campaign_ids: List[StrictStr] = Field(alias="campaignIds")
31
31
  __properties: ClassVar[List[str]] = ["_t", "campaignIds"]
32
32
 
33
33
  @field_validator('t')
@@ -19,7 +19,6 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from rapidata.api_client.models.compare_workflow_config_rapid_selection_configs_inner import CompareWorkflowConfigRapidSelectionConfigsInner
23
22
  from rapidata.api_client.models.compare_workflow_config_referee import CompareWorkflowConfigReferee
24
23
  from rapidata.api_client.models.feature_flag import FeatureFlag
25
24
  from typing import Optional, Set
@@ -41,8 +40,7 @@ class CompareWorkflowConfig(BaseModel):
41
40
  feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
42
41
  priority: Optional[StrictStr] = None
43
42
  is_fallback: Optional[StrictBool] = Field(default=None, alias="isFallback")
44
- rapid_selection_configs: Optional[List[CompareWorkflowConfigRapidSelectionConfigsInner]] = Field(default=None, alias="rapidSelectionConfigs")
45
- __properties: ClassVar[List[str]] = ["_t", "criteria", "startingElo", "kFactor", "matchSize", "scalingFactor", "matchesUntilCompleted", "referee", "targetCountryCodes", "featureFlags", "priority", "isFallback", "rapidSelectionConfigs"]
43
+ __properties: ClassVar[List[str]] = ["_t", "criteria", "startingElo", "kFactor", "matchSize", "scalingFactor", "matchesUntilCompleted", "referee", "targetCountryCodes", "featureFlags", "priority", "isFallback"]
46
44
 
47
45
  @field_validator('t')
48
46
  def t_validate_enum(cls, value):
@@ -100,13 +98,6 @@ class CompareWorkflowConfig(BaseModel):
100
98
  if _item_feature_flags:
101
99
  _items.append(_item_feature_flags.to_dict())
102
100
  _dict['featureFlags'] = _items
103
- # override the default output from pydantic by calling `to_dict()` of each item in rapid_selection_configs (list)
104
- _items = []
105
- if self.rapid_selection_configs:
106
- for _item_rapid_selection_configs in self.rapid_selection_configs:
107
- if _item_rapid_selection_configs:
108
- _items.append(_item_rapid_selection_configs.to_dict())
109
- _dict['rapidSelectionConfigs'] = _items
110
101
  # set to None if priority (nullable) is None
111
102
  # and model_fields_set contains the field
112
103
  if self.priority is None and "priority" in self.model_fields_set:
@@ -135,8 +126,7 @@ class CompareWorkflowConfig(BaseModel):
135
126
  "targetCountryCodes": obj.get("targetCountryCodes"),
136
127
  "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
137
128
  "priority": obj.get("priority"),
138
- "isFallback": obj.get("isFallback"),
139
- "rapidSelectionConfigs": [CompareWorkflowConfigRapidSelectionConfigsInner.from_dict(_item) for _item in obj["rapidSelectionConfigs"]] if obj.get("rapidSelectionConfigs") is not None else None
129
+ "isFallback": obj.get("isFallback")
140
130
  })
141
131
  return _obj
142
132
 
@@ -0,0 +1,138 @@
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, StrictBool, 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 CompareWorkflowConfigModel(BaseModel):
28
+ """
29
+ The configuration for creating a compare workflow. A compare workflow is a workflow that continuously matches datapoints against each other and updates their respective ELO scores. The ELO scores are used to determine the relative strength of the datapoints, and datapoints are matched against other datapoints with similar ELO scores. The end goal is a ranking of the datapoints based on their relative strength.
30
+ """ # noqa: E501
31
+ t: StrictStr = Field(description="Discriminator value for CompareWorkflowConfig", alias="_t")
32
+ criteria: StrictStr = Field(description="The criteria to add to each compare rapid.")
33
+ starting_elo: Optional[StrictInt] = Field(default=None, description="The starting ELO score for each datapoint.", alias="startingElo")
34
+ k_factor: Optional[StrictInt] = Field(default=None, description="The K-factor to use in the ELO calculation. Determines the maximum possible change in a player's Elo rating after a single match. Higher K-Factor values result in larger rating changes.", alias="kFactor")
35
+ match_size: Optional[StrictInt] = Field(default=None, description="The number of datapoints to match against each other in each match.", alias="matchSize")
36
+ scaling_factor: Optional[StrictInt] = Field(default=None, description="Scaling factor to use in the ELO calculation. Adjusts the sensitivity of the Elo rating system to differences in player ratings. It affects how much the rating changes based on the expected outcome versus the actual outcome.", alias="scalingFactor")
37
+ matches_until_completed: Optional[StrictInt] = Field(default=None, description="The number of matches to run before each datapoint is considered \"completed\".", alias="matchesUntilCompleted")
38
+ referee: CompareWorkflowConfigReferee
39
+ target_country_codes: List[StrictStr] = Field(description="A list of country codes that this workflow is targeting.", alias="targetCountryCodes")
40
+ feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
41
+ priority: Optional[StrictStr] = None
42
+ is_fallback: Optional[StrictBool] = Field(default=None, alias="isFallback")
43
+ __properties: ClassVar[List[str]] = ["_t", "criteria", "startingElo", "kFactor", "matchSize", "scalingFactor", "matchesUntilCompleted", "referee", "targetCountryCodes", "featureFlags", "priority", "isFallback"]
44
+
45
+ @field_validator('t')
46
+ def t_validate_enum(cls, value):
47
+ """Validates the enum"""
48
+ if value not in set(['CompareWorkflowConfig']):
49
+ raise ValueError("must be one of enum values ('CompareWorkflowConfig')")
50
+ return value
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of CompareWorkflowConfigModel from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ """
83
+ excluded_fields: Set[str] = set([
84
+ ])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of referee
92
+ if self.referee:
93
+ _dict['referee'] = self.referee.to_dict()
94
+ # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
95
+ _items = []
96
+ if self.feature_flags:
97
+ for _item_feature_flags in self.feature_flags:
98
+ if _item_feature_flags:
99
+ _items.append(_item_feature_flags.to_dict())
100
+ _dict['featureFlags'] = _items
101
+ # set to None if priority (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.priority is None and "priority" in self.model_fields_set:
104
+ _dict['priority'] = None
105
+
106
+ # set to None if is_fallback (nullable) is None
107
+ # and model_fields_set contains the field
108
+ if self.is_fallback is None and "is_fallback" in self.model_fields_set:
109
+ _dict['isFallback'] = None
110
+
111
+ return _dict
112
+
113
+ @classmethod
114
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
115
+ """Create an instance of CompareWorkflowConfigModel from a dict"""
116
+ if obj is None:
117
+ return None
118
+
119
+ if not isinstance(obj, dict):
120
+ return cls.model_validate(obj)
121
+
122
+ _obj = cls.model_validate({
123
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'CompareWorkflowConfig',
124
+ "criteria": obj.get("criteria"),
125
+ "startingElo": obj.get("startingElo"),
126
+ "kFactor": obj.get("kFactor"),
127
+ "matchSize": obj.get("matchSize"),
128
+ "scalingFactor": obj.get("scalingFactor"),
129
+ "matchesUntilCompleted": obj.get("matchesUntilCompleted"),
130
+ "referee": CompareWorkflowConfigReferee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
131
+ "targetCountryCodes": obj.get("targetCountryCodes"),
132
+ "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
133
+ "priority": obj.get("priority"),
134
+ "isFallback": obj.get("isFallback")
135
+ })
136
+ return _obj
137
+
138
+
@@ -0,0 +1,137 @@
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.get_compare_workflow_result_overview_result import GetCompareWorkflowResultOverviewResult
21
+ from rapidata.api_client.models.get_compare_workflow_result_overview_small_result import GetCompareWorkflowResultOverviewSmallResult
22
+ from pydantic import StrictStr, Field
23
+ from typing import Union, List, Set, Optional, Dict
24
+ from typing_extensions import Literal, Self
25
+
26
+ COMPAREWORKFLOWGETRESULTOVERVIEWGET200RESPONSE_ONE_OF_SCHEMAS = ["GetCompareWorkflowResultOverviewResult", "GetCompareWorkflowResultOverviewSmallResult"]
27
+
28
+ class CompareWorkflowGetResultOverviewGet200Response(BaseModel):
29
+ """
30
+ CompareWorkflowGetResultOverviewGet200Response
31
+ """
32
+ # data type: GetCompareWorkflowResultOverviewResult
33
+ oneof_schema_1_validator: Optional[GetCompareWorkflowResultOverviewResult] = None
34
+ # data type: GetCompareWorkflowResultOverviewSmallResult
35
+ oneof_schema_2_validator: Optional[GetCompareWorkflowResultOverviewSmallResult] = None
36
+ actual_instance: Optional[Union[GetCompareWorkflowResultOverviewResult, GetCompareWorkflowResultOverviewSmallResult]] = None
37
+ one_of_schemas: Set[str] = { "GetCompareWorkflowResultOverviewResult", "GetCompareWorkflowResultOverviewSmallResult" }
38
+
39
+ model_config = ConfigDict(
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def __init__(self, *args, **kwargs) -> None:
46
+ if args:
47
+ if len(args) > 1:
48
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
49
+ if kwargs:
50
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
51
+ super().__init__(actual_instance=args[0])
52
+ else:
53
+ super().__init__(**kwargs)
54
+
55
+ @field_validator('actual_instance')
56
+ def actual_instance_must_validate_oneof(cls, v):
57
+ instance = CompareWorkflowGetResultOverviewGet200Response.model_construct()
58
+ error_messages = []
59
+ match = 0
60
+ # validate data type: GetCompareWorkflowResultOverviewResult
61
+ if not isinstance(v, GetCompareWorkflowResultOverviewResult):
62
+ error_messages.append(f"Error! Input type `{type(v)}` is not `GetCompareWorkflowResultOverviewResult`")
63
+ else:
64
+ match += 1
65
+ # validate data type: GetCompareWorkflowResultOverviewSmallResult
66
+ if not isinstance(v, GetCompareWorkflowResultOverviewSmallResult):
67
+ error_messages.append(f"Error! Input type `{type(v)}` is not `GetCompareWorkflowResultOverviewSmallResult`")
68
+ else:
69
+ match += 1
70
+ if match > 1:
71
+ # more than 1 match
72
+ raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowGetResultOverviewGet200Response with oneOf schemas: GetCompareWorkflowResultOverviewResult, GetCompareWorkflowResultOverviewSmallResult. Details: " + ", ".join(error_messages))
73
+ elif match == 0:
74
+ # no match
75
+ raise ValueError("No match found when setting `actual_instance` in CompareWorkflowGetResultOverviewGet200Response with oneOf schemas: GetCompareWorkflowResultOverviewResult, GetCompareWorkflowResultOverviewSmallResult. Details: " + ", ".join(error_messages))
76
+ else:
77
+ return v
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
81
+ return cls.from_json(json.dumps(obj))
82
+
83
+ @classmethod
84
+ def from_json(cls, json_str: str) -> Self:
85
+ """Returns the object represented by the json string"""
86
+ instance = cls.model_construct()
87
+ error_messages = []
88
+ match = 0
89
+
90
+ # deserialize data into GetCompareWorkflowResultOverviewResult
91
+ try:
92
+ instance.actual_instance = GetCompareWorkflowResultOverviewResult.from_json(json_str)
93
+ match += 1
94
+ except (ValidationError, ValueError) as e:
95
+ error_messages.append(str(e))
96
+ # deserialize data into GetCompareWorkflowResultOverviewSmallResult
97
+ try:
98
+ instance.actual_instance = GetCompareWorkflowResultOverviewSmallResult.from_json(json_str)
99
+ match += 1
100
+ except (ValidationError, ValueError) as e:
101
+ error_messages.append(str(e))
102
+
103
+ if match > 1:
104
+ # more than 1 match
105
+ raise ValueError("Multiple matches found when deserializing the JSON string into CompareWorkflowGetResultOverviewGet200Response with oneOf schemas: GetCompareWorkflowResultOverviewResult, GetCompareWorkflowResultOverviewSmallResult. Details: " + ", ".join(error_messages))
106
+ elif match == 0:
107
+ # no match
108
+ raise ValueError("No match found when deserializing the JSON string into CompareWorkflowGetResultOverviewGet200Response with oneOf schemas: GetCompareWorkflowResultOverviewResult, GetCompareWorkflowResultOverviewSmallResult. Details: " + ", ".join(error_messages))
109
+ else:
110
+ return instance
111
+
112
+ def to_json(self) -> str:
113
+ """Returns the JSON representation of the actual instance"""
114
+ if self.actual_instance is None:
115
+ return "null"
116
+
117
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
118
+ return self.actual_instance.to_json()
119
+ else:
120
+ return json.dumps(self.actual_instance)
121
+
122
+ def to_dict(self) -> Optional[Union[Dict[str, Any], GetCompareWorkflowResultOverviewResult, GetCompareWorkflowResultOverviewSmallResult]]:
123
+ """Returns the dict representation of the actual instance"""
124
+ if self.actual_instance is None:
125
+ return None
126
+
127
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
128
+ return self.actual_instance.to_dict()
129
+ else:
130
+ # primitive type
131
+ return self.actual_instance
132
+
133
+ def to_str(self) -> str:
134
+ """Returns the string representation of the actual instance"""
135
+ return pprint.pformat(self.model_dump())
136
+
137
+