twitter-openapi-python-generated 0.1.2__py3-none-any.whl → 0.1.4__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 (121) hide show
  1. twitter_openapi_python_generated/__init__.py +129 -1
  2. twitter_openapi_python_generated/api/default_api.py +1437 -199
  3. twitter_openapi_python_generated/api/user_api.py +310 -6
  4. twitter_openapi_python_generated/api/users_api.py +327 -6
  5. twitter_openapi_python_generated/api_client.py +1 -1
  6. twitter_openapi_python_generated/configuration.py +1 -1
  7. twitter_openapi_python_generated/models/__init__.py +64 -0
  8. twitter_openapi_python_generated/models/about_account_data.py +93 -0
  9. twitter_openapi_python_generated/models/about_account_response.py +102 -0
  10. twitter_openapi_python_generated/models/about_account_user.py +161 -0
  11. twitter_openapi_python_generated/models/about_account_user_result.py +95 -0
  12. twitter_openapi_python_generated/models/about_account_verification_info.py +95 -0
  13. twitter_openapi_python_generated/models/about_account_verification_info_reason.py +99 -0
  14. twitter_openapi_python_generated/models/about_profile.py +103 -0
  15. twitter_openapi_python_generated/models/about_profile_username_changes.py +109 -0
  16. twitter_openapi_python_generated/models/ad_metadata_container.py +3 -1
  17. twitter_openapi_python_generated/models/ai_trend.py +126 -0
  18. twitter_openapi_python_generated/models/ai_trend_core.py +95 -0
  19. twitter_openapi_python_generated/models/ai_trend_results.py +95 -0
  20. twitter_openapi_python_generated/models/ai_trend_social_proof.py +89 -0
  21. twitter_openapi_python_generated/models/article_content_block.py +117 -0
  22. twitter_openapi_python_generated/models/article_content_block_data.py +104 -0
  23. twitter_openapi_python_generated/models/article_content_entity.py +95 -0
  24. twitter_openapi_python_generated/models/article_content_entity_data.py +115 -0
  25. twitter_openapi_python_generated/models/article_content_entity_range.py +93 -0
  26. twitter_openapi_python_generated/models/article_content_entity_value.py +104 -0
  27. twitter_openapi_python_generated/models/article_content_inline_style_range.py +100 -0
  28. twitter_openapi_python_generated/models/article_content_media_item.py +101 -0
  29. twitter_openapi_python_generated/models/article_content_state.py +105 -0
  30. twitter_openapi_python_generated/models/article_content_text_range.py +93 -0
  31. twitter_openapi_python_generated/models/article_result.py +9 -3
  32. twitter_openapi_python_generated/models/audio_space.py +107 -0
  33. twitter_openapi_python_generated/models/audio_space_data.py +93 -0
  34. twitter_openapi_python_generated/models/audio_space_mentioned_user.py +97 -0
  35. twitter_openapi_python_generated/models/audio_space_metadata.py +165 -0
  36. twitter_openapi_python_generated/models/audio_space_participant.py +109 -0
  37. twitter_openapi_python_generated/models/audio_space_participant_user.py +104 -0
  38. twitter_openapi_python_generated/models/audio_space_participant_user_results.py +103 -0
  39. twitter_openapi_python_generated/models/audio_space_participant_verification.py +99 -0
  40. twitter_openapi_python_generated/models/audio_space_participants.py +114 -0
  41. twitter_openapi_python_generated/models/audio_space_response.py +102 -0
  42. twitter_openapi_python_generated/models/audio_space_sharings.py +91 -0
  43. twitter_openapi_python_generated/models/birdwatch_pivot.py +0 -17
  44. twitter_openapi_python_generated/models/broadcast.py +159 -0
  45. twitter_openapi_python_generated/models/broadcast_data.py +93 -0
  46. twitter_openapi_python_generated/models/broadcast_edited_replay.py +89 -0
  47. twitter_openapi_python_generated/models/broadcast_periscope_user.py +95 -0
  48. twitter_openapi_python_generated/models/broadcast_response.py +102 -0
  49. twitter_openapi_python_generated/models/cashtag_attachment.py +6 -4
  50. twitter_openapi_python_generated/models/community.py +2 -2
  51. twitter_openapi_python_generated/models/community_delete_action_result.py +1 -8
  52. twitter_openapi_python_generated/models/community_invites_result.py +1 -8
  53. twitter_openapi_python_generated/models/community_join_action_unavailable.py +1 -8
  54. twitter_openapi_python_generated/models/community_leave_action_result.py +1 -8
  55. twitter_openapi_python_generated/models/conversation_control.py +8 -1
  56. twitter_openapi_python_generated/models/conversation_details.py +1 -8
  57. twitter_openapi_python_generated/models/cover_cta.py +5 -15
  58. twitter_openapi_python_generated/models/cta_client_event_info.py +1 -8
  59. twitter_openapi_python_generated/models/cta_limited_action_prompt.py +1 -8
  60. twitter_openapi_python_generated/models/feedback_action.py +1 -21
  61. twitter_openapi_python_generated/models/feedback_client_event_info.py +2 -2
  62. twitter_openapi_python_generated/models/grok_account_jwt.py +89 -0
  63. twitter_openapi_python_generated/models/grok_account_jwt_data.py +93 -0
  64. twitter_openapi_python_generated/models/grok_account_jwt_response.py +102 -0
  65. twitter_openapi_python_generated/models/grok_entity_ref.py +19 -4
  66. twitter_openapi_python_generated/models/grok_image_annotation.py +2 -2
  67. twitter_openapi_python_generated/models/identity_profile_labels_highlighted_label.py +93 -0
  68. twitter_openapi_python_generated/models/limited_action.py +8 -1
  69. twitter_openapi_python_generated/models/limited_action_results_data.py +8 -1
  70. twitter_openapi_python_generated/models/media_result.py +1 -1
  71. twitter_openapi_python_generated/models/module_header.py +8 -9
  72. twitter_openapi_python_generated/models/note_tweet_result_data.py +2 -2
  73. twitter_openapi_python_generated/models/notification_additional_context.py +94 -0
  74. twitter_openapi_python_generated/models/notification_template.py +10 -2
  75. twitter_openapi_python_generated/models/notification_url.py +104 -0
  76. twitter_openapi_python_generated/models/notification_urt_endpoint_options.py +93 -0
  77. twitter_openapi_python_generated/models/preroll.py +97 -0
  78. twitter_openapi_python_generated/models/preroll_call_to_action.py +91 -0
  79. twitter_openapi_python_generated/models/preroll_media_info.py +118 -0
  80. twitter_openapi_python_generated/models/preroll_metadata.py +93 -0
  81. twitter_openapi_python_generated/models/preroll_video_variant.py +93 -0
  82. twitter_openapi_python_generated/models/rich_message_entity.py +6 -4
  83. twitter_openapi_python_generated/models/session.py +0 -7
  84. twitter_openapi_python_generated/models/sidebar_user_recommendation.py +95 -0
  85. twitter_openapi_python_generated/models/sidebar_user_recommendations_data.py +96 -0
  86. twitter_openapi_python_generated/models/sidebar_user_recommendations_response.py +102 -0
  87. twitter_openapi_python_generated/models/story_topic.py +95 -0
  88. twitter_openapi_python_generated/models/story_topic_data.py +93 -0
  89. twitter_openapi_python_generated/models/story_topic_item.py +93 -0
  90. twitter_openapi_python_generated/models/story_topic_response.py +102 -0
  91. twitter_openapi_python_generated/models/story_topic_stories.py +96 -0
  92. twitter_openapi_python_generated/models/timeline_general_context.py +2 -2
  93. twitter_openapi_python_generated/models/timeline_half_cover.py +0 -7
  94. twitter_openapi_python_generated/models/timeline_message_prompt_content.py +1 -8
  95. twitter_openapi_python_generated/models/timeline_notification.py +3 -3
  96. twitter_openapi_python_generated/models/timeline_prompt_content.py +1 -15
  97. twitter_openapi_python_generated/models/timeline_show_alert.py +1 -15
  98. twitter_openapi_python_generated/models/timeline_tombstone.py +1 -11
  99. twitter_openapi_python_generated/models/timeline_topic_context.py +1 -11
  100. twitter_openapi_python_generated/models/timeline_tweet.py +7 -1
  101. twitter_openapi_python_generated/models/tweet.py +10 -2
  102. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +8 -1
  103. twitter_openapi_python_generated/models/tweet_card_platform_audience.py +1 -8
  104. twitter_openapi_python_generated/models/tweet_legacy.py +18 -3
  105. twitter_openapi_python_generated/models/tweet_legacy_place.py +107 -0
  106. twitter_openapi_python_generated/models/tweet_legacy_place_bounding_box.py +98 -0
  107. twitter_openapi_python_generated/models/tweet_legacy_point.py +98 -0
  108. twitter_openapi_python_generated/models/tweet_post_cta.py +1 -9
  109. twitter_openapi_python_generated/models/tweet_sports_competitor.py +107 -0
  110. twitter_openapi_python_generated/models/tweet_sports_post_context.py +122 -0
  111. twitter_openapi_python_generated/models/tweet_sports_rest_id.py +97 -0
  112. twitter_openapi_python_generated/models/type_name.py +2 -0
  113. twitter_openapi_python_generated/models/unified_card.py +1 -8
  114. twitter_openapi_python_generated/models/user_highlights_tweets_result.py +2 -2
  115. twitter_openapi_python_generated/models/user_tweets_result_v1.py +2 -2
  116. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.4.dist-info}/METADATA +72 -2
  117. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.4.dist-info}/RECORD +121 -57
  118. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.4.dist-info}/WHEEL +1 -1
  119. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.4.dist-info}/licenses/LICENSE +0 -0
  120. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.4.dist-info}/licenses/LICENSE.AGPL +0 -0
  121. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,109 @@
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, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class AboutProfileUsernameChanges(BaseModel):
29
+ """
30
+ AboutProfileUsernameChanges
31
+ """ # noqa: E501
32
+ count: Annotated[str, Field(strict=True)]
33
+ last_changed_at_msec: Optional[Annotated[str, Field(strict=True)]] = None
34
+ __properties: ClassVar[List[str]] = ["count", "last_changed_at_msec"]
35
+
36
+ @field_validator('count', mode="before")
37
+ def count_validate_regular_expression(cls, value):
38
+ """Validates the regular expression"""
39
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
40
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
41
+ return value
42
+
43
+ @field_validator('last_changed_at_msec', mode="before")
44
+ def last_changed_at_msec_validate_regular_expression(cls, value):
45
+ """Validates the regular expression"""
46
+ if value is None:
47
+ return value
48
+
49
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
50
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
51
+ return value
52
+
53
+ model_config = ConfigDict(
54
+ validate_by_name=True,
55
+ validate_by_alias=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ return json.dumps(to_jsonable_python(self.to_dict()))
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of AboutProfileUsernameChanges from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([
85
+ ])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of AboutProfileUsernameChanges from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate({
104
+ "count": obj.get("count"),
105
+ "last_changed_at_msec": obj.get("last_changed_at_msec")
106
+ })
107
+ return _obj
108
+
109
+
@@ -31,11 +31,12 @@ class AdMetadataContainer(BaseModel):
31
31
  """ # noqa: E501
32
32
  destination_url_params: Optional[List[KeyValue]] = Field(default=None, alias="destinationUrlParams")
33
33
  is_quick_promote: StrictBool = Field(alias="isQuickPromote")
34
+ remove_promoted_attribution_for_preroll: Optional[StrictBool] = None
34
35
  render_legacy_website_card: StrictBool = Field(alias="renderLegacyWebsiteCard")
35
36
  render_sales_cta_website_card: StrictBool = Field(alias="renderSalesCtaWebsiteCard")
36
37
  show_overlay_on_first_card: Optional[StrictBool] = Field(default=None, alias="showOverlayOnFirstCard")
37
38
  unified_card_override: Optional[StrictStr] = Field(default=None, alias="unifiedCardOverride")
38
- __properties: ClassVar[List[str]] = ["destinationUrlParams", "isQuickPromote", "renderLegacyWebsiteCard", "renderSalesCtaWebsiteCard", "showOverlayOnFirstCard", "unifiedCardOverride"]
39
+ __properties: ClassVar[List[str]] = ["destinationUrlParams", "isQuickPromote", "remove_promoted_attribution_for_preroll", "renderLegacyWebsiteCard", "renderSalesCtaWebsiteCard", "showOverlayOnFirstCard", "unifiedCardOverride"]
39
40
 
40
41
  model_config = ConfigDict(
41
42
  validate_by_name=True,
@@ -96,6 +97,7 @@ class AdMetadataContainer(BaseModel):
96
97
  _obj = cls.model_validate({
97
98
  "destinationUrlParams": [KeyValue.from_dict(_item) for _item in obj["destinationUrlParams"]] if obj.get("destinationUrlParams") is not None else None,
98
99
  "isQuickPromote": obj.get("isQuickPromote"),
100
+ "remove_promoted_attribution_for_preroll": obj.get("remove_promoted_attribution_for_preroll"),
99
101
  "renderLegacyWebsiteCard": obj.get("renderLegacyWebsiteCard"),
100
102
  "renderSalesCtaWebsiteCard": obj.get("renderSalesCtaWebsiteCard"),
101
103
  "showOverlayOnFirstCard": obj.get("showOverlayOnFirstCard"),
@@ -0,0 +1,126 @@
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_extensions import Annotated
24
+ from twitter_openapi_python_generated.models.ai_trend_core import AiTrendCore
25
+ from twitter_openapi_python_generated.models.ai_trend_social_proof import AiTrendSocialProof
26
+ from twitter_openapi_python_generated.models.type_name import TypeName
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+ from pydantic_core import to_jsonable_python
30
+
31
+ class AiTrend(BaseModel):
32
+ """
33
+ AiTrend
34
+ """ # noqa: E501
35
+ typename: TypeName = Field(alias="__typename")
36
+ core: AiTrendCore
37
+ id: StrictStr
38
+ post_count: Annotated[str, Field(strict=True)]
39
+ rest_id: Annotated[str, Field(strict=True)]
40
+ social_proof: List[AiTrendSocialProof]
41
+ __properties: ClassVar[List[str]] = ["__typename", "core", "id", "post_count", "rest_id", "social_proof"]
42
+
43
+ @field_validator('post_count', mode="before")
44
+ def post_count_validate_regular_expression(cls, value):
45
+ """Validates the regular expression"""
46
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
47
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
48
+ return value
49
+
50
+ @field_validator('rest_id', mode="before")
51
+ def rest_id_validate_regular_expression(cls, value):
52
+ """Validates the regular expression"""
53
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
54
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
55
+ return value
56
+
57
+ model_config = ConfigDict(
58
+ validate_by_name=True,
59
+ validate_by_alias=True,
60
+ validate_assignment=True,
61
+ protected_namespaces=(),
62
+ )
63
+
64
+
65
+ def to_str(self) -> str:
66
+ """Returns the string representation of the model using alias"""
67
+ return pprint.pformat(self.model_dump(by_alias=True))
68
+
69
+ def to_json(self) -> str:
70
+ """Returns the JSON representation of the model using alias"""
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
72
+
73
+ @classmethod
74
+ def from_json(cls, json_str: str) -> Optional[Self]:
75
+ """Create an instance of AiTrend from a JSON string"""
76
+ return cls.from_dict(json.loads(json_str))
77
+
78
+ def to_dict(self) -> Dict[str, Any]:
79
+ """Return the dictionary representation of the model using alias.
80
+
81
+ This has the following differences from calling pydantic's
82
+ `self.model_dump(by_alias=True)`:
83
+
84
+ * `None` is only added to the output dict for nullable fields that
85
+ were set at model initialization. Other fields with value `None`
86
+ are ignored.
87
+ """
88
+ excluded_fields: Set[str] = set([
89
+ ])
90
+
91
+ _dict = self.model_dump(
92
+ by_alias=True,
93
+ exclude=excluded_fields,
94
+ exclude_none=True,
95
+ )
96
+ # override the default output from pydantic by calling `to_dict()` of core
97
+ if self.core:
98
+ _dict['core'] = self.core.to_dict()
99
+ # override the default output from pydantic by calling `to_dict()` of each item in social_proof (list)
100
+ _items = []
101
+ if self.social_proof:
102
+ for _item_social_proof in self.social_proof:
103
+ _items.append(_item_social_proof.to_dict() if _item_social_proof is not None else None)
104
+ _dict['social_proof'] = _items
105
+ return _dict
106
+
107
+ @classmethod
108
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
+ """Create an instance of AiTrend from a dict"""
110
+ if obj is None:
111
+ return None
112
+
113
+ if not isinstance(obj, dict):
114
+ return cls.model_validate(obj)
115
+
116
+ _obj = cls.model_validate({
117
+ "__typename": obj.get("__typename"),
118
+ "core": AiTrendCore.from_dict(obj["core"]) if obj.get("core") is not None else None,
119
+ "id": obj.get("id"),
120
+ "post_count": obj.get("post_count"),
121
+ "rest_id": obj.get("rest_id"),
122
+ "social_proof": [AiTrendSocialProof.from_dict(_item) for _item in obj["social_proof"]] if obj.get("social_proof") is not None else None
123
+ })
124
+ return _obj
125
+
126
+
@@ -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, StrictInt, 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 AiTrendCore(BaseModel):
28
+ """
29
+ AiTrendCore
30
+ """ # noqa: E501
31
+ category: StrictStr
32
+ created_at_ms: StrictInt
33
+ hook: StrictStr
34
+ name: StrictStr
35
+ __properties: ClassVar[List[str]] = ["category", "created_at_ms", "hook", "name"]
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 AiTrendCore 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
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of AiTrendCore from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "category": obj.get("category"),
89
+ "created_at_ms": obj.get("created_at_ms"),
90
+ "hook": obj.get("hook"),
91
+ "name": obj.get("name")
92
+ })
93
+ return _obj
94
+
95
+
@@ -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
23
+ from twitter_openapi_python_generated.models.ai_trend import AiTrend
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class AiTrendResults(BaseModel):
29
+ """
30
+ AiTrendResults
31
+ """ # noqa: E501
32
+ id: StrictStr
33
+ result: AiTrend
34
+ __properties: ClassVar[List[str]] = ["id", "result"]
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 AiTrendResults 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 result
76
+ if self.result:
77
+ _dict['result'] = self.result.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 AiTrendResults 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
+ "result": AiTrend.from_dict(obj["result"]) if obj.get("result") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,89 @@
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 AiTrendSocialProof(BaseModel):
28
+ """
29
+ AiTrendSocialProof
30
+ """ # noqa: E501
31
+ img_url: StrictStr
32
+ __properties: ClassVar[List[str]] = ["img_url"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of AiTrendSocialProof from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of AiTrendSocialProof from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "img_url": obj.get("img_url")
86
+ })
87
+ return _obj
88
+
89
+
@@ -0,0 +1,117 @@
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
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.article_content_block_data import ArticleContentBlockData
24
+ from twitter_openapi_python_generated.models.article_content_entity_range import ArticleContentEntityRange
25
+ from twitter_openapi_python_generated.models.article_content_inline_style_range import ArticleContentInlineStyleRange
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+ from pydantic_core import to_jsonable_python
29
+
30
+ class ArticleContentBlock(BaseModel):
31
+ """
32
+ ArticleContentBlock
33
+ """ # noqa: E501
34
+ data: ArticleContentBlockData
35
+ entity_ranges: List[ArticleContentEntityRange] = Field(alias="entityRanges")
36
+ inline_style_ranges: List[ArticleContentInlineStyleRange] = Field(alias="inlineStyleRanges")
37
+ key: StrictStr
38
+ text: StrictStr
39
+ type: StrictStr
40
+ __properties: ClassVar[List[str]] = ["data", "entityRanges", "inlineStyleRanges", "key", "text", "type"]
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 ArticleContentBlock 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 data
82
+ if self.data:
83
+ _dict['data'] = self.data.to_dict()
84
+ # override the default output from pydantic by calling `to_dict()` of each item in entity_ranges (list)
85
+ _items = []
86
+ if self.entity_ranges:
87
+ for _item_entity_ranges in self.entity_ranges:
88
+ _items.append(_item_entity_ranges.to_dict() if _item_entity_ranges is not None else None)
89
+ _dict['entityRanges'] = _items
90
+ # override the default output from pydantic by calling `to_dict()` of each item in inline_style_ranges (list)
91
+ _items = []
92
+ if self.inline_style_ranges:
93
+ for _item_inline_style_ranges in self.inline_style_ranges:
94
+ _items.append(_item_inline_style_ranges.to_dict() if _item_inline_style_ranges is not None else None)
95
+ _dict['inlineStyleRanges'] = _items
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of ArticleContentBlock from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "data": ArticleContentBlockData.from_dict(obj["data"]) if obj.get("data") is not None else None,
109
+ "entityRanges": [ArticleContentEntityRange.from_dict(_item) for _item in obj["entityRanges"]] if obj.get("entityRanges") is not None else None,
110
+ "inlineStyleRanges": [ArticleContentInlineStyleRange.from_dict(_item) for _item in obj["inlineStyleRanges"]] if obj.get("inlineStyleRanges") is not None else None,
111
+ "key": obj.get("key"),
112
+ "text": obj.get("text"),
113
+ "type": obj.get("type")
114
+ })
115
+ return _obj
116
+
117
+