twitter-openapi-python-generated 0.0.35__py3-none-any.whl → 0.1.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 (95) hide show
  1. twitter_openapi_python_generated/__init__.py +117 -9
  2. twitter_openapi_python_generated/api_client.py +1 -1
  3. twitter_openapi_python_generated/configuration.py +1 -1
  4. twitter_openapi_python_generated/models/__init__.py +58 -4
  5. twitter_openapi_python_generated/models/ad_metadata_container.py +104 -0
  6. twitter_openapi_python_generated/models/affiliates_highlighted_label.py +93 -0
  7. twitter_openapi_python_generated/models/api_image.py +108 -0
  8. twitter_openapi_python_generated/models/api_media.py +110 -0
  9. twitter_openapi_python_generated/models/article_cover_media_info.py +3 -3
  10. twitter_openapi_python_generated/models/birdwatch_pivot.py +2 -2
  11. twitter_openapi_python_generated/models/cashtag_info.py +93 -0
  12. twitter_openapi_python_generated/models/click_tracking_info.py +96 -0
  13. twitter_openapi_python_generated/models/client_event_info.py +6 -2
  14. twitter_openapi_python_generated/models/client_event_info_details.py +99 -0
  15. twitter_openapi_python_generated/models/community.py +17 -6
  16. twitter_openapi_python_generated/models/community_banner_media.py +95 -0
  17. twitter_openapi_python_generated/models/community_banner_media_info.py +108 -0
  18. twitter_openapi_python_generated/models/community_moderation_state.py +90 -0
  19. twitter_openapi_python_generated/models/community_relationship.py +6 -2
  20. twitter_openapi_python_generated/models/community_viewer_relationship.py +95 -0
  21. twitter_openapi_python_generated/models/conversation_control.py +10 -11
  22. twitter_openapi_python_generated/models/conversation_details.py +96 -0
  23. twitter_openapi_python_generated/models/conversation_metadata.py +92 -0
  24. twitter_openapi_python_generated/models/conversation_owner.py +96 -0
  25. twitter_openapi_python_generated/models/conversation_owner_core.py +89 -0
  26. twitter_openapi_python_generated/models/conversation_owner_results.py +93 -0
  27. twitter_openapi_python_generated/models/cta_limited_action_prompt.py +110 -0
  28. twitter_openapi_python_generated/models/cta_limited_action_prompt_text.py +91 -0
  29. twitter_openapi_python_generated/models/deepsearch_header.py +96 -0
  30. twitter_openapi_python_generated/models/deepsearch_step.py +99 -0
  31. twitter_openapi_python_generated/models/deepsearch_web_result.py +89 -0
  32. twitter_openapi_python_generated/models/entities.py +27 -6
  33. twitter_openapi_python_generated/models/feedback_action.py +136 -0
  34. twitter_openapi_python_generated/models/feedback_action_entry.py +95 -0
  35. twitter_openapi_python_generated/models/feedback_client_event_info.py +93 -0
  36. twitter_openapi_python_generated/models/feedback_info.py +8 -6
  37. twitter_openapi_python_generated/models/grok_share_attachment_item.py +9 -2
  38. twitter_openapi_python_generated/models/hashtag.py +91 -0
  39. twitter_openapi_python_generated/models/jetfuel_attachment.py +91 -0
  40. twitter_openapi_python_generated/models/key_value.py +91 -0
  41. twitter_openapi_python_generated/models/landing_url.py +98 -0
  42. twitter_openapi_python_generated/models/limited_action.py +95 -0
  43. twitter_openapi_python_generated/models/limited_action_results.py +96 -0
  44. twitter_openapi_python_generated/models/limited_action_results_data.py +1 -8
  45. twitter_openapi_python_generated/models/list_banner_media_info.py +3 -3
  46. twitter_openapi_python_generated/models/list_banner_media_results.py +93 -0
  47. twitter_openapi_python_generated/models/{article_cover_media_color_info.py → media_color_info.py} +7 -7
  48. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette.py → media_color_info_palette.py} +7 -7
  49. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette_rgb.py → media_color_info_palette_rgb.py} +4 -4
  50. twitter_openapi_python_generated/models/{list_banner_media_salient_rect.py → media_salient_rect.py} +4 -4
  51. twitter_openapi_python_generated/models/module_footer.py +104 -0
  52. twitter_openapi_python_generated/models/module_header.py +100 -0
  53. twitter_openapi_python_generated/models/module_metadata.py +93 -0
  54. twitter_openapi_python_generated/models/promoted_metadata.py +109 -0
  55. twitter_openapi_python_generated/models/reader_mode_config.py +89 -0
  56. twitter_openapi_python_generated/models/scribe_config.py +89 -0
  57. twitter_openapi_python_generated/models/smarttag_tag.py +6 -2
  58. twitter_openapi_python_generated/models/smarttag_tag_info.py +93 -0
  59. twitter_openapi_python_generated/models/symbol.py +97 -0
  60. twitter_openapi_python_generated/models/timeline.py +12 -4
  61. twitter_openapi_python_generated/models/timeline_metadata.py +99 -0
  62. twitter_openapi_python_generated/models/timeline_response_objects.py +96 -0
  63. twitter_openapi_python_generated/models/timeline_show_alert.py +18 -21
  64. twitter_openapi_python_generated/models/timeline_show_alert_color_config.py +93 -0
  65. twitter_openapi_python_generated/models/timeline_show_alert_icon_display_info.py +91 -0
  66. twitter_openapi_python_generated/models/timeline_show_alert_rich_text.py +3 -3
  67. twitter_openapi_python_generated/models/timeline_timeline_item.py +6 -2
  68. twitter_openapi_python_generated/models/timeline_timeline_module.py +18 -6
  69. twitter_openapi_python_generated/models/timeline_tweet.py +6 -2
  70. twitter_openapi_python_generated/models/timelines_details.py +93 -0
  71. twitter_openapi_python_generated/models/tweet.py +7 -1
  72. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +6 -2
  73. twitter_openapi_python_generated/models/tweet_legacy.py +6 -2
  74. twitter_openapi_python_generated/models/tweet_with_visibility_results.py +6 -2
  75. twitter_openapi_python_generated/models/twitter_list.py +17 -3
  76. twitter_openapi_python_generated/models/type_name.py +3 -0
  77. twitter_openapi_python_generated/models/user.py +6 -2
  78. twitter_openapi_python_generated/models/user_label.py +128 -0
  79. twitter_openapi_python_generated/models/user_label_badge.py +89 -0
  80. twitter_openapi_python_generated/models/user_label_mention_results.py +93 -0
  81. twitter_openapi_python_generated/models/user_label_mention_user.py +106 -0
  82. twitter_openapi_python_generated/models/user_label_mention_user_core.py +89 -0
  83. twitter_openapi_python_generated/models/user_label_text.py +98 -0
  84. twitter_openapi_python_generated/models/user_label_text_entity.py +97 -0
  85. twitter_openapi_python_generated/models/user_label_text_entity_ref.py +104 -0
  86. twitter_openapi_python_generated/models/user_label_url.py +98 -0
  87. twitter_openapi_python_generated/models/user_legacy.py +6 -2
  88. twitter_openapi_python_generated/models/user_mention.py +115 -0
  89. twitter_openapi_python_generated/models/user_professional.py +7 -2
  90. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/METADATA +63 -9
  91. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/RECORD +95 -41
  92. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/WHEEL +0 -0
  93. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/licenses/LICENSE +0 -0
  94. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/licenses/LICENSE.AGPL +0 -0
  95. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.cashtag_info import CashtagInfo
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class SmarttagTagInfo(BaseModel):
29
+ """
30
+ SmarttagTagInfo
31
+ """ # noqa: E501
32
+ info: Optional[CashtagInfo] = None
33
+ __properties: ClassVar[List[str]] = ["info"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of SmarttagTagInfo 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 info
75
+ if self.info:
76
+ _dict['info'] = self.info.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 SmarttagTagInfo 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
+ "info": CashtagInfo.from_dict(obj["info"]) if obj.get("info") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
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 twitter_openapi_python_generated.models.smarttag_tag import SmarttagTag
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class Symbol(BaseModel):
29
+ """
30
+ Symbol
31
+ """ # noqa: E501
32
+ indices: List[StrictInt]
33
+ tag: Optional[SmarttagTag] = None
34
+ text: StrictStr
35
+ __properties: ClassVar[List[str]] = ["indices", "tag", "text"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ return json.dumps(to_jsonable_python(self.to_dict()))
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of Symbol 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 tag
77
+ if self.tag:
78
+ _dict['tag'] = self.tag.to_dict()
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of Symbol 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
+ "indices": obj.get("indices"),
92
+ "tag": SmarttagTag.from_dict(obj["tag"]) if obj.get("tag") is not None else None,
93
+ "text": obj.get("text")
94
+ })
95
+ return _obj
96
+
97
+
@@ -21,6 +21,8 @@ import json
21
21
  from pydantic import BaseModel, ConfigDict, Field
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from twitter_openapi_python_generated.models.instruction_union import InstructionUnion
24
+ from twitter_openapi_python_generated.models.timeline_metadata import TimelineMetadata
25
+ from twitter_openapi_python_generated.models.timeline_response_objects import TimelineResponseObjects
24
26
  from typing import Optional, Set
25
27
  from typing_extensions import Self
26
28
  from pydantic_core import to_jsonable_python
@@ -30,8 +32,8 @@ class Timeline(BaseModel):
30
32
  Timeline
31
33
  """ # noqa: E501
32
34
  instructions: List[InstructionUnion]
33
- metadata: Optional[Dict[str, Any]] = None
34
- response_objects: Optional[Dict[str, Any]] = Field(default=None, alias="responseObjects")
35
+ metadata: Optional[TimelineMetadata] = None
36
+ response_objects: Optional[TimelineResponseObjects] = Field(default=None, alias="responseObjects")
35
37
  __properties: ClassVar[List[str]] = ["instructions", "metadata", "responseObjects"]
36
38
 
37
39
  model_config = ConfigDict(
@@ -79,6 +81,12 @@ class Timeline(BaseModel):
79
81
  for _item_instructions in self.instructions:
80
82
  _items.append(_item_instructions.to_dict() if _item_instructions is not None else None)
81
83
  _dict['instructions'] = _items
84
+ # override the default output from pydantic by calling `to_dict()` of metadata
85
+ if self.metadata:
86
+ _dict['metadata'] = self.metadata.to_dict()
87
+ # override the default output from pydantic by calling `to_dict()` of response_objects
88
+ if self.response_objects:
89
+ _dict['responseObjects'] = self.response_objects.to_dict()
82
90
  return _dict
83
91
 
84
92
  @classmethod
@@ -92,8 +100,8 @@ class Timeline(BaseModel):
92
100
 
93
101
  _obj = cls.model_validate({
94
102
  "instructions": [InstructionUnion.from_dict(_item) for _item in obj["instructions"]] if obj.get("instructions") is not None else None,
95
- "metadata": obj.get("metadata"),
96
- "responseObjects": obj.get("responseObjects")
103
+ "metadata": TimelineMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None,
104
+ "responseObjects": TimelineResponseObjects.from_dict(obj["responseObjects"]) if obj.get("responseObjects") is not None else None
97
105
  })
98
106
  return _obj
99
107
 
@@ -0,0 +1,99 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
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 twitter_openapi_python_generated.models.reader_mode_config import ReaderModeConfig
24
+ from twitter_openapi_python_generated.models.scribe_config import ScribeConfig
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class TimelineMetadata(BaseModel):
30
+ """
31
+ TimelineMetadata
32
+ """ # noqa: E501
33
+ reader_mode_config: Optional[ReaderModeConfig] = None
34
+ scribe_config: ScribeConfig = Field(alias="scribeConfig")
35
+ __properties: ClassVar[List[str]] = ["reader_mode_config", "scribeConfig"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ return json.dumps(to_jsonable_python(self.to_dict()))
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of TimelineMetadata 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 reader_mode_config
77
+ if self.reader_mode_config:
78
+ _dict['reader_mode_config'] = self.reader_mode_config.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of scribe_config
80
+ if self.scribe_config:
81
+ _dict['scribeConfig'] = self.scribe_config.to_dict()
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of TimelineMetadata 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
+ "reader_mode_config": ReaderModeConfig.from_dict(obj["reader_mode_config"]) if obj.get("reader_mode_config") is not None else None,
95
+ "scribeConfig": ScribeConfig.from_dict(obj["scribeConfig"]) if obj.get("scribeConfig") is not None else None
96
+ })
97
+ return _obj
98
+
99
+
@@ -0,0 +1,96 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
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 twitter_openapi_python_generated.models.feedback_action_entry import FeedbackActionEntry
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class TimelineResponseObjects(BaseModel):
29
+ """
30
+ TimelineResponseObjects
31
+ """ # noqa: E501
32
+ feedback_actions: Optional[List[FeedbackActionEntry]] = Field(default=None, alias="feedbackActions")
33
+ __properties: ClassVar[List[str]] = ["feedbackActions"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of TimelineResponseObjects 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 feedback_actions (list)
75
+ _items = []
76
+ if self.feedback_actions:
77
+ for _item_feedback_actions in self.feedback_actions:
78
+ _items.append(_item_feedback_actions.to_dict() if _item_feedback_actions is not None else None)
79
+ _dict['feedbackActions'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of TimelineResponseObjects 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
+ "feedbackActions": [FeedbackActionEntry.from_dict(_item) for _item in obj["feedbackActions"]] if obj.get("feedbackActions") is not None else None
93
+ })
94
+ return _obj
95
+
96
+
@@ -22,6 +22,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_v
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from twitter_openapi_python_generated.models.client_event_info import ClientEventInfo
24
24
  from twitter_openapi_python_generated.models.instruction_type import InstructionType
25
+ from twitter_openapi_python_generated.models.timeline_show_alert_color_config import TimelineShowAlertColorConfig
26
+ from twitter_openapi_python_generated.models.timeline_show_alert_icon_display_info import TimelineShowAlertIconDisplayInfo
25
27
  from twitter_openapi_python_generated.models.timeline_show_alert_rich_text import TimelineShowAlertRichText
26
28
  from twitter_openapi_python_generated.models.user_results import UserResults
27
29
  from typing import Optional, Set
@@ -32,24 +34,21 @@ class TimelineShowAlert(BaseModel):
32
34
  """
33
35
  TimelineShowAlert
34
36
  """ # noqa: E501
35
- alert_type: Optional[StrictStr] = Field(default=None, alias="alertType")
36
- client_event_info: Optional[ClientEventInfo] = Field(default=None, alias="clientEventInfo")
37
- color_config: Optional[Dict[str, Any]] = Field(default=None, alias="colorConfig")
38
- display_duration_ms: Optional[StrictInt] = Field(default=None, alias="displayDurationMs")
39
- display_location: Optional[StrictStr] = Field(default=None, alias="displayLocation")
40
- icon_display_info: Optional[Dict[str, Any]] = Field(default=None, alias="iconDisplayInfo")
37
+ alert_type: StrictStr = Field(alias="alertType")
38
+ client_event_info: ClientEventInfo = Field(alias="clientEventInfo")
39
+ color_config: TimelineShowAlertColorConfig = Field(alias="colorConfig")
40
+ display_duration_ms: StrictInt = Field(alias="displayDurationMs")
41
+ display_location: StrictStr = Field(alias="displayLocation")
42
+ icon_display_info: TimelineShowAlertIconDisplayInfo = Field(alias="iconDisplayInfo")
41
43
  rich_text: TimelineShowAlertRichText = Field(alias="richText")
42
- trigger_delay_ms: Optional[StrictInt] = Field(default=None, alias="triggerDelayMs")
44
+ trigger_delay_ms: StrictInt = Field(alias="triggerDelayMs")
43
45
  type: InstructionType
44
- users_results: Optional[List[UserResults]] = Field(alias="usersResults")
46
+ users_results: Optional[List[UserResults]] = Field(default=None, alias="usersResults")
45
47
  __properties: ClassVar[List[str]] = ["alertType", "clientEventInfo", "colorConfig", "displayDurationMs", "displayLocation", "iconDisplayInfo", "richText", "triggerDelayMs", "type", "usersResults"]
46
48
 
47
49
  @field_validator('alert_type')
48
50
  def alert_type_validate_enum(cls, value):
49
51
  """Validates the enum"""
50
- if value is None:
51
- return value
52
-
53
52
  if value not in set(['NewTweets']):
54
53
  raise ValueError("must be one of enum values ('NewTweets')")
55
54
  return value
@@ -57,9 +56,6 @@ class TimelineShowAlert(BaseModel):
57
56
  @field_validator('display_location')
58
57
  def display_location_validate_enum(cls, value):
59
58
  """Validates the enum"""
60
- if value is None:
61
- return value
62
-
63
59
  if value not in set(['Top']):
64
60
  raise ValueError("must be one of enum values ('Top')")
65
61
  return value
@@ -106,6 +102,12 @@ class TimelineShowAlert(BaseModel):
106
102
  # override the default output from pydantic by calling `to_dict()` of client_event_info
107
103
  if self.client_event_info:
108
104
  _dict['clientEventInfo'] = self.client_event_info.to_dict()
105
+ # override the default output from pydantic by calling `to_dict()` of color_config
106
+ if self.color_config:
107
+ _dict['colorConfig'] = self.color_config.to_dict()
108
+ # override the default output from pydantic by calling `to_dict()` of icon_display_info
109
+ if self.icon_display_info:
110
+ _dict['iconDisplayInfo'] = self.icon_display_info.to_dict()
109
111
  # override the default output from pydantic by calling `to_dict()` of rich_text
110
112
  if self.rich_text:
111
113
  _dict['richText'] = self.rich_text.to_dict()
@@ -115,11 +117,6 @@ class TimelineShowAlert(BaseModel):
115
117
  for _item_users_results in self.users_results:
116
118
  _items.append(_item_users_results.to_dict() if _item_users_results is not None else None)
117
119
  _dict['usersResults'] = _items
118
- # set to None if users_results (nullable) is None
119
- # and model_fields_set contains the field
120
- if self.users_results is None and "users_results" in self.model_fields_set:
121
- _dict['usersResults'] = None
122
-
123
120
  return _dict
124
121
 
125
122
  @classmethod
@@ -134,10 +131,10 @@ class TimelineShowAlert(BaseModel):
134
131
  _obj = cls.model_validate({
135
132
  "alertType": obj.get("alertType"),
136
133
  "clientEventInfo": ClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
137
- "colorConfig": obj.get("colorConfig"),
134
+ "colorConfig": TimelineShowAlertColorConfig.from_dict(obj["colorConfig"]) if obj.get("colorConfig") is not None else None,
138
135
  "displayDurationMs": obj.get("displayDurationMs"),
139
136
  "displayLocation": obj.get("displayLocation"),
140
- "iconDisplayInfo": obj.get("iconDisplayInfo"),
137
+ "iconDisplayInfo": TimelineShowAlertIconDisplayInfo.from_dict(obj["iconDisplayInfo"]) if obj.get("iconDisplayInfo") is not None else None,
141
138
  "richText": TimelineShowAlertRichText.from_dict(obj["richText"]) if obj.get("richText") is not None else None,
142
139
  "triggerDelayMs": obj.get("triggerDelayMs"),
143
140
  "type": obj.get("type"),
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
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, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class TimelineShowAlertColorConfig(BaseModel):
28
+ """
29
+ TimelineShowAlertColorConfig
30
+ """ # noqa: E501
31
+ background: StrictStr
32
+ border: StrictStr
33
+ text: StrictStr
34
+ __properties: ClassVar[List[str]] = ["background", "border", "text"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of TimelineShowAlertColorConfig 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 TimelineShowAlertColorConfig 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
+ "background": obj.get("background"),
88
+ "border": obj.get("border"),
89
+ "text": obj.get("text")
90
+ })
91
+ return _obj
92
+
93
+