twitter-openapi-python-generated 0.1.2__py3-none-any.whl → 0.1.3__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 (104) hide show
  1. twitter_openapi_python_generated/__init__.py +107 -1
  2. twitter_openapi_python_generated/api/default_api.py +1437 -199
  3. twitter_openapi_python_generated/api/user_api.py +301 -0
  4. twitter_openapi_python_generated/api/users_api.py +318 -0
  5. twitter_openapi_python_generated/api_client.py +1 -1
  6. twitter_openapi_python_generated/configuration.py +1 -1
  7. twitter_openapi_python_generated/models/__init__.py +53 -0
  8. twitter_openapi_python_generated/models/about_account_data.py +93 -0
  9. twitter_openapi_python_generated/models/about_account_response.py +102 -0
  10. twitter_openapi_python_generated/models/about_account_user.py +161 -0
  11. twitter_openapi_python_generated/models/about_account_user_result.py +95 -0
  12. twitter_openapi_python_generated/models/about_account_verification_info.py +95 -0
  13. twitter_openapi_python_generated/models/about_account_verification_info_reason.py +99 -0
  14. twitter_openapi_python_generated/models/about_profile.py +103 -0
  15. twitter_openapi_python_generated/models/about_profile_username_changes.py +109 -0
  16. twitter_openapi_python_generated/models/ai_trend.py +126 -0
  17. twitter_openapi_python_generated/models/ai_trend_core.py +95 -0
  18. twitter_openapi_python_generated/models/ai_trend_results.py +95 -0
  19. twitter_openapi_python_generated/models/ai_trend_social_proof.py +89 -0
  20. twitter_openapi_python_generated/models/article_content_block.py +117 -0
  21. twitter_openapi_python_generated/models/article_content_block_data.py +104 -0
  22. twitter_openapi_python_generated/models/article_content_entity.py +95 -0
  23. twitter_openapi_python_generated/models/article_content_entity_data.py +115 -0
  24. twitter_openapi_python_generated/models/article_content_entity_range.py +93 -0
  25. twitter_openapi_python_generated/models/article_content_entity_value.py +104 -0
  26. twitter_openapi_python_generated/models/article_content_inline_style_range.py +100 -0
  27. twitter_openapi_python_generated/models/article_content_media_item.py +101 -0
  28. twitter_openapi_python_generated/models/article_content_state.py +105 -0
  29. twitter_openapi_python_generated/models/article_content_text_range.py +93 -0
  30. twitter_openapi_python_generated/models/article_result.py +9 -3
  31. twitter_openapi_python_generated/models/audio_space.py +107 -0
  32. twitter_openapi_python_generated/models/audio_space_data.py +93 -0
  33. twitter_openapi_python_generated/models/audio_space_mentioned_user.py +97 -0
  34. twitter_openapi_python_generated/models/audio_space_metadata.py +165 -0
  35. twitter_openapi_python_generated/models/audio_space_participant.py +109 -0
  36. twitter_openapi_python_generated/models/audio_space_participant_user.py +104 -0
  37. twitter_openapi_python_generated/models/audio_space_participant_user_results.py +103 -0
  38. twitter_openapi_python_generated/models/audio_space_participant_verification.py +99 -0
  39. twitter_openapi_python_generated/models/audio_space_participants.py +114 -0
  40. twitter_openapi_python_generated/models/audio_space_response.py +102 -0
  41. twitter_openapi_python_generated/models/audio_space_sharings.py +91 -0
  42. twitter_openapi_python_generated/models/birdwatch_pivot.py +0 -17
  43. twitter_openapi_python_generated/models/broadcast.py +159 -0
  44. twitter_openapi_python_generated/models/broadcast_data.py +93 -0
  45. twitter_openapi_python_generated/models/broadcast_edited_replay.py +89 -0
  46. twitter_openapi_python_generated/models/broadcast_periscope_user.py +95 -0
  47. twitter_openapi_python_generated/models/broadcast_response.py +102 -0
  48. twitter_openapi_python_generated/models/cashtag_attachment.py +6 -4
  49. twitter_openapi_python_generated/models/community.py +2 -2
  50. twitter_openapi_python_generated/models/community_delete_action_result.py +1 -8
  51. twitter_openapi_python_generated/models/community_invites_result.py +1 -8
  52. twitter_openapi_python_generated/models/community_join_action_unavailable.py +1 -8
  53. twitter_openapi_python_generated/models/community_leave_action_result.py +1 -8
  54. twitter_openapi_python_generated/models/conversation_control.py +8 -1
  55. twitter_openapi_python_generated/models/conversation_details.py +1 -8
  56. twitter_openapi_python_generated/models/cover_cta.py +5 -15
  57. twitter_openapi_python_generated/models/cta_client_event_info.py +1 -8
  58. twitter_openapi_python_generated/models/cta_limited_action_prompt.py +1 -8
  59. twitter_openapi_python_generated/models/feedback_action.py +1 -21
  60. twitter_openapi_python_generated/models/grok_account_jwt.py +89 -0
  61. twitter_openapi_python_generated/models/grok_account_jwt_data.py +93 -0
  62. twitter_openapi_python_generated/models/grok_account_jwt_response.py +102 -0
  63. twitter_openapi_python_generated/models/grok_entity_ref.py +19 -4
  64. twitter_openapi_python_generated/models/grok_image_annotation.py +2 -2
  65. twitter_openapi_python_generated/models/identity_profile_labels_highlighted_label.py +93 -0
  66. twitter_openapi_python_generated/models/limited_action.py +8 -1
  67. twitter_openapi_python_generated/models/limited_action_results_data.py +8 -1
  68. twitter_openapi_python_generated/models/media_result.py +1 -1
  69. twitter_openapi_python_generated/models/module_header.py +8 -9
  70. twitter_openapi_python_generated/models/note_tweet_result_data.py +2 -2
  71. twitter_openapi_python_generated/models/session.py +0 -7
  72. twitter_openapi_python_generated/models/sidebar_user_recommendation.py +95 -0
  73. twitter_openapi_python_generated/models/sidebar_user_recommendations_data.py +96 -0
  74. twitter_openapi_python_generated/models/sidebar_user_recommendations_response.py +102 -0
  75. twitter_openapi_python_generated/models/story_topic.py +95 -0
  76. twitter_openapi_python_generated/models/story_topic_data.py +93 -0
  77. twitter_openapi_python_generated/models/story_topic_item.py +93 -0
  78. twitter_openapi_python_generated/models/story_topic_response.py +102 -0
  79. twitter_openapi_python_generated/models/story_topic_stories.py +96 -0
  80. twitter_openapi_python_generated/models/timeline_general_context.py +2 -2
  81. twitter_openapi_python_generated/models/timeline_half_cover.py +0 -7
  82. twitter_openapi_python_generated/models/timeline_message_prompt_content.py +1 -8
  83. twitter_openapi_python_generated/models/timeline_prompt_content.py +1 -15
  84. twitter_openapi_python_generated/models/timeline_show_alert.py +1 -15
  85. twitter_openapi_python_generated/models/timeline_tombstone.py +1 -11
  86. twitter_openapi_python_generated/models/timeline_topic_context.py +1 -11
  87. twitter_openapi_python_generated/models/tweet.py +4 -2
  88. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +8 -1
  89. twitter_openapi_python_generated/models/tweet_card_platform_audience.py +1 -8
  90. twitter_openapi_python_generated/models/tweet_legacy.py +18 -3
  91. twitter_openapi_python_generated/models/tweet_legacy_place.py +107 -0
  92. twitter_openapi_python_generated/models/tweet_legacy_place_bounding_box.py +98 -0
  93. twitter_openapi_python_generated/models/tweet_legacy_point.py +98 -0
  94. twitter_openapi_python_generated/models/tweet_post_cta.py +1 -9
  95. twitter_openapi_python_generated/models/type_name.py +1 -0
  96. twitter_openapi_python_generated/models/unified_card.py +1 -8
  97. twitter_openapi_python_generated/models/user_highlights_tweets_result.py +2 -2
  98. twitter_openapi_python_generated/models/user_tweets_result_v1.py +2 -2
  99. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/METADATA +61 -2
  100. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/RECORD +104 -51
  101. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/WHEEL +0 -0
  102. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/licenses/LICENSE +0 -0
  103. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/licenses/LICENSE.AGPL +0 -0
  104. {twitter_openapi_python_generated-0.1.2.dist-info → twitter_openapi_python_generated-0.1.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,89 @@
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
+ from pydantic_core import to_jsonable_python
26
+
27
+ class GrokAccountJwt(BaseModel):
28
+ """
29
+ GrokAccountJwt
30
+ """ # noqa: E501
31
+ status: StrictStr
32
+ __properties: ClassVar[List[str]] = ["status"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of GrokAccountJwt 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 GrokAccountJwt 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
+ "status": obj.get("status")
86
+ })
87
+ return _obj
88
+
89
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.grok_account_jwt import GrokAccountJwt
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class GrokAccountJwtData(BaseModel):
29
+ """
30
+ GrokAccountJwtData
31
+ """ # noqa: E501
32
+ grok_account_jwt: GrokAccountJwt
33
+ __properties: ClassVar[List[str]] = ["grok_account_jwt"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of GrokAccountJwtData from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of grok_account_jwt
75
+ if self.grok_account_jwt:
76
+ _dict['grok_account_jwt'] = self.grok_account_jwt.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of GrokAccountJwtData from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "grok_account_jwt": GrokAccountJwt.from_dict(obj["grok_account_jwt"]) if obj.get("grok_account_jwt") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,102 @@
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, Optional
23
+ from twitter_openapi_python_generated.models.error_response import ErrorResponse
24
+ from twitter_openapi_python_generated.models.grok_account_jwt_data import GrokAccountJwtData
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class GrokAccountJwtResponse(BaseModel):
30
+ """
31
+ GrokAccountJwtResponse
32
+ """ # noqa: E501
33
+ data: GrokAccountJwtData
34
+ errors: Optional[List[ErrorResponse]] = None
35
+ __properties: ClassVar[List[str]] = ["data", "errors"]
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 GrokAccountJwtResponse from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of data
77
+ if self.data:
78
+ _dict['data'] = self.data.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
80
+ _items = []
81
+ if self.errors:
82
+ for _item_errors in self.errors:
83
+ _items.append(_item_errors.to_dict() if _item_errors is not None else None)
84
+ _dict['errors'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of GrokAccountJwtResponse from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "data": GrokAccountJwtData.from_dict(obj["data"]) if obj.get("data") is not None else None,
98
+ "errors": [ErrorResponse.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None
99
+ })
100
+ return _obj
101
+
102
+
@@ -18,8 +18,9 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
  from pydantic_core import to_jsonable_python
@@ -30,17 +31,29 @@ class GrokEntityRef(BaseModel):
30
31
  """ # noqa: E501
31
32
  display_url: Optional[StrictStr] = None
32
33
  expanded_url: Optional[StrictStr] = None
34
+ id: Optional[Annotated[str, Field(strict=True)]] = None
35
+ screen_name: Optional[StrictStr] = None
33
36
  text: Optional[StrictStr] = None
34
37
  type: StrictStr
35
38
  url: Optional[StrictStr] = None
36
39
  url_type: Optional[StrictStr] = None
37
- __properties: ClassVar[List[str]] = ["display_url", "expanded_url", "text", "type", "url", "url_type"]
40
+ __properties: ClassVar[List[str]] = ["display_url", "expanded_url", "id", "screen_name", "text", "type", "url", "url_type"]
41
+
42
+ @field_validator('id', mode="before")
43
+ def id_validate_regular_expression(cls, value):
44
+ """Validates the regular expression"""
45
+ if value is None:
46
+ return value
47
+
48
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
49
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
50
+ return value
38
51
 
39
52
  @field_validator('type')
40
53
  def type_validate_enum(cls, value):
41
54
  """Validates the enum"""
42
- if value not in set(['TimelineUrl', 'TimelineRichTextHashtag']):
43
- raise ValueError("must be one of enum values ('TimelineUrl', 'TimelineRichTextHashtag')")
55
+ if value not in set(['TimelineUrl', 'TimelineRichTextHashtag', 'TimelineRichTextMention']):
56
+ raise ValueError("must be one of enum values ('TimelineUrl', 'TimelineRichTextHashtag', 'TimelineRichTextMention')")
44
57
  return value
45
58
 
46
59
  @field_validator('url_type')
@@ -106,6 +119,8 @@ class GrokEntityRef(BaseModel):
106
119
  _obj = cls.model_validate({
107
120
  "display_url": obj.get("display_url"),
108
121
  "expanded_url": obj.get("expanded_url"),
122
+ "id": obj.get("id"),
123
+ "screen_name": obj.get("screen_name"),
109
124
  "text": obj.get("text"),
110
125
  "type": obj.get("type"),
111
126
  "url": obj.get("url"),
@@ -19,7 +19,7 @@ import re # noqa: F401
19
19
  import json
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
- from typing import Any, ClassVar, Dict, List
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
  from pydantic_core import to_jsonable_python
@@ -29,7 +29,7 @@ class GrokImageAnnotation(BaseModel):
29
29
  GrokImageAnnotation
30
30
  """ # noqa: E501
31
31
  prompt: StrictStr
32
- upsampled_prompt: StrictStr
32
+ upsampled_prompt: Optional[StrictStr] = None
33
33
  __properties: ClassVar[List[str]] = ["prompt", "upsampled_prompt"]
34
34
 
35
35
  model_config = ConfigDict(
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.user_label import UserLabel
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class IdentityProfileLabelsHighlightedLabel(BaseModel):
29
+ """
30
+ IdentityProfileLabelsHighlightedLabel
31
+ """ # noqa: E501
32
+ label: Optional[UserLabel] = None
33
+ __properties: ClassVar[List[str]] = ["label"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of IdentityProfileLabelsHighlightedLabel from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of label
75
+ if self.label:
76
+ _dict['label'] = self.label.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of IdentityProfileLabelsHighlightedLabel from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "label": UserLabel.from_dict(obj["label"]) if obj.get("label") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -18,7 +18,7 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from twitter_openapi_python_generated.models.cta_limited_action_prompt import CtaLimitedActionPrompt
24
24
  from typing import Optional, Set
@@ -33,6 +33,13 @@ class LimitedAction(BaseModel):
33
33
  prompt: Optional[CtaLimitedActionPrompt] = None
34
34
  __properties: ClassVar[List[str]] = ["action", "prompt"]
35
35
 
36
+ @field_validator('action')
37
+ def action_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in set(['Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements', 'CopyLink', 'ShareTweetVia', 'Embed', 'HideCommunityTweet', 'ViewTweetActivity']):
40
+ raise ValueError("must be one of enum values ('Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements', 'CopyLink', 'ShareTweetVia', 'Embed', 'HideCommunityTweet', 'ViewTweetActivity')")
41
+ return value
42
+
36
43
  model_config = ConfigDict(
37
44
  validate_by_name=True,
38
45
  validate_by_alias=True,
@@ -18,7 +18,7 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22
22
  from typing import Any, ClassVar, Dict, List
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
@@ -31,6 +31,13 @@ class LimitedActionResultsData(BaseModel):
31
31
  action: StrictStr
32
32
  __properties: ClassVar[List[str]] = ["action"]
33
33
 
34
+ @field_validator('action')
35
+ def action_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(['Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements', 'CopyLink', 'ShareTweetVia', 'Embed', 'HideCommunityTweet', 'ViewTweetActivity']):
38
+ raise ValueError("must be one of enum values ('Reply', 'Retweet', 'QuoteTweet', 'Like', 'React', 'AddToBookmarks', 'AddToMoment', 'PinToProfile', 'ViewHiddenReplies', 'VoteOnPoll', 'ShowRetweetActionMenu', 'ReplyDownVote', 'SendViaDm', 'ViewPostEngagements', 'CopyLink', 'ShareTweetVia', 'Embed', 'HideCommunityTweet', 'ViewTweetActivity')")
39
+ return value
40
+
34
41
  model_config = ConfigDict(
35
42
  validate_by_name=True,
36
43
  validate_by_alias=True,
@@ -30,7 +30,7 @@ class MediaResult(BaseModel):
30
30
  MediaResult
31
31
  """ # noqa: E501
32
32
  grok_image_annotation: Optional[GrokImageAnnotation] = None
33
- media_key: StrictStr
33
+ media_key: Optional[StrictStr] = None
34
34
  __properties: ClassVar[List[str]] = ["grok_image_annotation", "media_key"]
35
35
 
36
36
  model_config = ConfigDict(
@@ -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, StrictBool, StrictStr, field_validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.social_context_union import SocialContextUnion
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
  from pydantic_core import to_jsonable_python
@@ -29,16 +30,10 @@ class ModuleHeader(BaseModel):
29
30
  ModuleHeader
30
31
  """ # noqa: E501
31
32
  display_type: StrictStr = Field(alias="displayType")
33
+ social_context: Optional[SocialContextUnion] = Field(default=None, alias="socialContext")
32
34
  sticky: Optional[StrictBool] = None
33
35
  text: StrictStr
34
- __properties: ClassVar[List[str]] = ["displayType", "sticky", "text"]
35
-
36
- @field_validator('display_type')
37
- def display_type_validate_enum(cls, value):
38
- """Validates the enum"""
39
- if value not in set(['Classic']):
40
- raise ValueError("must be one of enum values ('Classic')")
41
- return value
36
+ __properties: ClassVar[List[str]] = ["displayType", "socialContext", "sticky", "text"]
42
37
 
43
38
  model_config = ConfigDict(
44
39
  validate_by_name=True,
@@ -79,6 +74,9 @@ class ModuleHeader(BaseModel):
79
74
  exclude=excluded_fields,
80
75
  exclude_none=True,
81
76
  )
77
+ # override the default output from pydantic by calling `to_dict()` of social_context
78
+ if self.social_context:
79
+ _dict['socialContext'] = self.social_context.to_dict()
82
80
  return _dict
83
81
 
84
82
  @classmethod
@@ -92,6 +90,7 @@ class ModuleHeader(BaseModel):
92
90
 
93
91
  _obj = cls.model_validate({
94
92
  "displayType": obj.get("displayType"),
93
+ "socialContext": SocialContextUnion.from_dict(obj["socialContext"]) if obj.get("socialContext") is not None else None,
95
94
  "sticky": obj.get("sticky"),
96
95
  "text": obj.get("text")
97
96
  })
@@ -32,11 +32,11 @@ class NoteTweetResultData(BaseModel):
32
32
  """
33
33
  NoteTweetResultData
34
34
  """ # noqa: E501
35
- entity_set: Entities
35
+ entity_set: Optional[Entities] = None
36
36
  id: Annotated[str, Field(strict=True)]
37
37
  media: Optional[NoteTweetResultMedia] = None
38
38
  richtext: Optional[NoteTweetResultRichText] = None
39
- text: StrictStr
39
+ text: Optional[StrictStr] = None
40
40
  __properties: ClassVar[List[str]] = ["entity_set", "id", "media", "richtext", "text"]
41
41
 
42
42
  @field_validator('id', mode="before")
@@ -69,13 +69,6 @@ class Session(BaseModel):
69
69
  raise ValueError(r"must validate the regular expression /^[a-z]{2}$/")
70
70
  return value
71
71
 
72
- @field_validator('super_follows_application_status')
73
- def super_follows_application_status_validate_enum(cls, value):
74
- """Validates the enum"""
75
- if value not in set(['NotStarted']):
76
- raise ValueError("must be one of enum values ('NotStarted')")
77
- return value
78
-
79
72
  @field_validator('user_id', mode="before")
80
73
  def user_id_validate_regular_expression(cls, value):
81
74
  """Validates the regular expression"""
@@ -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
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.user_results import UserResults
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class SidebarUserRecommendation(BaseModel):
29
+ """
30
+ SidebarUserRecommendation
31
+ """ # noqa: E501
32
+ token: StrictStr
33
+ user_results: UserResults
34
+ __properties: ClassVar[List[str]] = ["token", "user_results"]
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 SidebarUserRecommendation 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
+ # override the default output from pydantic by calling `to_dict()` of user_results
76
+ if self.user_results:
77
+ _dict['user_results'] = self.user_results.to_dict()
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of SidebarUserRecommendation from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate({
90
+ "token": obj.get("token"),
91
+ "user_results": UserResults.from_dict(obj["user_results"]) if obj.get("user_results") is not None else None
92
+ })
93
+ return _obj
94
+
95
+