twitter-openapi-python-generated 0.1.3__py3-none-any.whl → 0.1.5__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.
- twitter_openapi_python_generated/__init__.py +23 -1
- twitter_openapi_python_generated/api/user_api.py +9 -6
- twitter_openapi_python_generated/api/users_api.py +9 -6
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +11 -0
- twitter_openapi_python_generated/models/ad_metadata_container.py +3 -1
- twitter_openapi_python_generated/models/click_tracking_info.py +7 -3
- twitter_openapi_python_generated/models/feedback_client_event_info.py +2 -2
- twitter_openapi_python_generated/models/notification_additional_context.py +94 -0
- twitter_openapi_python_generated/models/notification_template.py +10 -2
- twitter_openapi_python_generated/models/notification_url.py +104 -0
- twitter_openapi_python_generated/models/notification_urt_endpoint_options.py +93 -0
- twitter_openapi_python_generated/models/preroll.py +97 -0
- twitter_openapi_python_generated/models/preroll_call_to_action.py +91 -0
- twitter_openapi_python_generated/models/preroll_media_info.py +118 -0
- twitter_openapi_python_generated/models/preroll_metadata.py +93 -0
- twitter_openapi_python_generated/models/preroll_video_variant.py +93 -0
- twitter_openapi_python_generated/models/rich_message_entity.py +6 -4
- twitter_openapi_python_generated/models/timeline_notification.py +3 -3
- twitter_openapi_python_generated/models/timeline_tweet.py +7 -1
- twitter_openapi_python_generated/models/tweet.py +7 -1
- twitter_openapi_python_generated/models/tweet_sports_competitor.py +107 -0
- twitter_openapi_python_generated/models/tweet_sports_post_context.py +122 -0
- twitter_openapi_python_generated/models/tweet_sports_rest_id.py +97 -0
- twitter_openapi_python_generated/models/type_name.py +1 -0
- twitter_openapi_python_generated/models/user_label_mention_user.py +6 -3
- {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/METADATA +13 -2
- {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/RECORD +33 -22
- {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/licenses/LICENSE +0 -0
- {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/licenses/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/top_level.txt +0 -0
|
@@ -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
|
+
|
|
@@ -18,8 +18,8 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from twitter_openapi_python_generated.models.rich_message_entity_ref import RichMessageEntityRef
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
@@ -29,10 +29,11 @@ class RichMessageEntity(BaseModel):
|
|
|
29
29
|
"""
|
|
30
30
|
RichMessageEntity
|
|
31
31
|
""" # noqa: E501
|
|
32
|
+
format: Optional[StrictStr] = None
|
|
32
33
|
from_index: StrictInt = Field(alias="fromIndex")
|
|
33
|
-
ref: RichMessageEntityRef
|
|
34
|
+
ref: Optional[RichMessageEntityRef] = None
|
|
34
35
|
to_index: StrictInt = Field(alias="toIndex")
|
|
35
|
-
__properties: ClassVar[List[str]] = ["fromIndex", "ref", "toIndex"]
|
|
36
|
+
__properties: ClassVar[List[str]] = ["format", "fromIndex", "ref", "toIndex"]
|
|
36
37
|
|
|
37
38
|
model_config = ConfigDict(
|
|
38
39
|
validate_by_name=True,
|
|
@@ -88,6 +89,7 @@ class RichMessageEntity(BaseModel):
|
|
|
88
89
|
return cls.model_validate(obj)
|
|
89
90
|
|
|
90
91
|
_obj = cls.model_validate({
|
|
92
|
+
"format": obj.get("format"),
|
|
91
93
|
"fromIndex": obj.get("fromIndex"),
|
|
92
94
|
"ref": RichMessageEntityRef.from_dict(obj["ref"]) if obj.get("ref") is not None else None,
|
|
93
95
|
"toIndex": obj.get("toIndex")
|
|
@@ -22,8 +22,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
23
|
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
24
|
from twitter_openapi_python_generated.models.notification_template import NotificationTemplate
|
|
25
|
+
from twitter_openapi_python_generated.models.notification_url import NotificationUrl
|
|
25
26
|
from twitter_openapi_python_generated.models.rich_message import RichMessage
|
|
26
|
-
from twitter_openapi_python_generated.models.social_context_landing_url import SocialContextLandingUrl
|
|
27
27
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
28
28
|
from typing import Optional, Set
|
|
29
29
|
from typing_extensions import Self
|
|
@@ -37,7 +37,7 @@ class TimelineNotification(BaseModel):
|
|
|
37
37
|
id: StrictStr
|
|
38
38
|
item_type: ContentItemType = Field(alias="itemType")
|
|
39
39
|
notification_icon: StrictStr
|
|
40
|
-
notification_url:
|
|
40
|
+
notification_url: NotificationUrl
|
|
41
41
|
rich_message: RichMessage
|
|
42
42
|
template: NotificationTemplate
|
|
43
43
|
timestamp_ms: StrictStr
|
|
@@ -107,7 +107,7 @@ class TimelineNotification(BaseModel):
|
|
|
107
107
|
"id": obj.get("id"),
|
|
108
108
|
"itemType": obj.get("itemType"),
|
|
109
109
|
"notification_icon": obj.get("notification_icon"),
|
|
110
|
-
"notification_url":
|
|
110
|
+
"notification_url": NotificationUrl.from_dict(obj["notification_url"]) if obj.get("notification_url") is not None else None,
|
|
111
111
|
"rich_message": RichMessage.from_dict(obj["rich_message"]) if obj.get("rich_message") is not None else None,
|
|
112
112
|
"template": NotificationTemplate.from_dict(obj["template"]) if obj.get("template") is not None else None,
|
|
113
113
|
"timestamp_ms": obj.get("timestamp_ms")
|
|
@@ -23,6 +23,7 @@ from typing import Any, ClassVar, Dict, List, Optional
|
|
|
23
23
|
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
24
24
|
from twitter_openapi_python_generated.models.highlight import Highlight
|
|
25
25
|
from twitter_openapi_python_generated.models.item_result import ItemResult
|
|
26
|
+
from twitter_openapi_python_generated.models.preroll_metadata import PrerollMetadata
|
|
26
27
|
from twitter_openapi_python_generated.models.promoted_metadata import PromotedMetadata
|
|
27
28
|
from twitter_openapi_python_generated.models.social_context_union import SocialContextUnion
|
|
28
29
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
@@ -38,11 +39,12 @@ class TimelineTweet(BaseModel):
|
|
|
38
39
|
has_moderated_replies: Optional[StrictBool] = Field(default=None, alias="hasModeratedReplies")
|
|
39
40
|
highlights: Optional[Highlight] = None
|
|
40
41
|
item_type: ContentItemType = Field(alias="itemType")
|
|
42
|
+
preroll_metadata: Optional[PrerollMetadata] = Field(default=None, alias="prerollMetadata")
|
|
41
43
|
promoted_metadata: Optional[PromotedMetadata] = Field(default=None, alias="promotedMetadata")
|
|
42
44
|
social_context: Optional[SocialContextUnion] = Field(default=None, alias="socialContext")
|
|
43
45
|
tweet_display_type: StrictStr = Field(alias="tweetDisplayType")
|
|
44
46
|
tweet_results: ItemResult
|
|
45
|
-
__properties: ClassVar[List[str]] = ["__typename", "hasModeratedReplies", "highlights", "itemType", "promotedMetadata", "socialContext", "tweetDisplayType", "tweet_results"]
|
|
47
|
+
__properties: ClassVar[List[str]] = ["__typename", "hasModeratedReplies", "highlights", "itemType", "prerollMetadata", "promotedMetadata", "socialContext", "tweetDisplayType", "tweet_results"]
|
|
46
48
|
|
|
47
49
|
@field_validator('tweet_display_type')
|
|
48
50
|
def tweet_display_type_validate_enum(cls, value):
|
|
@@ -93,6 +95,9 @@ class TimelineTweet(BaseModel):
|
|
|
93
95
|
# override the default output from pydantic by calling `to_dict()` of highlights
|
|
94
96
|
if self.highlights:
|
|
95
97
|
_dict['highlights'] = self.highlights.to_dict()
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of preroll_metadata
|
|
99
|
+
if self.preroll_metadata:
|
|
100
|
+
_dict['prerollMetadata'] = self.preroll_metadata.to_dict()
|
|
96
101
|
# override the default output from pydantic by calling `to_dict()` of promoted_metadata
|
|
97
102
|
if self.promoted_metadata:
|
|
98
103
|
_dict['promotedMetadata'] = self.promoted_metadata.to_dict()
|
|
@@ -118,6 +123,7 @@ class TimelineTweet(BaseModel):
|
|
|
118
123
|
"hasModeratedReplies": obj.get("hasModeratedReplies"),
|
|
119
124
|
"highlights": Highlight.from_dict(obj["highlights"]) if obj.get("highlights") is not None else None,
|
|
120
125
|
"itemType": obj.get("itemType"),
|
|
126
|
+
"prerollMetadata": PrerollMetadata.from_dict(obj["prerollMetadata"]) if obj.get("prerollMetadata") is not None else None,
|
|
121
127
|
"promotedMetadata": PromotedMetadata.from_dict(obj["promotedMetadata"]) if obj.get("promotedMetadata") is not None else None,
|
|
122
128
|
"socialContext": SocialContextUnion.from_dict(obj["socialContext"]) if obj.get("socialContext") is not None else None,
|
|
123
129
|
"tweetDisplayType": obj.get("tweetDisplayType"),
|
|
@@ -39,6 +39,7 @@ from twitter_openapi_python_generated.models.tweet_edit_control import TweetEdit
|
|
|
39
39
|
from twitter_openapi_python_generated.models.tweet_edit_prespective import TweetEditPrespective
|
|
40
40
|
from twitter_openapi_python_generated.models.tweet_post_cta import TweetPostCta
|
|
41
41
|
from twitter_openapi_python_generated.models.tweet_previous_counts import TweetPreviousCounts
|
|
42
|
+
from twitter_openapi_python_generated.models.tweet_sports_post_context import TweetSportsPostContext
|
|
42
43
|
from twitter_openapi_python_generated.models.tweet_view import TweetView
|
|
43
44
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
44
45
|
from twitter_openapi_python_generated.models.unified_card import UnifiedCard
|
|
@@ -83,13 +84,14 @@ class Tweet(BaseModel):
|
|
|
83
84
|
quoted_status_result: Optional[ItemResult] = None
|
|
84
85
|
rest_id: Annotated[str, Field(strict=True)]
|
|
85
86
|
source: Optional[StrictStr] = None
|
|
87
|
+
sports_post_context: Optional[TweetSportsPostContext] = None
|
|
86
88
|
super_follows_reply_user_result: Optional[SuperFollowsReplyUserResult] = Field(default=None, alias="superFollowsReplyUserResult")
|
|
87
89
|
trend_results: Optional[TrendResults] = None
|
|
88
90
|
unified_card: Optional[UnifiedCard] = None
|
|
89
91
|
unmention_data: Optional[Dict[str, Any]] = None
|
|
90
92
|
views: Optional[TweetView] = None
|
|
91
93
|
voice_info: Optional[Dict[str, Any]] = Field(default=None, alias="voiceInfo")
|
|
92
|
-
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "cashtag_attachments", "community_relationship", "community_results", "content_disclosure", "core", "edit_control", "edit_prespective", "grok_analysis_button", "grok_analysis_followups", "grok_annotations", "grok_share_attachment", "grok_translated_post_with_availability", "has_birdwatch_notes", "is_translatable", "jetfuel_attachment", "legacy", "nested_quoted_tweet_results", "note_tweet", "postCta", "post_image_description", "post_video_description", "previous_counts", "quick_promote_eligibility", "quotedRefResult", "quoted_status_result", "rest_id", "source", "superFollowsReplyUserResult", "trend_results", "unified_card", "unmention_data", "views", "voiceInfo"]
|
|
94
|
+
__properties: ClassVar[List[str]] = ["__typename", "article", "author_community_relationship", "birdwatch_pivot", "card", "cashtag_attachments", "community_relationship", "community_results", "content_disclosure", "core", "edit_control", "edit_prespective", "grok_analysis_button", "grok_analysis_followups", "grok_annotations", "grok_share_attachment", "grok_translated_post_with_availability", "has_birdwatch_notes", "is_translatable", "jetfuel_attachment", "legacy", "nested_quoted_tweet_results", "note_tweet", "postCta", "post_image_description", "post_video_description", "previous_counts", "quick_promote_eligibility", "quotedRefResult", "quoted_status_result", "rest_id", "source", "sports_post_context", "superFollowsReplyUserResult", "trend_results", "unified_card", "unmention_data", "views", "voiceInfo"]
|
|
93
95
|
|
|
94
96
|
@field_validator('rest_id', mode="before")
|
|
95
97
|
def rest_id_validate_regular_expression(cls, value):
|
|
@@ -206,6 +208,9 @@ class Tweet(BaseModel):
|
|
|
206
208
|
# override the default output from pydantic by calling `to_dict()` of quoted_status_result
|
|
207
209
|
if self.quoted_status_result:
|
|
208
210
|
_dict['quoted_status_result'] = self.quoted_status_result.to_dict()
|
|
211
|
+
# override the default output from pydantic by calling `to_dict()` of sports_post_context
|
|
212
|
+
if self.sports_post_context:
|
|
213
|
+
_dict['sports_post_context'] = self.sports_post_context.to_dict()
|
|
209
214
|
# override the default output from pydantic by calling `to_dict()` of super_follows_reply_user_result
|
|
210
215
|
if self.super_follows_reply_user_result:
|
|
211
216
|
_dict['superFollowsReplyUserResult'] = self.super_follows_reply_user_result.to_dict()
|
|
@@ -262,6 +267,7 @@ class Tweet(BaseModel):
|
|
|
262
267
|
"quoted_status_result": ItemResult.from_dict(obj["quoted_status_result"]) if obj.get("quoted_status_result") is not None else None,
|
|
263
268
|
"rest_id": obj.get("rest_id"),
|
|
264
269
|
"source": obj.get("source"),
|
|
270
|
+
"sports_post_context": TweetSportsPostContext.from_dict(obj["sports_post_context"]) if obj.get("sports_post_context") is not None else None,
|
|
265
271
|
"superFollowsReplyUserResult": SuperFollowsReplyUserResult.from_dict(obj["superFollowsReplyUserResult"]) if obj.get("superFollowsReplyUserResult") is not None else None,
|
|
266
272
|
"trend_results": TrendResults.from_dict(obj["trend_results"]) if obj.get("trend_results") is not None else None,
|
|
267
273
|
"unified_card": UnifiedCard.from_dict(obj["unified_card"]) if obj.get("unified_card") is not None else None,
|