camb-sdk 1.0.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 camb-sdk might be problematic. Click here for more details.

Files changed (64) hide show
  1. camb_sdk-1.0.0.dist-info/METADATA +266 -0
  2. camb_sdk-1.0.0.dist-info/RECORD +64 -0
  3. camb_sdk-1.0.0.dist-info/WHEEL +5 -0
  4. camb_sdk-1.0.0.dist-info/licenses/LICENSE +21 -0
  5. camb_sdk-1.0.0.dist-info/top_level.txt +1 -0
  6. cambai/__init__.py +145 -0
  7. cambai/api/__init__.py +12 -0
  8. cambai/api/apis_api.py +10291 -0
  9. cambai/api/audio_separation_api.py +837 -0
  10. cambai/api/dictionaries_api.py +286 -0
  11. cambai/api/dub_api.py +906 -0
  12. cambai/api/stories_api.py +1511 -0
  13. cambai/api/text_to_audio_api.py +835 -0
  14. cambai/api/text_to_speech_api.py +574 -0
  15. cambai/api/text_to_voice_api.py +840 -0
  16. cambai/api_client.py +801 -0
  17. cambai/api_response.py +21 -0
  18. cambai/configuration.py +603 -0
  19. cambai/exceptions.py +216 -0
  20. cambai/models/__init__.py +58 -0
  21. cambai/models/audio_output_file_url_response.py +87 -0
  22. cambai/models/audio_output_type.py +39 -0
  23. cambai/models/audio_separation_run_info_response.py +89 -0
  24. cambai/models/body_translate_translate_post.py +103 -0
  25. cambai/models/create_api_key_request_payload.py +89 -0
  26. cambai/models/create_custom_voice_out.py +87 -0
  27. cambai/models/create_text_to_audio_request_payload.py +89 -0
  28. cambai/models/create_text_to_voice_request_payload.py +89 -0
  29. cambai/models/create_translated_story_request_payload.py +88 -0
  30. cambai/models/create_translated_tts_request_payload.py +120 -0
  31. cambai/models/create_translation_stream_request_payload.py +108 -0
  32. cambai/models/create_tts_request_payload.py +102 -0
  33. cambai/models/create_tts_stream_request_payload.py +100 -0
  34. cambai/models/dialogue_item.py +93 -0
  35. cambai/models/dictionary.py +96 -0
  36. cambai/models/dub_alt_format_response_body.py +92 -0
  37. cambai/models/dubbed_output_in_alt_format_request_payload.py +91 -0
  38. cambai/models/end_to_end_dubbing_request_payload.py +99 -0
  39. cambai/models/expire_api_key_request_payload.py +87 -0
  40. cambai/models/formalities.py +37 -0
  41. cambai/models/gender.py +39 -0
  42. cambai/models/http_validation_error.py +95 -0
  43. cambai/models/language_item.py +91 -0
  44. cambai/models/languages.py +183 -0
  45. cambai/models/orchestrator_pipeline_result.py +95 -0
  46. cambai/models/output_api_key.py +105 -0
  47. cambai/models/output_format.py +134 -0
  48. cambai/models/output_type.py +37 -0
  49. cambai/models/request_dubbed_output_in_alt_format200_response.py +137 -0
  50. cambai/models/run_info_response.py +101 -0
  51. cambai/models/story_run_info_response.py +99 -0
  52. cambai/models/task_id.py +87 -0
  53. cambai/models/task_status.py +40 -0
  54. cambai/models/text_to_voice_run_info_response.py +87 -0
  55. cambai/models/transcript_data_type.py +37 -0
  56. cambai/models/transcript_file_format.py +38 -0
  57. cambai/models/translation_result.py +87 -0
  58. cambai/models/tts_stream_output_format.py +40 -0
  59. cambai/models/validation_error.py +99 -0
  60. cambai/models/validation_error_loc_inner.py +138 -0
  61. cambai/models/video_output_type_without_avi.py +38 -0
  62. cambai/models/voice_item.py +102 -0
  63. cambai/py.typed +0 -0
  64. cambai/rest.py +258 -0
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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 Formalities(int, Enum):
22
+ """
23
+ Formalities
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NUMBER_1 = 1
30
+ NUMBER_2 = 2
31
+
32
+ @classmethod
33
+ def from_json(cls, json_str: str) -> Self:
34
+ """Create an instance of Formalities from a JSON string"""
35
+ return cls(json.loads(json_str))
36
+
37
+
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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 Gender(int, Enum):
22
+ """
23
+ The gender of the speaker.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NUMBER_0 = 0
30
+ NUMBER_1 = 1
31
+ NUMBER_2 = 2
32
+ NUMBER_9 = 9
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of Gender from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from cambai.models.validation_error import ValidationError
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class HTTPValidationError(BaseModel):
27
+ """
28
+ HTTPValidationError
29
+ """ # noqa: E501
30
+ detail: Optional[List[ValidationError]] = None
31
+ __properties: ClassVar[List[str]] = ["detail"]
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 HTTPValidationError 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
+ # override the default output from pydantic by calling `to_dict()` of each item in detail (list)
73
+ _items = []
74
+ if self.detail:
75
+ for _item_detail in self.detail:
76
+ if _item_detail:
77
+ _items.append(_item_detail.to_dict())
78
+ _dict['detail'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of HTTPValidationError 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
+ "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class LanguageItem(BaseModel):
26
+ """
27
+ LanguageItem
28
+ """ # noqa: E501
29
+ id: Optional[StrictInt] = Field(default=None, description="The id property represents a unique numerical identifier assigned to each language in the system.")
30
+ language: Optional[StrictStr] = Field(default=None, description="The language property represents the full, human-readable name of a language and its associated regional or country variant.")
31
+ short_name: Optional[StrictStr] = Field(default=None, description="The short name is a standardized identifier for each language and locale combination, represented in the format of <language code>-<country code>.")
32
+ __properties: ClassVar[List[str]] = ["id", "language", "short_name"]
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 LanguageItem 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
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of LanguageItem from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "id": obj.get("id"),
86
+ "language": obj.get("language"),
87
+ "short_name": obj.get("short_name")
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,183 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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 Languages(int, Enum):
22
+ """
23
+ Languages
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NUMBER_1 = 1
30
+ NUMBER_2 = 2
31
+ NUMBER_3 = 3
32
+ NUMBER_4 = 4
33
+ NUMBER_5 = 5
34
+ NUMBER_6 = 6
35
+ NUMBER_7 = 7
36
+ NUMBER_8 = 8
37
+ NUMBER_9 = 9
38
+ NUMBER_10 = 10
39
+ NUMBER_11 = 11
40
+ NUMBER_12 = 12
41
+ NUMBER_13 = 13
42
+ NUMBER_14 = 14
43
+ NUMBER_15 = 15
44
+ NUMBER_16 = 16
45
+ NUMBER_17 = 17
46
+ NUMBER_18 = 18
47
+ NUMBER_19 = 19
48
+ NUMBER_20 = 20
49
+ NUMBER_21 = 21
50
+ NUMBER_22 = 22
51
+ NUMBER_23 = 23
52
+ NUMBER_24 = 24
53
+ NUMBER_25 = 25
54
+ NUMBER_26 = 26
55
+ NUMBER_27 = 27
56
+ NUMBER_28 = 28
57
+ NUMBER_29 = 29
58
+ NUMBER_30 = 30
59
+ NUMBER_31 = 31
60
+ NUMBER_32 = 32
61
+ NUMBER_33 = 33
62
+ NUMBER_34 = 34
63
+ NUMBER_35 = 35
64
+ NUMBER_36 = 36
65
+ NUMBER_37 = 37
66
+ NUMBER_38 = 38
67
+ NUMBER_39 = 39
68
+ NUMBER_40 = 40
69
+ NUMBER_41 = 41
70
+ NUMBER_42 = 42
71
+ NUMBER_43 = 43
72
+ NUMBER_44 = 44
73
+ NUMBER_45 = 45
74
+ NUMBER_46 = 46
75
+ NUMBER_47 = 47
76
+ NUMBER_48 = 48
77
+ NUMBER_49 = 49
78
+ NUMBER_50 = 50
79
+ NUMBER_51 = 51
80
+ NUMBER_52 = 52
81
+ NUMBER_53 = 53
82
+ NUMBER_54 = 54
83
+ NUMBER_55 = 55
84
+ NUMBER_56 = 56
85
+ NUMBER_57 = 57
86
+ NUMBER_58 = 58
87
+ NUMBER_59 = 59
88
+ NUMBER_60 = 60
89
+ NUMBER_61 = 61
90
+ NUMBER_62 = 62
91
+ NUMBER_63 = 63
92
+ NUMBER_64 = 64
93
+ NUMBER_65 = 65
94
+ NUMBER_66 = 66
95
+ NUMBER_67 = 67
96
+ NUMBER_68 = 68
97
+ NUMBER_69 = 69
98
+ NUMBER_70 = 70
99
+ NUMBER_71 = 71
100
+ NUMBER_72 = 72
101
+ NUMBER_73 = 73
102
+ NUMBER_74 = 74
103
+ NUMBER_75 = 75
104
+ NUMBER_76 = 76
105
+ NUMBER_77 = 77
106
+ NUMBER_78 = 78
107
+ NUMBER_79 = 79
108
+ NUMBER_80 = 80
109
+ NUMBER_81 = 81
110
+ NUMBER_82 = 82
111
+ NUMBER_83 = 83
112
+ NUMBER_84 = 84
113
+ NUMBER_85 = 85
114
+ NUMBER_86 = 86
115
+ NUMBER_87 = 87
116
+ NUMBER_88 = 88
117
+ NUMBER_89 = 89
118
+ NUMBER_90 = 90
119
+ NUMBER_91 = 91
120
+ NUMBER_92 = 92
121
+ NUMBER_93 = 93
122
+ NUMBER_94 = 94
123
+ NUMBER_95 = 95
124
+ NUMBER_96 = 96
125
+ NUMBER_97 = 97
126
+ NUMBER_98 = 98
127
+ NUMBER_99 = 99
128
+ NUMBER_100 = 100
129
+ NUMBER_101 = 101
130
+ NUMBER_102 = 102
131
+ NUMBER_103 = 103
132
+ NUMBER_104 = 104
133
+ NUMBER_105 = 105
134
+ NUMBER_106 = 106
135
+ NUMBER_107 = 107
136
+ NUMBER_108 = 108
137
+ NUMBER_109 = 109
138
+ NUMBER_110 = 110
139
+ NUMBER_111 = 111
140
+ NUMBER_112 = 112
141
+ NUMBER_113 = 113
142
+ NUMBER_114 = 114
143
+ NUMBER_115 = 115
144
+ NUMBER_116 = 116
145
+ NUMBER_117 = 117
146
+ NUMBER_118 = 118
147
+ NUMBER_119 = 119
148
+ NUMBER_120 = 120
149
+ NUMBER_121 = 121
150
+ NUMBER_122 = 122
151
+ NUMBER_123 = 123
152
+ NUMBER_124 = 124
153
+ NUMBER_125 = 125
154
+ NUMBER_126 = 126
155
+ NUMBER_127 = 127
156
+ NUMBER_128 = 128
157
+ NUMBER_129 = 129
158
+ NUMBER_130 = 130
159
+ NUMBER_131 = 131
160
+ NUMBER_132 = 132
161
+ NUMBER_133 = 133
162
+ NUMBER_134 = 134
163
+ NUMBER_135 = 135
164
+ NUMBER_136 = 136
165
+ NUMBER_137 = 137
166
+ NUMBER_138 = 138
167
+ NUMBER_139 = 139
168
+ NUMBER_140 = 140
169
+ NUMBER_141 = 141
170
+ NUMBER_142 = 142
171
+ NUMBER_143 = 143
172
+ NUMBER_144 = 144
173
+ NUMBER_145 = 145
174
+ NUMBER_146 = 146
175
+ NUMBER_147 = 147
176
+ NUMBER_148 = 148
177
+
178
+ @classmethod
179
+ def from_json(cls, json_str: str) -> Self:
180
+ """Create an instance of Languages from a JSON string"""
181
+ return cls(json.loads(json_str))
182
+
183
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from cambai.models.task_status import TaskStatus
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OrchestratorPipelineResult(BaseModel):
27
+ """
28
+ OrchestratorPipelineResult
29
+ """ # noqa: E501
30
+ status: Optional[TaskStatus] = None
31
+ run_id: Optional[StrictInt] = None
32
+ __properties: ClassVar[List[str]] = ["status", "run_id"]
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 OrchestratorPipelineResult 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
+ # set to None if run_id (nullable) is None
74
+ # and model_fields_set contains the field
75
+ if self.run_id is None and "run_id" in self.model_fields_set:
76
+ _dict['run_id'] = None
77
+
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of OrchestratorPipelineResult from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate({
90
+ "status": obj.get("status"),
91
+ "run_id": obj.get("run_id")
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
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, StrictBool, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OutputAPIKey(BaseModel):
27
+ """
28
+ OutputAPIKey
29
+ """ # noqa: E501
30
+ id: StrictInt
31
+ api_key: StrictStr
32
+ api_key_name: Optional[StrictStr] = None
33
+ created_at: datetime
34
+ expiry_time: datetime
35
+ team_id: StrictInt
36
+ is_valid: StrictBool
37
+ __properties: ClassVar[List[str]] = ["id", "api_key", "api_key_name", "created_at", "expiry_time", "team_id", "is_valid"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of OutputAPIKey from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # set to None if api_key_name (nullable) is None
79
+ # and model_fields_set contains the field
80
+ if self.api_key_name is None and "api_key_name" in self.model_fields_set:
81
+ _dict['api_key_name'] = None
82
+
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of OutputAPIKey from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "id": obj.get("id"),
96
+ "api_key": obj.get("api_key"),
97
+ "api_key_name": obj.get("api_key_name"),
98
+ "created_at": obj.get("created_at"),
99
+ "expiry_time": obj.get("expiry_time"),
100
+ "team_id": obj.get("team_id"),
101
+ "is_valid": obj.get("is_valid")
102
+ })
103
+ return _obj
104
+
105
+