neurograph-core 1.202509242146__py3-none-any.whl → 1.202509282026__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 (36) hide show
  1. neurograph/v1/__init__.py +72 -6
  2. neurograph/v1/api/__init__.py +4 -0
  3. neurograph/v1/api/admin_api.py +575 -0
  4. neurograph/v1/api/dagster_api.py +2 -1
  5. neurograph/v1/api/knowledge_api.py +3 -6
  6. neurograph/v1/api/lookup_api.py +277 -27
  7. neurograph/v1/api/organization_api.py +1 -537
  8. neurograph/v1/api/persona_api.py +29 -16
  9. neurograph/v1/api/user_api.py +1356 -0
  10. neurograph/v1/models/__init__.py +44 -4
  11. neurograph/v1/models/admin_permission_response.py +95 -0
  12. neurograph/v1/models/admin_set_permission_request.py +91 -0
  13. neurograph/v1/models/admin_upsert_user_request.py +91 -0
  14. neurograph/v1/models/admin_upsert_user_response.py +99 -0
  15. neurograph/v1/models/admin_user.py +97 -0
  16. neurograph/v1/models/admin_user_detail_response.py +121 -0
  17. neurograph/v1/models/admin_users_get_many_response.py +97 -0
  18. neurograph/v1/models/admin_users_org_response.py +97 -0
  19. neurograph/v1/models/db_account_organization_brand.py +109 -0
  20. neurograph/v1/models/db_lookup_environment.py +95 -0
  21. neurograph/v1/models/db_my_client.py +99 -0
  22. neurograph/v1/models/db_my_org.py +121 -0
  23. neurograph/v1/models/db_user_client_role.py +93 -0
  24. neurograph/v1/models/db_user_in_db.py +127 -0
  25. neurograph/v1/models/db_user_org_role.py +93 -0
  26. neurograph/v1/models/db_user_role.py +91 -0
  27. neurograph/v1/models/{lookup_lookup_language_response.py → lookup_language_response.py} +4 -4
  28. neurograph/v1/models/lookup_lookup_environments_response.py +97 -0
  29. neurograph/v1/models/lookup_role.py +89 -0
  30. neurograph/v1/models/lookup_roles_response.py +97 -0
  31. neurograph/v1/models/{lookup_lookup_state_response.py → lookup_states_response.py} +4 -4
  32. neurograph/v1/models/me_my_profile_response.py +115 -0
  33. {neurograph_core-1.202509242146.dist-info → neurograph_core-1.202509282026.dist-info}/METADATA +1 -1
  34. {neurograph_core-1.202509242146.dist-info → neurograph_core-1.202509282026.dist-info}/RECORD +36 -14
  35. {neurograph_core-1.202509242146.dist-info → neurograph_core-1.202509282026.dist-info}/WHEEL +0 -0
  36. {neurograph_core-1.202509242146.dist-info → neurograph_core-1.202509282026.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,121 @@
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.db_my_client import DbMyClient
23
+ from neurograph.v1.models.db_my_org import DbMyOrg
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class AdminUserDetailResponse(BaseModel):
28
+ """
29
+ AdminUserDetailResponse
30
+ """ # noqa: E501
31
+ clients: Optional[List[DbMyClient]] = None
32
+ display_name: Optional[StrictStr] = None
33
+ email: Optional[StrictStr] = None
34
+ error: Optional[StrictStr] = None
35
+ firebase_uid: Optional[StrictStr] = None
36
+ id: Optional[StrictInt] = None
37
+ ng_roles: Optional[List[StrictStr]] = None
38
+ orgs: Optional[List[DbMyOrg]] = None
39
+ ts_created: Optional[StrictInt] = None
40
+ ts_updated: Optional[StrictInt] = None
41
+ __properties: ClassVar[List[str]] = ["clients", "display_name", "email", "error", "firebase_uid", "id", "ng_roles", "orgs", "ts_created", "ts_updated"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of AdminUserDetailResponse from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of each item in clients (list)
83
+ _items = []
84
+ if self.clients:
85
+ for _item_clients in self.clients:
86
+ if _item_clients:
87
+ _items.append(_item_clients.to_dict())
88
+ _dict['clients'] = _items
89
+ # override the default output from pydantic by calling `to_dict()` of each item in orgs (list)
90
+ _items = []
91
+ if self.orgs:
92
+ for _item_orgs in self.orgs:
93
+ if _item_orgs:
94
+ _items.append(_item_orgs.to_dict())
95
+ _dict['orgs'] = _items
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of AdminUserDetailResponse from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "clients": [DbMyClient.from_dict(_item) for _item in obj["clients"]] if obj.get("clients") is not None else None,
109
+ "display_name": obj.get("display_name"),
110
+ "email": obj.get("email"),
111
+ "error": obj.get("error"),
112
+ "firebase_uid": obj.get("firebase_uid"),
113
+ "id": obj.get("id"),
114
+ "ng_roles": obj.get("ng_roles"),
115
+ "orgs": [DbMyOrg.from_dict(_item) for _item in obj["orgs"]] if obj.get("orgs") is not None else None,
116
+ "ts_created": obj.get("ts_created"),
117
+ "ts_updated": obj.get("ts_updated")
118
+ })
119
+ return _obj
120
+
121
+
@@ -0,0 +1,97 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from neurograph.v1.models.db_user_in_db import DbUserInDb
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class AdminUsersGetManyResponse(BaseModel):
27
+ """
28
+ AdminUsersGetManyResponse
29
+ """ # noqa: E501
30
+ data: Optional[List[DbUserInDb]] = None
31
+ error: Optional[StrictStr] = None
32
+ __properties: ClassVar[List[str]] = ["data", "error"]
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 AdminUsersGetManyResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in data (list)
74
+ _items = []
75
+ if self.data:
76
+ for _item_data in self.data:
77
+ if _item_data:
78
+ _items.append(_item_data.to_dict())
79
+ _dict['data'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of AdminUsersGetManyResponse 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
+ "data": [DbUserInDb.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
93
+ "error": obj.get("error")
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,97 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from neurograph.v1.models.admin_user import AdminUser
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class AdminUsersOrgResponse(BaseModel):
27
+ """
28
+ AdminUsersOrgResponse
29
+ """ # noqa: E501
30
+ data: Optional[List[AdminUser]] = None
31
+ error: Optional[StrictStr] = None
32
+ __properties: ClassVar[List[str]] = ["data", "error"]
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 AdminUsersOrgResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in data (list)
74
+ _items = []
75
+ if self.data:
76
+ for _item_data in self.data:
77
+ if _item_data:
78
+ _items.append(_item_data.to_dict())
79
+ _dict['data'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of AdminUsersOrgResponse 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
+ "data": [AdminUser.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
93
+ "error": obj.get("error")
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,109 @@
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 DbAccountOrganizationBrand(BaseModel):
26
+ """
27
+ DbAccountOrganizationBrand
28
+ """ # noqa: E501
29
+ background_img_url: Optional[StrictStr] = None
30
+ color1: Optional[StrictStr] = None
31
+ color2: Optional[StrictStr] = None
32
+ color3: Optional[StrictStr] = None
33
+ color4: Optional[StrictStr] = None
34
+ color5: Optional[StrictStr] = None
35
+ id: Optional[StrictInt] = None
36
+ logo_img_url: Optional[StrictStr] = None
37
+ org_id: Optional[StrictStr] = None
38
+ primary_color: Optional[StrictStr] = None
39
+ secondary_color: Optional[StrictStr] = None
40
+ tertiary_color: Optional[StrictStr] = None
41
+ __properties: ClassVar[List[str]] = ["background_img_url", "color1", "color2", "color3", "color4", "color5", "id", "logo_img_url", "org_id", "primary_color", "secondary_color", "tertiary_color"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of DbAccountOrganizationBrand from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of DbAccountOrganizationBrand from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "background_img_url": obj.get("background_img_url"),
95
+ "color1": obj.get("color1"),
96
+ "color2": obj.get("color2"),
97
+ "color3": obj.get("color3"),
98
+ "color4": obj.get("color4"),
99
+ "color5": obj.get("color5"),
100
+ "id": obj.get("id"),
101
+ "logo_img_url": obj.get("logo_img_url"),
102
+ "org_id": obj.get("org_id"),
103
+ "primary_color": obj.get("primary_color"),
104
+ "secondary_color": obj.get("secondary_color"),
105
+ "tertiary_color": obj.get("tertiary_color")
106
+ })
107
+ return _obj
108
+
109
+
@@ -0,0 +1,95 @@
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.pgtype_timestamp import PgtypeTimestamp
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class DbLookupEnvironment(BaseModel):
27
+ """
28
+ DbLookupEnvironment
29
+ """ # noqa: E501
30
+ id: Optional[StrictInt] = None
31
+ name: Optional[StrictStr] = None
32
+ ts_created: Optional[PgtypeTimestamp] = None
33
+ __properties: ClassVar[List[str]] = ["id", "name", "ts_created"]
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 DbLookupEnvironment 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
+ # override the default output from pydantic by calling `to_dict()` of ts_created
75
+ if self.ts_created:
76
+ _dict['ts_created'] = self.ts_created.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of DbLookupEnvironment from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "id": obj.get("id"),
90
+ "name": obj.get("name"),
91
+ "ts_created": PgtypeTimestamp.from_dict(obj["ts_created"]) if obj.get("ts_created") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,99 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from neurograph.v1.models.db_user_client_role import DbUserClientRole
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class DbMyClient(BaseModel):
27
+ """
28
+ DbMyClient
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr] = None
31
+ name: Optional[StrictStr] = None
32
+ roles: Optional[List[DbUserClientRole]] = None
33
+ __properties: ClassVar[List[str]] = ["id", "name", "roles"]
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 DbMyClient 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
+ # override the default output from pydantic by calling `to_dict()` of each item in roles (list)
75
+ _items = []
76
+ if self.roles:
77
+ for _item_roles in self.roles:
78
+ if _item_roles:
79
+ _items.append(_item_roles.to_dict())
80
+ _dict['roles'] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of DbMyClient from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "id": obj.get("id"),
94
+ "name": obj.get("name"),
95
+ "roles": [DbUserClientRole.from_dict(_item) for _item in obj["roles"]] if obj.get("roles") is not None else None
96
+ })
97
+ return _obj
98
+
99
+