neurograph-core 1.202508112256__py3-none-any.whl → 1.202508152055__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 (34) hide show
  1. neurograph/v1/__init__.py +24 -16
  2. neurograph/v1/api/__init__.py +0 -1
  3. neurograph/v1/api/authentication_api.py +36 -8
  4. neurograph/v1/api/client_api.py +9 -3
  5. neurograph/v1/api/client_metadata_api.py +287 -1
  6. neurograph/v1/api/lookup_api.py +2 -0
  7. neurograph/v1/api/organization_api.py +9 -272
  8. neurograph/v1/api/organization_metadata_api.py +3 -0
  9. neurograph/v1/api/persona_api.py +1249 -135
  10. neurograph/v1/api/tasks_api.py +1 -0
  11. neurograph/v1/api/workbench_api.py +3 -0
  12. neurograph/v1/models/__init__.py +12 -7
  13. neurograph/v1/models/auth_test_service_token_request.py +87 -0
  14. neurograph/v1/models/organizations_organization_detail_response.py +1 -7
  15. neurograph/v1/models/organizations_organization_set_workbench_request.py +10 -10
  16. neurograph/v1/models/organizations_organization_set_workbench_response.py +12 -10
  17. neurograph/v1/models/organizations_workbench_config.py +12 -10
  18. neurograph/v1/models/personas_delete_many_persona_instances_request.py +87 -0
  19. neurograph/v1/models/personas_kpi.py +93 -0
  20. neurograph/v1/models/personas_persona.py +171 -0
  21. neurograph/v1/models/personas_persona_factor.py +1 -3
  22. neurograph/v1/models/personas_persona_factor_create_response.py +3 -3
  23. neurograph/v1/models/personas_persona_factor_resp.py +101 -0
  24. neurograph/v1/models/personas_persona_insight.py +93 -0
  25. neurograph/v1/models/personas_persona_instances_delete_response.py +89 -0
  26. neurograph/v1/models/personas_persona_instances_response.py +103 -0
  27. neurograph/v1/models/personas_persona_personality_trait.py +93 -0
  28. neurograph/v1/models/personas_persona_seed_get_many_response.py +105 -0
  29. neurograph/v1/models/personas_persona_seeds_delete_request.py +87 -0
  30. neurograph/v1/models/personas_persona_seeds_delete_response.py +89 -0
  31. {neurograph_core-1.202508112256.dist-info → neurograph_core-1.202508152055.dist-info}/METADATA +2 -2
  32. {neurograph_core-1.202508112256.dist-info → neurograph_core-1.202508152055.dist-info}/RECORD +34 -22
  33. {neurograph_core-1.202508112256.dist-info → neurograph_core-1.202508152055.dist-info}/WHEEL +0 -0
  34. {neurograph_core-1.202508112256.dist-info → neurograph_core-1.202508152055.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,171 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Neurograph Core
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 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, StrictFloat, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from neurograph.v1.models.personas_kpi import PersonasKpi
23
+ from neurograph.v1.models.personas_persona_factor import PersonasPersonaFactor
24
+ from neurograph.v1.models.personas_persona_insight import PersonasPersonaInsight
25
+ from neurograph.v1.models.personas_persona_personality_trait import PersonasPersonaPersonalityTrait
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class PersonasPersona(BaseModel):
30
+ """
31
+ PersonasPersona
32
+ """ # noqa: E501
33
+ age: Optional[Union[StrictFloat, StrictInt]] = None
34
+ description: Optional[StrictStr] = None
35
+ factors: Optional[List[PersonasPersonaFactor]] = None
36
+ female: Optional[Union[StrictFloat, StrictInt]] = None
37
+ id: Optional[StrictInt] = None
38
+ income: Optional[StrictStr] = None
39
+ insights: Optional[List[PersonasPersonaInsight]] = None
40
+ kpis: Optional[List[PersonasKpi]] = None
41
+ male: Optional[Union[StrictFloat, StrictInt]] = None
42
+ metadata: Optional[StrictStr] = None
43
+ name: Optional[StrictStr] = None
44
+ persona_seed_id: Optional[StrictInt] = None
45
+ personality_background: Optional[StrictStr] = None
46
+ personality_first_name: Optional[StrictStr] = None
47
+ personality_img_url: Optional[StrictStr] = None
48
+ personality_last_name: Optional[StrictStr] = None
49
+ personality_quote: Optional[StrictStr] = None
50
+ personality_traits: Optional[List[PersonasPersonaPersonalityTrait]] = None
51
+ personality_video_url: Optional[StrictStr] = None
52
+ positioning_statement: Optional[StrictStr] = None
53
+ seed_uid: Optional[StrictStr] = None
54
+ summary_detail: Optional[StrictStr] = None
55
+ summary_headline: Optional[StrictStr] = None
56
+ tag: Optional[StrictStr] = None
57
+ ts_created: Optional[StrictStr] = None
58
+ ts_updated: Optional[StrictStr] = None
59
+ value: Optional[StrictStr] = None
60
+ __properties: ClassVar[List[str]] = ["age", "description", "factors", "female", "id", "income", "insights", "kpis", "male", "metadata", "name", "persona_seed_id", "personality_background", "personality_first_name", "personality_img_url", "personality_last_name", "personality_quote", "personality_traits", "personality_video_url", "positioning_statement", "seed_uid", "summary_detail", "summary_headline", "tag", "ts_created", "ts_updated", "value"]
61
+
62
+ model_config = ConfigDict(
63
+ populate_by_name=True,
64
+ validate_assignment=True,
65
+ protected_namespaces=(),
66
+ )
67
+
68
+
69
+ def to_str(self) -> str:
70
+ """Returns the string representation of the model using alias"""
71
+ return pprint.pformat(self.model_dump(by_alias=True))
72
+
73
+ def to_json(self) -> str:
74
+ """Returns the JSON representation of the model using alias"""
75
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> Optional[Self]:
80
+ """Create an instance of PersonasPersona from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self) -> Dict[str, Any]:
84
+ """Return the dictionary representation of the model using alias.
85
+
86
+ This has the following differences from calling pydantic's
87
+ `self.model_dump(by_alias=True)`:
88
+
89
+ * `None` is only added to the output dict for nullable fields that
90
+ were set at model initialization. Other fields with value `None`
91
+ are ignored.
92
+ """
93
+ excluded_fields: Set[str] = set([
94
+ ])
95
+
96
+ _dict = self.model_dump(
97
+ by_alias=True,
98
+ exclude=excluded_fields,
99
+ exclude_none=True,
100
+ )
101
+ # override the default output from pydantic by calling `to_dict()` of each item in factors (list)
102
+ _items = []
103
+ if self.factors:
104
+ for _item_factors in self.factors:
105
+ if _item_factors:
106
+ _items.append(_item_factors.to_dict())
107
+ _dict['factors'] = _items
108
+ # override the default output from pydantic by calling `to_dict()` of each item in insights (list)
109
+ _items = []
110
+ if self.insights:
111
+ for _item_insights in self.insights:
112
+ if _item_insights:
113
+ _items.append(_item_insights.to_dict())
114
+ _dict['insights'] = _items
115
+ # override the default output from pydantic by calling `to_dict()` of each item in kpis (list)
116
+ _items = []
117
+ if self.kpis:
118
+ for _item_kpis in self.kpis:
119
+ if _item_kpis:
120
+ _items.append(_item_kpis.to_dict())
121
+ _dict['kpis'] = _items
122
+ # override the default output from pydantic by calling `to_dict()` of each item in personality_traits (list)
123
+ _items = []
124
+ if self.personality_traits:
125
+ for _item_personality_traits in self.personality_traits:
126
+ if _item_personality_traits:
127
+ _items.append(_item_personality_traits.to_dict())
128
+ _dict['personality_traits'] = _items
129
+ return _dict
130
+
131
+ @classmethod
132
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
133
+ """Create an instance of PersonasPersona from a dict"""
134
+ if obj is None:
135
+ return None
136
+
137
+ if not isinstance(obj, dict):
138
+ return cls.model_validate(obj)
139
+
140
+ _obj = cls.model_validate({
141
+ "age": obj.get("age"),
142
+ "description": obj.get("description"),
143
+ "factors": [PersonasPersonaFactor.from_dict(_item) for _item in obj["factors"]] if obj.get("factors") is not None else None,
144
+ "female": obj.get("female"),
145
+ "id": obj.get("id"),
146
+ "income": obj.get("income"),
147
+ "insights": [PersonasPersonaInsight.from_dict(_item) for _item in obj["insights"]] if obj.get("insights") is not None else None,
148
+ "kpis": [PersonasKpi.from_dict(_item) for _item in obj["kpis"]] if obj.get("kpis") is not None else None,
149
+ "male": obj.get("male"),
150
+ "metadata": obj.get("metadata"),
151
+ "name": obj.get("name"),
152
+ "persona_seed_id": obj.get("persona_seed_id"),
153
+ "personality_background": obj.get("personality_background"),
154
+ "personality_first_name": obj.get("personality_first_name"),
155
+ "personality_img_url": obj.get("personality_img_url"),
156
+ "personality_last_name": obj.get("personality_last_name"),
157
+ "personality_quote": obj.get("personality_quote"),
158
+ "personality_traits": [PersonasPersonaPersonalityTrait.from_dict(_item) for _item in obj["personality_traits"]] if obj.get("personality_traits") is not None else None,
159
+ "personality_video_url": obj.get("personality_video_url"),
160
+ "positioning_statement": obj.get("positioning_statement"),
161
+ "seed_uid": obj.get("seed_uid"),
162
+ "summary_detail": obj.get("summary_detail"),
163
+ "summary_headline": obj.get("summary_headline"),
164
+ "tag": obj.get("tag"),
165
+ "ts_created": obj.get("ts_created"),
166
+ "ts_updated": obj.get("ts_updated"),
167
+ "value": obj.get("value")
168
+ })
169
+ return _obj
170
+
171
+
@@ -28,13 +28,12 @@ class PersonasPersonaFactor(BaseModel):
28
28
  """ # noqa: E501
29
29
  detail: Optional[StrictStr] = None
30
30
  display: Optional[StrictStr] = None
31
- error: Optional[StrictStr] = None
32
31
  id: Optional[StrictInt] = None
33
32
  name: Optional[StrictStr] = None
34
33
  persona_instance_id: Optional[StrictInt] = None
35
34
  summary: Optional[StrictStr] = None
36
35
  value: Optional[StrictInt] = None
37
- __properties: ClassVar[List[str]] = ["detail", "display", "error", "id", "name", "persona_instance_id", "summary", "value"]
36
+ __properties: ClassVar[List[str]] = ["detail", "display", "id", "name", "persona_instance_id", "summary", "value"]
38
37
 
39
38
  model_config = ConfigDict(
40
39
  populate_by_name=True,
@@ -89,7 +88,6 @@ class PersonasPersonaFactor(BaseModel):
89
88
  _obj = cls.model_validate({
90
89
  "detail": obj.get("detail"),
91
90
  "display": obj.get("display"),
92
- "error": obj.get("error"),
93
91
  "id": obj.get("id"),
94
92
  "name": obj.get("name"),
95
93
  "persona_instance_id": obj.get("persona_instance_id"),
@@ -19,7 +19,7 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from neurograph.v1.models.personas_persona_factor import PersonasPersonaFactor
22
+ from neurograph.v1.models.personas_persona_factor_resp import PersonasPersonaFactorResp
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
@@ -27,7 +27,7 @@ class PersonasPersonaFactorCreateResponse(BaseModel):
27
27
  """
28
28
  PersonasPersonaFactorCreateResponse
29
29
  """ # noqa: E501
30
- data: Optional[List[PersonasPersonaFactor]] = None
30
+ data: Optional[List[PersonasPersonaFactorResp]] = None
31
31
  error: Optional[StrictStr] = None
32
32
  __properties: ClassVar[List[str]] = ["data", "error"]
33
33
 
@@ -89,7 +89,7 @@ class PersonasPersonaFactorCreateResponse(BaseModel):
89
89
  return cls.model_validate(obj)
90
90
 
91
91
  _obj = cls.model_validate({
92
- "data": [PersonasPersonaFactor.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
92
+ "data": [PersonasPersonaFactorResp.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
93
93
  "error": obj.get("error")
94
94
  })
95
95
  return _obj
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Neurograph Core
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 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, 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 PersonasPersonaFactorResp(BaseModel):
26
+ """
27
+ PersonasPersonaFactorResp
28
+ """ # noqa: E501
29
+ detail: Optional[StrictStr] = None
30
+ display: Optional[StrictStr] = None
31
+ error: Optional[StrictStr] = None
32
+ id: Optional[StrictInt] = None
33
+ name: Optional[StrictStr] = None
34
+ persona_instance_id: Optional[StrictInt] = None
35
+ summary: Optional[StrictStr] = None
36
+ value: Optional[StrictInt] = None
37
+ __properties: ClassVar[List[str]] = ["detail", "display", "error", "id", "name", "persona_instance_id", "summary", "value"]
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 PersonasPersonaFactorResp 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
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of PersonasPersonaFactorResp 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
+ "detail": obj.get("detail"),
91
+ "display": obj.get("display"),
92
+ "error": obj.get("error"),
93
+ "id": obj.get("id"),
94
+ "name": obj.get("name"),
95
+ "persona_instance_id": obj.get("persona_instance_id"),
96
+ "summary": obj.get("summary"),
97
+ "value": obj.get("value")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Neurograph Core
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 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, 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 PersonasPersonaInsight(BaseModel):
26
+ """
27
+ PersonasPersonaInsight
28
+ """ # noqa: E501
29
+ data: Optional[Dict[str, Any]] = None
30
+ id: Optional[StrictInt] = None
31
+ key: Optional[StrictStr] = None
32
+ persona_instance_id: Optional[StrictInt] = None
33
+ __properties: ClassVar[List[str]] = ["data", "id", "key", "persona_instance_id"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of PersonasPersonaInsight from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of PersonasPersonaInsight from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "data": obj.get("data"),
87
+ "id": obj.get("id"),
88
+ "key": obj.get("key"),
89
+ "persona_instance_id": obj.get("persona_instance_id")
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,89 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Neurograph Core
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 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, 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 PersonasPersonaInstancesDeleteResponse(BaseModel):
26
+ """
27
+ PersonasPersonaInstancesDeleteResponse
28
+ """ # noqa: E501
29
+ deleted_seed_ids: Optional[List[StrictInt]] = None
30
+ error: Optional[StrictStr] = None
31
+ __properties: ClassVar[List[str]] = ["deleted_seed_ids", "error"]
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 PersonasPersonaInstancesDeleteResponse 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 PersonasPersonaInstancesDeleteResponse 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
+ "deleted_seed_ids": obj.get("deleted_seed_ids"),
85
+ "error": obj.get("error")
86
+ })
87
+ return _obj
88
+
89
+
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Neurograph Core
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from neurograph.v1.models.personas_persona import PersonasPersona
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PersonasPersonaInstancesResponse(BaseModel):
27
+ """
28
+ PersonasPersonaInstancesResponse
29
+ """ # noqa: E501
30
+ data: Optional[List[PersonasPersona]] = None
31
+ error: Optional[StrictStr] = None
32
+ query_limit: Optional[StrictInt] = None
33
+ query_offset: Optional[StrictInt] = None
34
+ total_rows: Optional[StrictInt] = None
35
+ __properties: ClassVar[List[str]] = ["data", "error", "query_limit", "query_offset", "total_rows"]
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 PersonasPersonaInstancesResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in data (list)
77
+ _items = []
78
+ if self.data:
79
+ for _item_data in self.data:
80
+ if _item_data:
81
+ _items.append(_item_data.to_dict())
82
+ _dict['data'] = _items
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of PersonasPersonaInstancesResponse 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
+ "data": [PersonasPersona.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
96
+ "error": obj.get("error"),
97
+ "query_limit": obj.get("query_limit"),
98
+ "query_offset": obj.get("query_offset"),
99
+ "total_rows": obj.get("total_rows")
100
+ })
101
+ return _obj
102
+
103
+