twitter-openapi-typescript-generated 0.0.6 → 0.0.7
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.
- package/.openapi-generator/FILES +1 -0
- package/README.md +2 -2
- package/dist/apis/DefaultApi.d.ts +0 -1
- package/dist/apis/DefaultApi.d.ts.map +1 -1
- package/dist/apis/DefaultApi.js +0 -6
- package/dist/apis/DefaultApi.js.map +1 -1
- package/dist/apis/TweetApi.d.ts +0 -9
- package/dist/apis/TweetApi.d.ts.map +1 -1
- package/dist/apis/TweetApi.js +0 -54
- package/dist/apis/TweetApi.js.map +1 -1
- package/dist/apis/UserApi.d.ts +0 -1
- package/dist/apis/UserApi.d.ts.map +1 -1
- package/dist/apis/UserApi.js +0 -6
- package/dist/apis/UserApi.js.map +1 -1
- package/dist/apis/UserListApi.d.ts +0 -2
- package/dist/apis/UserListApi.d.ts.map +1 -1
- package/dist/apis/UserListApi.js +0 -12
- package/dist/apis/UserListApi.js.map +1 -1
- package/dist/models/TweetLegacy.d.ts +7 -0
- package/dist/models/TweetLegacy.d.ts.map +1 -1
- package/dist/models/TweetLegacy.js +3 -0
- package/dist/models/TweetLegacy.js.map +1 -1
- package/dist/models/TweetLegacySelfThread.d.ts +32 -0
- package/dist/models/TweetLegacySelfThread.d.ts.map +1 -0
- package/dist/models/TweetLegacySelfThread.js +51 -0
- package/dist/models/TweetLegacySelfThread.js.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +1 -0
- package/dist/models/index.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/DefaultApi.ts +0 -9
- package/src/apis/TweetApi.ts +0 -81
- package/src/apis/UserApi.ts +0 -9
- package/src/apis/UserListApi.ts +0 -18
- package/src/models/TweetLegacy.ts +14 -0
- package/src/models/TweetLegacySelfThread.ts +66 -0
- package/src/models/index.ts +1 -0
- package/tools/openapi-generator-config.yaml +2 -2
- package/twitter-openapi/dist/{typescript → compatible}/paths/bookmarks.yaml +0 -7
- package/twitter-openapi/dist/{test → compatible}/paths/follow.yaml +0 -14
- package/twitter-openapi/dist/{test → compatible}/paths/profile.yaml +0 -7
- package/twitter-openapi/dist/{test → compatible}/paths/timeline.yaml +0 -21
- package/twitter-openapi/dist/{test → compatible}/paths/tweet.yaml +0 -7
- package/twitter-openapi/dist/{test → compatible}/paths/user.yaml +0 -7
- package/twitter-openapi/dist/{typescript → compatible}/paths/usertweets.yaml +0 -28
- package/twitter-openapi/dist/{dart → compatible}/schemas/tweet.yaml +8 -0
- package/twitter-openapi/dist/docs/paths/bookmarks.yaml +0 -56
- package/twitter-openapi/dist/docs/paths/follow.yaml +0 -112
- package/twitter-openapi/dist/docs/paths/profile.yaml +0 -35
- package/twitter-openapi/dist/docs/paths/timeline.yaml +0 -170
- package/twitter-openapi/dist/docs/paths/tweet.yaml +0 -61
- package/twitter-openapi/dist/docs/paths/user.yaml +0 -41
- package/twitter-openapi/dist/docs/paths/usertweets.yaml +0 -238
- package/twitter-openapi/dist/docs/schemas/tweet.yaml +8 -0
- package/twitter-openapi/src/openapi/schemas/tweet.yaml +8 -0
- package/twitter-openapi/tools/__pycache__/build_config.cpython-310.pyc +0 -0
- package/twitter-openapi/tools/__pycache__/hooks.cpython-310.pyc +0 -0
- package/twitter-openapi/tools/build_config.py +67 -190
- package/twitter-openapi/tools/hooks.py +28 -7
- package/twitter-openapi/dist/dart/openapi-3.0.yaml +0 -117
- package/twitter-openapi/dist/dart/paths/bookmarks.yaml +0 -141
- package/twitter-openapi/dist/dart/paths/follow.yaml +0 -276
- package/twitter-openapi/dist/dart/paths/post.yaml +0 -876
- package/twitter-openapi/dist/dart/paths/profile.yaml +0 -159
- package/twitter-openapi/dist/dart/paths/timeline.yaml +0 -401
- package/twitter-openapi/dist/dart/paths/tweet.yaml +0 -141
- package/twitter-openapi/dist/dart/paths/user.yaml +0 -119
- package/twitter-openapi/dist/dart/paths/usertweets.yaml +0 -512
- package/twitter-openapi/dist/dart/paths/v1.1-get.yaml +0 -300
- package/twitter-openapi/dist/dart/paths/v1.1-post.yaml +0 -295
- package/twitter-openapi/dist/dart/paths/v2.0-get.yaml +0 -331
- package/twitter-openapi/dist/test/paths/bookmarks.yaml +0 -112
- package/twitter-openapi/dist/test/paths/other.yaml +0 -96
- package/twitter-openapi/dist/test/paths/post.yaml +0 -527
- package/twitter-openapi/dist/test/paths/usertweets.yaml +0 -396
- package/twitter-openapi/dist/test/paths/v1.1-get.yaml +0 -242
- package/twitter-openapi/dist/test/paths/v1.1-post.yaml +0 -277
- package/twitter-openapi/dist/test/paths/v2.0-get.yaml +0 -302
- package/twitter-openapi/dist/test/resources/parameters.yaml +0 -13
- package/twitter-openapi/dist/test/response/error.yaml +0 -90
- package/twitter-openapi/dist/test/schemas/content.yaml +0 -181
- package/twitter-openapi/dist/test/schemas/general.yaml +0 -13
- package/twitter-openapi/dist/test/schemas/instruction.yaml +0 -83
- package/twitter-openapi/dist/test/schemas/timeline.yaml +0 -25
- package/twitter-openapi/dist/test/schemas/tweet.yaml +0 -308
- package/twitter-openapi/dist/test/schemas/typename.yaml +0 -19
- package/twitter-openapi/dist/test/schemas/user.yaml +0 -206
- package/twitter-openapi/dist/typescript/openapi-3.0.yaml +0 -141
- package/twitter-openapi/dist/typescript/paths/follow.yaml +0 -218
- package/twitter-openapi/dist/typescript/paths/other.yaml +0 -96
- package/twitter-openapi/dist/typescript/paths/profile.yaml +0 -130
- package/twitter-openapi/dist/typescript/paths/timeline.yaml +0 -314
- package/twitter-openapi/dist/typescript/paths/tweet.yaml +0 -112
- package/twitter-openapi/dist/typescript/paths/user.yaml +0 -90
- package/twitter-openapi/dist/typescript/resources/parameters.yaml +0 -13
- package/twitter-openapi/dist/typescript/response/error.yaml +0 -90
- package/twitter-openapi/dist/typescript/schemas/content.yaml +0 -181
- package/twitter-openapi/dist/typescript/schemas/general.yaml +0 -13
- package/twitter-openapi/dist/typescript/schemas/instruction.yaml +0 -83
- package/twitter-openapi/dist/typescript/schemas/timeline.yaml +0 -25
- package/twitter-openapi/dist/typescript/schemas/tweet.yaml +0 -308
- package/twitter-openapi/dist/typescript/schemas/typename.yaml +0 -19
- package/twitter-openapi/dist/typescript/schemas/user.yaml +0 -206
- /package/twitter-openapi/dist/{test → compatible}/openapi-3.0.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/paths/other.yaml +0 -0
- /package/twitter-openapi/dist/{typescript → compatible}/paths/post.yaml +0 -0
- /package/twitter-openapi/dist/{typescript → compatible}/paths/v1.1-get.yaml +0 -0
- /package/twitter-openapi/dist/{typescript → compatible}/paths/v1.1-post.yaml +0 -0
- /package/twitter-openapi/dist/{typescript → compatible}/paths/v2.0-get.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/resources/parameters.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/response/error.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/schemas/content.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/schemas/general.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/schemas/instruction.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/schemas/timeline.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/schemas/typename.yaml +0 -0
- /package/twitter-openapi/dist/{dart → compatible}/schemas/user.yaml +0 -0
|
@@ -5,196 +5,73 @@ class Config:
|
|
|
5
5
|
OUTPUT_DIR = "dist/{0}"
|
|
6
6
|
INPUT_DIR = "src/openapi"
|
|
7
7
|
|
|
8
|
+
def hooks_generator(self, queryParameterJson=True):
|
|
9
|
+
# https://stackoverflow.com/questions/34820064/defining-an-api-with-swagger-get-call-that-uses-json-in-parameters/45223964
|
|
10
|
+
if queryParameterJson:
|
|
11
|
+
getParamHook = AddParametersOnContent(
|
|
12
|
+
split=-1,
|
|
13
|
+
contentType="application/json",
|
|
14
|
+
ignoreKeys=["queryId"],
|
|
15
|
+
)
|
|
16
|
+
postParamHook = AddParametersOnParameters(
|
|
17
|
+
split=-1,
|
|
18
|
+
schemaType=None,
|
|
19
|
+
)
|
|
20
|
+
else:
|
|
21
|
+
getParamHook = AddParametersOnParameters(
|
|
22
|
+
split=-1,
|
|
23
|
+
schemaType="string",
|
|
24
|
+
ignoreKeys=["queryId"],
|
|
25
|
+
)
|
|
26
|
+
postParamHook = AddParametersOnBody(
|
|
27
|
+
split=-1,
|
|
28
|
+
schemaType=None,
|
|
29
|
+
contentType="application/json",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
"openapi": [AddSecuritySchemesOnSecuritySchemes()],
|
|
34
|
+
"schemas": [],
|
|
35
|
+
"other": [],
|
|
36
|
+
"request": {
|
|
37
|
+
key: [
|
|
38
|
+
SetResponsesHeader(suffix=None),
|
|
39
|
+
AddPathQueryIdOnParameters(split=-1),
|
|
40
|
+
getParamHook,
|
|
41
|
+
]
|
|
42
|
+
for key in ["default", "user", "user-list", "tweet"]
|
|
43
|
+
}
|
|
44
|
+
| {
|
|
45
|
+
key: [
|
|
46
|
+
SetResponsesHeader(suffix=None),
|
|
47
|
+
AddPathQueryIdOnParameters(split=-1),
|
|
48
|
+
postParamHook,
|
|
49
|
+
]
|
|
50
|
+
for key in ["post"]
|
|
51
|
+
}
|
|
52
|
+
| {
|
|
53
|
+
key: [
|
|
54
|
+
SetResponsesHeader(suffix="legacy"),
|
|
55
|
+
AddParametersOnParameters(split=2, schemaType=None),
|
|
56
|
+
]
|
|
57
|
+
for key in ["v1.1-get", "v2.0-get"]
|
|
58
|
+
}
|
|
59
|
+
| {
|
|
60
|
+
key: [
|
|
61
|
+
SetResponsesHeader(suffix="legacy"),
|
|
62
|
+
AddParametersOnBody(
|
|
63
|
+
split=2,
|
|
64
|
+
schemaType=None,
|
|
65
|
+
contentType="application/x-www-form-urlencoded",
|
|
66
|
+
),
|
|
67
|
+
]
|
|
68
|
+
for key in ["v1.1-post", "v2.0-post"]
|
|
69
|
+
}
|
|
70
|
+
| {"other": []},
|
|
71
|
+
}
|
|
72
|
+
|
|
8
73
|
def main(self):
|
|
9
74
|
return {
|
|
10
|
-
"docs":
|
|
11
|
-
|
|
12
|
-
"schemas": [],
|
|
13
|
-
"other": [],
|
|
14
|
-
"request": {
|
|
15
|
-
key: [
|
|
16
|
-
SetResponsesHeader(suffix=None),
|
|
17
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
18
|
-
AddParametersOnContent(
|
|
19
|
-
split=-1, contentType="application/json"
|
|
20
|
-
),
|
|
21
|
-
]
|
|
22
|
-
for key in ["default", "user", "user-list", "tweet"]
|
|
23
|
-
}
|
|
24
|
-
| {
|
|
25
|
-
key: [
|
|
26
|
-
SetResponsesHeader(suffix=None),
|
|
27
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
28
|
-
AddParametersOnParameters(
|
|
29
|
-
split=-1,
|
|
30
|
-
schemaType=None,
|
|
31
|
-
),
|
|
32
|
-
]
|
|
33
|
-
for key in ["post"]
|
|
34
|
-
}
|
|
35
|
-
| {
|
|
36
|
-
key: [
|
|
37
|
-
SetResponsesHeader(suffix="legacy"),
|
|
38
|
-
AddParametersOnParameters(
|
|
39
|
-
split=2,
|
|
40
|
-
schemaType=None,
|
|
41
|
-
),
|
|
42
|
-
]
|
|
43
|
-
for key in ["v1.1-get", "v2.0-get"]
|
|
44
|
-
}
|
|
45
|
-
| {
|
|
46
|
-
key: [
|
|
47
|
-
SetResponsesHeader(suffix="legacy"),
|
|
48
|
-
AddParametersOnBody(
|
|
49
|
-
split=2,
|
|
50
|
-
schemaType=None,
|
|
51
|
-
contentType="application/x-www-form-urlencoded",
|
|
52
|
-
),
|
|
53
|
-
]
|
|
54
|
-
for key in ["v1.1-post", "v2.0-post"]
|
|
55
|
-
}
|
|
56
|
-
| {"other": []},
|
|
57
|
-
},
|
|
58
|
-
"dart": {
|
|
59
|
-
"openapi": [],
|
|
60
|
-
"schemas": [],
|
|
61
|
-
"other": [],
|
|
62
|
-
"request": {
|
|
63
|
-
key: [
|
|
64
|
-
AddSecuritySchemesOnHeader(split=-1),
|
|
65
|
-
SetResponsesHeader(suffix=None),
|
|
66
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
67
|
-
AddParametersOnParameters(
|
|
68
|
-
split=-1,
|
|
69
|
-
schemaType="string",
|
|
70
|
-
),
|
|
71
|
-
]
|
|
72
|
-
for key in ["default", "user", "user-list", "tweet"]
|
|
73
|
-
}
|
|
74
|
-
| {
|
|
75
|
-
key: [
|
|
76
|
-
AddSecuritySchemesOnHeader(split=-1),
|
|
77
|
-
SetResponsesHeader(suffix=None),
|
|
78
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
79
|
-
AddParametersOnBody(
|
|
80
|
-
split=-1,
|
|
81
|
-
schemaType=None,
|
|
82
|
-
contentType="application/json",
|
|
83
|
-
),
|
|
84
|
-
]
|
|
85
|
-
for key in ["post"]
|
|
86
|
-
}
|
|
87
|
-
| {
|
|
88
|
-
key: [
|
|
89
|
-
SetResponsesHeader(suffix="legacy"),
|
|
90
|
-
AddSecuritySchemesOnHeader(split=-1),
|
|
91
|
-
AddParametersOnParameters(
|
|
92
|
-
split=2,
|
|
93
|
-
schemaType=None,
|
|
94
|
-
),
|
|
95
|
-
]
|
|
96
|
-
for key in ["v1.1-get", "v2.0-get"]
|
|
97
|
-
}
|
|
98
|
-
| {
|
|
99
|
-
key: [
|
|
100
|
-
SetResponsesHeader(suffix="legacy"),
|
|
101
|
-
AddSecuritySchemesOnHeader(split=-1),
|
|
102
|
-
AddParametersOnBody(
|
|
103
|
-
split=2,
|
|
104
|
-
schemaType=None,
|
|
105
|
-
contentType="application/x-www-form-urlencoded",
|
|
106
|
-
),
|
|
107
|
-
]
|
|
108
|
-
for key in ["v1.1-post", "v2.0-post"]
|
|
109
|
-
}
|
|
110
|
-
| {"other": []},
|
|
111
|
-
},
|
|
112
|
-
"typescript": {
|
|
113
|
-
"openapi": [AddSecuritySchemesOnSecuritySchemes()],
|
|
114
|
-
"schemas": [],
|
|
115
|
-
"other": [],
|
|
116
|
-
"request": {
|
|
117
|
-
key: [
|
|
118
|
-
SetResponsesHeader(suffix=None),
|
|
119
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
120
|
-
AddParametersOnParameters(
|
|
121
|
-
split=-1,
|
|
122
|
-
schemaType="string",
|
|
123
|
-
),
|
|
124
|
-
]
|
|
125
|
-
for key in ["default", "user", "user-list", "tweet"]
|
|
126
|
-
}
|
|
127
|
-
| {
|
|
128
|
-
key: [
|
|
129
|
-
SetResponsesHeader(suffix=None),
|
|
130
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
131
|
-
AddParametersOnBody(
|
|
132
|
-
split=-1,
|
|
133
|
-
schemaType=None,
|
|
134
|
-
contentType="application/json",
|
|
135
|
-
),
|
|
136
|
-
]
|
|
137
|
-
for key in ["post"]
|
|
138
|
-
}
|
|
139
|
-
| {
|
|
140
|
-
key: [
|
|
141
|
-
SetResponsesHeader(suffix="legacy"),
|
|
142
|
-
AddParametersOnParameters(
|
|
143
|
-
split=2,
|
|
144
|
-
schemaType=None,
|
|
145
|
-
),
|
|
146
|
-
]
|
|
147
|
-
for key in ["v1.1-get", "v2.0-get"]
|
|
148
|
-
}
|
|
149
|
-
| {
|
|
150
|
-
key: [
|
|
151
|
-
SetResponsesHeader(suffix="legacy"),
|
|
152
|
-
AddParametersOnBody(
|
|
153
|
-
split=2,
|
|
154
|
-
schemaType=None,
|
|
155
|
-
contentType="application/x-www-form-urlencoded",
|
|
156
|
-
),
|
|
157
|
-
]
|
|
158
|
-
for key in ["v1.1-post", "v2.0-post"]
|
|
159
|
-
}
|
|
160
|
-
| {"other": []},
|
|
161
|
-
},
|
|
162
|
-
"test": {
|
|
163
|
-
"openapi": [AddSecuritySchemesOnSecuritySchemes()],
|
|
164
|
-
"schemas": [],
|
|
165
|
-
"other": [],
|
|
166
|
-
"request": {
|
|
167
|
-
key: [
|
|
168
|
-
SetResponsesHeader(suffix=None),
|
|
169
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
170
|
-
AddParametersOnParameters(
|
|
171
|
-
split=-1,
|
|
172
|
-
schemaType="string",
|
|
173
|
-
),
|
|
174
|
-
]
|
|
175
|
-
for key in ["default", "user", "user-list", "tweet"]
|
|
176
|
-
}
|
|
177
|
-
| {
|
|
178
|
-
key: [
|
|
179
|
-
SetResponsesHeader(suffix=None),
|
|
180
|
-
AddPathQueryIdOnParameters(split=-1),
|
|
181
|
-
AddParametersOnParameters(
|
|
182
|
-
split=-1,
|
|
183
|
-
schemaType="string",
|
|
184
|
-
),
|
|
185
|
-
]
|
|
186
|
-
for key in ["post"]
|
|
187
|
-
}
|
|
188
|
-
| {
|
|
189
|
-
key: [
|
|
190
|
-
SetResponsesHeader(suffix="legacy"),
|
|
191
|
-
AddParametersOnParameters(
|
|
192
|
-
split=2,
|
|
193
|
-
schemaType="object",
|
|
194
|
-
),
|
|
195
|
-
]
|
|
196
|
-
for key in ["v1.1-get", "v1.1-post", "v2.0-get", "v2.0-post"]
|
|
197
|
-
}
|
|
198
|
-
| {"other": []},
|
|
199
|
-
},
|
|
75
|
+
"docs": self.hooks_generator(),
|
|
76
|
+
"compatible": self.hooks_generator(queryParameterJson=False),
|
|
200
77
|
}
|
|
@@ -169,24 +169,33 @@ class AddPathQueryIdOnParameters(RequestHookBase):
|
|
|
169
169
|
|
|
170
170
|
class AddParametersOnParameters(RequestHookBase):
|
|
171
171
|
schemaType: str | None
|
|
172
|
+
ignoreKeys: list[str]
|
|
172
173
|
|
|
173
|
-
def __init__(
|
|
174
|
+
def __init__(
|
|
175
|
+
self,
|
|
176
|
+
split: str = 1,
|
|
177
|
+
schemaType: str | None = None,
|
|
178
|
+
ignoreKeys: list[str] | None = None,
|
|
179
|
+
):
|
|
174
180
|
super().__init__(split=split)
|
|
175
181
|
self.schemaType = schemaType
|
|
182
|
+
self.ignoreKeys = ignoreKeys or []
|
|
176
183
|
|
|
177
184
|
def hook(self, path: str, value: dict):
|
|
178
185
|
path, value = super().hook(path, value)
|
|
179
186
|
data = self.PLACEHOLDER[self.path_name]
|
|
187
|
+
data = {key: data[key] for key in data.keys() if key not in self.ignoreKeys}
|
|
188
|
+
|
|
180
189
|
for key in data.keys():
|
|
181
190
|
if self.schemaType == "string":
|
|
182
|
-
example = json.dumps(data[key])
|
|
191
|
+
example = data[key] if type(data[key]) is str else json.dumps(data[key])
|
|
183
192
|
schema = {
|
|
184
193
|
"type": "string",
|
|
185
194
|
"default": example,
|
|
186
195
|
"example": example,
|
|
187
196
|
}
|
|
188
197
|
elif self.schemaType == "object":
|
|
189
|
-
example = json.dumps(data[key])
|
|
198
|
+
example = data[key] if type(data[key]) is str else json.dumps(data[key])
|
|
190
199
|
schema = {
|
|
191
200
|
"type": "object",
|
|
192
201
|
"default": example,
|
|
@@ -211,30 +220,34 @@ class AddParametersOnParameters(RequestHookBase):
|
|
|
211
220
|
class AddParametersOnBody(RequestHookBase):
|
|
212
221
|
schemaType: str | None
|
|
213
222
|
contentType: str | None
|
|
223
|
+
ignoreKeys: list[str]
|
|
214
224
|
|
|
215
225
|
def __init__(
|
|
216
226
|
self,
|
|
217
227
|
split: str = 1,
|
|
218
228
|
contentType: str = "application/json",
|
|
219
229
|
schemaType: str | None = None,
|
|
230
|
+
ignoreKeys: list[str] | None = None,
|
|
220
231
|
):
|
|
221
232
|
super().__init__(split)
|
|
222
233
|
self.schemaType = schemaType
|
|
223
234
|
self.contentType = contentType
|
|
235
|
+
self.ignoreKeys = ignoreKeys or []
|
|
224
236
|
|
|
225
237
|
def hook(self, path: str, value: dict):
|
|
226
238
|
path, value = super().hook(path, value)
|
|
227
239
|
data = self.PLACEHOLDER[self.path_name]
|
|
240
|
+
data = {key: data[key] for key in data.keys() if key not in self.ignoreKeys}
|
|
228
241
|
|
|
229
242
|
if self.schemaType == "string":
|
|
230
|
-
example = json.dumps(data)
|
|
243
|
+
example = data if type(data) is str else json.dumps(data)
|
|
231
244
|
schema = {
|
|
232
245
|
"type": "string",
|
|
233
246
|
"default": example,
|
|
234
247
|
"example": example,
|
|
235
248
|
}
|
|
236
249
|
elif self.schemaType == "object":
|
|
237
|
-
example = json.dumps(data)
|
|
250
|
+
example = data if type(data) is str else json.dumps(data)
|
|
238
251
|
schema = {
|
|
239
252
|
"type": "object",
|
|
240
253
|
"default": example,
|
|
@@ -264,14 +277,23 @@ class AddParametersOnBody(RequestHookBase):
|
|
|
264
277
|
|
|
265
278
|
class AddParametersOnContent(RequestHookBase):
|
|
266
279
|
contentType: str
|
|
280
|
+
ignoreKeys: list[str]
|
|
267
281
|
|
|
268
|
-
def __init__(
|
|
282
|
+
def __init__(
|
|
283
|
+
self,
|
|
284
|
+
split: str = 1,
|
|
285
|
+
contentType: str = "application/json",
|
|
286
|
+
ignoreKeys: list[str] | None = None,
|
|
287
|
+
):
|
|
269
288
|
super().__init__(split=split)
|
|
270
289
|
self.contentType = contentType
|
|
290
|
+
self.ignoreKeys = ignoreKeys or []
|
|
271
291
|
|
|
272
292
|
def hook(self, path: str, value: dict):
|
|
273
293
|
path, value = super().hook(path, value)
|
|
274
294
|
data = self.PLACEHOLDER[self.path_name]
|
|
295
|
+
data = {key: data[key] for key in data.keys() if key not in self.ignoreKeys}
|
|
296
|
+
|
|
275
297
|
for key in data.keys():
|
|
276
298
|
value["parameters"].append(
|
|
277
299
|
{
|
|
@@ -281,7 +303,6 @@ class AddParametersOnContent(RequestHookBase):
|
|
|
281
303
|
"content": {
|
|
282
304
|
self.contentType: {
|
|
283
305
|
"schema": self.placeholder_to_yaml(data[key]),
|
|
284
|
-
"required": [i for i in data[key]],
|
|
285
306
|
}
|
|
286
307
|
},
|
|
287
308
|
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
components:
|
|
2
|
-
schemas: {}
|
|
3
|
-
securitySchemes:
|
|
4
|
-
AuthType:
|
|
5
|
-
description: OAuth2Session if you are logged in
|
|
6
|
-
in: header
|
|
7
|
-
name: x-twitter-auth-type
|
|
8
|
-
type: apiKey
|
|
9
|
-
CookieAuthToken:
|
|
10
|
-
description: HttpOnly cookie
|
|
11
|
-
in: cookie
|
|
12
|
-
name: auth_token
|
|
13
|
-
type: apiKey
|
|
14
|
-
CookieCt0:
|
|
15
|
-
description: document.cookie.split('; ').find(row => row.startsWith('ct0='));
|
|
16
|
-
in: cookie
|
|
17
|
-
name: ct0
|
|
18
|
-
type: apiKey
|
|
19
|
-
CsrfToken:
|
|
20
|
-
description: ''
|
|
21
|
-
in: header
|
|
22
|
-
name: x-csrf-token
|
|
23
|
-
type: apiKey
|
|
24
|
-
GuestToken:
|
|
25
|
-
description: document.cookie.split('; ').find(row => row.startsWith('gt='));
|
|
26
|
-
in: header
|
|
27
|
-
name: x-guest-token
|
|
28
|
-
type: apiKey
|
|
29
|
-
info:
|
|
30
|
-
contact:
|
|
31
|
-
email: yuki@yuki0311.com
|
|
32
|
-
description: Twitter OpenAPI(Swagger) specification
|
|
33
|
-
license:
|
|
34
|
-
name: GNU Affero General Public License v3.
|
|
35
|
-
url: https://raw.githubusercontent.com/fa0311/twitter-openapi/main/LICENSE.txt
|
|
36
|
-
termsOfService: https://github.com/fa0311
|
|
37
|
-
title: Twitter OpenAPI
|
|
38
|
-
version: 0.0.1
|
|
39
|
-
openapi: 3.0.3
|
|
40
|
-
paths:
|
|
41
|
-
/1.1/friends/following/list.json:
|
|
42
|
-
$ref: ./paths/v1.1-get.yaml#/paths/~11.1~1friends~1following~1list.json
|
|
43
|
-
/1.1/friendships/create.json:
|
|
44
|
-
$ref: ./paths/v1.1-post.yaml#/paths/~11.1~1friendships~1create.json
|
|
45
|
-
/1.1/friendships/destroy.json:
|
|
46
|
-
$ref: ./paths/v1.1-post.yaml#/paths/~11.1~1friendships~1destroy.json
|
|
47
|
-
/1.1/search/typeahead.json:
|
|
48
|
-
$ref: ./paths/v1.1-get.yaml#/paths/~11.1~1search~1typeahead.json
|
|
49
|
-
/2/search/adaptive.json:
|
|
50
|
-
$ref: ./paths/v2.0-get.yaml#/paths/~12~1search~1adaptive.json
|
|
51
|
-
/graphql/{pathQueryId}/Bookmarks:
|
|
52
|
-
$ref: ./paths/bookmarks.yaml#/paths/~1graphql~1{pathQueryId}~1Bookmarks
|
|
53
|
-
/graphql/{pathQueryId}/CreateRetweet:
|
|
54
|
-
$ref: ./paths/post.yaml#/paths/~1graphql~1{pathQueryId}~1CreateRetweet
|
|
55
|
-
/graphql/{pathQueryId}/CreateTweet:
|
|
56
|
-
$ref: ./paths/post.yaml#/paths/~1graphql~1{pathQueryId}~1CreateTweet
|
|
57
|
-
/graphql/{pathQueryId}/DeleteRetweet:
|
|
58
|
-
$ref: ./paths/post.yaml#/paths/~1graphql~1{pathQueryId}~1DeleteRetweet
|
|
59
|
-
/graphql/{pathQueryId}/DeleteTweet:
|
|
60
|
-
$ref: ./paths/post.yaml#/paths/~1graphql~1{pathQueryId}~1DeleteTweet
|
|
61
|
-
/graphql/{pathQueryId}/FavoriteTweet:
|
|
62
|
-
$ref: ./paths/post.yaml#/paths/~1graphql~1{pathQueryId}~1FavoriteTweet
|
|
63
|
-
/graphql/{pathQueryId}/Followers:
|
|
64
|
-
$ref: ./paths/follow.yaml#/paths/~1graphql~1{pathQueryId}~1Followers
|
|
65
|
-
/graphql/{pathQueryId}/Following:
|
|
66
|
-
$ref: ./paths/follow.yaml#/paths/~1graphql~1{pathQueryId}~1Following
|
|
67
|
-
/graphql/{pathQueryId}/HomeLatestTimeline:
|
|
68
|
-
$ref: ./paths/timeline.yaml#/paths/~1graphql~1{pathQueryId}~1HomeLatestTimeline
|
|
69
|
-
/graphql/{pathQueryId}/HomeTimeline:
|
|
70
|
-
$ref: ./paths/timeline.yaml#/paths/~1graphql~1{pathQueryId}~1HomeTimeline
|
|
71
|
-
/graphql/{pathQueryId}/Likes:
|
|
72
|
-
$ref: ./paths/usertweets.yaml#/paths/~1graphql~1{pathQueryId}~1Likes
|
|
73
|
-
/graphql/{pathQueryId}/ListLatestTweetsTimeline:
|
|
74
|
-
$ref: ./paths/timeline.yaml#/paths/~1graphql~1{pathQueryId}~1ListLatestTweetsTimeline
|
|
75
|
-
/graphql/{pathQueryId}/ProfileSpotlightsQuery:
|
|
76
|
-
$ref: ./paths/profile.yaml#/paths/~1graphql~1{pathQueryId}~1ProfileSpotlightsQuery
|
|
77
|
-
/graphql/{pathQueryId}/TweetDetail:
|
|
78
|
-
$ref: ./paths/tweet.yaml#/paths/~1graphql~1{pathQueryId}~1TweetDetail
|
|
79
|
-
/graphql/{pathQueryId}/UnfavoriteTweet:
|
|
80
|
-
$ref: ./paths/post.yaml#/paths/~1graphql~1{pathQueryId}~1UnfavoriteTweet
|
|
81
|
-
/graphql/{pathQueryId}/UserByScreenName:
|
|
82
|
-
$ref: ./paths/user.yaml#/paths/~1graphql~1{pathQueryId}~1UserByScreenName
|
|
83
|
-
/graphql/{pathQueryId}/UserMedia:
|
|
84
|
-
$ref: ./paths/usertweets.yaml#/paths/~1graphql~1{pathQueryId}~1UserMedia
|
|
85
|
-
/graphql/{pathQueryId}/UserTweets:
|
|
86
|
-
$ref: ./paths/usertweets.yaml#/paths/~1graphql~1{pathQueryId}~1UserTweets
|
|
87
|
-
/graphql/{pathQueryId}/UserTweetsAndReplies:
|
|
88
|
-
$ref: ./paths/usertweets.yaml#/paths/~1graphql~1{pathQueryId}~1UserTweetsAndReplies
|
|
89
|
-
/other:
|
|
90
|
-
$ref: ./paths/other.yaml#/paths/~1other
|
|
91
|
-
security:
|
|
92
|
-
- CsrfToken: []
|
|
93
|
-
- CookieCt0: []
|
|
94
|
-
- GuestToken: []
|
|
95
|
-
- CookieAuthToken: []
|
|
96
|
-
- AuthType: []
|
|
97
|
-
servers:
|
|
98
|
-
- url: https://twitter.com/i/api
|
|
99
|
-
tags:
|
|
100
|
-
- description: response User
|
|
101
|
-
name: user
|
|
102
|
-
- description: response User list
|
|
103
|
-
name: user-list
|
|
104
|
-
- description: response tweet
|
|
105
|
-
name: tweet
|
|
106
|
-
- description: post
|
|
107
|
-
name: post
|
|
108
|
-
- description: legacy APIs get
|
|
109
|
-
name: v1.1-get
|
|
110
|
-
- description: legacy APIs post
|
|
111
|
-
name: v1.1-post
|
|
112
|
-
- description: legacy APIs get
|
|
113
|
-
name: v2.0-get
|
|
114
|
-
- description: legacy APIs post
|
|
115
|
-
name: v2.0-post
|
|
116
|
-
- description: other
|
|
117
|
-
name: other
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
components:
|
|
2
|
-
schemas:
|
|
3
|
-
BookmarksResponse:
|
|
4
|
-
properties:
|
|
5
|
-
data:
|
|
6
|
-
$ref: '#/components/schemas/BookmarksResponseData'
|
|
7
|
-
required:
|
|
8
|
-
- data
|
|
9
|
-
BookmarksResponseData:
|
|
10
|
-
properties:
|
|
11
|
-
bookmark_timeline_v2:
|
|
12
|
-
$ref: '#/components/schemas/BookmarksTimeline'
|
|
13
|
-
required:
|
|
14
|
-
- bookmark_timeline_v2
|
|
15
|
-
BookmarksTimeline:
|
|
16
|
-
properties:
|
|
17
|
-
timeline:
|
|
18
|
-
$ref: ./../schemas/timeline.yaml#/components/schemas/Timeline
|
|
19
|
-
required:
|
|
20
|
-
- timeline
|
|
21
|
-
info:
|
|
22
|
-
title: Twitter OpenAPI
|
|
23
|
-
version: 0.0.1
|
|
24
|
-
openapi: 3.0.3
|
|
25
|
-
paths:
|
|
26
|
-
/graphql/{pathQueryId}/Bookmarks:
|
|
27
|
-
get:
|
|
28
|
-
description: get bookmarks
|
|
29
|
-
operationId: getBookmarks
|
|
30
|
-
parameters:
|
|
31
|
-
- in: header
|
|
32
|
-
name: user-agent
|
|
33
|
-
required: true
|
|
34
|
-
schema:
|
|
35
|
-
default: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
|
|
36
|
-
like Gecko) Chrome/112.0.0.0 Safari/537.36
|
|
37
|
-
description: UserAgent, some APIs may be rejected if changed.
|
|
38
|
-
type: string
|
|
39
|
-
- in: header
|
|
40
|
-
name: authorization
|
|
41
|
-
required: true
|
|
42
|
-
schema:
|
|
43
|
-
default: Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
|
|
44
|
-
description: It is a constant value and does not need to be changed.
|
|
45
|
-
type: string
|
|
46
|
-
- in: header
|
|
47
|
-
name: x-twitter-active-user
|
|
48
|
-
required: true
|
|
49
|
-
schema:
|
|
50
|
-
default: 'yes'
|
|
51
|
-
description: Unknown what this value means.
|
|
52
|
-
type: string
|
|
53
|
-
- in: header
|
|
54
|
-
name: x-twitter-client-language
|
|
55
|
-
required: true
|
|
56
|
-
schema:
|
|
57
|
-
default: en
|
|
58
|
-
description: language code.
|
|
59
|
-
type: string
|
|
60
|
-
- in: path
|
|
61
|
-
name: pathQueryId
|
|
62
|
-
required: true
|
|
63
|
-
schema:
|
|
64
|
-
default: tmd4ifV8RHltzn8ymGg1aw
|
|
65
|
-
example: tmd4ifV8RHltzn8ymGg1aw
|
|
66
|
-
type: string
|
|
67
|
-
- in: query
|
|
68
|
-
name: queryId
|
|
69
|
-
required: true
|
|
70
|
-
schema:
|
|
71
|
-
default: '"tmd4ifV8RHltzn8ymGg1aw"'
|
|
72
|
-
example: '"tmd4ifV8RHltzn8ymGg1aw"'
|
|
73
|
-
type: string
|
|
74
|
-
- in: query
|
|
75
|
-
name: variables
|
|
76
|
-
required: true
|
|
77
|
-
schema:
|
|
78
|
-
default: '{"count": 20, "includePromotedContent": true}'
|
|
79
|
-
example: '{"count": 20, "includePromotedContent": true}'
|
|
80
|
-
type: string
|
|
81
|
-
- in: query
|
|
82
|
-
name: features
|
|
83
|
-
required: true
|
|
84
|
-
schema:
|
|
85
|
-
default: '{"graphql_timeline_v2_bookmark_timeline": true, "blue_business_profile_image_shape_enabled":
|
|
86
|
-
true, "responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled":
|
|
87
|
-
false, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled":
|
|
88
|
-
false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_enabled":
|
|
89
|
-
true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled":
|
|
90
|
-
true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled":
|
|
91
|
-
true, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled":
|
|
92
|
-
false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
|
|
93
|
-
false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled":
|
|
94
|
-
false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled":
|
|
95
|
-
false}'
|
|
96
|
-
example: '{"graphql_timeline_v2_bookmark_timeline": true, "blue_business_profile_image_shape_enabled":
|
|
97
|
-
true, "responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled":
|
|
98
|
-
false, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled":
|
|
99
|
-
false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_enabled":
|
|
100
|
-
true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled":
|
|
101
|
-
true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled":
|
|
102
|
-
true, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled":
|
|
103
|
-
false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":
|
|
104
|
-
false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled":
|
|
105
|
-
false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled":
|
|
106
|
-
false}'
|
|
107
|
-
type: string
|
|
108
|
-
responses:
|
|
109
|
-
'200':
|
|
110
|
-
content:
|
|
111
|
-
application/json:
|
|
112
|
-
schema:
|
|
113
|
-
$ref: '#/components/schemas/BookmarksResponse'
|
|
114
|
-
description: Successful operation
|
|
115
|
-
headers:
|
|
116
|
-
x-connection-hash:
|
|
117
|
-
schema:
|
|
118
|
-
type: string
|
|
119
|
-
x-rate-limit-limit:
|
|
120
|
-
schema:
|
|
121
|
-
type: integer
|
|
122
|
-
x-rate-limit-remaining:
|
|
123
|
-
schema:
|
|
124
|
-
type: integer
|
|
125
|
-
x-rate-limit-reset:
|
|
126
|
-
schema:
|
|
127
|
-
type: integer
|
|
128
|
-
x-response-time:
|
|
129
|
-
schema:
|
|
130
|
-
type: integer
|
|
131
|
-
x-tfe-preserve-body:
|
|
132
|
-
schema:
|
|
133
|
-
type: boolean
|
|
134
|
-
x-transaction-id:
|
|
135
|
-
schema:
|
|
136
|
-
type: string
|
|
137
|
-
x-twitter-response-tags:
|
|
138
|
-
schema:
|
|
139
|
-
type: string
|
|
140
|
-
tags:
|
|
141
|
-
- tweet
|