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,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, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.notification_urt_endpoint_options import NotificationUrtEndpointOptions
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class NotificationUrl(BaseModel):
29
+ """
30
+ NotificationUrl
31
+ """ # noqa: E501
32
+ url: StrictStr
33
+ url_type: StrictStr = Field(alias="urlType")
34
+ urt_endpoint_options: Optional[NotificationUrtEndpointOptions] = Field(default=None, alias="urtEndpointOptions")
35
+ __properties: ClassVar[List[str]] = ["url", "urlType", "urtEndpointOptions"]
36
+
37
+ @field_validator('url_type')
38
+ def url_type_validate_enum(cls, value):
39
+ """Validates the enum"""
40
+ if value not in set(['ExternalUrl', 'UrtEndpoint']):
41
+ raise ValueError("must be one of enum values ('ExternalUrl', 'UrtEndpoint')")
42
+ return value
43
+
44
+ model_config = ConfigDict(
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of NotificationUrl from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ ])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # override the default output from pydantic by calling `to_dict()` of urt_endpoint_options
84
+ if self.urt_endpoint_options:
85
+ _dict['urtEndpointOptions'] = self.urt_endpoint_options.to_dict()
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of NotificationUrl from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "url": obj.get("url"),
99
+ "urlType": obj.get("urlType"),
100
+ "urtEndpointOptions": NotificationUrtEndpointOptions.from_dict(obj["urtEndpointOptions"]) if obj.get("urtEndpointOptions") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -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, Field, 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 NotificationUrtEndpointOptions(BaseModel):
28
+ """
29
+ NotificationUrtEndpointOptions
30
+ """ # noqa: E501
31
+ cache_id: StrictStr = Field(alias="cacheId")
32
+ subtitle: StrictStr
33
+ title: StrictStr
34
+ __properties: ClassVar[List[str]] = ["cacheId", "subtitle", "title"]
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 NotificationUrtEndpointOptions 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 NotificationUrtEndpointOptions 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
+ "cacheId": obj.get("cacheId"),
88
+ "subtitle": obj.get("subtitle"),
89
+ "title": obj.get("title")
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.preroll_media_info import PrerollMediaInfo
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class Preroll(BaseModel):
29
+ """
30
+ Preroll
31
+ """ # noqa: E501
32
+ dynamic_preroll_type: StrictStr = Field(alias="dynamicPrerollType")
33
+ media_info: PrerollMediaInfo = Field(alias="mediaInfo")
34
+ preroll_id: StrictStr = Field(alias="prerollId")
35
+ __properties: ClassVar[List[str]] = ["dynamicPrerollType", "mediaInfo", "prerollId"]
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 Preroll 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 media_info
77
+ if self.media_info:
78
+ _dict['mediaInfo'] = self.media_info.to_dict()
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of Preroll from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "dynamicPrerollType": obj.get("dynamicPrerollType"),
92
+ "mediaInfo": PrerollMediaInfo.from_dict(obj["mediaInfo"]) if obj.get("mediaInfo") is not None else None,
93
+ "prerollId": obj.get("prerollId")
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, 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 PrerollCallToAction(BaseModel):
28
+ """
29
+ PrerollCallToAction
30
+ """ # noqa: E501
31
+ call_to_action_type: StrictStr = Field(alias="callToActionType")
32
+ url: StrictStr
33
+ __properties: ClassVar[List[str]] = ["callToActionType", "url"]
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 PrerollCallToAction from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of PrerollCallToAction from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "callToActionType": obj.get("callToActionType"),
87
+ "url": obj.get("url")
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,118 @@
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, StrictBool, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.preroll_call_to_action import PrerollCallToAction
24
+ from twitter_openapi_python_generated.models.preroll_video_variant import PrerollVideoVariant
25
+ from twitter_openapi_python_generated.models.user_results import UserResults
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+ from pydantic_core import to_jsonable_python
29
+
30
+ class PrerollMediaInfo(BaseModel):
31
+ """
32
+ PrerollMediaInfo
33
+ """ # noqa: E501
34
+ advertiser_name: StrictStr = Field(alias="advertiserName")
35
+ advertiser_profile_image_url: StrictStr = Field(alias="advertiserProfileImageUrl")
36
+ call_to_action: PrerollCallToAction = Field(alias="callToAction")
37
+ duration_millis: StrictInt = Field(alias="durationMillis")
38
+ publisher_results: UserResults = Field(alias="publisherResults")
39
+ render_ad_by_advertiser_name: StrictBool = Field(alias="renderAdByAdvertiserName")
40
+ uuid: StrictStr
41
+ video_variants: List[PrerollVideoVariant] = Field(alias="videoVariants")
42
+ __properties: ClassVar[List[str]] = ["advertiserName", "advertiserProfileImageUrl", "callToAction", "durationMillis", "publisherResults", "renderAdByAdvertiserName", "uuid", "videoVariants"]
43
+
44
+ model_config = ConfigDict(
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of PrerollMediaInfo from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ ])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # override the default output from pydantic by calling `to_dict()` of call_to_action
84
+ if self.call_to_action:
85
+ _dict['callToAction'] = self.call_to_action.to_dict()
86
+ # override the default output from pydantic by calling `to_dict()` of publisher_results
87
+ if self.publisher_results:
88
+ _dict['publisherResults'] = self.publisher_results.to_dict()
89
+ # override the default output from pydantic by calling `to_dict()` of each item in video_variants (list)
90
+ _items = []
91
+ if self.video_variants:
92
+ for _item_video_variants in self.video_variants:
93
+ _items.append(_item_video_variants.to_dict() if _item_video_variants is not None else None)
94
+ _dict['videoVariants'] = _items
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of PrerollMediaInfo 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
+ "advertiserName": obj.get("advertiserName"),
108
+ "advertiserProfileImageUrl": obj.get("advertiserProfileImageUrl"),
109
+ "callToAction": PrerollCallToAction.from_dict(obj["callToAction"]) if obj.get("callToAction") is not None else None,
110
+ "durationMillis": obj.get("durationMillis"),
111
+ "publisherResults": UserResults.from_dict(obj["publisherResults"]) if obj.get("publisherResults") is not None else None,
112
+ "renderAdByAdvertiserName": obj.get("renderAdByAdvertiserName"),
113
+ "uuid": obj.get("uuid"),
114
+ "videoVariants": [PrerollVideoVariant.from_dict(_item) for _item in obj["videoVariants"]] if obj.get("videoVariants") is not None else None
115
+ })
116
+ return _obj
117
+
118
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.preroll import Preroll
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class PrerollMetadata(BaseModel):
29
+ """
30
+ PrerollMetadata
31
+ """ # noqa: E501
32
+ preroll: Preroll
33
+ __properties: ClassVar[List[str]] = ["preroll"]
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 PrerollMetadata 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 preroll
75
+ if self.preroll:
76
+ _dict['preroll'] = self.preroll.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of PrerollMetadata from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "preroll": Preroll.from_dict(obj["preroll"]) if obj.get("preroll") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -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, Field, 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 PrerollVideoVariant(BaseModel):
28
+ """
29
+ PrerollVideoVariant
30
+ """ # noqa: E501
31
+ bitrate: StrictInt
32
+ content_type: StrictStr = Field(alias="contentType")
33
+ url: StrictStr
34
+ __properties: ClassVar[List[str]] = ["bitrate", "contentType", "url"]
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 PrerollVideoVariant 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 PrerollVideoVariant 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
+ "bitrate": obj.get("bitrate"),
88
+ "contentType": obj.get("contentType"),
89
+ "url": obj.get("url")
90
+ })
91
+ return _obj
92
+
93
+