twitter-openapi-python-generated 0.1.2__py3-none-any.whl → 0.1.3__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 (104) hide show
  1. twitter_openapi_python_generated/__init__.py +107 -1
  2. twitter_openapi_python_generated/api/default_api.py +1437 -199
  3. twitter_openapi_python_generated/api/user_api.py +301 -0
  4. twitter_openapi_python_generated/api/users_api.py +318 -0
  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 +53 -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/ai_trend.py +126 -0
  17. twitter_openapi_python_generated/models/ai_trend_core.py +95 -0
  18. twitter_openapi_python_generated/models/ai_trend_results.py +95 -0
  19. twitter_openapi_python_generated/models/ai_trend_social_proof.py +89 -0
  20. twitter_openapi_python_generated/models/article_content_block.py +117 -0
  21. twitter_openapi_python_generated/models/article_content_block_data.py +104 -0
  22. twitter_openapi_python_generated/models/article_content_entity.py +95 -0
  23. twitter_openapi_python_generated/models/article_content_entity_data.py +115 -0
  24. twitter_openapi_python_generated/models/article_content_entity_range.py +93 -0
  25. twitter_openapi_python_generated/models/article_content_entity_value.py +104 -0
  26. twitter_openapi_python_generated/models/article_content_inline_style_range.py +100 -0
  27. twitter_openapi_python_generated/models/article_content_media_item.py +101 -0
  28. twitter_openapi_python_generated/models/article_content_state.py +105 -0
  29. twitter_openapi_python_generated/models/article_content_text_range.py +93 -0
  30. twitter_openapi_python_generated/models/article_result.py +9 -3
  31. twitter_openapi_python_generated/models/audio_space.py +107 -0
  32. twitter_openapi_python_generated/models/audio_space_data.py +93 -0
  33. twitter_openapi_python_generated/models/audio_space_mentioned_user.py +97 -0
  34. twitter_openapi_python_generated/models/audio_space_metadata.py +165 -0
  35. twitter_openapi_python_generated/models/audio_space_participant.py +109 -0
  36. twitter_openapi_python_generated/models/audio_space_participant_user.py +104 -0
  37. twitter_openapi_python_generated/models/audio_space_participant_user_results.py +103 -0
  38. twitter_openapi_python_generated/models/audio_space_participant_verification.py +99 -0
  39. twitter_openapi_python_generated/models/audio_space_participants.py +114 -0
  40. twitter_openapi_python_generated/models/audio_space_response.py +102 -0
  41. twitter_openapi_python_generated/models/audio_space_sharings.py +91 -0
  42. twitter_openapi_python_generated/models/birdwatch_pivot.py +0 -17
  43. twitter_openapi_python_generated/models/broadcast.py +159 -0
  44. twitter_openapi_python_generated/models/broadcast_data.py +93 -0
  45. twitter_openapi_python_generated/models/broadcast_edited_replay.py +89 -0
  46. twitter_openapi_python_generated/models/broadcast_periscope_user.py +95 -0
  47. twitter_openapi_python_generated/models/broadcast_response.py +102 -0
  48. twitter_openapi_python_generated/models/cashtag_attachment.py +6 -4
  49. twitter_openapi_python_generated/models/community.py +2 -2
  50. twitter_openapi_python_generated/models/community_delete_action_result.py +1 -8
  51. twitter_openapi_python_generated/models/community_invites_result.py +1 -8
  52. twitter_openapi_python_generated/models/community_join_action_unavailable.py +1 -8
  53. twitter_openapi_python_generated/models/community_leave_action_result.py +1 -8
  54. twitter_openapi_python_generated/models/conversation_control.py +8 -1
  55. twitter_openapi_python_generated/models/conversation_details.py +1 -8
  56. twitter_openapi_python_generated/models/cover_cta.py +5 -15
  57. twitter_openapi_python_generated/models/cta_client_event_info.py +1 -8
  58. twitter_openapi_python_generated/models/cta_limited_action_prompt.py +1 -8
  59. twitter_openapi_python_generated/models/feedback_action.py +1 -21
  60. twitter_openapi_python_generated/models/grok_account_jwt.py +89 -0
  61. twitter_openapi_python_generated/models/grok_account_jwt_data.py +93 -0
  62. twitter_openapi_python_generated/models/grok_account_jwt_response.py +102 -0
  63. twitter_openapi_python_generated/models/grok_entity_ref.py +19 -4
  64. twitter_openapi_python_generated/models/grok_image_annotation.py +2 -2
  65. twitter_openapi_python_generated/models/identity_profile_labels_highlighted_label.py +93 -0
  66. twitter_openapi_python_generated/models/limited_action.py +8 -1
  67. twitter_openapi_python_generated/models/limited_action_results_data.py +8 -1
  68. twitter_openapi_python_generated/models/media_result.py +1 -1
  69. twitter_openapi_python_generated/models/module_header.py +8 -9
  70. twitter_openapi_python_generated/models/note_tweet_result_data.py +2 -2
  71. twitter_openapi_python_generated/models/session.py +0 -7
  72. twitter_openapi_python_generated/models/sidebar_user_recommendation.py +95 -0
  73. twitter_openapi_python_generated/models/sidebar_user_recommendations_data.py +96 -0
  74. twitter_openapi_python_generated/models/sidebar_user_recommendations_response.py +102 -0
  75. twitter_openapi_python_generated/models/story_topic.py +95 -0
  76. twitter_openapi_python_generated/models/story_topic_data.py +93 -0
  77. twitter_openapi_python_generated/models/story_topic_item.py +93 -0
  78. twitter_openapi_python_generated/models/story_topic_response.py +102 -0
  79. twitter_openapi_python_generated/models/story_topic_stories.py +96 -0
  80. twitter_openapi_python_generated/models/timeline_general_context.py +2 -2
  81. twitter_openapi_python_generated/models/timeline_half_cover.py +0 -7
  82. twitter_openapi_python_generated/models/timeline_message_prompt_content.py +1 -8
  83. twitter_openapi_python_generated/models/timeline_prompt_content.py +1 -15
  84. twitter_openapi_python_generated/models/timeline_show_alert.py +1 -15
  85. twitter_openapi_python_generated/models/timeline_tombstone.py +1 -11
  86. twitter_openapi_python_generated/models/timeline_topic_context.py +1 -11
  87. twitter_openapi_python_generated/models/tweet.py +4 -2
  88. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +8 -1
  89. twitter_openapi_python_generated/models/tweet_card_platform_audience.py +1 -8
  90. twitter_openapi_python_generated/models/tweet_legacy.py +18 -3
  91. twitter_openapi_python_generated/models/tweet_legacy_place.py +107 -0
  92. twitter_openapi_python_generated/models/tweet_legacy_place_bounding_box.py +98 -0
  93. twitter_openapi_python_generated/models/tweet_legacy_point.py +98 -0
  94. twitter_openapi_python_generated/models/tweet_post_cta.py +1 -9
  95. twitter_openapi_python_generated/models/type_name.py +1 -0
  96. twitter_openapi_python_generated/models/unified_card.py +1 -8
  97. twitter_openapi_python_generated/models/user_highlights_tweets_result.py +2 -2
  98. twitter_openapi_python_generated/models/user_tweets_result_v1.py +2 -2
  99. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/METADATA +61 -2
  100. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/RECORD +104 -51
  101. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/WHEEL +0 -0
  102. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/licenses/LICENSE +0 -0
  103. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/licenses/LICENSE.AGPL +0 -0
  104. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/top_level.txt +0 -0
@@ -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
+
@@ -0,0 +1,104 @@
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.article_content_text_range import ArticleContentTextRange
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class ArticleContentBlockData(BaseModel):
29
+ """
30
+ ArticleContentBlockData
31
+ """ # noqa: E501
32
+ mentions: Optional[List[ArticleContentTextRange]] = None
33
+ urls: Optional[List[ArticleContentTextRange]] = None
34
+ __properties: ClassVar[List[str]] = ["mentions", "urls"]
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 ArticleContentBlockData 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 each item in mentions (list)
76
+ _items = []
77
+ if self.mentions:
78
+ for _item_mentions in self.mentions:
79
+ _items.append(_item_mentions.to_dict() if _item_mentions is not None else None)
80
+ _dict['mentions'] = _items
81
+ # override the default output from pydantic by calling `to_dict()` of each item in urls (list)
82
+ _items = []
83
+ if self.urls:
84
+ for _item_urls in self.urls:
85
+ _items.append(_item_urls.to_dict() if _item_urls is not None else None)
86
+ _dict['urls'] = _items
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of ArticleContentBlockData 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
+ "mentions": [ArticleContentTextRange.from_dict(_item) for _item in obj["mentions"]] if obj.get("mentions") is not None else None,
100
+ "urls": [ArticleContentTextRange.from_dict(_item) for _item in obj["urls"]] if obj.get("urls") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -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.article_content_entity_value import ArticleContentEntityValue
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class ArticleContentEntity(BaseModel):
29
+ """
30
+ ArticleContentEntity
31
+ """ # noqa: E501
32
+ key: StrictStr
33
+ value: ArticleContentEntityValue
34
+ __properties: ClassVar[List[str]] = ["key", "value"]
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 ArticleContentEntity 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 value
76
+ if self.value:
77
+ _dict['value'] = self.value.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 ArticleContentEntity 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
+ "key": obj.get("key"),
91
+ "value": ArticleContentEntityValue.from_dict(obj["value"]) if obj.get("value") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,115 @@
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, Optional
23
+ from typing_extensions import Annotated
24
+ from twitter_openapi_python_generated.models.article_content_media_item import ArticleContentMediaItem
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class ArticleContentEntityData(BaseModel):
30
+ """
31
+ ArticleContentEntityData
32
+ """ # noqa: E501
33
+ caption: Optional[StrictStr] = None
34
+ entity_key: Optional[StrictStr] = Field(default=None, alias="entityKey")
35
+ media_items: Optional[List[ArticleContentMediaItem]] = Field(default=None, alias="mediaItems")
36
+ tweet_id: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="tweetId")
37
+ url: Optional[StrictStr] = None
38
+ __properties: ClassVar[List[str]] = ["caption", "entityKey", "mediaItems", "tweetId", "url"]
39
+
40
+ @field_validator('tweet_id', mode="before")
41
+ def tweet_id_validate_regular_expression(cls, value):
42
+ """Validates the regular expression"""
43
+ if value is None:
44
+ return value
45
+
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
+ model_config = ConfigDict(
51
+ validate_by_name=True,
52
+ validate_by_alias=True,
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+
58
+ def to_str(self) -> str:
59
+ """Returns the string representation of the model using alias"""
60
+ return pprint.pformat(self.model_dump(by_alias=True))
61
+
62
+ def to_json(self) -> str:
63
+ """Returns the JSON representation of the model using alias"""
64
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
+
66
+ @classmethod
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
68
+ """Create an instance of ArticleContentEntityData from a JSON string"""
69
+ return cls.from_dict(json.loads(json_str))
70
+
71
+ def to_dict(self) -> Dict[str, Any]:
72
+ """Return the dictionary representation of the model using alias.
73
+
74
+ This has the following differences from calling pydantic's
75
+ `self.model_dump(by_alias=True)`:
76
+
77
+ * `None` is only added to the output dict for nullable fields that
78
+ were set at model initialization. Other fields with value `None`
79
+ are ignored.
80
+ """
81
+ excluded_fields: Set[str] = set([
82
+ ])
83
+
84
+ _dict = self.model_dump(
85
+ by_alias=True,
86
+ exclude=excluded_fields,
87
+ exclude_none=True,
88
+ )
89
+ # override the default output from pydantic by calling `to_dict()` of each item in media_items (list)
90
+ _items = []
91
+ if self.media_items:
92
+ for _item_media_items in self.media_items:
93
+ _items.append(_item_media_items.to_dict() if _item_media_items is not None else None)
94
+ _dict['mediaItems'] = _items
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of ArticleContentEntityData from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "caption": obj.get("caption"),
108
+ "entityKey": obj.get("entityKey"),
109
+ "mediaItems": [ArticleContentMediaItem.from_dict(_item) for _item in obj["mediaItems"]] if obj.get("mediaItems") is not None else None,
110
+ "tweetId": obj.get("tweetId"),
111
+ "url": obj.get("url")
112
+ })
113
+ return _obj
114
+
115
+
@@ -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, StrictInt
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 ArticleContentEntityRange(BaseModel):
28
+ """
29
+ ArticleContentEntityRange
30
+ """ # noqa: E501
31
+ key: StrictInt
32
+ length: StrictInt
33
+ offset: StrictInt
34
+ __properties: ClassVar[List[str]] = ["key", "length", "offset"]
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 ArticleContentEntityRange 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 ArticleContentEntityRange 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
+ "key": obj.get("key"),
88
+ "length": obj.get("length"),
89
+ "offset": obj.get("offset")
90
+ })
91
+ return _obj
92
+
93
+