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.
Files changed (33) hide show
  1. twitter_openapi_python_generated/__init__.py +23 -1
  2. twitter_openapi_python_generated/api/user_api.py +9 -6
  3. twitter_openapi_python_generated/api/users_api.py +9 -6
  4. twitter_openapi_python_generated/api_client.py +1 -1
  5. twitter_openapi_python_generated/configuration.py +1 -1
  6. twitter_openapi_python_generated/models/__init__.py +11 -0
  7. twitter_openapi_python_generated/models/ad_metadata_container.py +3 -1
  8. twitter_openapi_python_generated/models/click_tracking_info.py +7 -3
  9. twitter_openapi_python_generated/models/feedback_client_event_info.py +2 -2
  10. twitter_openapi_python_generated/models/notification_additional_context.py +94 -0
  11. twitter_openapi_python_generated/models/notification_template.py +10 -2
  12. twitter_openapi_python_generated/models/notification_url.py +104 -0
  13. twitter_openapi_python_generated/models/notification_urt_endpoint_options.py +93 -0
  14. twitter_openapi_python_generated/models/preroll.py +97 -0
  15. twitter_openapi_python_generated/models/preroll_call_to_action.py +91 -0
  16. twitter_openapi_python_generated/models/preroll_media_info.py +118 -0
  17. twitter_openapi_python_generated/models/preroll_metadata.py +93 -0
  18. twitter_openapi_python_generated/models/preroll_video_variant.py +93 -0
  19. twitter_openapi_python_generated/models/rich_message_entity.py +6 -4
  20. twitter_openapi_python_generated/models/timeline_notification.py +3 -3
  21. twitter_openapi_python_generated/models/timeline_tweet.py +7 -1
  22. twitter_openapi_python_generated/models/tweet.py +7 -1
  23. twitter_openapi_python_generated/models/tweet_sports_competitor.py +107 -0
  24. twitter_openapi_python_generated/models/tweet_sports_post_context.py +122 -0
  25. twitter_openapi_python_generated/models/tweet_sports_rest_id.py +97 -0
  26. twitter_openapi_python_generated/models/type_name.py +1 -0
  27. twitter_openapi_python_generated/models/user_label_mention_user.py +6 -3
  28. {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/METADATA +13 -2
  29. {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/RECORD +33 -22
  30. {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/WHEEL +1 -1
  31. {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/licenses/LICENSE +0 -0
  32. {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/licenses/LICENSE.AGPL +0 -0
  33. {twitter_openapi_python_generated-0.1.3.dist-info → twitter_openapi_python_generated-0.1.5.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,7 @@
15
15
  """ # noqa: E501
16
16
 
17
17
 
18
- __version__ = "0.1.3"
18
+ __version__ = "0.1.5"
19
19
 
20
20
  # Define package exports
21
21
  __all__ = [
@@ -401,8 +401,11 @@ __all__ = [
401
401
  "NoteTweetResultMediaInlineMedia",
402
402
  "NoteTweetResultRichText",
403
403
  "NoteTweetResultRichTextTag",
404
+ "NotificationAdditionalContext",
404
405
  "NotificationDetails",
405
406
  "NotificationTemplate",
407
+ "NotificationUrl",
408
+ "NotificationUrtEndpointOptions",
406
409
  "NotificationsResult",
407
410
  "NotificationsTimelineData",
408
411
  "NotificationsTimelineResponse",
@@ -450,6 +453,11 @@ __all__ = [
450
453
  "PostListAddMemberRequestVariables",
451
454
  "PostListRemoveMemberRequest",
452
455
  "PostUnfavoriteTweetRequest",
456
+ "Preroll",
457
+ "PrerollCallToAction",
458
+ "PrerollMediaInfo",
459
+ "PrerollMetadata",
460
+ "PrerollVideoVariant",
453
461
  "PrimaryCommunityTopic",
454
462
  "ProfileBio",
455
463
  "ProfileBioEntities",
@@ -604,6 +612,9 @@ __all__ = [
604
612
  "TweetResultByRestIdResponse",
605
613
  "TweetRetweetersResponse",
606
614
  "TweetRetweetersResponseData",
615
+ "TweetSportsCompetitor",
616
+ "TweetSportsPostContext",
617
+ "TweetSportsRestId",
607
618
  "TweetTombstone",
608
619
  "TweetUnavailable",
609
620
  "TweetUnion",
@@ -1082,8 +1093,11 @@ from twitter_openapi_python_generated.models.note_tweet_result_media import Note
1082
1093
  from twitter_openapi_python_generated.models.note_tweet_result_media_inline_media import NoteTweetResultMediaInlineMedia as NoteTweetResultMediaInlineMedia
1083
1094
  from twitter_openapi_python_generated.models.note_tweet_result_rich_text import NoteTweetResultRichText as NoteTweetResultRichText
1084
1095
  from twitter_openapi_python_generated.models.note_tweet_result_rich_text_tag import NoteTweetResultRichTextTag as NoteTweetResultRichTextTag
1096
+ from twitter_openapi_python_generated.models.notification_additional_context import NotificationAdditionalContext as NotificationAdditionalContext
1085
1097
  from twitter_openapi_python_generated.models.notification_details import NotificationDetails as NotificationDetails
1086
1098
  from twitter_openapi_python_generated.models.notification_template import NotificationTemplate as NotificationTemplate
1099
+ from twitter_openapi_python_generated.models.notification_url import NotificationUrl as NotificationUrl
1100
+ from twitter_openapi_python_generated.models.notification_urt_endpoint_options import NotificationUrtEndpointOptions as NotificationUrtEndpointOptions
1087
1101
  from twitter_openapi_python_generated.models.notifications_result import NotificationsResult as NotificationsResult
1088
1102
  from twitter_openapi_python_generated.models.notifications_timeline_data import NotificationsTimelineData as NotificationsTimelineData
1089
1103
  from twitter_openapi_python_generated.models.notifications_timeline_response import NotificationsTimelineResponse as NotificationsTimelineResponse
@@ -1131,6 +1145,11 @@ from twitter_openapi_python_generated.models.post_list_add_member_request import
1131
1145
  from twitter_openapi_python_generated.models.post_list_add_member_request_variables import PostListAddMemberRequestVariables as PostListAddMemberRequestVariables
1132
1146
  from twitter_openapi_python_generated.models.post_list_remove_member_request import PostListRemoveMemberRequest as PostListRemoveMemberRequest
1133
1147
  from twitter_openapi_python_generated.models.post_unfavorite_tweet_request import PostUnfavoriteTweetRequest as PostUnfavoriteTweetRequest
1148
+ from twitter_openapi_python_generated.models.preroll import Preroll as Preroll
1149
+ from twitter_openapi_python_generated.models.preroll_call_to_action import PrerollCallToAction as PrerollCallToAction
1150
+ from twitter_openapi_python_generated.models.preroll_media_info import PrerollMediaInfo as PrerollMediaInfo
1151
+ from twitter_openapi_python_generated.models.preroll_metadata import PrerollMetadata as PrerollMetadata
1152
+ from twitter_openapi_python_generated.models.preroll_video_variant import PrerollVideoVariant as PrerollVideoVariant
1134
1153
  from twitter_openapi_python_generated.models.primary_community_topic import PrimaryCommunityTopic as PrimaryCommunityTopic
1135
1154
  from twitter_openapi_python_generated.models.profile_bio import ProfileBio as ProfileBio
1136
1155
  from twitter_openapi_python_generated.models.profile_bio_entities import ProfileBioEntities as ProfileBioEntities
@@ -1285,6 +1304,9 @@ from twitter_openapi_python_generated.models.tweet_result_by_rest_id_data import
1285
1304
  from twitter_openapi_python_generated.models.tweet_result_by_rest_id_response import TweetResultByRestIdResponse as TweetResultByRestIdResponse
1286
1305
  from twitter_openapi_python_generated.models.tweet_retweeters_response import TweetRetweetersResponse as TweetRetweetersResponse
1287
1306
  from twitter_openapi_python_generated.models.tweet_retweeters_response_data import TweetRetweetersResponseData as TweetRetweetersResponseData
1307
+ from twitter_openapi_python_generated.models.tweet_sports_competitor import TweetSportsCompetitor as TweetSportsCompetitor
1308
+ from twitter_openapi_python_generated.models.tweet_sports_post_context import TweetSportsPostContext as TweetSportsPostContext
1309
+ from twitter_openapi_python_generated.models.tweet_sports_rest_id import TweetSportsRestId as TweetSportsRestId
1288
1310
  from twitter_openapi_python_generated.models.tweet_tombstone import TweetTombstone as TweetTombstone
1289
1311
  from twitter_openapi_python_generated.models.tweet_unavailable import TweetUnavailable as TweetUnavailable
1290
1312
  from twitter_openapi_python_generated.models.tweet_union import TweetUnion as TweetUnion
@@ -960,9 +960,9 @@ class UserApi:
960
960
  _headers: Optional[Dict[StrictStr, Any]] = None,
961
961
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
962
962
  ) -> UserResponse:
963
- """get_user_by_rest_id
963
+ """(Deprecated) get_user_by_rest_id
964
964
 
965
- get user by rest id
965
+ get user by rest id. Deprecated: X answers 403 outside a browser since 2026-10
966
966
 
967
967
  :param path_query_id: (required)
968
968
  :type path_query_id: str
@@ -991,6 +991,7 @@ class UserApi:
991
991
  :type _host_index: int, optional
992
992
  :return: Returns the result object.
993
993
  """ # noqa: E501
994
+ warnings.warn("GET /graphql/{pathQueryId}/UserByRestId is deprecated.", DeprecationWarning)
994
995
 
995
996
  _param = self._get_user_by_rest_id_serialize(
996
997
  path_query_id=path_query_id,
@@ -1035,9 +1036,9 @@ class UserApi:
1035
1036
  _headers: Optional[Dict[StrictStr, Any]] = None,
1036
1037
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1037
1038
  ) -> ApiResponse[UserResponse]:
1038
- """get_user_by_rest_id
1039
+ """(Deprecated) get_user_by_rest_id
1039
1040
 
1040
- get user by rest id
1041
+ get user by rest id. Deprecated: X answers 403 outside a browser since 2026-10
1041
1042
 
1042
1043
  :param path_query_id: (required)
1043
1044
  :type path_query_id: str
@@ -1066,6 +1067,7 @@ class UserApi:
1066
1067
  :type _host_index: int, optional
1067
1068
  :return: Returns the result object.
1068
1069
  """ # noqa: E501
1070
+ warnings.warn("GET /graphql/{pathQueryId}/UserByRestId is deprecated.", DeprecationWarning)
1069
1071
 
1070
1072
  _param = self._get_user_by_rest_id_serialize(
1071
1073
  path_query_id=path_query_id,
@@ -1110,9 +1112,9 @@ class UserApi:
1110
1112
  _headers: Optional[Dict[StrictStr, Any]] = None,
1111
1113
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1112
1114
  ) -> RESTResponseType:
1113
- """get_user_by_rest_id
1115
+ """(Deprecated) get_user_by_rest_id
1114
1116
 
1115
- get user by rest id
1117
+ get user by rest id. Deprecated: X answers 403 outside a browser since 2026-10
1116
1118
 
1117
1119
  :param path_query_id: (required)
1118
1120
  :type path_query_id: str
@@ -1141,6 +1143,7 @@ class UserApi:
1141
1143
  :type _host_index: int, optional
1142
1144
  :return: Returns the result object.
1143
1145
  """ # noqa: E501
1146
+ warnings.warn("GET /graphql/{pathQueryId}/UserByRestId is deprecated.", DeprecationWarning)
1144
1147
 
1145
1148
  _param = self._get_user_by_rest_id_serialize(
1146
1149
  path_query_id=path_query_id,
@@ -375,9 +375,9 @@ class UsersApi:
375
375
  _headers: Optional[Dict[StrictStr, Any]] = None,
376
376
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
377
377
  ) -> UsersResponse:
378
- """get_users_by_rest_ids
378
+ """(Deprecated) get_users_by_rest_ids
379
379
 
380
- get users by rest ids
380
+ get users by rest ids. Deprecated: X answers 403 outside a browser since 2026-10
381
381
 
382
382
  :param path_query_id: (required)
383
383
  :type path_query_id: str
@@ -406,6 +406,7 @@ class UsersApi:
406
406
  :type _host_index: int, optional
407
407
  :return: Returns the result object.
408
408
  """ # noqa: E501
409
+ warnings.warn("GET /graphql/{pathQueryId}/UsersByRestIds is deprecated.", DeprecationWarning)
409
410
 
410
411
  _param = self._get_users_by_rest_ids_serialize(
411
412
  path_query_id=path_query_id,
@@ -450,9 +451,9 @@ class UsersApi:
450
451
  _headers: Optional[Dict[StrictStr, Any]] = None,
451
452
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
452
453
  ) -> ApiResponse[UsersResponse]:
453
- """get_users_by_rest_ids
454
+ """(Deprecated) get_users_by_rest_ids
454
455
 
455
- get users by rest ids
456
+ get users by rest ids. Deprecated: X answers 403 outside a browser since 2026-10
456
457
 
457
458
  :param path_query_id: (required)
458
459
  :type path_query_id: str
@@ -481,6 +482,7 @@ class UsersApi:
481
482
  :type _host_index: int, optional
482
483
  :return: Returns the result object.
483
484
  """ # noqa: E501
485
+ warnings.warn("GET /graphql/{pathQueryId}/UsersByRestIds is deprecated.", DeprecationWarning)
484
486
 
485
487
  _param = self._get_users_by_rest_ids_serialize(
486
488
  path_query_id=path_query_id,
@@ -525,9 +527,9 @@ class UsersApi:
525
527
  _headers: Optional[Dict[StrictStr, Any]] = None,
526
528
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
527
529
  ) -> RESTResponseType:
528
- """get_users_by_rest_ids
530
+ """(Deprecated) get_users_by_rest_ids
529
531
 
530
- get users by rest ids
532
+ get users by rest ids. Deprecated: X answers 403 outside a browser since 2026-10
531
533
 
532
534
  :param path_query_id: (required)
533
535
  :type path_query_id: str
@@ -556,6 +558,7 @@ class UsersApi:
556
558
  :type _host_index: int, optional
557
559
  :return: Returns the result object.
558
560
  """ # noqa: E501
561
+ warnings.warn("GET /graphql/{pathQueryId}/UsersByRestIds is deprecated.", DeprecationWarning)
559
562
 
560
563
  _param = self._get_users_by_rest_ids_serialize(
561
564
  path_query_id=path_query_id,
@@ -92,7 +92,7 @@ class ApiClient:
92
92
  self.default_headers[header_name] = header_value
93
93
  self.cookie = cookie
94
94
  # Set default User-Agent.
95
- self.user_agent = 'OpenAPI-Generator/0.1.3/python'
95
+ self.user_agent = 'OpenAPI-Generator/0.1.5/python'
96
96
  self.client_side_validation = configuration.client_side_validation
97
97
 
98
98
  def __enter__(self):
@@ -802,7 +802,7 @@ conf = twitter_openapi_python_generated.Configuration(
802
802
  "OS: {env}\n"\
803
803
  "Python Version: {pyversion}\n"\
804
804
  "Version of the API: 0.0.1\n"\
805
- "SDK Package Version: 0.1.3".\
805
+ "SDK Package Version: 0.1.5".\
806
806
  format(env=sys.platform, pyversion=sys.version)
807
807
 
808
808
  def get_host_settings(self) -> List[HostSetting]:
@@ -375,8 +375,11 @@ from twitter_openapi_python_generated.models.note_tweet_result_media import Note
375
375
  from twitter_openapi_python_generated.models.note_tweet_result_media_inline_media import NoteTweetResultMediaInlineMedia
376
376
  from twitter_openapi_python_generated.models.note_tweet_result_rich_text import NoteTweetResultRichText
377
377
  from twitter_openapi_python_generated.models.note_tweet_result_rich_text_tag import NoteTweetResultRichTextTag
378
+ from twitter_openapi_python_generated.models.notification_additional_context import NotificationAdditionalContext
378
379
  from twitter_openapi_python_generated.models.notification_details import NotificationDetails
379
380
  from twitter_openapi_python_generated.models.notification_template import NotificationTemplate
381
+ from twitter_openapi_python_generated.models.notification_url import NotificationUrl
382
+ from twitter_openapi_python_generated.models.notification_urt_endpoint_options import NotificationUrtEndpointOptions
380
383
  from twitter_openapi_python_generated.models.notifications_result import NotificationsResult
381
384
  from twitter_openapi_python_generated.models.notifications_timeline_data import NotificationsTimelineData
382
385
  from twitter_openapi_python_generated.models.notifications_timeline_response import NotificationsTimelineResponse
@@ -424,6 +427,11 @@ from twitter_openapi_python_generated.models.post_list_add_member_request import
424
427
  from twitter_openapi_python_generated.models.post_list_add_member_request_variables import PostListAddMemberRequestVariables
425
428
  from twitter_openapi_python_generated.models.post_list_remove_member_request import PostListRemoveMemberRequest
426
429
  from twitter_openapi_python_generated.models.post_unfavorite_tweet_request import PostUnfavoriteTweetRequest
430
+ from twitter_openapi_python_generated.models.preroll import Preroll
431
+ from twitter_openapi_python_generated.models.preroll_call_to_action import PrerollCallToAction
432
+ from twitter_openapi_python_generated.models.preroll_media_info import PrerollMediaInfo
433
+ from twitter_openapi_python_generated.models.preroll_metadata import PrerollMetadata
434
+ from twitter_openapi_python_generated.models.preroll_video_variant import PrerollVideoVariant
427
435
  from twitter_openapi_python_generated.models.primary_community_topic import PrimaryCommunityTopic
428
436
  from twitter_openapi_python_generated.models.profile_bio import ProfileBio
429
437
  from twitter_openapi_python_generated.models.profile_bio_entities import ProfileBioEntities
@@ -578,6 +586,9 @@ from twitter_openapi_python_generated.models.tweet_result_by_rest_id_data import
578
586
  from twitter_openapi_python_generated.models.tweet_result_by_rest_id_response import TweetResultByRestIdResponse
579
587
  from twitter_openapi_python_generated.models.tweet_retweeters_response import TweetRetweetersResponse
580
588
  from twitter_openapi_python_generated.models.tweet_retweeters_response_data import TweetRetweetersResponseData
589
+ from twitter_openapi_python_generated.models.tweet_sports_competitor import TweetSportsCompetitor
590
+ from twitter_openapi_python_generated.models.tweet_sports_post_context import TweetSportsPostContext
591
+ from twitter_openapi_python_generated.models.tweet_sports_rest_id import TweetSportsRestId
581
592
  from twitter_openapi_python_generated.models.tweet_tombstone import TweetTombstone
582
593
  from twitter_openapi_python_generated.models.tweet_unavailable import TweetUnavailable
583
594
  from twitter_openapi_python_generated.models.tweet_union import TweetUnion
@@ -31,11 +31,12 @@ class AdMetadataContainer(BaseModel):
31
31
  """ # noqa: E501
32
32
  destination_url_params: Optional[List[KeyValue]] = Field(default=None, alias="destinationUrlParams")
33
33
  is_quick_promote: StrictBool = Field(alias="isQuickPromote")
34
+ remove_promoted_attribution_for_preroll: Optional[StrictBool] = None
34
35
  render_legacy_website_card: StrictBool = Field(alias="renderLegacyWebsiteCard")
35
36
  render_sales_cta_website_card: StrictBool = Field(alias="renderSalesCtaWebsiteCard")
36
37
  show_overlay_on_first_card: Optional[StrictBool] = Field(default=None, alias="showOverlayOnFirstCard")
37
38
  unified_card_override: Optional[StrictStr] = Field(default=None, alias="unifiedCardOverride")
38
- __properties: ClassVar[List[str]] = ["destinationUrlParams", "isQuickPromote", "renderLegacyWebsiteCard", "renderSalesCtaWebsiteCard", "showOverlayOnFirstCard", "unifiedCardOverride"]
39
+ __properties: ClassVar[List[str]] = ["destinationUrlParams", "isQuickPromote", "remove_promoted_attribution_for_preroll", "renderLegacyWebsiteCard", "renderSalesCtaWebsiteCard", "showOverlayOnFirstCard", "unifiedCardOverride"]
39
40
 
40
41
  model_config = ConfigDict(
41
42
  validate_by_name=True,
@@ -96,6 +97,7 @@ class AdMetadataContainer(BaseModel):
96
97
  _obj = cls.model_validate({
97
98
  "destinationUrlParams": [KeyValue.from_dict(_item) for _item in obj["destinationUrlParams"]] if obj.get("destinationUrlParams") is not None else None,
98
99
  "isQuickPromote": obj.get("isQuickPromote"),
100
+ "remove_promoted_attribution_for_preroll": obj.get("remove_promoted_attribution_for_preroll"),
99
101
  "renderLegacyWebsiteCard": obj.get("renderLegacyWebsiteCard"),
100
102
  "renderSalesCtaWebsiteCard": obj.get("renderSalesCtaWebsiteCard"),
101
103
  "showOverlayOnFirstCard": obj.get("showOverlayOnFirstCard"),
@@ -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
22
- from typing import Any, ClassVar, Dict, List
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
23
  from twitter_openapi_python_generated.models.key_value import KeyValue
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
@@ -29,8 +29,10 @@ class ClickTrackingInfo(BaseModel):
29
29
  """
30
30
  ClickTrackingInfo
31
31
  """ # noqa: E501
32
+ url_override: Optional[StrictStr] = Field(default=None, alias="urlOverride")
33
+ url_override_type: Optional[StrictStr] = Field(default=None, alias="urlOverrideType")
32
34
  url_params: List[KeyValue] = Field(alias="urlParams")
33
- __properties: ClassVar[List[str]] = ["urlParams"]
35
+ __properties: ClassVar[List[str]] = ["urlOverride", "urlOverrideType", "urlParams"]
34
36
 
35
37
  model_config = ConfigDict(
36
38
  validate_by_name=True,
@@ -89,6 +91,8 @@ class ClickTrackingInfo(BaseModel):
89
91
  return cls.model_validate(obj)
90
92
 
91
93
  _obj = cls.model_validate({
94
+ "urlOverride": obj.get("urlOverride"),
95
+ "urlOverrideType": obj.get("urlOverrideType"),
92
96
  "urlParams": [KeyValue.from_dict(_item) for _item in obj["urlParams"]] if obj.get("urlParams") is not None else None
93
97
  })
94
98
  return _obj
@@ -28,9 +28,9 @@ class FeedbackClientEventInfo(BaseModel):
28
28
  """
29
29
  FeedbackClientEventInfo
30
30
  """ # noqa: E501
31
- action: StrictStr
31
+ action: Optional[StrictStr] = None
32
32
  component: Optional[StrictStr] = None
33
- element: StrictStr
33
+ element: Optional[StrictStr] = None
34
34
  __properties: ClassVar[List[str]] = ["action", "component", "element"]
35
35
 
36
36
  model_config = ConfigDict(
@@ -0,0 +1,94 @@
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.type_name import TypeName
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class NotificationAdditionalContext(BaseModel):
29
+ """
30
+ NotificationAdditionalContext
31
+ """ # noqa: E501
32
+ typename: TypeName = Field(alias="__typename")
33
+ entities: List[Dict[str, Any]]
34
+ text: StrictStr
35
+ __properties: ClassVar[List[str]] = ["__typename", "entities", "text"]
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 NotificationAdditionalContext 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
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of NotificationAdditionalContext from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "__typename": obj.get("__typename"),
89
+ "entities": obj.get("entities"),
90
+ "text": obj.get("text")
91
+ })
92
+ return _obj
93
+
94
+
@@ -18,8 +18,9 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.notification_additional_context import NotificationAdditionalContext
23
24
  from twitter_openapi_python_generated.models.type_name import TypeName
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
@@ -30,9 +31,11 @@ class NotificationTemplate(BaseModel):
30
31
  NotificationTemplate
31
32
  """ # noqa: E501
32
33
  typename: Optional[TypeName] = Field(default=None, alias="__typename")
34
+ additional_context: Optional[NotificationAdditionalContext] = None
33
35
  from_users: Optional[List[Dict[str, Any]]] = None
36
+ show_all_link_text: Optional[StrictStr] = None
34
37
  target_objects: Optional[List[Dict[str, Any]]] = None
35
- __properties: ClassVar[List[str]] = ["__typename", "from_users", "target_objects"]
38
+ __properties: ClassVar[List[str]] = ["__typename", "additional_context", "from_users", "show_all_link_text", "target_objects"]
36
39
 
37
40
  model_config = ConfigDict(
38
41
  validate_by_name=True,
@@ -73,6 +76,9 @@ class NotificationTemplate(BaseModel):
73
76
  exclude=excluded_fields,
74
77
  exclude_none=True,
75
78
  )
79
+ # override the default output from pydantic by calling `to_dict()` of additional_context
80
+ if self.additional_context:
81
+ _dict['additional_context'] = self.additional_context.to_dict()
76
82
  return _dict
77
83
 
78
84
  @classmethod
@@ -86,7 +92,9 @@ class NotificationTemplate(BaseModel):
86
92
 
87
93
  _obj = cls.model_validate({
88
94
  "__typename": obj.get("__typename"),
95
+ "additional_context": NotificationAdditionalContext.from_dict(obj["additional_context"]) if obj.get("additional_context") is not None else None,
89
96
  "from_users": obj.get("from_users"),
97
+ "show_all_link_text": obj.get("show_all_link_text"),
90
98
  "target_objects": obj.get("target_objects")
91
99
  })
92
100
  return _obj
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.notification_urt_endpoint_options import NotificationUrtEndpointOptions
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class NotificationUrl(BaseModel):
29
+ """
30
+ NotificationUrl
31
+ """ # noqa: E501
32
+ url: StrictStr
33
+ url_type: StrictStr = Field(alias="urlType")
34
+ urt_endpoint_options: Optional[NotificationUrtEndpointOptions] = Field(default=None, alias="urtEndpointOptions")
35
+ __properties: ClassVar[List[str]] = ["url", "urlType", "urtEndpointOptions"]
36
+
37
+ @field_validator('url_type')
38
+ def url_type_validate_enum(cls, value):
39
+ """Validates the enum"""
40
+ if value not in set(['ExternalUrl', 'UrtEndpoint']):
41
+ raise ValueError("must be one of enum values ('ExternalUrl', 'UrtEndpoint')")
42
+ return value
43
+
44
+ model_config = ConfigDict(
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of NotificationUrl from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ ])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # override the default output from pydantic by calling `to_dict()` of urt_endpoint_options
84
+ if self.urt_endpoint_options:
85
+ _dict['urtEndpointOptions'] = self.urt_endpoint_options.to_dict()
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of NotificationUrl from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "url": obj.get("url"),
99
+ "urlType": obj.get("urlType"),
100
+ "urtEndpointOptions": NotificationUrtEndpointOptions.from_dict(obj["urtEndpointOptions"]) if obj.get("urtEndpointOptions") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class NotificationUrtEndpointOptions(BaseModel):
28
+ """
29
+ NotificationUrtEndpointOptions
30
+ """ # noqa: E501
31
+ cache_id: StrictStr = Field(alias="cacheId")
32
+ subtitle: StrictStr
33
+ title: StrictStr
34
+ __properties: ClassVar[List[str]] = ["cacheId", "subtitle", "title"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of NotificationUrtEndpointOptions from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of NotificationUrtEndpointOptions from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "cacheId": obj.get("cacheId"),
88
+ "subtitle": obj.get("subtitle"),
89
+ "title": obj.get("title")
90
+ })
91
+ return _obj
92
+
93
+