twitter-openapi-python-generated 0.0.35__py3-none-any.whl → 0.1.0__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 (95) hide show
  1. twitter_openapi_python_generated/__init__.py +117 -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 +58 -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 +17 -6
  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/feedback_action.py +136 -0
  34. twitter_openapi_python_generated/models/feedback_action_entry.py +95 -0
  35. twitter_openapi_python_generated/models/feedback_client_event_info.py +93 -0
  36. twitter_openapi_python_generated/models/feedback_info.py +8 -6
  37. twitter_openapi_python_generated/models/grok_share_attachment_item.py +9 -2
  38. twitter_openapi_python_generated/models/hashtag.py +91 -0
  39. twitter_openapi_python_generated/models/jetfuel_attachment.py +91 -0
  40. twitter_openapi_python_generated/models/key_value.py +91 -0
  41. twitter_openapi_python_generated/models/landing_url.py +98 -0
  42. twitter_openapi_python_generated/models/limited_action.py +95 -0
  43. twitter_openapi_python_generated/models/limited_action_results.py +96 -0
  44. twitter_openapi_python_generated/models/limited_action_results_data.py +1 -8
  45. twitter_openapi_python_generated/models/list_banner_media_info.py +3 -3
  46. twitter_openapi_python_generated/models/list_banner_media_results.py +93 -0
  47. twitter_openapi_python_generated/models/{article_cover_media_color_info.py → media_color_info.py} +7 -7
  48. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette.py → media_color_info_palette.py} +7 -7
  49. twitter_openapi_python_generated/models/{article_cover_media_color_info_palette_rgb.py → media_color_info_palette_rgb.py} +4 -4
  50. twitter_openapi_python_generated/models/{list_banner_media_salient_rect.py → media_salient_rect.py} +4 -4
  51. twitter_openapi_python_generated/models/module_footer.py +104 -0
  52. twitter_openapi_python_generated/models/module_header.py +100 -0
  53. twitter_openapi_python_generated/models/module_metadata.py +93 -0
  54. twitter_openapi_python_generated/models/promoted_metadata.py +109 -0
  55. twitter_openapi_python_generated/models/reader_mode_config.py +89 -0
  56. twitter_openapi_python_generated/models/scribe_config.py +89 -0
  57. twitter_openapi_python_generated/models/smarttag_tag.py +6 -2
  58. twitter_openapi_python_generated/models/smarttag_tag_info.py +93 -0
  59. twitter_openapi_python_generated/models/symbol.py +97 -0
  60. twitter_openapi_python_generated/models/timeline.py +12 -4
  61. twitter_openapi_python_generated/models/timeline_metadata.py +99 -0
  62. twitter_openapi_python_generated/models/timeline_response_objects.py +96 -0
  63. twitter_openapi_python_generated/models/timeline_show_alert.py +18 -21
  64. twitter_openapi_python_generated/models/timeline_show_alert_color_config.py +93 -0
  65. twitter_openapi_python_generated/models/timeline_show_alert_icon_display_info.py +91 -0
  66. twitter_openapi_python_generated/models/timeline_show_alert_rich_text.py +3 -3
  67. twitter_openapi_python_generated/models/timeline_timeline_item.py +6 -2
  68. twitter_openapi_python_generated/models/timeline_timeline_module.py +18 -6
  69. twitter_openapi_python_generated/models/timeline_tweet.py +6 -2
  70. twitter_openapi_python_generated/models/timelines_details.py +93 -0
  71. twitter_openapi_python_generated/models/tweet.py +7 -1
  72. twitter_openapi_python_generated/models/tweet_card_legacy_binding_value_data.py +6 -2
  73. twitter_openapi_python_generated/models/tweet_legacy.py +6 -2
  74. twitter_openapi_python_generated/models/tweet_with_visibility_results.py +6 -2
  75. twitter_openapi_python_generated/models/twitter_list.py +17 -3
  76. twitter_openapi_python_generated/models/type_name.py +3 -0
  77. twitter_openapi_python_generated/models/user.py +6 -2
  78. twitter_openapi_python_generated/models/user_label.py +128 -0
  79. twitter_openapi_python_generated/models/user_label_badge.py +89 -0
  80. twitter_openapi_python_generated/models/user_label_mention_results.py +93 -0
  81. twitter_openapi_python_generated/models/user_label_mention_user.py +106 -0
  82. twitter_openapi_python_generated/models/user_label_mention_user_core.py +89 -0
  83. twitter_openapi_python_generated/models/user_label_text.py +98 -0
  84. twitter_openapi_python_generated/models/user_label_text_entity.py +97 -0
  85. twitter_openapi_python_generated/models/user_label_text_entity_ref.py +104 -0
  86. twitter_openapi_python_generated/models/user_label_url.py +98 -0
  87. twitter_openapi_python_generated/models/user_legacy.py +6 -2
  88. twitter_openapi_python_generated/models/user_mention.py +115 -0
  89. twitter_openapi_python_generated/models/user_professional.py +7 -2
  90. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/METADATA +63 -9
  91. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/RECORD +95 -41
  92. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/WHEEL +0 -0
  93. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/licenses/LICENSE +0 -0
  94. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/licenses/LICENSE.AGPL +0 -0
  95. {twitter_openapi_python_generated-0.0.35.dist-info → twitter_openapi_python_generated-0.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,128 @@
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.user_label_badge import UserLabelBadge
24
+ from twitter_openapi_python_generated.models.user_label_text import UserLabelText
25
+ from twitter_openapi_python_generated.models.user_label_url import UserLabelUrl
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+ from pydantic_core import to_jsonable_python
29
+
30
+ class UserLabel(BaseModel):
31
+ """
32
+ UserLabel
33
+ """ # noqa: E501
34
+ badge: UserLabelBadge
35
+ description: StrictStr
36
+ long_description: Optional[UserLabelText] = Field(default=None, alias="longDescription")
37
+ url: Optional[UserLabelUrl] = None
38
+ user_label_display_type: Optional[StrictStr] = Field(default=None, alias="userLabelDisplayType")
39
+ user_label_type: StrictStr = Field(alias="userLabelType")
40
+ __properties: ClassVar[List[str]] = ["badge", "description", "longDescription", "url", "userLabelDisplayType", "userLabelType"]
41
+
42
+ @field_validator('user_label_display_type')
43
+ def user_label_display_type_validate_enum(cls, value):
44
+ """Validates the enum"""
45
+ if value is None:
46
+ return value
47
+
48
+ if value not in set(['Badge']):
49
+ raise ValueError("must be one of enum values ('Badge')")
50
+ return value
51
+
52
+ @field_validator('user_label_type')
53
+ def user_label_type_validate_enum(cls, value):
54
+ """Validates the enum"""
55
+ if value not in set(['AutomatedLabel', 'BusinessLabel']):
56
+ raise ValueError("must be one of enum values ('AutomatedLabel', 'BusinessLabel')")
57
+ return value
58
+
59
+ model_config = ConfigDict(
60
+ validate_by_name=True,
61
+ validate_by_alias=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
66
+
67
+ def to_str(self) -> str:
68
+ """Returns the string representation of the model using alias"""
69
+ return pprint.pformat(self.model_dump(by_alias=True))
70
+
71
+ def to_json(self) -> str:
72
+ """Returns the JSON representation of the model using alias"""
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of UserLabel from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ """
90
+ excluded_fields: Set[str] = set([
91
+ ])
92
+
93
+ _dict = self.model_dump(
94
+ by_alias=True,
95
+ exclude=excluded_fields,
96
+ exclude_none=True,
97
+ )
98
+ # override the default output from pydantic by calling `to_dict()` of badge
99
+ if self.badge:
100
+ _dict['badge'] = self.badge.to_dict()
101
+ # override the default output from pydantic by calling `to_dict()` of long_description
102
+ if self.long_description:
103
+ _dict['longDescription'] = self.long_description.to_dict()
104
+ # override the default output from pydantic by calling `to_dict()` of url
105
+ if self.url:
106
+ _dict['url'] = self.url.to_dict()
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of UserLabel from a dict"""
112
+ if obj is None:
113
+ return None
114
+
115
+ if not isinstance(obj, dict):
116
+ return cls.model_validate(obj)
117
+
118
+ _obj = cls.model_validate({
119
+ "badge": UserLabelBadge.from_dict(obj["badge"]) if obj.get("badge") is not None else None,
120
+ "description": obj.get("description"),
121
+ "longDescription": UserLabelText.from_dict(obj["longDescription"]) if obj.get("longDescription") is not None else None,
122
+ "url": UserLabelUrl.from_dict(obj["url"]) if obj.get("url") is not None else None,
123
+ "userLabelDisplayType": obj.get("userLabelDisplayType"),
124
+ "userLabelType": obj.get("userLabelType")
125
+ })
126
+ return _obj
127
+
128
+
@@ -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 UserLabelBadge(BaseModel):
28
+ """
29
+ UserLabelBadge
30
+ """ # noqa: E501
31
+ url: StrictStr
32
+ __properties: ClassVar[List[str]] = ["url"]
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 UserLabelBadge 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 UserLabelBadge 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
+ "url": obj.get("url")
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.user_label_mention_user import UserLabelMentionUser
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class UserLabelMentionResults(BaseModel):
29
+ """
30
+ UserLabelMentionResults
31
+ """ # noqa: E501
32
+ result: UserLabelMentionUser
33
+ __properties: ClassVar[List[str]] = ["result"]
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 UserLabelMentionResults 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 result
75
+ if self.result:
76
+ _dict['result'] = self.result.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 UserLabelMentionResults 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
+ "result": UserLabelMentionUser.from_dict(obj["result"]) if obj.get("result") is not None else None
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,106 @@
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, field_validator
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing_extensions import Annotated
24
+ from twitter_openapi_python_generated.models.type_name import TypeName
25
+ from twitter_openapi_python_generated.models.user_label_mention_user_core import UserLabelMentionUserCore
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+ from pydantic_core import to_jsonable_python
29
+
30
+ class UserLabelMentionUser(BaseModel):
31
+ """
32
+ UserLabelMentionUser
33
+ """ # noqa: E501
34
+ typename: TypeName = Field(alias="__typename")
35
+ core: UserLabelMentionUserCore
36
+ rest_id: Annotated[str, Field(strict=True)]
37
+ __properties: ClassVar[List[str]] = ["__typename", "core", "rest_id"]
38
+
39
+ @field_validator('rest_id', mode="before")
40
+ def rest_id_validate_regular_expression(cls, value):
41
+ """Validates the regular expression"""
42
+ if isinstance(value, str) and not re.match(r"^[0-9]+$", value):
43
+ raise ValueError(r"must validate the regular expression /^[0-9]+$/")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ validate_by_name=True,
48
+ validate_by_alias=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ return json.dumps(to_jsonable_python(self.to_dict()))
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of UserLabelMentionUser from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ """
77
+ excluded_fields: Set[str] = set([
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ # override the default output from pydantic by calling `to_dict()` of core
86
+ if self.core:
87
+ _dict['core'] = self.core.to_dict()
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of UserLabelMentionUser from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "__typename": obj.get("__typename"),
101
+ "core": UserLabelMentionUserCore.from_dict(obj["core"]) if obj.get("core") is not None else None,
102
+ "rest_id": obj.get("rest_id")
103
+ })
104
+ return _obj
105
+
106
+
@@ -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 UserLabelMentionUserCore(BaseModel):
28
+ """
29
+ UserLabelMentionUserCore
30
+ """ # noqa: E501
31
+ screen_name: StrictStr
32
+ __properties: ClassVar[List[str]] = ["screen_name"]
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 UserLabelMentionUserCore 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 UserLabelMentionUserCore 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
+ "screen_name": obj.get("screen_name")
86
+ })
87
+ return _obj
88
+
89
+
@@ -0,0 +1,98 @@
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_label_text_entity import UserLabelTextEntity
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class UserLabelText(BaseModel):
29
+ """
30
+ UserLabelText
31
+ """ # noqa: E501
32
+ entities: List[UserLabelTextEntity]
33
+ text: StrictStr
34
+ __properties: ClassVar[List[str]] = ["entities", "text"]
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 UserLabelText 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 each item in entities (list)
76
+ _items = []
77
+ if self.entities:
78
+ for _item_entities in self.entities:
79
+ _items.append(_item_entities.to_dict() if _item_entities is not None else None)
80
+ _dict['entities'] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of UserLabelText from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "entities": [UserLabelTextEntity.from_dict(_item) for _item in obj["entities"]] if obj.get("entities") is not None else None,
94
+ "text": obj.get("text")
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,97 @@
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, StrictInt
22
+ from typing import Any, ClassVar, Dict, List
23
+ from twitter_openapi_python_generated.models.user_label_text_entity_ref import UserLabelTextEntityRef
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class UserLabelTextEntity(BaseModel):
29
+ """
30
+ UserLabelTextEntity
31
+ """ # noqa: E501
32
+ from_index: StrictInt = Field(alias="fromIndex")
33
+ ref: UserLabelTextEntityRef
34
+ to_index: StrictInt = Field(alias="toIndex")
35
+ __properties: ClassVar[List[str]] = ["fromIndex", "ref", "toIndex"]
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 UserLabelTextEntity 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 ref
77
+ if self.ref:
78
+ _dict['ref'] = self.ref.to_dict()
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of UserLabelTextEntity from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "fromIndex": obj.get("fromIndex"),
92
+ "ref": UserLabelTextEntityRef.from_dict(obj["ref"]) if obj.get("ref") is not None else None,
93
+ "toIndex": obj.get("toIndex")
94
+ })
95
+ return _obj
96
+
97
+