twitter-openapi-python-generated 0.0.35__py3-none-any.whl → 0.1.1__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 (111) hide show
  1. twitter_openapi_python_generated/__init__.py +135 -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 +67 -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 +20 -7
  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/error_extensions.py +1 -1
  34. twitter_openapi_python_generated/models/error_response.py +1 -1
  35. twitter_openapi_python_generated/models/feedback_action.py +136 -0
  36. twitter_openapi_python_generated/models/feedback_action_entry.py +95 -0
  37. twitter_openapi_python_generated/models/feedback_client_event_info.py +93 -0
  38. twitter_openapi_python_generated/models/feedback_info.py +8 -6
  39. twitter_openapi_python_generated/models/grok_share_attachment_item.py +9 -2
  40. twitter_openapi_python_generated/models/grouped_trend.py +95 -0
  41. twitter_openapi_python_generated/models/hashtag.py +91 -0
  42. twitter_openapi_python_generated/models/jetfuel_attachment.py +91 -0
  43. twitter_openapi_python_generated/models/key_value.py +91 -0
  44. twitter_openapi_python_generated/models/landing_url.py +98 -0
  45. twitter_openapi_python_generated/models/limited_action.py +95 -0
  46. twitter_openapi_python_generated/models/limited_action_results.py +96 -0
  47. twitter_openapi_python_generated/models/limited_action_results_data.py +1 -8
  48. twitter_openapi_python_generated/models/list_banner_media_info.py +3 -3
  49. twitter_openapi_python_generated/models/list_banner_media_results.py +93 -0
  50. twitter_openapi_python_generated/models/{article_cover_media_color_info.py → media_color_info.py} +7 -7
  51. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette.py → media_color_info_palette.py} +7 -7
  52. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette_rgb.py → media_color_info_palette_rgb.py} +4 -4
  53. twitter_openapi_python_generated/models/{list_banner_media_salient_rect.py → media_salient_rect.py} +4 -4
  54. twitter_openapi_python_generated/models/module_footer.py +104 -0
  55. twitter_openapi_python_generated/models/module_header.py +100 -0
  56. twitter_openapi_python_generated/models/module_metadata.py +93 -0
  57. twitter_openapi_python_generated/models/promoted_metadata.py +109 -0
  58. twitter_openapi_python_generated/models/reader_mode_config.py +89 -0
  59. twitter_openapi_python_generated/models/scribe_config.py +89 -0
  60. twitter_openapi_python_generated/models/search_timeline.py +2 -2
  61. twitter_openapi_python_generated/models/smarttag_tag.py +6 -2
  62. twitter_openapi_python_generated/models/smarttag_tag_info.py +93 -0
  63. twitter_openapi_python_generated/models/symbol.py +97 -0
  64. twitter_openapi_python_generated/models/timeline.py +12 -4
  65. twitter_openapi_python_generated/models/timeline_community.py +13 -17
  66. twitter_openapi_python_generated/models/timeline_message_prompt.py +13 -17
  67. twitter_openapi_python_generated/models/timeline_message_prompt_button.py +95 -0
  68. twitter_openapi_python_generated/models/timeline_message_prompt_button_action.py +91 -0
  69. twitter_openapi_python_generated/models/timeline_message_prompt_content.py +112 -0
  70. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text.py +98 -0
  71. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity.py +97 -0
  72. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity_ref.py +107 -0
  73. twitter_openapi_python_generated/models/timeline_metadata.py +99 -0
  74. twitter_openapi_python_generated/models/timeline_prompt.py +19 -17
  75. twitter_openapi_python_generated/models/timeline_prompt_callback.py +89 -0
  76. twitter_openapi_python_generated/models/timeline_prompt_content.py +124 -0
  77. twitter_openapi_python_generated/models/timeline_response_objects.py +96 -0
  78. twitter_openapi_python_generated/models/timeline_show_alert.py +18 -21
  79. twitter_openapi_python_generated/models/timeline_show_alert_color_config.py +93 -0
  80. twitter_openapi_python_generated/models/timeline_show_alert_icon_display_info.py +91 -0
  81. twitter_openapi_python_generated/models/timeline_show_alert_rich_text.py +3 -3
  82. twitter_openapi_python_generated/models/timeline_timeline_item.py +6 -2
  83. twitter_openapi_python_generated/models/timeline_timeline_module.py +18 -6
  84. twitter_openapi_python_generated/models/timeline_trend.py +10 -1
  85. twitter_openapi_python_generated/models/timeline_tweet.py +6 -2
  86. twitter_openapi_python_generated/models/timelines_details.py +93 -0
  87. twitter_openapi_python_generated/models/tweet.py +7 -1
  88. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +6 -2
  89. twitter_openapi_python_generated/models/tweet_legacy.py +6 -2
  90. twitter_openapi_python_generated/models/tweet_with_visibility_results.py +6 -2
  91. twitter_openapi_python_generated/models/twitter_list.py +17 -3
  92. twitter_openapi_python_generated/models/type_name.py +3 -0
  93. twitter_openapi_python_generated/models/user.py +6 -2
  94. twitter_openapi_python_generated/models/user_label.py +128 -0
  95. twitter_openapi_python_generated/models/user_label_badge.py +89 -0
  96. twitter_openapi_python_generated/models/user_label_mention_results.py +93 -0
  97. twitter_openapi_python_generated/models/user_label_mention_user.py +106 -0
  98. twitter_openapi_python_generated/models/user_label_mention_user_core.py +89 -0
  99. twitter_openapi_python_generated/models/user_label_text.py +98 -0
  100. twitter_openapi_python_generated/models/user_label_text_entity.py +97 -0
  101. twitter_openapi_python_generated/models/user_label_text_entity_ref.py +104 -0
  102. twitter_openapi_python_generated/models/user_label_url.py +98 -0
  103. twitter_openapi_python_generated/models/user_legacy.py +6 -2
  104. twitter_openapi_python_generated/models/user_mention.py +115 -0
  105. twitter_openapi_python_generated/models/user_professional.py +7 -2
  106. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/METADATA +72 -9
  107. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/RECORD +111 -48
  108. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/WHEEL +0 -0
  109. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE +0 -0
  110. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE.AGPL +0 -0
  111. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,91 @@
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 KeyValue(BaseModel):
28
+ """
29
+ KeyValue
30
+ """ # noqa: E501
31
+ key: StrictStr
32
+ value: StrictStr
33
+ __properties: ClassVar[List[str]] = ["key", "value"]
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 KeyValue 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 KeyValue 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
+ "key": obj.get("key"),
87
+ "value": obj.get("value")
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,98 @@
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, StrictStr, field_validator
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 LandingUrl(BaseModel):
28
+ """
29
+ LandingUrl
30
+ """ # noqa: E501
31
+ url: StrictStr
32
+ url_type: StrictStr = Field(alias="urlType")
33
+ __properties: ClassVar[List[str]] = ["url", "urlType"]
34
+
35
+ @field_validator('url_type')
36
+ def url_type_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value not in set(['DeepLink', 'ExternalUrl']):
39
+ raise ValueError("must be one of enum values ('DeepLink', 'ExternalUrl')")
40
+ return value
41
+
42
+ model_config = ConfigDict(
43
+ validate_by_name=True,
44
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of LandingUrl from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of LandingUrl 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
+ "url": obj.get("url"),
94
+ "urlType": obj.get("urlType")
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,95 @@
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, Optional
23
+ from twitter_openapi_python_generated.models.cta_limited_action_prompt import CtaLimitedActionPrompt
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class LimitedAction(BaseModel):
29
+ """
30
+ LimitedAction
31
+ """ # noqa: E501
32
+ action: StrictStr
33
+ prompt: Optional[CtaLimitedActionPrompt] = None
34
+ __properties: ClassVar[List[str]] = ["action", "prompt"]
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 LimitedAction 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
+ # override the default output from pydantic by calling `to_dict()` of prompt
76
+ if self.prompt:
77
+ _dict['prompt'] = self.prompt.to_dict()
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of LimitedAction 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
+ "action": obj.get("action"),
91
+ "prompt": CtaLimitedActionPrompt.from_dict(obj["prompt"]) if obj.get("prompt") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -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
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.limited_action import LimitedAction
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class LimitedActionResults(BaseModel):
29
+ """
30
+ LimitedActionResults
31
+ """ # noqa: E501
32
+ limited_actions: List[LimitedAction]
33
+ __properties: ClassVar[List[str]] = ["limited_actions"]
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 LimitedActionResults 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 limited_actions (list)
75
+ _items = []
76
+ if self.limited_actions:
77
+ for _item_limited_actions in self.limited_actions:
78
+ _items.append(_item_limited_actions.to_dict() if _item_limited_actions is not None else None)
79
+ _dict['limited_actions'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of LimitedActionResults 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
+ "limited_actions": [LimitedAction.from_dict(_item) for _item in obj["limited_actions"]] if obj.get("limited_actions") is not None else None
93
+ })
94
+ return _obj
95
+
96
+
@@ -18,7 +18,7 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
@@ -31,13 +31,6 @@ class LimitedActionResultsData(BaseModel):
31
31
  action: StrictStr
32
32
  __properties: ClassVar[List[str]] = ["action"]
33
33
 
34
- @field_validator('action')
35
- def action_validate_enum(cls, value):
36
- """Validates the enum"""
37
- if value not in set(['Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements']):
38
- raise ValueError("must be one of enum values ('Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements')")
39
- return value
40
-
41
34
  model_config = ConfigDict(
42
35
  validate_by_name=True,
43
36
  validate_by_alias=True,
@@ -20,7 +20,7 @@ import json
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List
23
- from twitter_openapi_python_generated.models.list_banner_media_salient_rect import ListBannerMediaSalientRect
23
+ from twitter_openapi_python_generated.models.media_salient_rect import MediaSalientRect
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
  from pydantic_core import to_jsonable_python
@@ -32,7 +32,7 @@ class ListBannerMediaInfo(BaseModel):
32
32
  original_img_height: StrictInt
33
33
  original_img_url: StrictStr
34
34
  original_img_width: StrictInt
35
- salient_rect: ListBannerMediaSalientRect
35
+ salient_rect: MediaSalientRect
36
36
  __properties: ClassVar[List[str]] = ["original_img_height", "original_img_url", "original_img_width", "salient_rect"]
37
37
 
38
38
  model_config = ConfigDict(
@@ -92,7 +92,7 @@ class ListBannerMediaInfo(BaseModel):
92
92
  "original_img_height": obj.get("original_img_height"),
93
93
  "original_img_url": obj.get("original_img_url"),
94
94
  "original_img_width": obj.get("original_img_width"),
95
- "salient_rect": ListBannerMediaSalientRect.from_dict(obj["salient_rect"]) if obj.get("salient_rect") is not None else None
95
+ "salient_rect": MediaSalientRect.from_dict(obj["salient_rect"]) if obj.get("salient_rect") is not None else None
96
96
  })
97
97
  return _obj
98
98
 
@@ -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.api_media import ApiMedia
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class ListBannerMediaResults(BaseModel):
29
+ """
30
+ ListBannerMediaResults
31
+ """ # noqa: E501
32
+ result: Optional[ApiMedia] = None
33
+ __properties: ClassVar[List[str]] = ["result"]
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 ListBannerMediaResults 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 result
75
+ if self.result:
76
+ _dict['result'] = self.result.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 ListBannerMediaResults 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
+ "result": ApiMedia.from_dict(obj["result"]) if obj.get("result") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -20,16 +20,16 @@ import json
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict
22
22
  from typing import Any, ClassVar, Dict, List
23
- from twitter_openapi_python_generated.models.article_cover_media_color_info_palette import ArticleCoverMediaColorInfoPalette
23
+ from twitter_openapi_python_generated.models.media_color_info_palette import MediaColorInfoPalette
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
  from pydantic_core import to_jsonable_python
27
27
 
28
- class ArticleCoverMediaColorInfo(BaseModel):
28
+ class MediaColorInfo(BaseModel):
29
29
  """
30
- ArticleCoverMediaColorInfo
30
+ MediaColorInfo
31
31
  """ # noqa: E501
32
- palette: List[ArticleCoverMediaColorInfoPalette]
32
+ palette: List[MediaColorInfoPalette]
33
33
  __properties: ClassVar[List[str]] = ["palette"]
34
34
 
35
35
  model_config = ConfigDict(
@@ -50,7 +50,7 @@ class ArticleCoverMediaColorInfo(BaseModel):
50
50
 
51
51
  @classmethod
52
52
  def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of ArticleCoverMediaColorInfo from a JSON string"""
53
+ """Create an instance of MediaColorInfo from a JSON string"""
54
54
  return cls.from_dict(json.loads(json_str))
55
55
 
56
56
  def to_dict(self) -> Dict[str, Any]:
@@ -81,7 +81,7 @@ class ArticleCoverMediaColorInfo(BaseModel):
81
81
 
82
82
  @classmethod
83
83
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
- """Create an instance of ArticleCoverMediaColorInfo from a dict"""
84
+ """Create an instance of MediaColorInfo from a dict"""
85
85
  if obj is None:
86
86
  return None
87
87
 
@@ -89,7 +89,7 @@ class ArticleCoverMediaColorInfo(BaseModel):
89
89
  return cls.model_validate(obj)
90
90
 
91
91
  _obj = cls.model_validate({
92
- "palette": [ArticleCoverMediaColorInfoPalette.from_dict(_item) for _item in obj["palette"]] if obj.get("palette") is not None else None
92
+ "palette": [MediaColorInfoPalette.from_dict(_item) for _item in obj["palette"]] if obj.get("palette") is not None else None
93
93
  })
94
94
  return _obj
95
95
 
@@ -20,17 +20,17 @@ import json
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
22
22
  from typing import Any, ClassVar, Dict, List, Union
23
- from twitter_openapi_python_generated.models.article_cover_media_color_info_palette_rgb import ArticleCoverMediaColorInfoPaletteRGB
23
+ from twitter_openapi_python_generated.models.media_color_info_palette_rgb import MediaColorInfoPaletteRGB
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
  from pydantic_core import to_jsonable_python
27
27
 
28
- class ArticleCoverMediaColorInfoPalette(BaseModel):
28
+ class MediaColorInfoPalette(BaseModel):
29
29
  """
30
- ArticleCoverMediaColorInfoPalette
30
+ MediaColorInfoPalette
31
31
  """ # noqa: E501
32
32
  percentage: Union[StrictFloat, StrictInt]
33
- rgb: ArticleCoverMediaColorInfoPaletteRGB
33
+ rgb: MediaColorInfoPaletteRGB
34
34
  __properties: ClassVar[List[str]] = ["percentage", "rgb"]
35
35
 
36
36
  model_config = ConfigDict(
@@ -51,7 +51,7 @@ class ArticleCoverMediaColorInfoPalette(BaseModel):
51
51
 
52
52
  @classmethod
53
53
  def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of ArticleCoverMediaColorInfoPalette from a JSON string"""
54
+ """Create an instance of MediaColorInfoPalette from a JSON string"""
55
55
  return cls.from_dict(json.loads(json_str))
56
56
 
57
57
  def to_dict(self) -> Dict[str, Any]:
@@ -79,7 +79,7 @@ class ArticleCoverMediaColorInfoPalette(BaseModel):
79
79
 
80
80
  @classmethod
81
81
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
- """Create an instance of ArticleCoverMediaColorInfoPalette from a dict"""
82
+ """Create an instance of MediaColorInfoPalette from a dict"""
83
83
  if obj is None:
84
84
  return None
85
85
 
@@ -88,7 +88,7 @@ class ArticleCoverMediaColorInfoPalette(BaseModel):
88
88
 
89
89
  _obj = cls.model_validate({
90
90
  "percentage": obj.get("percentage"),
91
- "rgb": ArticleCoverMediaColorInfoPaletteRGB.from_dict(obj["rgb"]) if obj.get("rgb") is not None else None
91
+ "rgb": MediaColorInfoPaletteRGB.from_dict(obj["rgb"]) if obj.get("rgb") is not None else None
92
92
  })
93
93
  return _obj
94
94
 
@@ -24,9 +24,9 @@ from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
  from pydantic_core import to_jsonable_python
26
26
 
27
- class ArticleCoverMediaColorInfoPaletteRGB(BaseModel):
27
+ class MediaColorInfoPaletteRGB(BaseModel):
28
28
  """
29
- ArticleCoverMediaColorInfoPaletteRGB
29
+ MediaColorInfoPaletteRGB
30
30
  """ # noqa: E501
31
31
  blue: StrictInt
32
32
  green: StrictInt
@@ -51,7 +51,7 @@ class ArticleCoverMediaColorInfoPaletteRGB(BaseModel):
51
51
 
52
52
  @classmethod
53
53
  def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of ArticleCoverMediaColorInfoPaletteRGB from a JSON string"""
54
+ """Create an instance of MediaColorInfoPaletteRGB from a JSON string"""
55
55
  return cls.from_dict(json.loads(json_str))
56
56
 
57
57
  def to_dict(self) -> Dict[str, Any]:
@@ -76,7 +76,7 @@ class ArticleCoverMediaColorInfoPaletteRGB(BaseModel):
76
76
 
77
77
  @classmethod
78
78
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
- """Create an instance of ArticleCoverMediaColorInfoPaletteRGB from a dict"""
79
+ """Create an instance of MediaColorInfoPaletteRGB from a dict"""
80
80
  if obj is None:
81
81
  return None
82
82
 
@@ -24,9 +24,9 @@ from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
  from pydantic_core import to_jsonable_python
26
26
 
27
- class ListBannerMediaSalientRect(BaseModel):
27
+ class MediaSalientRect(BaseModel):
28
28
  """
29
- ListBannerMediaSalientRect
29
+ MediaSalientRect
30
30
  """ # noqa: E501
31
31
  height: StrictInt
32
32
  left: StrictInt
@@ -52,7 +52,7 @@ class ListBannerMediaSalientRect(BaseModel):
52
52
 
53
53
  @classmethod
54
54
  def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of ListBannerMediaSalientRect from a JSON string"""
55
+ """Create an instance of MediaSalientRect from a JSON string"""
56
56
  return cls.from_dict(json.loads(json_str))
57
57
 
58
58
  def to_dict(self) -> Dict[str, Any]:
@@ -77,7 +77,7 @@ class ListBannerMediaSalientRect(BaseModel):
77
77
 
78
78
  @classmethod
79
79
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
- """Create an instance of ListBannerMediaSalientRect from a dict"""
80
+ """Create an instance of MediaSalientRect from a dict"""
81
81
  if obj is None:
82
82
  return None
83
83