twitter-openapi-python-generated 0.1.0__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.
- twitter_openapi_python_generated/__init__.py +19 -1
- twitter_openapi_python_generated/api_client.py +1 -1
- twitter_openapi_python_generated/configuration.py +1 -1
- twitter_openapi_python_generated/models/__init__.py +9 -0
- twitter_openapi_python_generated/models/community.py +3 -1
- twitter_openapi_python_generated/models/error_extensions.py +1 -1
- twitter_openapi_python_generated/models/error_response.py +1 -1
- twitter_openapi_python_generated/models/grouped_trend.py +95 -0
- twitter_openapi_python_generated/models/search_timeline.py +2 -2
- twitter_openapi_python_generated/models/timeline_community.py +13 -17
- twitter_openapi_python_generated/models/timeline_message_prompt.py +13 -17
- twitter_openapi_python_generated/models/timeline_message_prompt_button.py +95 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_button_action.py +91 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_content.py +112 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text.py +98 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity.py +97 -0
- twitter_openapi_python_generated/models/timeline_message_prompt_rich_text_entity_ref.py +107 -0
- twitter_openapi_python_generated/models/timeline_prompt.py +19 -17
- twitter_openapi_python_generated/models/timeline_prompt_callback.py +89 -0
- twitter_openapi_python_generated/models/timeline_prompt_content.py +124 -0
- twitter_openapi_python_generated/models/timeline_trend.py +10 -1
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/METADATA +11 -2
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/RECORD +27 -18
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/WHEEL +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/licenses/LICENSE.AGPL +0 -0
- {twitter_openapi_python_generated-0.1.0.dist-info → twitter_openapi_python_generated-0.1.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
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.timeline_message_prompt_button import TimelineMessagePromptButton
|
|
24
|
+
from twitter_openapi_python_generated.models.timeline_message_prompt_rich_text import TimelineMessagePromptRichText
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class TimelineMessagePromptContent(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
TimelineMessagePromptContent
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
body_rich_text: Optional[TimelineMessagePromptRichText] = Field(default=None, alias="bodyRichText")
|
|
34
|
+
body_text: Optional[StrictStr] = Field(default=None, alias="bodyText")
|
|
35
|
+
content_type: StrictStr = Field(alias="contentType")
|
|
36
|
+
header_text: StrictStr = Field(alias="headerText")
|
|
37
|
+
primary_button_action: Optional[TimelineMessagePromptButton] = Field(default=None, alias="primaryButtonAction")
|
|
38
|
+
__properties: ClassVar[List[str]] = ["bodyRichText", "bodyText", "contentType", "headerText", "primaryButtonAction"]
|
|
39
|
+
|
|
40
|
+
@field_validator('content_type')
|
|
41
|
+
def content_type_validate_enum(cls, value):
|
|
42
|
+
"""Validates the enum"""
|
|
43
|
+
if value not in set(['TimelineInlinePrompt', 'TimelineCompactPrompt']):
|
|
44
|
+
raise ValueError("must be one of enum values ('TimelineInlinePrompt', 'TimelineCompactPrompt')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
validate_by_name=True,
|
|
49
|
+
validate_by_alias=True,
|
|
50
|
+
validate_assignment=True,
|
|
51
|
+
protected_namespaces=(),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of TimelineMessagePromptContent from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of body_rich_text
|
|
87
|
+
if self.body_rich_text:
|
|
88
|
+
_dict['bodyRichText'] = self.body_rich_text.to_dict()
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of primary_button_action
|
|
90
|
+
if self.primary_button_action:
|
|
91
|
+
_dict['primaryButtonAction'] = self.primary_button_action.to_dict()
|
|
92
|
+
return _dict
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
96
|
+
"""Create an instance of TimelineMessagePromptContent from a dict"""
|
|
97
|
+
if obj is None:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
if not isinstance(obj, dict):
|
|
101
|
+
return cls.model_validate(obj)
|
|
102
|
+
|
|
103
|
+
_obj = cls.model_validate({
|
|
104
|
+
"bodyRichText": TimelineMessagePromptRichText.from_dict(obj["bodyRichText"]) if obj.get("bodyRichText") is not None else None,
|
|
105
|
+
"bodyText": obj.get("bodyText"),
|
|
106
|
+
"contentType": obj.get("contentType"),
|
|
107
|
+
"headerText": obj.get("headerText"),
|
|
108
|
+
"primaryButtonAction": TimelineMessagePromptButton.from_dict(obj["primaryButtonAction"]) if obj.get("primaryButtonAction") is not None else None
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -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.timeline_message_prompt_rich_text_entity import TimelineMessagePromptRichTextEntity
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class TimelineMessagePromptRichText(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineMessagePromptRichText
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
entities: List[TimelineMessagePromptRichTextEntity]
|
|
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 TimelineMessagePromptRichText 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 TimelineMessagePromptRichText 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": [TimelineMessagePromptRichTextEntity.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.timeline_message_prompt_rich_text_entity_ref import TimelineMessagePromptRichTextEntityRef
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class TimelineMessagePromptRichTextEntity(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
TimelineMessagePromptRichTextEntity
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
from_index: StrictInt = Field(alias="fromIndex")
|
|
33
|
+
ref: TimelineMessagePromptRichTextEntityRef
|
|
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 TimelineMessagePromptRichTextEntity 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 TimelineMessagePromptRichTextEntity 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": TimelineMessagePromptRichTextEntityRef.from_dict(obj["ref"]) if obj.get("ref") is not None else None,
|
|
93
|
+
"toIndex": obj.get("toIndex")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class TimelineMessagePromptRichTextEntityRef(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TimelineMessagePromptRichTextEntityRef
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
type: StrictStr
|
|
32
|
+
url: StrictStr
|
|
33
|
+
url_type: StrictStr = Field(alias="urlType")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["type", "url", "urlType"]
|
|
35
|
+
|
|
36
|
+
@field_validator('type')
|
|
37
|
+
def type_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['TimelineUrl']):
|
|
40
|
+
raise ValueError("must be one of enum values ('TimelineUrl')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
@field_validator('url_type')
|
|
44
|
+
def url_type_validate_enum(cls, value):
|
|
45
|
+
"""Validates the enum"""
|
|
46
|
+
if value not in set(['ExternalUrl']):
|
|
47
|
+
raise ValueError("must be one of enum values ('ExternalUrl')")
|
|
48
|
+
return value
|
|
49
|
+
|
|
50
|
+
model_config = ConfigDict(
|
|
51
|
+
validate_by_name=True,
|
|
52
|
+
validate_by_alias=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
68
|
+
"""Create an instance of TimelineMessagePromptRichTextEntityRef from a JSON string"""
|
|
69
|
+
return cls.from_dict(json.loads(json_str))
|
|
70
|
+
|
|
71
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
72
|
+
"""Return the dictionary representation of the model using alias.
|
|
73
|
+
|
|
74
|
+
This has the following differences from calling pydantic's
|
|
75
|
+
`self.model_dump(by_alias=True)`:
|
|
76
|
+
|
|
77
|
+
* `None` is only added to the output dict for nullable fields that
|
|
78
|
+
were set at model initialization. Other fields with value `None`
|
|
79
|
+
are ignored.
|
|
80
|
+
"""
|
|
81
|
+
excluded_fields: Set[str] = set([
|
|
82
|
+
])
|
|
83
|
+
|
|
84
|
+
_dict = self.model_dump(
|
|
85
|
+
by_alias=True,
|
|
86
|
+
exclude=excluded_fields,
|
|
87
|
+
exclude_none=True,
|
|
88
|
+
)
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of TimelineMessagePromptRichTextEntityRef from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate({
|
|
101
|
+
"type": obj.get("type"),
|
|
102
|
+
"url": obj.get("url"),
|
|
103
|
+
"urlType": obj.get("urlType")
|
|
104
|
+
})
|
|
105
|
+
return _obj
|
|
106
|
+
|
|
107
|
+
|
|
@@ -19,7 +19,10 @@ import re # noqa: F401
|
|
|
19
19
|
import json
|
|
20
20
|
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from twitter_openapi_python_generated.models.client_event_info import ClientEventInfo
|
|
24
|
+
from twitter_openapi_python_generated.models.content_item_type import ContentItemType
|
|
25
|
+
from twitter_openapi_python_generated.models.timeline_prompt_content import TimelinePromptContent
|
|
23
26
|
from twitter_openapi_python_generated.models.type_name import TypeName
|
|
24
27
|
from typing import Optional, Set
|
|
25
28
|
from typing_extensions import Self
|
|
@@ -29,9 +32,11 @@ class TimelinePrompt(BaseModel):
|
|
|
29
32
|
"""
|
|
30
33
|
TimelinePrompt
|
|
31
34
|
""" # noqa: E501
|
|
32
|
-
typename:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
typename: TypeName = Field(alias="__typename")
|
|
36
|
+
client_event_info: ClientEventInfo = Field(alias="clientEventInfo")
|
|
37
|
+
content: TimelinePromptContent
|
|
38
|
+
item_type: ContentItemType = Field(alias="itemType")
|
|
39
|
+
__properties: ClassVar[List[str]] = ["__typename", "clientEventInfo", "content", "itemType"]
|
|
35
40
|
|
|
36
41
|
model_config = ConfigDict(
|
|
37
42
|
validate_by_name=True,
|
|
@@ -63,10 +68,8 @@ class TimelinePrompt(BaseModel):
|
|
|
63
68
|
* `None` is only added to the output dict for nullable fields that
|
|
64
69
|
were set at model initialization. Other fields with value `None`
|
|
65
70
|
are ignored.
|
|
66
|
-
* Fields in `self.additional_properties` are added to the output dict.
|
|
67
71
|
"""
|
|
68
72
|
excluded_fields: Set[str] = set([
|
|
69
|
-
"additional_properties",
|
|
70
73
|
])
|
|
71
74
|
|
|
72
75
|
_dict = self.model_dump(
|
|
@@ -74,11 +77,12 @@ class TimelinePrompt(BaseModel):
|
|
|
74
77
|
exclude=excluded_fields,
|
|
75
78
|
exclude_none=True,
|
|
76
79
|
)
|
|
77
|
-
#
|
|
78
|
-
if self.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of client_event_info
|
|
81
|
+
if self.client_event_info:
|
|
82
|
+
_dict['clientEventInfo'] = self.client_event_info.to_dict()
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of content
|
|
84
|
+
if self.content:
|
|
85
|
+
_dict['content'] = self.content.to_dict()
|
|
82
86
|
return _dict
|
|
83
87
|
|
|
84
88
|
@classmethod
|
|
@@ -91,13 +95,11 @@ class TimelinePrompt(BaseModel):
|
|
|
91
95
|
return cls.model_validate(obj)
|
|
92
96
|
|
|
93
97
|
_obj = cls.model_validate({
|
|
94
|
-
"__typename": obj.get("__typename")
|
|
98
|
+
"__typename": obj.get("__typename"),
|
|
99
|
+
"clientEventInfo": ClientEventInfo.from_dict(obj["clientEventInfo"]) if obj.get("clientEventInfo") is not None else None,
|
|
100
|
+
"content": TimelinePromptContent.from_dict(obj["content"]) if obj.get("content") is not None else None,
|
|
101
|
+
"itemType": obj.get("itemType")
|
|
95
102
|
})
|
|
96
|
-
# store additional fields in additional_properties
|
|
97
|
-
for _key in obj.keys():
|
|
98
|
-
if _key not in cls.__properties:
|
|
99
|
-
_obj.additional_properties[_key] = obj.get(_key)
|
|
100
|
-
|
|
101
103
|
return _obj
|
|
102
104
|
|
|
103
105
|
|
|
@@ -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 TimelinePromptCallback(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
TimelinePromptCallback
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
endpoint: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["endpoint"]
|
|
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 TimelinePromptCallback 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 TimelinePromptCallback 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
|
+
"endpoint": obj.get("endpoint")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|