wordlift-client 1.134.0__py3-none-any.whl → 1.136.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. wordlift_client/__init__.py +25 -3
  2. wordlift_client/api/__init__.py +1 -0
  3. wordlift_client/api/audit_api.py +18 -6
  4. wordlift_client/api/default_api.py +1767 -39
  5. wordlift_client/api_client.py +1 -1
  6. wordlift_client/configuration.py +1 -1
  7. wordlift_client/models/__init__.py +23 -2
  8. wordlift_client/models/audit_data.py +27 -11
  9. wordlift_client/models/automation_issue.py +110 -0
  10. wordlift_client/models/automation_readiness.py +16 -5
  11. wordlift_client/models/bot_status.py +102 -0
  12. wordlift_client/models/content_freshness.py +106 -0
  13. wordlift_client/models/content_structure.py +10 -6
  14. wordlift_client/models/detected_schema.py +100 -0
  15. wordlift_client/models/error_response.py +5 -3
  16. wordlift_client/models/html_semantics.py +100 -0
  17. wordlift_client/models/http_validation_error1.py +96 -0
  18. wordlift_client/models/image_accessibility.py +9 -7
  19. wordlift_client/models/internal_linking.py +100 -0
  20. wordlift_client/models/js_rendering.py +8 -17
  21. wordlift_client/models/monitor_result_item.py +117 -0
  22. wordlift_client/models/monitor_state.py +39 -0
  23. wordlift_client/models/monitor_summary_item.py +105 -0
  24. wordlift_client/models/neighbors.py +101 -0
  25. wordlift_client/models/page_info.py +95 -0
  26. wordlift_client/models/quick_wins_result.py +110 -0
  27. wordlift_client/models/resource_request.py +92 -0
  28. wordlift_client/models/resource_type.py +40 -0
  29. wordlift_client/models/schema_recommendation.py +90 -0
  30. wordlift_client/models/seo_fundamentals.py +6 -3
  31. wordlift_client/models/site_files.py +25 -10
  32. wordlift_client/models/structured_data.py +28 -5
  33. wordlift_client/models/url_list_item.py +132 -0
  34. wordlift_client/models/url_list_response.py +104 -0
  35. wordlift_client/models/url_results_response.py +121 -0
  36. wordlift_client/models/url_summary_response.py +136 -0
  37. wordlift_client/models/validation_error1.py +22 -9
  38. wordlift_client/models/validation_error2.py +96 -0
  39. wordlift_client/models/validation_error2_detail_inner.py +92 -0
  40. wordlift_client/models/well_known_files.py +98 -0
  41. {wordlift_client-1.134.0.dist-info → wordlift_client-1.136.0.dist-info}/METADATA +1 -1
  42. {wordlift_client-1.134.0.dist-info → wordlift_client-1.136.0.dist-info}/RECORD +45 -22
  43. {wordlift_client-1.134.0.dist-info → wordlift_client-1.136.0.dist-info}/LICENSE +0 -0
  44. {wordlift_client-1.134.0.dist-info → wordlift_client-1.136.0.dist-info}/WHEEL +0 -0
  45. {wordlift_client-1.134.0.dist-info → wordlift_client-1.136.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import json
18
+ from enum import Enum
19
+ from typing_extensions import Self
20
+
21
+
22
+ class MonitorState(str, Enum):
23
+ """
24
+ MonitorState
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ OK = 'OK'
31
+ WARN = 'WARN'
32
+ FAIL = 'FAIL'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of MonitorState from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from wordlift_client.models.monitor_state import MonitorState
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class MonitorSummaryItem(BaseModel):
28
+ """
29
+ MonitorSummaryItem
30
+ """ # noqa: E501
31
+ name: StrictStr
32
+ state: MonitorState
33
+ details: Optional[StrictStr] = None
34
+ score: Optional[Union[StrictFloat, StrictInt]] = None
35
+ __properties: ClassVar[List[str]] = ["name", "state", "details", "score"]
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 MonitorSummaryItem 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 details (nullable) is None
77
+ # and model_fields_set contains the field
78
+ if self.details is None and "details" in self.model_fields_set:
79
+ _dict['details'] = None
80
+
81
+ # set to None if score (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.score is None and "score" in self.model_fields_set:
84
+ _dict['score'] = None
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of MonitorSummaryItem from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "name": obj.get("name"),
99
+ "state": obj.get("state"),
100
+ "details": obj.get("details"),
101
+ "score": obj.get("score")
102
+ })
103
+ return _obj
104
+
105
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class Neighbors(BaseModel):
28
+ """
29
+ Neighbors
30
+ """ # noqa: E501
31
+ previous: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=2083)]] = None
32
+ next: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=2083)]] = None
33
+ __properties: ClassVar[List[str]] = ["previous", "next"]
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 Neighbors 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
+ # set to None if previous (nullable) is None
75
+ # and model_fields_set contains the field
76
+ if self.previous is None and "previous" in self.model_fields_set:
77
+ _dict['previous'] = None
78
+
79
+ # set to None if next (nullable) is None
80
+ # and model_fields_set contains the field
81
+ if self.next is None and "next" in self.model_fields_set:
82
+ _dict['next'] = None
83
+
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of Neighbors from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "previous": obj.get("previous"),
97
+ "next": obj.get("next")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, 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 PageInfo(BaseModel):
27
+ """
28
+ PageInfo
29
+ """ # noqa: E501
30
+ limit: StrictInt
31
+ cursor: Optional[StrictStr] = None
32
+ __properties: ClassVar[List[str]] = ["limit", "cursor"]
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 PageInfo 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 cursor (nullable) is None
74
+ # and model_fields_set contains the field
75
+ if self.cursor is None and "cursor" in self.model_fields_set:
76
+ _dict['cursor'] = 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 PageInfo 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
+ "limit": obj.get("limit"),
91
+ "cursor": obj.get("cursor")
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from wordlift_client.models.quick_win import QuickWin
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class QuickWinsResult(BaseModel):
28
+ """
29
+ QuickWinsResult
30
+ """ # noqa: E501
31
+ status: Optional[StrictStr] = Field(default=None, description="Overall quick wins status")
32
+ explanation: Optional[StrictStr] = Field(default=None, description="Explanation of quick wins findings")
33
+ wins: Optional[List[QuickWin]] = Field(default=None, description="List of quick win recommendations")
34
+ __properties: ClassVar[List[str]] = ["status", "explanation", "wins"]
35
+
36
+ @field_validator('status')
37
+ def status_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value is None:
40
+ return value
41
+
42
+ if value not in set(['Good', 'Needs Improvement', 'Poor', 'Unknown']):
43
+ raise ValueError("must be one of enum values ('Good', 'Needs Improvement', 'Poor', 'Unknown')")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+
53
+ def to_str(self) -> str:
54
+ """Returns the string representation of the model using alias"""
55
+ return pprint.pformat(self.model_dump(by_alias=True))
56
+
57
+ def to_json(self) -> str:
58
+ """Returns the JSON representation of the model using alias"""
59
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of QuickWinsResult from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ """
77
+ excluded_fields: Set[str] = set([
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 wins (list)
86
+ _items = []
87
+ if self.wins:
88
+ for _item in self.wins:
89
+ if _item:
90
+ _items.append(_item.to_dict())
91
+ _dict['wins'] = _items
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of QuickWinsResult from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate({
104
+ "status": obj.get("status"),
105
+ "explanation": obj.get("explanation"),
106
+ "wins": [QuickWin.from_dict(_item) for _item in obj["wins"]] if obj.get("wins") is not None else None
107
+ })
108
+ return _obj
109
+
110
+
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from wordlift_client.models.resource_type import ResourceType
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class ResourceRequest(BaseModel):
29
+ """
30
+ ResourceRequest
31
+ """ # noqa: E501
32
+ url: Annotated[str, Field(min_length=1, strict=True, max_length=2083)]
33
+ type: Optional[ResourceType] = None
34
+ __properties: ClassVar[List[str]] = ["url", "type"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of ResourceRequest from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of ResourceRequest from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "url": obj.get("url"),
88
+ "type": obj.get("type")
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import json
18
+ from enum import Enum
19
+ from typing_extensions import Self
20
+
21
+
22
+ class ResourceType(str, Enum):
23
+ """
24
+ ResourceType
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ PAGE = 'page'
31
+ SITEMAP = 'sitemap'
32
+ CONFIG = 'config'
33
+ ASSET = 'asset'
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of ResourceType from a JSON string"""
38
+ return cls(json.loads(json_str))
39
+
40
+
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ WordLift API
5
+
6
+ WordLift API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: hello@wordlift.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, 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 SchemaRecommendation(BaseModel):
27
+ """
28
+ SchemaRecommendation
29
+ """ # noqa: E501
30
+ title: Optional[StrictStr] = Field(default=None, description="Title of the schema recommendation")
31
+ description: Optional[StrictStr] = Field(default=None, description="Detailed description of the recommendation")
32
+ __properties: ClassVar[List[str]] = ["title", "description"]
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 SchemaRecommendation 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 SchemaRecommendation 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
+ "title": obj.get("title"),
86
+ "description": obj.get("description")
87
+ })
88
+ return _obj
89
+
90
+