twitter-openapi-python-generated 0.0.26__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.
Files changed (30) hide show
  1. twitter_openapi_python_generated/__init__.py +13 -3
  2. twitter_openapi_python_generated/api/tweet_api.py +17 -0
  3. twitter_openapi_python_generated/api_client.py +1 -1
  4. twitter_openapi_python_generated/configuration.py +1 -1
  5. twitter_openapi_python_generated/models/__init__.py +12 -2
  6. twitter_openapi_python_generated/models/community_actions.py +3 -3
  7. twitter_openapi_python_generated/models/community_data.py +24 -15
  8. twitter_openapi_python_generated/models/{community_join_action_result.py → community_join_action.py} +4 -4
  9. twitter_openapi_python_generated/models/{community_join_action_union.py → community_join_action_result_union.py} +21 -26
  10. twitter_openapi_python_generated/models/grok_share_attachment.py +96 -0
  11. twitter_openapi_python_generated/models/grok_share_attachment_item.py +90 -0
  12. twitter_openapi_python_generated/models/limited_action_results_data.py +95 -0
  13. twitter_openapi_python_generated/models/timeline_tweet.py +4 -2
  14. twitter_openapi_python_generated/models/trend_results.py +96 -0
  15. twitter_openapi_python_generated/models/tweet.py +15 -1
  16. twitter_openapi_python_generated/models/tweet_limited_action_results.py +96 -0
  17. twitter_openapi_python_generated/models/tweet_preview_display.py +107 -0
  18. twitter_openapi_python_generated/models/tweet_preview_display_cta.py +94 -0
  19. twitter_openapi_python_generated/models/tweet_preview_display_cta_url.py +97 -0
  20. twitter_openapi_python_generated/models/tweet_preview_display_tweet.py +131 -0
  21. twitter_openapi_python_generated/models/tweet_preview_display_tweet_view_count.py +96 -0
  22. twitter_openapi_python_generated/models/tweet_union.py +27 -8
  23. twitter_openapi_python_generated/models/type_name.py +1 -0
  24. twitter_openapi_python_generated/models/user.py +3 -1
  25. {twitter_openapi_python_generated-0.0.26.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/METADATA +6 -6
  26. {twitter_openapi_python_generated-0.0.26.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/RECORD +30 -20
  27. {twitter_openapi_python_generated-0.0.26.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/WHEEL +1 -1
  28. {twitter_openapi_python_generated-0.0.26.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/LICENSE +0 -0
  29. {twitter_openapi_python_generated-0.0.26.dist-info → twitter_openapi_python_generated-0.0.28.dist-info}/LICENSE.AGPL +0 -0
  30. {twitter_openapi_python_generated-0.0.26.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.26"
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
@@ -74,9 +74,9 @@ from twitter_openapi_python_generated.models.community_actions import CommunityA
74
74
  from twitter_openapi_python_generated.models.community_data import CommunityData
75
75
  from twitter_openapi_python_generated.models.community_delete_action_result import CommunityDeleteActionResult
76
76
  from twitter_openapi_python_generated.models.community_invites_result import CommunityInvitesResult
77
- from twitter_openapi_python_generated.models.community_join_action_result import CommunityJoinActionResult
77
+ from twitter_openapi_python_generated.models.community_join_action import CommunityJoinAction
78
+ from twitter_openapi_python_generated.models.community_join_action_result_union import CommunityJoinActionResultUnion
78
79
  from twitter_openapi_python_generated.models.community_join_action_unavailable import CommunityJoinActionUnavailable
79
- from twitter_openapi_python_generated.models.community_join_action_union import CommunityJoinActionUnion
80
80
  from twitter_openapi_python_generated.models.community_join_requests_result import CommunityJoinRequestsResult
81
81
  from twitter_openapi_python_generated.models.community_leave_action_result import CommunityLeaveActionResult
82
82
  from twitter_openapi_python_generated.models.community_pin_action_result import CommunityPinActionResult
@@ -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.26/python'
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.26".\
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]:
@@ -48,9 +48,9 @@ from twitter_openapi_python_generated.models.community_actions import CommunityA
48
48
  from twitter_openapi_python_generated.models.community_data import CommunityData
49
49
  from twitter_openapi_python_generated.models.community_delete_action_result import CommunityDeleteActionResult
50
50
  from twitter_openapi_python_generated.models.community_invites_result import CommunityInvitesResult
51
- from twitter_openapi_python_generated.models.community_join_action_result import CommunityJoinActionResult
51
+ from twitter_openapi_python_generated.models.community_join_action import CommunityJoinAction
52
+ from twitter_openapi_python_generated.models.community_join_action_result_union import CommunityJoinActionResultUnion
52
53
  from twitter_openapi_python_generated.models.community_join_action_unavailable import CommunityJoinActionUnavailable
53
- from twitter_openapi_python_generated.models.community_join_action_union import CommunityJoinActionUnion
54
54
  from twitter_openapi_python_generated.models.community_join_requests_result import CommunityJoinRequestsResult
55
55
  from twitter_openapi_python_generated.models.community_leave_action_result import CommunityLeaveActionResult
56
56
  from twitter_openapi_python_generated.models.community_pin_action_result import CommunityPinActionResult
@@ -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
@@ -21,7 +21,7 @@ import json
21
21
  from pydantic import BaseModel, ConfigDict
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from twitter_openapi_python_generated.models.community_delete_action_result import CommunityDeleteActionResult
24
- from twitter_openapi_python_generated.models.community_join_action_union import CommunityJoinActionUnion
24
+ from twitter_openapi_python_generated.models.community_join_action_result_union import CommunityJoinActionResultUnion
25
25
  from twitter_openapi_python_generated.models.community_leave_action_result import CommunityLeaveActionResult
26
26
  from twitter_openapi_python_generated.models.community_pin_action_result import CommunityPinActionResult
27
27
  from twitter_openapi_python_generated.models.community_unpin_action_result import CommunityUnpinActionResult
@@ -33,7 +33,7 @@ class CommunityActions(BaseModel):
33
33
  CommunityActions
34
34
  """ # noqa: E501
35
35
  delete_action_result: Optional[CommunityDeleteActionResult] = None
36
- join_action_result: Optional[CommunityJoinActionUnion] = None
36
+ join_action_result: Optional[CommunityJoinActionResultUnion] = None
37
37
  leave_action_result: Optional[CommunityLeaveActionResult] = None
38
38
  pin_action_result: Optional[CommunityPinActionResult] = None
39
39
  unpin_action_result: Optional[CommunityUnpinActionResult] = None
@@ -106,7 +106,7 @@ class CommunityActions(BaseModel):
106
106
 
107
107
  _obj = cls.model_validate({
108
108
  "delete_action_result": CommunityDeleteActionResult.from_dict(obj["delete_action_result"]) if obj.get("delete_action_result") is not None else None,
109
- "join_action_result": CommunityJoinActionUnion.from_dict(obj["join_action_result"]) if obj.get("join_action_result") is not None else None,
109
+ "join_action_result": CommunityJoinActionResultUnion.from_dict(obj["join_action_result"]) if obj.get("join_action_result") is not None else None,
110
110
  "leave_action_result": CommunityLeaveActionResult.from_dict(obj["leave_action_result"]) if obj.get("leave_action_result") is not None else None,
111
111
  "pin_action_result": CommunityPinActionResult.from_dict(obj["pin_action_result"]) if obj.get("pin_action_result") is not None else None,
112
112
  "unpin_action_result": CommunityUnpinActionResult.from_dict(obj["unpin_action_result"]) if obj.get("unpin_action_result") is not None else None
@@ -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
@@ -24,9 +24,9 @@ from twitter_openapi_python_generated.models.type_name import TypeName
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
 
27
- class CommunityJoinActionResult(BaseModel):
27
+ class CommunityJoinAction(BaseModel):
28
28
  """
29
- CommunityJoinActionResult
29
+ CommunityJoinAction
30
30
  """ # noqa: E501
31
31
  typename: TypeName = Field(alias="__typename")
32
32
  __properties: ClassVar[List[str]] = ["__typename"]
@@ -49,7 +49,7 @@ class CommunityJoinActionResult(BaseModel):
49
49
 
50
50
  @classmethod
51
51
  def from_json(cls, json_str: str) -> Optional[Self]:
52
- """Create an instance of CommunityJoinActionResult from a JSON string"""
52
+ """Create an instance of CommunityJoinAction from a JSON string"""
53
53
  return cls.from_dict(json.loads(json_str))
54
54
 
55
55
  def to_dict(self) -> Dict[str, Any]:
@@ -74,7 +74,7 @@ class CommunityJoinActionResult(BaseModel):
74
74
 
75
75
  @classmethod
76
76
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
- """Create an instance of CommunityJoinActionResult from a dict"""
77
+ """Create an instance of CommunityJoinAction from a dict"""
78
78
  if obj is None:
79
79
  return None
80
80
 
@@ -18,24 +18,24 @@ import json
18
18
  import pprint
19
19
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20
20
  from typing import Any, List, Optional
21
- from twitter_openapi_python_generated.models.community_join_action_result import CommunityJoinActionResult
21
+ from twitter_openapi_python_generated.models.community_join_action import CommunityJoinAction
22
22
  from twitter_openapi_python_generated.models.community_join_action_unavailable import CommunityJoinActionUnavailable
23
23
  from pydantic import StrictStr, Field
24
24
  from typing import Union, List, Set, Optional, Dict
25
25
  from typing_extensions import Literal, Self
26
26
 
27
- COMMUNITYJOINACTIONUNION_ONE_OF_SCHEMAS = ["CommunityJoinActionResult", "CommunityJoinActionUnavailable"]
27
+ COMMUNITYJOINACTIONRESULTUNION_ONE_OF_SCHEMAS = ["CommunityJoinAction", "CommunityJoinActionUnavailable"]
28
28
 
29
- class CommunityJoinActionUnion(BaseModel):
29
+ class CommunityJoinActionResultUnion(BaseModel):
30
30
  """
31
- CommunityJoinActionUnion
31
+ CommunityJoinActionResultUnion
32
32
  """
33
- # data type: CommunityJoinActionResult
34
- oneof_schema_1_validator: Optional[CommunityJoinActionResult] = None
33
+ # data type: CommunityJoinAction
34
+ oneof_schema_1_validator: Optional[CommunityJoinAction] = None
35
35
  # data type: CommunityJoinActionUnavailable
36
36
  oneof_schema_2_validator: Optional[CommunityJoinActionUnavailable] = None
37
- actual_instance: Optional[Union[CommunityJoinActionResult, CommunityJoinActionUnavailable]] = None
38
- one_of_schemas: Set[str] = { "CommunityJoinActionResult", "CommunityJoinActionUnavailable" }
37
+ actual_instance: Optional[Union[CommunityJoinAction, CommunityJoinActionUnavailable]] = None
38
+ one_of_schemas: Set[str] = { "CommunityJoinAction", "CommunityJoinActionUnavailable" }
39
39
 
40
40
  model_config = ConfigDict(
41
41
  validate_assignment=True,
@@ -58,12 +58,12 @@ class CommunityJoinActionUnion(BaseModel):
58
58
 
59
59
  @field_validator('actual_instance')
60
60
  def actual_instance_must_validate_oneof(cls, v):
61
- instance = CommunityJoinActionUnion.model_construct()
61
+ instance = CommunityJoinActionResultUnion.model_construct()
62
62
  error_messages = []
63
63
  match = 0
64
- # validate data type: CommunityJoinActionResult
65
- if not isinstance(v, CommunityJoinActionResult):
66
- error_messages.append(f"Error! Input type `{type(v)}` is not `CommunityJoinActionResult`")
64
+ # validate data type: CommunityJoinAction
65
+ if not isinstance(v, CommunityJoinAction):
66
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CommunityJoinAction`")
67
67
  else:
68
68
  match += 1
69
69
  # validate data type: CommunityJoinActionUnavailable
@@ -73,10 +73,10 @@ class CommunityJoinActionUnion(BaseModel):
73
73
  match += 1
74
74
  if match > 1:
75
75
  # more than 1 match
76
- raise ValueError("Multiple matches found when setting `actual_instance` in CommunityJoinActionUnion with oneOf schemas: CommunityJoinActionResult, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
76
+ raise ValueError("Multiple matches found when setting `actual_instance` in CommunityJoinActionResultUnion with oneOf schemas: CommunityJoinAction, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
77
77
  elif match == 0:
78
78
  # no match
79
- raise ValueError("No match found when setting `actual_instance` in CommunityJoinActionUnion with oneOf schemas: CommunityJoinActionResult, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
79
+ raise ValueError("No match found when setting `actual_instance` in CommunityJoinActionResultUnion with oneOf schemas: CommunityJoinAction, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
80
80
  else:
81
81
  return v
82
82
 
@@ -96,9 +96,9 @@ class CommunityJoinActionUnion(BaseModel):
96
96
  if not _data_type:
97
97
  raise ValueError("Failed to lookup data type from the field `__typename` in the input.")
98
98
 
99
- # check if data type is `CommunityJoinActionResult`
99
+ # check if data type is `CommunityJoinAction`
100
100
  if _data_type == "CommunityJoinAction":
101
- instance.actual_instance = CommunityJoinActionResult.from_json(json_str)
101
+ instance.actual_instance = CommunityJoinAction.from_json(json_str)
102
102
  return instance
103
103
 
104
104
  # check if data type is `CommunityJoinActionUnavailable`
@@ -106,14 +106,9 @@ class CommunityJoinActionUnion(BaseModel):
106
106
  instance.actual_instance = CommunityJoinActionUnavailable.from_json(json_str)
107
107
  return instance
108
108
 
109
- # check if data type is `CommunityJoinActionResult`
110
- if _data_type == "CommunityJoinActionResult":
111
- instance.actual_instance = CommunityJoinActionResult.from_json(json_str)
112
- return instance
113
-
114
- # deserialize data into CommunityJoinActionResult
109
+ # deserialize data into CommunityJoinAction
115
110
  try:
116
- instance.actual_instance = CommunityJoinActionResult.from_json(json_str)
111
+ instance.actual_instance = CommunityJoinAction.from_json(json_str)
117
112
  match += 1
118
113
  except (ValidationError, ValueError) as e:
119
114
  error_messages.append(str(e))
@@ -126,10 +121,10 @@ class CommunityJoinActionUnion(BaseModel):
126
121
 
127
122
  if match > 1:
128
123
  # more than 1 match
129
- raise ValueError("Multiple matches found when deserializing the JSON string into CommunityJoinActionUnion with oneOf schemas: CommunityJoinActionResult, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
124
+ raise ValueError("Multiple matches found when deserializing the JSON string into CommunityJoinActionResultUnion with oneOf schemas: CommunityJoinAction, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
130
125
  elif match == 0:
131
126
  # no match
132
- raise ValueError("No match found when deserializing the JSON string into CommunityJoinActionUnion with oneOf schemas: CommunityJoinActionResult, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
127
+ raise ValueError("No match found when deserializing the JSON string into CommunityJoinActionResultUnion with oneOf schemas: CommunityJoinAction, CommunityJoinActionUnavailable. Details: " + ", ".join(error_messages))
133
128
  else:
134
129
  return instance
135
130
 
@@ -143,7 +138,7 @@ class CommunityJoinActionUnion(BaseModel):
143
138
  else:
144
139
  return json.dumps(self.actual_instance)
145
140
 
146
- def to_dict(self) -> Optional[Union[Dict[str, Any], CommunityJoinActionResult, CommunityJoinActionUnavailable]]:
141
+ def to_dict(self) -> Optional[Union[Dict[str, Any], CommunityJoinAction, CommunityJoinActionUnavailable]]:
147
142
  """Returns the dict representation of the actual instance"""
148
143
  if self.actual_instance is None:
149
144
  return None
@@ -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
+