twitter-openapi-python-generated 0.0.27__py3-none-any.whl → 0.0.28__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 +11 -1
- twitter_openapi_python_generated/api/tweet_api.py +17 -0
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +10 -0
- twitter_openapi_python_generated/models/community_data.py +24 -15
- twitter_openapi_python_generated/models/grok_share_attachment.py +96 -0
- twitter_openapi_python_generated/models/grok_share_attachment_item.py +90 -0
- twitter_openapi_python_generated/models/limited_action_results_data.py +95 -0
- twitter_openapi_python_generated/models/timeline_tweet.py +4 -2
- twitter_openapi_python_generated/models/trend_results.py +96 -0
- twitter_openapi_python_generated/models/tweet.py +15 -1
- twitter_openapi_python_generated/models/tweet_limited_action_results.py +96 -0
- twitter_openapi_python_generated/models/tweet_preview_display.py +107 -0
- twitter_openapi_python_generated/models/tweet_preview_display_cta.py +94 -0
- twitter_openapi_python_generated/models/tweet_preview_display_cta_url.py +97 -0
- twitter_openapi_python_generated/models/tweet_preview_display_tweet.py +131 -0
- twitter_openapi_python_generated/models/tweet_preview_display_tweet_view_count.py +96 -0
- twitter_openapi_python_generated/models/tweet_union.py +27 -8
- twitter_openapi_python_generated/models/type_name.py +1 -0
- twitter_openapi_python_generated/models/user.py +3 -1
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/METADATA +6 -6
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/RECORD +27 -17
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/WHEEL +1 -1
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/LICENSE +0 -0
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.0.27.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/top_level.txt +0 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
""" # noqa: E501
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
__version__ = "0.0.
|
|
18
|
+
__version__ = "0.0.28"
|
|
19
19
|
|
|
20
20
|
# import apis into sdk package
|
|
21
21
|
from twitter_openapi_python_generated.api.default_api import DefaultApi
|
|
@@ -126,6 +126,8 @@ from twitter_openapi_python_generated.models.follow_response_data import FollowR
|
|
|
126
126
|
from twitter_openapi_python_generated.models.follow_response_result import FollowResponseResult
|
|
127
127
|
from twitter_openapi_python_generated.models.follow_response_user import FollowResponseUser
|
|
128
128
|
from twitter_openapi_python_generated.models.follow_timeline import FollowTimeline
|
|
129
|
+
from twitter_openapi_python_generated.models.grok_share_attachment import GrokShareAttachment
|
|
130
|
+
from twitter_openapi_python_generated.models.grok_share_attachment_item import GrokShareAttachmentItem
|
|
129
131
|
from twitter_openapi_python_generated.models.highlight import Highlight
|
|
130
132
|
from twitter_openapi_python_generated.models.home_timeline_home import HomeTimelineHome
|
|
131
133
|
from twitter_openapi_python_generated.models.home_timeline_response_data import HomeTimelineResponseData
|
|
@@ -133,6 +135,7 @@ from twitter_openapi_python_generated.models.instruction_type import Instruction
|
|
|
133
135
|
from twitter_openapi_python_generated.models.instruction_union import InstructionUnion
|
|
134
136
|
from twitter_openapi_python_generated.models.item_content_union import ItemContentUnion
|
|
135
137
|
from twitter_openapi_python_generated.models.item_result import ItemResult
|
|
138
|
+
from twitter_openapi_python_generated.models.limited_action_results_data import LimitedActionResultsData
|
|
136
139
|
from twitter_openapi_python_generated.models.list_latest_tweets_timeline_response import ListLatestTweetsTimelineResponse
|
|
137
140
|
from twitter_openapi_python_generated.models.list_tweets_timeline import ListTweetsTimeline
|
|
138
141
|
from twitter_openapi_python_generated.models.list_tweets_timeline_data import ListTweetsTimelineData
|
|
@@ -232,6 +235,7 @@ from twitter_openapi_python_generated.models.timeline_v2 import TimelineV2
|
|
|
232
235
|
from twitter_openapi_python_generated.models.timestamp import Timestamp
|
|
233
236
|
from twitter_openapi_python_generated.models.topic_context import TopicContext
|
|
234
237
|
from twitter_openapi_python_generated.models.tracing import Tracing
|
|
238
|
+
from twitter_openapi_python_generated.models.trend_results import TrendResults
|
|
235
239
|
from twitter_openapi_python_generated.models.tweet import Tweet
|
|
236
240
|
from twitter_openapi_python_generated.models.tweet_card import TweetCard
|
|
237
241
|
from twitter_openapi_python_generated.models.tweet_card_legacy import TweetCardLegacy
|
|
@@ -256,6 +260,12 @@ from twitter_openapi_python_generated.models.tweet_interstitial_text_entity impo
|
|
|
256
260
|
from twitter_openapi_python_generated.models.tweet_interstitial_text_entity_ref import TweetInterstitialTextEntityRef
|
|
257
261
|
from twitter_openapi_python_generated.models.tweet_legacy import TweetLegacy
|
|
258
262
|
from twitter_openapi_python_generated.models.tweet_legacy_scopes import TweetLegacyScopes
|
|
263
|
+
from twitter_openapi_python_generated.models.tweet_limited_action_results import TweetLimitedActionResults
|
|
264
|
+
from twitter_openapi_python_generated.models.tweet_preview_display import TweetPreviewDisplay
|
|
265
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_cta import TweetPreviewDisplayCta
|
|
266
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_cta_url import TweetPreviewDisplayCtaUrl
|
|
267
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_tweet import TweetPreviewDisplayTweet
|
|
268
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_tweet_view_count import TweetPreviewDisplayTweetViewCount
|
|
259
269
|
from twitter_openapi_python_generated.models.tweet_previous_counts import TweetPreviousCounts
|
|
260
270
|
from twitter_openapi_python_generated.models.tweet_result_by_rest_id_data import TweetResultByRestIdData
|
|
261
271
|
from twitter_openapi_python_generated.models.tweet_result_by_rest_id_response import TweetResultByRestIdResponse
|
|
@@ -2303,6 +2303,7 @@ class TweetApi:
|
|
|
2303
2303
|
path_query_id: StrictStr,
|
|
2304
2304
|
variables: StrictStr,
|
|
2305
2305
|
features: StrictStr,
|
|
2306
|
+
field_toggles: StrictStr,
|
|
2306
2307
|
_request_timeout: Union[
|
|
2307
2308
|
None,
|
|
2308
2309
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -2326,6 +2327,8 @@ class TweetApi:
|
|
|
2326
2327
|
:type variables: str
|
|
2327
2328
|
:param features: (required)
|
|
2328
2329
|
:type features: str
|
|
2330
|
+
:param field_toggles: (required)
|
|
2331
|
+
:type field_toggles: str
|
|
2329
2332
|
:param _request_timeout: timeout setting for this request. If one
|
|
2330
2333
|
number provided, it will be total request
|
|
2331
2334
|
timeout. It can also be a pair (tuple) of
|
|
@@ -2352,6 +2355,7 @@ class TweetApi:
|
|
|
2352
2355
|
path_query_id=path_query_id,
|
|
2353
2356
|
variables=variables,
|
|
2354
2357
|
features=features,
|
|
2358
|
+
field_toggles=field_toggles,
|
|
2355
2359
|
_request_auth=_request_auth,
|
|
2356
2360
|
_content_type=_content_type,
|
|
2357
2361
|
_headers=_headers,
|
|
@@ -2378,6 +2382,7 @@ class TweetApi:
|
|
|
2378
2382
|
path_query_id: StrictStr,
|
|
2379
2383
|
variables: StrictStr,
|
|
2380
2384
|
features: StrictStr,
|
|
2385
|
+
field_toggles: StrictStr,
|
|
2381
2386
|
_request_timeout: Union[
|
|
2382
2387
|
None,
|
|
2383
2388
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -2401,6 +2406,8 @@ class TweetApi:
|
|
|
2401
2406
|
:type variables: str
|
|
2402
2407
|
:param features: (required)
|
|
2403
2408
|
:type features: str
|
|
2409
|
+
:param field_toggles: (required)
|
|
2410
|
+
:type field_toggles: str
|
|
2404
2411
|
:param _request_timeout: timeout setting for this request. If one
|
|
2405
2412
|
number provided, it will be total request
|
|
2406
2413
|
timeout. It can also be a pair (tuple) of
|
|
@@ -2427,6 +2434,7 @@ class TweetApi:
|
|
|
2427
2434
|
path_query_id=path_query_id,
|
|
2428
2435
|
variables=variables,
|
|
2429
2436
|
features=features,
|
|
2437
|
+
field_toggles=field_toggles,
|
|
2430
2438
|
_request_auth=_request_auth,
|
|
2431
2439
|
_content_type=_content_type,
|
|
2432
2440
|
_headers=_headers,
|
|
@@ -2453,6 +2461,7 @@ class TweetApi:
|
|
|
2453
2461
|
path_query_id: StrictStr,
|
|
2454
2462
|
variables: StrictStr,
|
|
2455
2463
|
features: StrictStr,
|
|
2464
|
+
field_toggles: StrictStr,
|
|
2456
2465
|
_request_timeout: Union[
|
|
2457
2466
|
None,
|
|
2458
2467
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -2476,6 +2485,8 @@ class TweetApi:
|
|
|
2476
2485
|
:type variables: str
|
|
2477
2486
|
:param features: (required)
|
|
2478
2487
|
:type features: str
|
|
2488
|
+
:param field_toggles: (required)
|
|
2489
|
+
:type field_toggles: str
|
|
2479
2490
|
:param _request_timeout: timeout setting for this request. If one
|
|
2480
2491
|
number provided, it will be total request
|
|
2481
2492
|
timeout. It can also be a pair (tuple) of
|
|
@@ -2502,6 +2513,7 @@ class TweetApi:
|
|
|
2502
2513
|
path_query_id=path_query_id,
|
|
2503
2514
|
variables=variables,
|
|
2504
2515
|
features=features,
|
|
2516
|
+
field_toggles=field_toggles,
|
|
2505
2517
|
_request_auth=_request_auth,
|
|
2506
2518
|
_content_type=_content_type,
|
|
2507
2519
|
_headers=_headers,
|
|
@@ -2523,6 +2535,7 @@ class TweetApi:
|
|
|
2523
2535
|
path_query_id,
|
|
2524
2536
|
variables,
|
|
2525
2537
|
features,
|
|
2538
|
+
field_toggles,
|
|
2526
2539
|
_request_auth,
|
|
2527
2540
|
_content_type,
|
|
2528
2541
|
_headers,
|
|
@@ -2555,6 +2568,10 @@ class TweetApi:
|
|
|
2555
2568
|
|
|
2556
2569
|
_query_params.append(('features', features))
|
|
2557
2570
|
|
|
2571
|
+
if field_toggles is not None:
|
|
2572
|
+
|
|
2573
|
+
_query_params.append(('fieldToggles', field_toggles))
|
|
2574
|
+
|
|
2558
2575
|
# process the header parameters
|
|
2559
2576
|
# process the form parameters
|
|
2560
2577
|
# process the body parameter
|
|
@@ -91,7 +91,7 @@ class ApiClient:
|
|
|
91
91
|
self.default_headers[header_name] = header_value
|
|
92
92
|
self.cookie = cookie
|
|
93
93
|
# Set default User-Agent.
|
|
94
|
-
self.user_agent = 'OpenAPI-Generator/0.0.
|
|
94
|
+
self.user_agent = 'OpenAPI-Generator/0.0.28/python'
|
|
95
95
|
self.client_side_validation = configuration.client_side_validation
|
|
96
96
|
|
|
97
97
|
def __enter__(self):
|
|
@@ -743,7 +743,7 @@ conf = twitter_openapi_python_generated.Configuration(
|
|
|
743
743
|
"OS: {env}\n"\
|
|
744
744
|
"Python Version: {pyversion}\n"\
|
|
745
745
|
"Version of the API: 0.0.1\n"\
|
|
746
|
-
"SDK Package Version: 0.0.
|
|
746
|
+
"SDK Package Version: 0.0.28".\
|
|
747
747
|
format(env=sys.platform, pyversion=sys.version)
|
|
748
748
|
|
|
749
749
|
def get_host_settings(self) -> List[HostSetting]:
|
|
@@ -100,6 +100,8 @@ from twitter_openapi_python_generated.models.follow_response_data import FollowR
|
|
|
100
100
|
from twitter_openapi_python_generated.models.follow_response_result import FollowResponseResult
|
|
101
101
|
from twitter_openapi_python_generated.models.follow_response_user import FollowResponseUser
|
|
102
102
|
from twitter_openapi_python_generated.models.follow_timeline import FollowTimeline
|
|
103
|
+
from twitter_openapi_python_generated.models.grok_share_attachment import GrokShareAttachment
|
|
104
|
+
from twitter_openapi_python_generated.models.grok_share_attachment_item import GrokShareAttachmentItem
|
|
103
105
|
from twitter_openapi_python_generated.models.highlight import Highlight
|
|
104
106
|
from twitter_openapi_python_generated.models.home_timeline_home import HomeTimelineHome
|
|
105
107
|
from twitter_openapi_python_generated.models.home_timeline_response_data import HomeTimelineResponseData
|
|
@@ -107,6 +109,7 @@ from twitter_openapi_python_generated.models.instruction_type import Instruction
|
|
|
107
109
|
from twitter_openapi_python_generated.models.instruction_union import InstructionUnion
|
|
108
110
|
from twitter_openapi_python_generated.models.item_content_union import ItemContentUnion
|
|
109
111
|
from twitter_openapi_python_generated.models.item_result import ItemResult
|
|
112
|
+
from twitter_openapi_python_generated.models.limited_action_results_data import LimitedActionResultsData
|
|
110
113
|
from twitter_openapi_python_generated.models.list_latest_tweets_timeline_response import ListLatestTweetsTimelineResponse
|
|
111
114
|
from twitter_openapi_python_generated.models.list_tweets_timeline import ListTweetsTimeline
|
|
112
115
|
from twitter_openapi_python_generated.models.list_tweets_timeline_data import ListTweetsTimelineData
|
|
@@ -206,6 +209,7 @@ from twitter_openapi_python_generated.models.timeline_v2 import TimelineV2
|
|
|
206
209
|
from twitter_openapi_python_generated.models.timestamp import Timestamp
|
|
207
210
|
from twitter_openapi_python_generated.models.topic_context import TopicContext
|
|
208
211
|
from twitter_openapi_python_generated.models.tracing import Tracing
|
|
212
|
+
from twitter_openapi_python_generated.models.trend_results import TrendResults
|
|
209
213
|
from twitter_openapi_python_generated.models.tweet import Tweet
|
|
210
214
|
from twitter_openapi_python_generated.models.tweet_card import TweetCard
|
|
211
215
|
from twitter_openapi_python_generated.models.tweet_card_legacy import TweetCardLegacy
|
|
@@ -230,6 +234,12 @@ from twitter_openapi_python_generated.models.tweet_interstitial_text_entity impo
|
|
|
230
234
|
from twitter_openapi_python_generated.models.tweet_interstitial_text_entity_ref import TweetInterstitialTextEntityRef
|
|
231
235
|
from twitter_openapi_python_generated.models.tweet_legacy import TweetLegacy
|
|
232
236
|
from twitter_openapi_python_generated.models.tweet_legacy_scopes import TweetLegacyScopes
|
|
237
|
+
from twitter_openapi_python_generated.models.tweet_limited_action_results import TweetLimitedActionResults
|
|
238
|
+
from twitter_openapi_python_generated.models.tweet_preview_display import TweetPreviewDisplay
|
|
239
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_cta import TweetPreviewDisplayCta
|
|
240
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_cta_url import TweetPreviewDisplayCtaUrl
|
|
241
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_tweet import TweetPreviewDisplayTweet
|
|
242
|
+
from twitter_openapi_python_generated.models.tweet_preview_display_tweet_view_count import TweetPreviewDisplayTweetViewCount
|
|
233
243
|
from twitter_openapi_python_generated.models.tweet_previous_counts import TweetPreviousCounts
|
|
234
244
|
from twitter_openapi_python_generated.models.tweet_result_by_rest_id_data import TweetResultByRestIdData
|
|
235
245
|
from twitter_openapi_python_generated.models.tweet_result_by_rest_id_response import TweetResultByRestIdResponse
|
|
@@ -37,28 +37,28 @@ class CommunityData(BaseModel):
|
|
|
37
37
|
CommunityData
|
|
38
38
|
""" # noqa: E501
|
|
39
39
|
typename: TypeName = Field(alias="__typename")
|
|
40
|
-
actions: CommunityActions
|
|
41
|
-
admin_results: UserResults
|
|
40
|
+
actions: Optional[CommunityActions] = None
|
|
41
|
+
admin_results: Optional[UserResults] = None
|
|
42
42
|
created_at: Optional[StrictInt] = None
|
|
43
|
-
creator_results: UserResults
|
|
43
|
+
creator_results: Optional[UserResults] = None
|
|
44
44
|
custom_banner_media: Optional[Dict[str, Any]] = None
|
|
45
45
|
default_banner_media: Optional[Dict[str, Any]] = None
|
|
46
|
-
description: StrictStr
|
|
46
|
+
description: Optional[StrictStr] = None
|
|
47
47
|
id_str: Annotated[str, Field(strict=True)]
|
|
48
|
-
invites_policy: StrictStr
|
|
49
|
-
invites_result: CommunityInvitesResult
|
|
50
|
-
is_pinned: StrictBool
|
|
51
|
-
join_policy: StrictStr
|
|
48
|
+
invites_policy: Optional[StrictStr] = None
|
|
49
|
+
invites_result: Optional[CommunityInvitesResult] = None
|
|
50
|
+
is_pinned: Optional[StrictBool] = None
|
|
51
|
+
join_policy: Optional[StrictStr] = None
|
|
52
52
|
join_requests_result: Optional[CommunityJoinRequestsResult] = None
|
|
53
|
-
member_count: StrictInt
|
|
54
|
-
members_facepile_results: List[UserResults]
|
|
55
|
-
moderator_count: StrictInt
|
|
56
|
-
name: StrictStr
|
|
53
|
+
member_count: Optional[StrictInt] = None
|
|
54
|
+
members_facepile_results: Optional[List[UserResults]] = None
|
|
55
|
+
moderator_count: Optional[StrictInt] = None
|
|
56
|
+
name: Optional[StrictStr] = None
|
|
57
57
|
primary_community_topic: Optional[PrimaryCommunityTopic] = None
|
|
58
58
|
question: Optional[StrictStr] = None
|
|
59
|
-
role: StrictStr
|
|
60
|
-
rules: List[CommunityRule]
|
|
61
|
-
search_tags: List[StrictStr]
|
|
59
|
+
role: Optional[StrictStr] = None
|
|
60
|
+
rules: Optional[List[CommunityRule]] = None
|
|
61
|
+
search_tags: Optional[List[StrictStr]] = None
|
|
62
62
|
show_only_users_to_display: Optional[List[StrictStr]] = None
|
|
63
63
|
urls: Optional[CommunityUrls] = None
|
|
64
64
|
viewer_relationship: Optional[Dict[str, Any]] = None
|
|
@@ -74,6 +74,9 @@ class CommunityData(BaseModel):
|
|
|
74
74
|
@field_validator('invites_policy')
|
|
75
75
|
def invites_policy_validate_enum(cls, value):
|
|
76
76
|
"""Validates the enum"""
|
|
77
|
+
if value is None:
|
|
78
|
+
return value
|
|
79
|
+
|
|
77
80
|
if value not in set(['MemberInvitesAllowed', 'ModeratorInvitesAllowed']):
|
|
78
81
|
raise ValueError("must be one of enum values ('MemberInvitesAllowed', 'ModeratorInvitesAllowed')")
|
|
79
82
|
return value
|
|
@@ -81,6 +84,9 @@ class CommunityData(BaseModel):
|
|
|
81
84
|
@field_validator('join_policy')
|
|
82
85
|
def join_policy_validate_enum(cls, value):
|
|
83
86
|
"""Validates the enum"""
|
|
87
|
+
if value is None:
|
|
88
|
+
return value
|
|
89
|
+
|
|
84
90
|
if value not in set(['Open', 'RestrictedJoinRequestsRequireModeratorApproval']):
|
|
85
91
|
raise ValueError("must be one of enum values ('Open', 'RestrictedJoinRequestsRequireModeratorApproval')")
|
|
86
92
|
return value
|
|
@@ -88,6 +94,9 @@ class CommunityData(BaseModel):
|
|
|
88
94
|
@field_validator('role')
|
|
89
95
|
def role_validate_enum(cls, value):
|
|
90
96
|
"""Validates the enum"""
|
|
97
|
+
if value is None:
|
|
98
|
+
return value
|
|
99
|
+
|
|
91
100
|
if value not in set(['NonMember']):
|
|
92
101
|
raise ValueError("must be one of enum values ('NonMember')")
|
|
93
102
|
return value
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Twitter OpenAPI
|
|
5
|
+
|
|
6
|
+
Twitter OpenAPI(Swagger) specification
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1
|
|
9
|
+
Contact: yuki@yuki0311.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.grok_share_attachment_item import GrokShareAttachmentItem
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class GrokShareAttachment(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GrokShareAttachment
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
items: List[GrokShareAttachmentItem]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of GrokShareAttachment 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
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.items:
|
|
76
|
+
for _item_items in self.items:
|
|
77
|
+
if _item_items:
|
|
78
|
+
_items.append(_item_items.to_dict())
|
|
79
|
+
_dict['items'] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of GrokShareAttachment from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"items": [GrokShareAttachmentItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
|
|
26
|
+
class GrokShareAttachmentItem(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
GrokShareAttachmentItem
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
media_urls: List[StrictStr]
|
|
31
|
+
message: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["media_urls", "message"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of GrokShareAttachmentItem 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 GrokShareAttachmentItem 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
|
+
"media_urls": obj.get("media_urls"),
|
|
86
|
+
"message": obj.get("message")
|
|
87
|
+
})
|
|
88
|
+
return _obj
|
|
89
|
+
|
|
90
|
+
|
|
@@ -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, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class LimitedActionResultsData(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
LimitedActionResultsData
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
action: StrictStr
|
|
31
|
+
__properties: ClassVar[List[str]] = ["action"]
|
|
32
|
+
|
|
33
|
+
@field_validator('action')
|
|
34
|
+
def action_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in set(['Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements']):
|
|
37
|
+
raise ValueError("must be one of enum values ('Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of LimitedActionResultsData from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of LimitedActionResultsData 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
|
+
"action": obj.get("action")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -18,7 +18,7 @@ import pprint
|
|
|
18
18
|
import re # noqa: F401
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
22
22
|
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
|
|
@@ -33,13 +33,14 @@ class TimelineTweet(BaseModel):
|
|
|
33
33
|
TimelineTweet
|
|
34
34
|
""" # noqa: E501
|
|
35
35
|
typename: TypeName = Field(alias="__typename")
|
|
36
|
+
has_moderated_replies: Optional[StrictBool] = Field(default=None, alias="hasModeratedReplies")
|
|
36
37
|
highlights: Optional[Highlight] = None
|
|
37
38
|
item_type: ContentItemType = Field(alias="itemType")
|
|
38
39
|
promoted_metadata: Optional[Dict[str, Any]] = Field(default=None, alias="promotedMetadata")
|
|
39
40
|
social_context: Optional[SocialContextUnion] = Field(default=None, alias="socialContext")
|
|
40
41
|
tweet_display_type: StrictStr = Field(alias="tweetDisplayType")
|
|
41
42
|
tweet_results: ItemResult
|
|
42
|
-
__properties: ClassVar[List[str]] = ["__typename", "highlights", "itemType", "promotedMetadata", "socialContext", "tweetDisplayType", "tweet_results"]
|
|
43
|
+
__properties: ClassVar[List[str]] = ["__typename", "hasModeratedReplies", "highlights", "itemType", "promotedMetadata", "socialContext", "tweetDisplayType", "tweet_results"]
|
|
43
44
|
|
|
44
45
|
@field_validator('tweet_display_type')
|
|
45
46
|
def tweet_display_type_validate_enum(cls, value):
|
|
@@ -109,6 +110,7 @@ class TimelineTweet(BaseModel):
|
|
|
109
110
|
|
|
110
111
|
_obj = cls.model_validate({
|
|
111
112
|
"__typename": obj.get("__typename"),
|
|
113
|
+
"hasModeratedReplies": obj.get("hasModeratedReplies"),
|
|
112
114
|
"highlights": Highlight.from_dict(obj["highlights"]) if obj.get("highlights") is not None else None,
|
|
113
115
|
"itemType": obj.get("itemType"),
|
|
114
116
|
"promotedMetadata": obj.get("promotedMetadata"),
|