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
@@ -51,8 +51,8 @@ class BirdwatchPivot(BaseModel):
51
51
  if value is None:
52
52
  return value
53
53
 
54
- if value not in set(['BirdwatchEyeOff']):
55
- raise ValueError("must be one of enum values ('BirdwatchEyeOff')")
54
+ if value not in set(['BirdwatchEyeOff', 'BirdwatchLevelLow']):
55
+ raise ValueError("must be one of enum values ('BirdwatchEyeOff', 'BirdwatchLevelLow')")
56
56
  return value
57
57
 
58
58
  @field_validator('icon_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 CashtagInfo(BaseModel):
28
+ """
29
+ CashtagInfo
30
+ """ # noqa: E501
31
+ name: StrictStr
32
+ ticker: StrictStr
33
+ tradable_platforms: List[StrictStr]
34
+ __properties: ClassVar[List[str]] = ["name", "ticker", "tradable_platforms"]
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 CashtagInfo 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 CashtagInfo 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
+ "name": obj.get("name"),
88
+ "ticker": obj.get("ticker"),
89
+ "tradable_platforms": obj.get("tradable_platforms")
90
+ })
91
+ return _obj
92
+
93
+
@@ -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
23
+ from twitter_openapi_python_generated.models.key_value import KeyValue
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class ClickTrackingInfo(BaseModel):
29
+ """
30
+ ClickTrackingInfo
31
+ """ # noqa: E501
32
+ url_params: List[KeyValue] = Field(alias="urlParams")
33
+ __properties: ClassVar[List[str]] = ["urlParams"]
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 ClickTrackingInfo 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 url_params (list)
75
+ _items = []
76
+ if self.url_params:
77
+ for _item_url_params in self.url_params:
78
+ _items.append(_item_url_params.to_dict() if _item_url_params is not None else None)
79
+ _dict['urlParams'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of ClickTrackingInfo 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
+ "urlParams": [KeyValue.from_dict(_item) for _item in obj["urlParams"]] if obj.get("urlParams") is not None else None
93
+ })
94
+ return _obj
95
+
96
+
@@ -20,6 +20,7 @@ import json
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.client_event_info_details import ClientEventInfoDetails
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
  from pydantic_core import to_jsonable_python
@@ -29,7 +30,7 @@ class ClientEventInfo(BaseModel):
29
30
  ClientEventInfo
30
31
  """ # noqa: E501
31
32
  component: Optional[StrictStr] = None
32
- details: Optional[Dict[str, Any]] = None
33
+ details: Optional[ClientEventInfoDetails] = None
33
34
  element: Optional[StrictStr] = None
34
35
  __properties: ClassVar[List[str]] = ["component", "details", "element"]
35
36
 
@@ -72,6 +73,9 @@ class ClientEventInfo(BaseModel):
72
73
  exclude=excluded_fields,
73
74
  exclude_none=True,
74
75
  )
76
+ # override the default output from pydantic by calling `to_dict()` of details
77
+ if self.details:
78
+ _dict['details'] = self.details.to_dict()
75
79
  return _dict
76
80
 
77
81
  @classmethod
@@ -85,7 +89,7 @@ class ClientEventInfo(BaseModel):
85
89
 
86
90
  _obj = cls.model_validate({
87
91
  "component": obj.get("component"),
88
- "details": obj.get("details"),
92
+ "details": ClientEventInfoDetails.from_dict(obj["details"]) if obj.get("details") is not None else None,
89
93
  "element": obj.get("element")
90
94
  })
91
95
  return _obj
@@ -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.conversation_details import ConversationDetails
24
+ from twitter_openapi_python_generated.models.timelines_details import TimelinesDetails
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class ClientEventInfoDetails(BaseModel):
30
+ """
31
+ ClientEventInfoDetails
32
+ """ # noqa: E501
33
+ conversation_details: Optional[ConversationDetails] = Field(default=None, alias="conversationDetails")
34
+ timelines_details: TimelinesDetails = Field(alias="timelinesDetails")
35
+ __properties: ClassVar[List[str]] = ["conversationDetails", "timelinesDetails"]
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 ClientEventInfoDetails 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 conversation_details
77
+ if self.conversation_details:
78
+ _dict['conversationDetails'] = self.conversation_details.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of timelines_details
80
+ if self.timelines_details:
81
+ _dict['timelinesDetails'] = self.timelines_details.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 ClientEventInfoDetails 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
+ "conversationDetails": ConversationDetails.from_dict(obj["conversationDetails"]) if obj.get("conversationDetails") is not None else None,
95
+ "timelinesDetails": TimelinesDetails.from_dict(obj["timelinesDetails"]) if obj.get("timelinesDetails") is not None else None
96
+ })
97
+ return _obj
98
+
99
+
@@ -22,10 +22,12 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, Strict
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from typing_extensions import Annotated
24
24
  from twitter_openapi_python_generated.models.community_actions import CommunityActions
25
+ from twitter_openapi_python_generated.models.community_banner_media import CommunityBannerMedia
25
26
  from twitter_openapi_python_generated.models.community_invites_result import CommunityInvitesResult
26
27
  from twitter_openapi_python_generated.models.community_join_requests_result import CommunityJoinRequestsResult
27
28
  from twitter_openapi_python_generated.models.community_rule import CommunityRule
28
29
  from twitter_openapi_python_generated.models.community_urls import CommunityUrls
30
+ from twitter_openapi_python_generated.models.community_viewer_relationship import CommunityViewerRelationship
29
31
  from twitter_openapi_python_generated.models.primary_community_topic import PrimaryCommunityTopic
30
32
  from twitter_openapi_python_generated.models.type_name import TypeName
31
33
  from twitter_openapi_python_generated.models.user_results import UserResults
@@ -42,8 +44,8 @@ class Community(BaseModel):
42
44
  admin_results: Optional[UserResults] = None
43
45
  created_at: Optional[StrictInt] = None
44
46
  creator_results: Optional[UserResults] = None
45
- custom_banner_media: Optional[Dict[str, Any]] = None
46
- default_banner_media: Optional[Dict[str, Any]] = None
47
+ custom_banner_media: Optional[CommunityBannerMedia] = None
48
+ default_banner_media: Optional[CommunityBannerMedia] = None
47
49
  description: Optional[StrictStr] = None
48
50
  id_str: Optional[Annotated[str, Field(strict=True)]] = None
49
51
  invites_policy: Optional[StrictStr] = None
@@ -62,7 +64,7 @@ class Community(BaseModel):
62
64
  search_tags: Optional[List[StrictStr]] = None
63
65
  show_only_users_to_display: Optional[List[StrictStr]] = None
64
66
  urls: Optional[CommunityUrls] = None
65
- viewer_relationship: Optional[Dict[str, Any]] = None
67
+ viewer_relationship: Optional[CommunityViewerRelationship] = None
66
68
  __properties: ClassVar[List[str]] = ["__typename", "actions", "admin_results", "created_at", "creator_results", "custom_banner_media", "default_banner_media", "description", "id_str", "invites_policy", "invites_result", "is_pinned", "join_policy", "join_requests_result", "member_count", "members_facepile_results", "moderator_count", "name", "primary_community_topic", "question", "role", "rules", "search_tags", "show_only_users_to_display", "urls", "viewer_relationship"]
67
69
 
68
70
  @field_validator('id_str', mode="before")
@@ -153,6 +155,12 @@ class Community(BaseModel):
153
155
  # override the default output from pydantic by calling `to_dict()` of creator_results
154
156
  if self.creator_results:
155
157
  _dict['creator_results'] = self.creator_results.to_dict()
158
+ # override the default output from pydantic by calling `to_dict()` of custom_banner_media
159
+ if self.custom_banner_media:
160
+ _dict['custom_banner_media'] = self.custom_banner_media.to_dict()
161
+ # override the default output from pydantic by calling `to_dict()` of default_banner_media
162
+ if self.default_banner_media:
163
+ _dict['default_banner_media'] = self.default_banner_media.to_dict()
156
164
  # override the default output from pydantic by calling `to_dict()` of invites_result
157
165
  if self.invites_result:
158
166
  _dict['invites_result'] = self.invites_result.to_dict()
@@ -177,6 +185,9 @@ class Community(BaseModel):
177
185
  # override the default output from pydantic by calling `to_dict()` of urls
178
186
  if self.urls:
179
187
  _dict['urls'] = self.urls.to_dict()
188
+ # override the default output from pydantic by calling `to_dict()` of viewer_relationship
189
+ if self.viewer_relationship:
190
+ _dict['viewer_relationship'] = self.viewer_relationship.to_dict()
180
191
  return _dict
181
192
 
182
193
  @classmethod
@@ -194,8 +205,8 @@ class Community(BaseModel):
194
205
  "admin_results": UserResults.from_dict(obj["admin_results"]) if obj.get("admin_results") is not None else None,
195
206
  "created_at": obj.get("created_at"),
196
207
  "creator_results": UserResults.from_dict(obj["creator_results"]) if obj.get("creator_results") is not None else None,
197
- "custom_banner_media": obj.get("custom_banner_media"),
198
- "default_banner_media": obj.get("default_banner_media"),
208
+ "custom_banner_media": CommunityBannerMedia.from_dict(obj["custom_banner_media"]) if obj.get("custom_banner_media") is not None else None,
209
+ "default_banner_media": CommunityBannerMedia.from_dict(obj["default_banner_media"]) if obj.get("default_banner_media") is not None else None,
199
210
  "description": obj.get("description"),
200
211
  "id_str": obj.get("id_str"),
201
212
  "invites_policy": obj.get("invites_policy"),
@@ -214,7 +225,7 @@ class Community(BaseModel):
214
225
  "search_tags": obj.get("search_tags"),
215
226
  "show_only_users_to_display": obj.get("show_only_users_to_display"),
216
227
  "urls": CommunityUrls.from_dict(obj["urls"]) if obj.get("urls") is not None else None,
217
- "viewer_relationship": obj.get("viewer_relationship")
228
+ "viewer_relationship": CommunityViewerRelationship.from_dict(obj["viewer_relationship"]) if obj.get("viewer_relationship") is not None else None
218
229
  })
219
230
  return _obj
220
231
 
@@ -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.community_banner_media_info import CommunityBannerMediaInfo
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class CommunityBannerMedia(BaseModel):
29
+ """
30
+ CommunityBannerMedia
31
+ """ # noqa: E501
32
+ id: Optional[StrictStr] = None
33
+ media_info: CommunityBannerMediaInfo
34
+ __properties: ClassVar[List[str]] = ["id", "media_info"]
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 CommunityBannerMedia 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 media_info
76
+ if self.media_info:
77
+ _dict['media_info'] = self.media_info.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 CommunityBannerMedia 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
+ "id": obj.get("id"),
91
+ "media_info": CommunityBannerMediaInfo.from_dict(obj["media_info"]) if obj.get("media_info") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,108 @@
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, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.media_color_info import MediaColorInfo
24
+ from twitter_openapi_python_generated.models.media_salient_rect import MediaSalientRect
25
+ from twitter_openapi_python_generated.models.type_name import TypeName
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+ from pydantic_core import to_jsonable_python
29
+
30
+ class CommunityBannerMediaInfo(BaseModel):
31
+ """
32
+ CommunityBannerMediaInfo
33
+ """ # noqa: E501
34
+ typename: Optional[TypeName] = Field(default=None, alias="__typename")
35
+ color_info: MediaColorInfo
36
+ original_img_height: StrictInt
37
+ original_img_url: StrictStr
38
+ original_img_width: StrictInt
39
+ salient_rect: Optional[MediaSalientRect] = None
40
+ __properties: ClassVar[List[str]] = ["__typename", "color_info", "original_img_height", "original_img_url", "original_img_width", "salient_rect"]
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 CommunityBannerMediaInfo 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
+ # override the default output from pydantic by calling `to_dict()` of color_info
82
+ if self.color_info:
83
+ _dict['color_info'] = self.color_info.to_dict()
84
+ # override the default output from pydantic by calling `to_dict()` of salient_rect
85
+ if self.salient_rect:
86
+ _dict['salient_rect'] = self.salient_rect.to_dict()
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of CommunityBannerMediaInfo from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "__typename": obj.get("__typename"),
100
+ "color_info": MediaColorInfo.from_dict(obj["color_info"]) if obj.get("color_info") is not None else None,
101
+ "original_img_height": obj.get("original_img_height"),
102
+ "original_img_url": obj.get("original_img_url"),
103
+ "original_img_width": obj.get("original_img_width"),
104
+ "salient_rect": MediaSalientRect.from_dict(obj["salient_rect"]) if obj.get("salient_rect") is not None else None
105
+ })
106
+ return _obj
107
+
108
+