rapidata 2.35.3__py3-none-any.whl → 2.36.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 (48) hide show
  1. rapidata/__init__.py +1 -1
  2. rapidata/api_client/__init__.py +21 -3
  3. rapidata/api_client/api/__init__.py +1 -0
  4. rapidata/api_client/api/benchmark_api.py +294 -0
  5. rapidata/api_client/api/campaign_api.py +268 -0
  6. rapidata/api_client/api/customer_rapid_api.py +247 -0
  7. rapidata/api_client/api/pipeline_api.py +0 -873
  8. rapidata/api_client/api/sample_api.py +299 -0
  9. rapidata/api_client/models/__init__.py +20 -3
  10. rapidata/api_client/models/and_filter.py +121 -0
  11. rapidata/api_client/models/and_filter_filters_inner.py +268 -0
  12. rapidata/api_client/models/boost_mode.py +37 -0
  13. rapidata/api_client/models/boost_query_result.py +10 -1
  14. rapidata/api_client/models/campaign_filter.py +98 -0
  15. rapidata/api_client/models/change_boost_model.py +89 -0
  16. rapidata/api_client/models/compare_rapid_blueprint.py +5 -3
  17. rapidata/api_client/models/compare_rapid_blueprint1.py +96 -0
  18. rapidata/api_client/models/country_filter.py +98 -0
  19. rapidata/api_client/models/create_leaderboard_model.py +32 -2
  20. rapidata/api_client/models/demographic_filter.py +100 -0
  21. rapidata/api_client/models/feature_flag_model.py +4 -4
  22. rapidata/api_client/models/free_text_payload.py +10 -3
  23. rapidata/api_client/models/free_text_rapid_blueprint.py +10 -3
  24. rapidata/api_client/models/get_compare_ab_summary_result.py +4 -2
  25. rapidata/api_client/models/get_leaderboard_by_id_result.py +29 -2
  26. rapidata/api_client/models/get_public_responses_result.py +95 -0
  27. rapidata/api_client/models/get_sample_by_id_result.py +126 -0
  28. rapidata/api_client/models/language_filter.py +98 -0
  29. rapidata/api_client/models/leaderboard_query_result.py +29 -2
  30. rapidata/api_client/models/new_user_filter.py +96 -0
  31. rapidata/api_client/models/not_filter.py +117 -0
  32. rapidata/api_client/models/or_filter.py +121 -0
  33. rapidata/api_client/models/public_rapid_response.py +112 -0
  34. rapidata/api_client/models/response_count_filter.py +109 -0
  35. rapidata/api_client/models/sample_by_identifier.py +126 -0
  36. rapidata/api_client/models/sample_by_identifier_paged_result.py +105 -0
  37. rapidata/api_client/models/simple_workflow_config_blueprint.py +37 -23
  38. rapidata/api_client/models/user_score_filter.py +102 -0
  39. rapidata/api_client/models/user_state.py +38 -0
  40. rapidata/api_client/models/user_state_filter.py +101 -0
  41. rapidata/api_client_README.md +24 -6
  42. rapidata/rapidata_client/benchmark/rapidata_benchmark.py +26 -2
  43. rapidata/rapidata_client/order/rapidata_order_manager.py +298 -219
  44. rapidata/rapidata_client/workflow/_compare_workflow.py +7 -2
  45. {rapidata-2.35.3.dist-info → rapidata-2.36.0.dist-info}/METADATA +1 -1
  46. {rapidata-2.35.3.dist-info → rapidata-2.36.0.dist-info}/RECORD +48 -26
  47. {rapidata-2.35.3.dist-info → rapidata-2.36.0.dist-info}/LICENSE +0 -0
  48. {rapidata-2.35.3.dist-info → rapidata-2.36.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,98 @@
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class LanguageFilter(BaseModel):
26
+ """
27
+ LanguageFilter
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for LanguageFilter", alias="_t")
30
+ languages: List[StrictStr]
31
+ execution_order: Optional[StrictInt] = Field(default=None, alias="executionOrder")
32
+ __properties: ClassVar[List[str]] = ["_t", "languages", "executionOrder"]
33
+
34
+ @field_validator('t')
35
+ def t_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['LanguageFilter']):
38
+ raise ValueError("must be one of enum values ('LanguageFilter')")
39
+ return value
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of LanguageFilter from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of LanguageFilter from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate({
92
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'LanguageFilter',
93
+ "languages": obj.get("languages"),
94
+ "executionOrder": obj.get("executionOrder")
95
+ })
96
+ return _obj
97
+
98
+
@@ -19,6 +19,8 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.and_filter_filters_inner import AndFilterFiltersInner
23
+ from rapidata.api_client.models.feature_flag import FeatureFlag
22
24
  from typing import Optional, Set
23
25
  from typing_extensions import Self
24
26
 
@@ -35,7 +37,10 @@ class LeaderboardQueryResult(BaseModel):
35
37
  is_inversed: StrictBool = Field(alias="isInversed")
36
38
  response_budget: StrictInt = Field(alias="responseBudget")
37
39
  min_responses: StrictInt = Field(alias="minResponses")
38
- __properties: ClassVar[List[str]] = ["id", "orderId", "name", "instruction", "showPrompt", "showPromptAsset", "isInversed", "responseBudget", "minResponses"]
40
+ validation_set_id: Optional[StrictStr] = Field(default=None, alias="validationSetId")
41
+ filters: List[AndFilterFiltersInner]
42
+ feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
43
+ __properties: ClassVar[List[str]] = ["id", "orderId", "name", "instruction", "showPrompt", "showPromptAsset", "isInversed", "responseBudget", "minResponses", "validationSetId", "filters", "featureFlags"]
39
44
 
40
45
  model_config = ConfigDict(
41
46
  populate_by_name=True,
@@ -76,11 +81,30 @@ class LeaderboardQueryResult(BaseModel):
76
81
  exclude=excluded_fields,
77
82
  exclude_none=True,
78
83
  )
84
+ # override the default output from pydantic by calling `to_dict()` of each item in filters (list)
85
+ _items = []
86
+ if self.filters:
87
+ for _item_filters in self.filters:
88
+ if _item_filters:
89
+ _items.append(_item_filters.to_dict())
90
+ _dict['filters'] = _items
91
+ # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
92
+ _items = []
93
+ if self.feature_flags:
94
+ for _item_feature_flags in self.feature_flags:
95
+ if _item_feature_flags:
96
+ _items.append(_item_feature_flags.to_dict())
97
+ _dict['featureFlags'] = _items
79
98
  # set to None if order_id (nullable) is None
80
99
  # and model_fields_set contains the field
81
100
  if self.order_id is None and "order_id" in self.model_fields_set:
82
101
  _dict['orderId'] = None
83
102
 
103
+ # set to None if validation_set_id (nullable) is None
104
+ # and model_fields_set contains the field
105
+ if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
106
+ _dict['validationSetId'] = None
107
+
84
108
  return _dict
85
109
 
86
110
  @classmethod
@@ -101,7 +125,10 @@ class LeaderboardQueryResult(BaseModel):
101
125
  "showPromptAsset": obj.get("showPromptAsset"),
102
126
  "isInversed": obj.get("isInversed"),
103
127
  "responseBudget": obj.get("responseBudget"),
104
- "minResponses": obj.get("minResponses")
128
+ "minResponses": obj.get("minResponses"),
129
+ "validationSetId": obj.get("validationSetId"),
130
+ "filters": [AndFilterFiltersInner.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None,
131
+ "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
105
132
  })
106
133
  return _obj
107
134
 
@@ -0,0 +1,96 @@
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class NewUserFilter(BaseModel):
26
+ """
27
+ NewUserFilter
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for NewUserFilter", alias="_t")
30
+ execution_order: Optional[StrictInt] = Field(default=None, alias="executionOrder")
31
+ __properties: ClassVar[List[str]] = ["_t", "executionOrder"]
32
+
33
+ @field_validator('t')
34
+ def t_validate_enum(cls, value):
35
+ """Validates the enum"""
36
+ if value not in set(['NewUserFilter']):
37
+ raise ValueError("must be one of enum values ('NewUserFilter')")
38
+ return value
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of NewUserFilter from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of NewUserFilter from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'NewUserFilter',
92
+ "executionOrder": obj.get("executionOrder")
93
+ })
94
+ return _obj
95
+
96
+
@@ -0,0 +1,117 @@
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class NotFilter(BaseModel):
26
+ """
27
+ NotFilter
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for NotFilter", alias="_t")
30
+ filter: AndFilterFiltersInner
31
+ execution_order: Optional[StrictInt] = Field(default=None, alias="executionOrder")
32
+ inner_filters: Optional[List[AndFilterFiltersInner]] = Field(default=None, alias="innerFilters")
33
+ __properties: ClassVar[List[str]] = ["_t", "filter", "executionOrder", "innerFilters"]
34
+
35
+ @field_validator('t')
36
+ def t_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['NotFilter']):
39
+ raise ValueError("must be one of enum values ('NotFilter')")
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 NotFilter 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
+ * OpenAPI `readOnly` fields are excluded.
73
+ * OpenAPI `readOnly` fields are excluded.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ "execution_order",
77
+ "inner_filters",
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ # override the default output from pydantic by calling `to_dict()` of filter
86
+ if self.filter:
87
+ _dict['filter'] = self.filter.to_dict()
88
+ # override the default output from pydantic by calling `to_dict()` of each item in inner_filters (list)
89
+ _items = []
90
+ if self.inner_filters:
91
+ for _item_inner_filters in self.inner_filters:
92
+ if _item_inner_filters:
93
+ _items.append(_item_inner_filters.to_dict())
94
+ _dict['innerFilters'] = _items
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of NotFilter from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'NotFilter',
108
+ "filter": AndFilterFiltersInner.from_dict(obj["filter"]) if obj.get("filter") is not None else None,
109
+ "executionOrder": obj.get("executionOrder"),
110
+ "innerFilters": [AndFilterFiltersInner.from_dict(_item) for _item in obj["innerFilters"]] if obj.get("innerFilters") is not None else None
111
+ })
112
+ return _obj
113
+
114
+ from rapidata.api_client.models.and_filter_filters_inner import AndFilterFiltersInner
115
+ # TODO: Rewrite to not use raise_errors
116
+ NotFilter.model_rebuild(raise_errors=False)
117
+
@@ -0,0 +1,121 @@
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class OrFilter(BaseModel):
26
+ """
27
+ OrFilter
28
+ """ # noqa: E501
29
+ t: StrictStr = Field(description="Discriminator value for OrFilter", alias="_t")
30
+ filters: List[AndFilterFiltersInner]
31
+ execution_order: Optional[StrictInt] = Field(default=None, alias="executionOrder")
32
+ inner_filters: Optional[List[AndFilterFiltersInner]] = Field(default=None, alias="innerFilters")
33
+ __properties: ClassVar[List[str]] = ["_t", "filters", "executionOrder", "innerFilters"]
34
+
35
+ @field_validator('t')
36
+ def t_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['OrFilter']):
39
+ raise ValueError("must be one of enum values ('OrFilter')")
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 OrFilter 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
+ * OpenAPI `readOnly` fields are excluded.
73
+ * OpenAPI `readOnly` fields are excluded.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ "execution_order",
77
+ "inner_filters",
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ # override the default output from pydantic by calling `to_dict()` of each item in filters (list)
86
+ _items = []
87
+ if self.filters:
88
+ for _item_filters in self.filters:
89
+ if _item_filters:
90
+ _items.append(_item_filters.to_dict())
91
+ _dict['filters'] = _items
92
+ # override the default output from pydantic by calling `to_dict()` of each item in inner_filters (list)
93
+ _items = []
94
+ if self.inner_filters:
95
+ for _item_inner_filters in self.inner_filters:
96
+ if _item_inner_filters:
97
+ _items.append(_item_inner_filters.to_dict())
98
+ _dict['innerFilters'] = _items
99
+ return _dict
100
+
101
+ @classmethod
102
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
103
+ """Create an instance of OrFilter from a dict"""
104
+ if obj is None:
105
+ return None
106
+
107
+ if not isinstance(obj, dict):
108
+ return cls.model_validate(obj)
109
+
110
+ _obj = cls.model_validate({
111
+ "_t": obj.get("_t") if obj.get("_t") is not None else 'OrFilter',
112
+ "filters": [AndFilterFiltersInner.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None,
113
+ "executionOrder": obj.get("executionOrder"),
114
+ "innerFilters": [AndFilterFiltersInner.from_dict(_item) for _item in obj["innerFilters"]] if obj.get("innerFilters") is not None else None
115
+ })
116
+ return _obj
117
+
118
+ from rapidata.api_client.models.and_filter_filters_inner import AndFilterFiltersInner
119
+ # TODO: Rewrite to not use raise_errors
120
+ OrFilter.model_rebuild(raise_errors=False)
121
+
@@ -0,0 +1,112 @@
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, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class PublicRapidResponse(BaseModel):
26
+ """
27
+ PublicRapidResponse
28
+ """ # noqa: E501
29
+ id: StrictStr
30
+ user_id: StrictStr = Field(alias="userId")
31
+ country: StrictStr
32
+ age: Optional[StrictStr] = None
33
+ occupation: Optional[StrictStr] = None
34
+ gender: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["id", "userId", "country", "age", "occupation", "gender"]
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 PublicRapidResponse 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
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # set to None if age (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.age is None and "age" in self.model_fields_set:
79
+ _dict['age'] = None
80
+
81
+ # set to None if occupation (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.occupation is None and "occupation" in self.model_fields_set:
84
+ _dict['occupation'] = None
85
+
86
+ # set to None if gender (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.gender is None and "gender" in self.model_fields_set:
89
+ _dict['gender'] = None
90
+
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of PublicRapidResponse from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate({
103
+ "id": obj.get("id"),
104
+ "userId": obj.get("userId"),
105
+ "country": obj.get("country"),
106
+ "age": obj.get("age"),
107
+ "occupation": obj.get("occupation"),
108
+ "gender": obj.get("gender")
109
+ })
110
+ return _obj
111
+
112
+