twitter-openapi-python-generated 0.0.35__py3-none-any.whl → 0.1.1__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 (111) hide show
  1. twitter_openapi_python_generated/__init__.py +135 -9
  2. twitter_openapi_python_generated/api_client.py +1 -1
  3. twitter_openapi_python_generated/configuration.py +1 -1
  4. twitter_openapi_python_generated/models/__init__.py +67 -4
  5. twitter_openapi_python_generated/models/ad_metadata_container.py +104 -0
  6. twitter_openapi_python_generated/models/affiliates_highlighted_label.py +93 -0
  7. twitter_openapi_python_generated/models/api_image.py +108 -0
  8. twitter_openapi_python_generated/models/api_media.py +110 -0
  9. twitter_openapi_python_generated/models/article_cover_media_info.py +3 -3
  10. twitter_openapi_python_generated/models/birdwatch_pivot.py +2 -2
  11. twitter_openapi_python_generated/models/cashtag_info.py +93 -0
  12. twitter_openapi_python_generated/models/click_tracking_info.py +96 -0
  13. twitter_openapi_python_generated/models/client_event_info.py +6 -2
  14. twitter_openapi_python_generated/models/client_event_info_details.py +99 -0
  15. twitter_openapi_python_generated/models/community.py +20 -7
  16. twitter_openapi_python_generated/models/community_banner_media.py +95 -0
  17. twitter_openapi_python_generated/models/community_banner_media_info.py +108 -0
  18. twitter_openapi_python_generated/models/community_moderation_state.py +90 -0
  19. twitter_openapi_python_generated/models/community_relationship.py +6 -2
  20. twitter_openapi_python_generated/models/community_viewer_relationship.py +95 -0
  21. twitter_openapi_python_generated/models/conversation_control.py +10 -11
  22. twitter_openapi_python_generated/models/conversation_details.py +96 -0
  23. twitter_openapi_python_generated/models/conversation_metadata.py +92 -0
  24. twitter_openapi_python_generated/models/conversation_owner.py +96 -0
  25. twitter_openapi_python_generated/models/conversation_owner_core.py +89 -0
  26. twitter_openapi_python_generated/models/conversation_owner_results.py +93 -0
  27. twitter_openapi_python_generated/models/cta_limited_action_prompt.py +110 -0
  28. twitter_openapi_python_generated/models/cta_limited_action_prompt_text.py +91 -0
  29. twitter_openapi_python_generated/models/deepsearch_header.py +96 -0
  30. twitter_openapi_python_generated/models/deepsearch_step.py +99 -0
  31. twitter_openapi_python_generated/models/deepsearch_web_result.py +89 -0
  32. twitter_openapi_python_generated/models/entities.py +27 -6
  33. twitter_openapi_python_generated/models/error_extensions.py +1 -1
  34. twitter_openapi_python_generated/models/error_response.py +1 -1
  35. twitter_openapi_python_generated/models/feedback_action.py +136 -0
  36. twitter_openapi_python_generated/models/feedback_action_entry.py +95 -0
  37. twitter_openapi_python_generated/models/feedback_client_event_info.py +93 -0
  38. twitter_openapi_python_generated/models/feedback_info.py +8 -6
  39. twitter_openapi_python_generated/models/grok_share_attachment_item.py +9 -2
  40. twitter_openapi_python_generated/models/grouped_trend.py +95 -0
  41. twitter_openapi_python_generated/models/hashtag.py +91 -0
  42. twitter_openapi_python_generated/models/jetfuel_attachment.py +91 -0
  43. twitter_openapi_python_generated/models/key_value.py +91 -0
  44. twitter_openapi_python_generated/models/landing_url.py +98 -0
  45. twitter_openapi_python_generated/models/limited_action.py +95 -0
  46. twitter_openapi_python_generated/models/limited_action_results.py +96 -0
  47. twitter_openapi_python_generated/models/limited_action_results_data.py +1 -8
  48. twitter_openapi_python_generated/models/list_banner_media_info.py +3 -3
  49. twitter_openapi_python_generated/models/list_banner_media_results.py +93 -0
  50. twitter_openapi_python_generated/models/{article_cover_media_color_info.py → media_color_info.py} +7 -7
  51. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette.py → media_color_info_palette.py} +7 -7
  52. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette_rgb.py → media_color_info_palette_rgb.py} +4 -4
  53. twitter_openapi_python_generated/models/{list_banner_media_salient_rect.py → media_salient_rect.py} +4 -4
  54. twitter_openapi_python_generated/models/module_footer.py +104 -0
  55. twitter_openapi_python_generated/models/module_header.py +100 -0
  56. twitter_openapi_python_generated/models/module_metadata.py +93 -0
  57. twitter_openapi_python_generated/models/promoted_metadata.py +109 -0
  58. twitter_openapi_python_generated/models/reader_mode_config.py +89 -0
  59. twitter_openapi_python_generated/models/scribe_config.py +89 -0
  60. twitter_openapi_python_generated/models/search_timeline.py +2 -2
  61. twitter_openapi_python_generated/models/smarttag_tag.py +6 -2
  62. twitter_openapi_python_generated/models/smarttag_tag_info.py +93 -0
  63. twitter_openapi_python_generated/models/symbol.py +97 -0
  64. twitter_openapi_python_generated/models/timeline.py +12 -4
  65. twitter_openapi_python_generated/models/timeline_community.py +13 -17
  66. twitter_openapi_python_generated/models/timeline_message_prompt.py +13 -17
  67. twitter_openapi_python_generated/models/timeline_message_prompt_button.py +95 -0
  68. twitter_openapi_python_generated/models/timeline_message_prompt_button_action.py +91 -0
  69. twitter_openapi_python_generated/models/timeline_message_prompt_content.py +112 -0
  70. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text.py +98 -0
  71. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity.py +97 -0
  72. twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity_ref.py +107 -0
  73. twitter_openapi_python_generated/models/timeline_metadata.py +99 -0
  74. twitter_openapi_python_generated/models/timeline_prompt.py +19 -17
  75. twitter_openapi_python_generated/models/timeline_prompt_callback.py +89 -0
  76. twitter_openapi_python_generated/models/timeline_prompt_content.py +124 -0
  77. twitter_openapi_python_generated/models/timeline_response_objects.py +96 -0
  78. twitter_openapi_python_generated/models/timeline_show_alert.py +18 -21
  79. twitter_openapi_python_generated/models/timeline_show_alert_color_config.py +93 -0
  80. twitter_openapi_python_generated/models/timeline_show_alert_icon_display_info.py +91 -0
  81. twitter_openapi_python_generated/models/timeline_show_alert_rich_text.py +3 -3
  82. twitter_openapi_python_generated/models/timeline_timeline_item.py +6 -2
  83. twitter_openapi_python_generated/models/timeline_timeline_module.py +18 -6
  84. twitter_openapi_python_generated/models/timeline_trend.py +10 -1
  85. twitter_openapi_python_generated/models/timeline_tweet.py +6 -2
  86. twitter_openapi_python_generated/models/timelines_details.py +93 -0
  87. twitter_openapi_python_generated/models/tweet.py +7 -1
  88. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +6 -2
  89. twitter_openapi_python_generated/models/tweet_legacy.py +6 -2
  90. twitter_openapi_python_generated/models/tweet_with_visibility_results.py +6 -2
  91. twitter_openapi_python_generated/models/twitter_list.py +17 -3
  92. twitter_openapi_python_generated/models/type_name.py +3 -0
  93. twitter_openapi_python_generated/models/user.py +6 -2
  94. twitter_openapi_python_generated/models/user_label.py +128 -0
  95. twitter_openapi_python_generated/models/user_label_badge.py +89 -0
  96. twitter_openapi_python_generated/models/user_label_mention_results.py +93 -0
  97. twitter_openapi_python_generated/models/user_label_mention_user.py +106 -0
  98. twitter_openapi_python_generated/models/user_label_mention_user_core.py +89 -0
  99. twitter_openapi_python_generated/models/user_label_text.py +98 -0
  100. twitter_openapi_python_generated/models/user_label_text_entity.py +97 -0
  101. twitter_openapi_python_generated/models/user_label_text_entity_ref.py +104 -0
  102. twitter_openapi_python_generated/models/user_label_url.py +98 -0
  103. twitter_openapi_python_generated/models/user_legacy.py +6 -2
  104. twitter_openapi_python_generated/models/user_mention.py +115 -0
  105. twitter_openapi_python_generated/models/user_professional.py +7 -2
  106. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/METADATA +72 -9
  107. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/RECORD +111 -48
  108. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/WHEEL +0 -0
  109. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE +0 -0
  110. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE.AGPL +0 -0
  111. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,136 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.feedback_client_event_info import FeedbackClientEventInfo
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class FeedbackAction(BaseModel):
29
+ """
30
+ FeedbackAction
31
+ """ # noqa: E501
32
+ child_keys: Optional[List[StrictStr]] = Field(default=None, alias="childKeys")
33
+ client_event_info: Optional[FeedbackClientEventInfo] = Field(default=None, alias="clientEventInfo")
34
+ confirmation: StrictStr
35
+ confirmation_display_type: Optional[StrictStr] = Field(default=None, alias="confirmationDisplayType")
36
+ feedback_type: StrictStr = Field(alias="feedbackType")
37
+ feedback_url: Optional[StrictStr] = Field(default=None, alias="feedbackUrl")
38
+ has_undo_action: StrictBool = Field(alias="hasUndoAction")
39
+ icon: Optional[StrictStr] = None
40
+ prompt: StrictStr
41
+ __properties: ClassVar[List[str]] = ["childKeys", "clientEventInfo", "confirmation", "confirmationDisplayType", "feedbackType", "feedbackUrl", "hasUndoAction", "icon", "prompt"]
42
+
43
+ @field_validator('confirmation_display_type')
44
+ def confirmation_display_type_validate_enum(cls, value):
45
+ """Validates the enum"""
46
+ if value is None:
47
+ return value
48
+
49
+ if value not in set(['BottomSheet', 'Inline']):
50
+ raise ValueError("must be one of enum values ('BottomSheet', 'Inline')")
51
+ return value
52
+
53
+ @field_validator('feedback_type')
54
+ def feedback_type_validate_enum(cls, value):
55
+ """Validates the enum"""
56
+ if value not in set(['DontLike', 'GiveFeedback', 'NotCredible', 'NotRelevant', 'SeeFewer']):
57
+ raise ValueError("must be one of enum values ('DontLike', 'GiveFeedback', 'NotCredible', 'NotRelevant', 'SeeFewer')")
58
+ return value
59
+
60
+ @field_validator('icon')
61
+ def icon_validate_enum(cls, value):
62
+ """Validates the enum"""
63
+ if value is None:
64
+ return value
65
+
66
+ if value not in set(['Frown']):
67
+ raise ValueError("must be one of enum values ('Frown')")
68
+ return value
69
+
70
+ model_config = ConfigDict(
71
+ validate_by_name=True,
72
+ validate_by_alias=True,
73
+ validate_assignment=True,
74
+ protected_namespaces=(),
75
+ )
76
+
77
+
78
+ def to_str(self) -> str:
79
+ """Returns the string representation of the model using alias"""
80
+ return pprint.pformat(self.model_dump(by_alias=True))
81
+
82
+ def to_json(self) -> str:
83
+ """Returns the JSON representation of the model using alias"""
84
+ return json.dumps(to_jsonable_python(self.to_dict()))
85
+
86
+ @classmethod
87
+ def from_json(cls, json_str: str) -> Optional[Self]:
88
+ """Create an instance of FeedbackAction from a JSON string"""
89
+ return cls.from_dict(json.loads(json_str))
90
+
91
+ def to_dict(self) -> Dict[str, Any]:
92
+ """Return the dictionary representation of the model using alias.
93
+
94
+ This has the following differences from calling pydantic's
95
+ `self.model_dump(by_alias=True)`:
96
+
97
+ * `None` is only added to the output dict for nullable fields that
98
+ were set at model initialization. Other fields with value `None`
99
+ are ignored.
100
+ """
101
+ excluded_fields: Set[str] = set([
102
+ ])
103
+
104
+ _dict = self.model_dump(
105
+ by_alias=True,
106
+ exclude=excluded_fields,
107
+ exclude_none=True,
108
+ )
109
+ # override the default output from pydantic by calling `to_dict()` of client_event_info
110
+ if self.client_event_info:
111
+ _dict['clientEventInfo'] = self.client_event_info.to_dict()
112
+ return _dict
113
+
114
+ @classmethod
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
+ """Create an instance of FeedbackAction from a dict"""
117
+ if obj is None:
118
+ return None
119
+
120
+ if not isinstance(obj, dict):
121
+ return cls.model_validate(obj)
122
+
123
+ _obj = cls.model_validate({
124
+ "childKeys": obj.get("childKeys"),
125
+ "clientEventInfo": FeedbackClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
126
+ "confirmation": obj.get("confirmation"),
127
+ "confirmationDisplayType": obj.get("confirmationDisplayType"),
128
+ "feedbackType": obj.get("feedbackType"),
129
+ "feedbackUrl": obj.get("feedbackUrl"),
130
+ "hasUndoAction": obj.get("hasUndoAction"),
131
+ "icon": obj.get("icon"),
132
+ "prompt": obj.get("prompt")
133
+ })
134
+ return _obj
135
+
136
+
@@ -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.feedback_action import FeedbackAction
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class FeedbackActionEntry(BaseModel):
29
+ """
30
+ FeedbackActionEntry
31
+ """ # noqa: E501
32
+ key: StrictStr
33
+ value: FeedbackAction
34
+ __properties: ClassVar[List[str]] = ["key", "value"]
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 FeedbackActionEntry 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 value
76
+ if self.value:
77
+ _dict['value'] = self.value.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 FeedbackActionEntry 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
+ "key": obj.get("key"),
91
+ "value": FeedbackAction.from_dict(obj["value"]) if obj.get("value") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -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, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class FeedbackClientEventInfo(BaseModel):
28
+ """
29
+ FeedbackClientEventInfo
30
+ """ # noqa: E501
31
+ action: StrictStr
32
+ component: Optional[StrictStr] = None
33
+ element: StrictStr
34
+ __properties: ClassVar[List[str]] = ["action", "component", "element"]
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 FeedbackClientEventInfo 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 FeedbackClientEventInfo 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
+ "action": obj.get("action"),
88
+ "component": obj.get("component"),
89
+ "element": obj.get("element")
90
+ })
91
+ return _obj
92
+
93
+
@@ -20,7 +20,7 @@ import json
20
20
 
21
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.client_event_info import ClientEventInfo
23
+ from twitter_openapi_python_generated.models.feedback_client_event_info import FeedbackClientEventInfo
24
24
  from typing import Optional, Set
25
25
  from typing_extensions import Self
26
26
  from pydantic_core import to_jsonable_python
@@ -29,9 +29,10 @@ class FeedbackInfo(BaseModel):
29
29
  """
30
30
  FeedbackInfo
31
31
  """ # noqa: E501
32
- client_event_info: Optional[ClientEventInfo] = Field(default=None, alias="clientEventInfo")
33
- feedback_keys: Optional[List[StrictStr]] = Field(default=None, alias="feedbackKeys")
34
- __properties: ClassVar[List[str]] = ["clientEventInfo", "feedbackKeys"]
32
+ client_event_info: Optional[FeedbackClientEventInfo] = Field(default=None, alias="clientEventInfo")
33
+ feedback_keys: List[StrictStr] = Field(alias="feedbackKeys")
34
+ feedback_metadata: Optional[StrictStr] = Field(default=None, alias="feedbackMetadata")
35
+ __properties: ClassVar[List[str]] = ["clientEventInfo", "feedbackKeys", "feedbackMetadata"]
35
36
 
36
37
  model_config = ConfigDict(
37
38
  validate_by_name=True,
@@ -87,8 +88,9 @@ class FeedbackInfo(BaseModel):
87
88
  return cls.model_validate(obj)
88
89
 
89
90
  _obj = cls.model_validate({
90
- "clientEventInfo": ClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
91
- "feedbackKeys": obj.get("feedbackKeys")
91
+ "clientEventInfo": FeedbackClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
92
+ "feedbackKeys": obj.get("feedbackKeys"),
93
+ "feedbackMetadata": obj.get("feedbackMetadata")
92
94
  })
93
95
  return _obj
94
96
 
@@ -20,6 +20,7 @@ import json
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
+ from twitter_openapi_python_generated.models.deepsearch_header import DeepsearchHeader
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
  from pydantic_core import to_jsonable_python
@@ -29,7 +30,7 @@ class GrokShareAttachmentItem(BaseModel):
29
30
  GrokShareAttachmentItem
30
31
  """ # noqa: E501
31
32
  analysis_post_id_results: Optional[AnalysisResults] = None
32
- deepsearch_headers: Optional[List[Dict[str, Any]]] = None
33
+ deepsearch_headers: Optional[List[DeepsearchHeader]] = None
33
34
  media_urls: List[StrictStr]
34
35
  message: StrictStr
35
36
  __properties: ClassVar[List[str]] = ["analysis_post_id_results", "deepsearch_headers", "media_urls", "message"]
@@ -76,6 +77,12 @@ class GrokShareAttachmentItem(BaseModel):
76
77
  # override the default output from pydantic by calling `to_dict()` of analysis_post_id_results
77
78
  if self.analysis_post_id_results:
78
79
  _dict['analysis_post_id_results'] = self.analysis_post_id_results.to_dict()
80
+ # override the default output from pydantic by calling `to_dict()` of each item in deepsearch_headers (list)
81
+ _items = []
82
+ if self.deepsearch_headers:
83
+ for _item_deepsearch_headers in self.deepsearch_headers:
84
+ _items.append(_item_deepsearch_headers.to_dict() if _item_deepsearch_headers is not None else None)
85
+ _dict['deepsearch_headers'] = _items
79
86
  return _dict
80
87
 
81
88
  @classmethod
@@ -89,7 +96,7 @@ class GrokShareAttachmentItem(BaseModel):
89
96
 
90
97
  _obj = cls.model_validate({
91
98
  "analysis_post_id_results": AnalysisResults.from_dict(obj["analysis_post_id_results"]) if obj.get("analysis_post_id_results") is not None else None,
92
- "deepsearch_headers": obj.get("deepsearch_headers"),
99
+ "deepsearch_headers": [DeepsearchHeader.from_dict(_item) for _item in obj["deepsearch_headers"]] if obj.get("deepsearch_headers") is not None else None,
93
100
  "media_urls": obj.get("media_urls"),
94
101
  "message": obj.get("message")
95
102
  })
@@ -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.social_context_landing_url import SocialContextLandingUrl
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class GroupedTrend(BaseModel):
29
+ """
30
+ GroupedTrend
31
+ """ # noqa: E501
32
+ name: StrictStr
33
+ url: SocialContextLandingUrl
34
+ __properties: ClassVar[List[str]] = ["name", "url"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of GroupedTrend 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 url
76
+ if self.url:
77
+ _dict['url'] = self.url.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 GroupedTrend 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
+ "name": obj.get("name"),
91
+ "url": SocialContextLandingUrl.from_dict(obj["url"]) if obj.get("url") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class Hashtag(BaseModel):
28
+ """
29
+ Hashtag
30
+ """ # noqa: E501
31
+ indices: List[StrictInt]
32
+ text: StrictStr
33
+ __properties: ClassVar[List[str]] = ["indices", "text"]
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 Hashtag from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of Hashtag from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "indices": obj.get("indices"),
87
+ "text": obj.get("text")
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Twitter OpenAPI
5
+
6
+ Twitter OpenAPI(Swagger) specification
7
+
8
+ The version of the OpenAPI document: 0.0.1
9
+ Contact: yuki@yuki0311.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class JetfuelAttachment(BaseModel):
28
+ """
29
+ JetfuelAttachment
30
+ """ # noqa: E501
31
+ height: StrictInt
32
+ payload: StrictStr
33
+ __properties: ClassVar[List[str]] = ["height", "payload"]
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 JetfuelAttachment from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of JetfuelAttachment from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "height": obj.get("height"),
87
+ "payload": obj.get("payload")
88
+ })
89
+ return _obj
90
+
91
+