twitter-openapi-typescript-generated 0.0.1 → 0.0.2
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-ignore +1 -2
- package/README.md +2 -2
- package/package.json +25 -26
- package/tools/openapi-generator-config.yaml +10 -0
- package/tools/win/clean.ps1 +21 -0
- package/tools/win/gen.ps1 +8 -0
- package/tools/win/init.ps1 +1 -0
- package/tools/win/replace.py +40 -0
- package/twitter-openapi/.vscode/extensions.json +3 -0
- package/twitter-openapi/.vscode/settings.json +9 -0
- package/twitter-openapi/LICENSE.txt +661 -0
- package/twitter-openapi/README.md +38 -0
- package/twitter-openapi/dist/dart/openapi-3.0.yaml +111 -0
- package/twitter-openapi/dist/dart/paths/bookmarks.yaml +134 -0
- package/twitter-openapi/dist/dart/paths/follow.yaml +262 -0
- package/twitter-openapi/dist/dart/paths/other.yaml +96 -0
- package/twitter-openapi/dist/dart/paths/post.yaml +834 -0
- package/twitter-openapi/dist/dart/paths/profile.yaml +152 -0
- package/twitter-openapi/dist/dart/paths/timeline.yaml +380 -0
- package/twitter-openapi/dist/dart/paths/tweet.yaml +134 -0
- package/twitter-openapi/dist/dart/paths/user.yaml +112 -0
- package/twitter-openapi/dist/dart/paths/usertweets.yaml +484 -0
- package/twitter-openapi/dist/dart/paths/v1.1-get.yaml +300 -0
- package/twitter-openapi/dist/dart/paths/v1.1-post.yaml +295 -0
- package/twitter-openapi/dist/dart/paths/v2.0-get.yaml +331 -0
- package/twitter-openapi/dist/dart/response/error.yaml +90 -0
- package/twitter-openapi/dist/dart/schemas/content.yaml +181 -0
- package/twitter-openapi/dist/dart/schemas/general.yaml +13 -0
- package/twitter-openapi/dist/dart/schemas/instruction.yaml +83 -0
- package/twitter-openapi/dist/dart/schemas/timeline.yaml +25 -0
- package/twitter-openapi/dist/dart/schemas/tweet.yaml +251 -0
- package/twitter-openapi/dist/dart/schemas/typename.yaml +19 -0
- package/twitter-openapi/dist/dart/schemas/user.yaml +206 -0
- package/twitter-openapi/dist/docs/openapi-3.0.yaml +135 -0
- package/twitter-openapi/dist/docs/paths/bookmarks.yaml +248 -0
- package/twitter-openapi/dist/docs/paths/follow.yaml +486 -0
- package/twitter-openapi/dist/docs/paths/other.yaml +96 -0
- package/twitter-openapi/dist/docs/paths/post.yaml +638 -0
- package/twitter-openapi/dist/docs/paths/profile.yaml +159 -0
- package/twitter-openapi/dist/docs/paths/timeline.yaml +730 -0
- package/twitter-openapi/dist/docs/paths/tweet.yaml +272 -0
- package/twitter-openapi/dist/docs/paths/user.yaml +152 -0
- package/twitter-openapi/dist/docs/paths/usertweets.yaml +1010 -0
- package/twitter-openapi/dist/docs/paths/v1.1-get.yaml +242 -0
- package/twitter-openapi/dist/docs/paths/v1.1-post.yaml +237 -0
- package/twitter-openapi/dist/docs/paths/v2.0-get.yaml +302 -0
- package/twitter-openapi/dist/docs/response/error.yaml +90 -0
- package/twitter-openapi/dist/docs/schemas/content.yaml +181 -0
- package/twitter-openapi/dist/docs/schemas/general.yaml +13 -0
- package/twitter-openapi/dist/docs/schemas/instruction.yaml +83 -0
- package/twitter-openapi/dist/docs/schemas/timeline.yaml +25 -0
- package/twitter-openapi/dist/docs/schemas/tweet.yaml +251 -0
- package/twitter-openapi/dist/docs/schemas/typename.yaml +19 -0
- package/twitter-openapi/dist/docs/schemas/user.yaml +206 -0
- package/twitter-openapi/dist/test/openapi-3.0.yaml +135 -0
- package/twitter-openapi/dist/test/paths/bookmarks.yaml +105 -0
- package/twitter-openapi/dist/test/paths/follow.yaml +204 -0
- package/twitter-openapi/dist/test/paths/other.yaml +96 -0
- package/twitter-openapi/dist/test/paths/post.yaml +485 -0
- package/twitter-openapi/dist/test/paths/profile.yaml +123 -0
- package/twitter-openapi/dist/test/paths/timeline.yaml +293 -0
- package/twitter-openapi/dist/test/paths/tweet.yaml +105 -0
- package/twitter-openapi/dist/test/paths/user.yaml +83 -0
- package/twitter-openapi/dist/test/paths/usertweets.yaml +368 -0
- package/twitter-openapi/dist/test/paths/v1.1-get.yaml +242 -0
- package/twitter-openapi/dist/test/paths/v1.1-post.yaml +277 -0
- package/twitter-openapi/dist/test/paths/v2.0-get.yaml +302 -0
- package/twitter-openapi/dist/test/response/error.yaml +90 -0
- package/twitter-openapi/dist/test/schemas/content.yaml +181 -0
- package/twitter-openapi/dist/test/schemas/general.yaml +13 -0
- package/twitter-openapi/dist/test/schemas/instruction.yaml +83 -0
- package/twitter-openapi/dist/test/schemas/timeline.yaml +25 -0
- package/twitter-openapi/dist/test/schemas/tweet.yaml +251 -0
- package/twitter-openapi/dist/test/schemas/typename.yaml +19 -0
- package/twitter-openapi/dist/test/schemas/user.yaml +206 -0
- package/twitter-openapi/dist/typescript/openapi-3.0.yaml +135 -0
- package/twitter-openapi/dist/typescript/paths/bookmarks.yaml +105 -0
- package/twitter-openapi/dist/typescript/paths/follow.yaml +204 -0
- package/twitter-openapi/dist/typescript/paths/other.yaml +96 -0
- package/twitter-openapi/dist/typescript/paths/post.yaml +660 -0
- package/twitter-openapi/dist/typescript/paths/profile.yaml +123 -0
- package/twitter-openapi/dist/typescript/paths/timeline.yaml +293 -0
- package/twitter-openapi/dist/typescript/paths/tweet.yaml +105 -0
- package/twitter-openapi/dist/typescript/paths/user.yaml +83 -0
- package/twitter-openapi/dist/typescript/paths/usertweets.yaml +368 -0
- package/twitter-openapi/dist/typescript/paths/v1.1-get.yaml +242 -0
- package/twitter-openapi/dist/typescript/paths/v1.1-post.yaml +237 -0
- package/twitter-openapi/dist/typescript/paths/v2.0-get.yaml +302 -0
- package/twitter-openapi/dist/typescript/response/error.yaml +90 -0
- package/twitter-openapi/dist/typescript/schemas/content.yaml +181 -0
- package/twitter-openapi/dist/typescript/schemas/general.yaml +13 -0
- package/twitter-openapi/dist/typescript/schemas/instruction.yaml +83 -0
- package/twitter-openapi/dist/typescript/schemas/timeline.yaml +25 -0
- package/twitter-openapi/dist/typescript/schemas/tweet.yaml +251 -0
- package/twitter-openapi/dist/typescript/schemas/typename.yaml +19 -0
- package/twitter-openapi/dist/typescript/schemas/user.yaml +206 -0
- package/twitter-openapi/requirements.txt +0 -0
- package/twitter-openapi/src/config/component/response_header.yaml +32 -0
- package/twitter-openapi/src/config/component/response_header_legacy.yaml +35 -0
- package/twitter-openapi/src/config/component/security_schemes.yaml +67 -0
- package/twitter-openapi/src/config/placeholder.json +535 -0
- package/twitter-openapi/src/openapi/openapi-3.0.yaml +68 -0
- package/twitter-openapi/src/openapi/paths/bookmarks.yaml +42 -0
- package/twitter-openapi/src/openapi/paths/follow.yaml +73 -0
- package/twitter-openapi/src/openapi/paths/other.yaml +101 -0
- package/twitter-openapi/src/openapi/paths/post.yaml +246 -0
- package/twitter-openapi/src/openapi/paths/profile.yaml +81 -0
- package/twitter-openapi/src/openapi/paths/timeline.yaml +98 -0
- package/twitter-openapi/src/openapi/paths/tweet.yaml +35 -0
- package/twitter-openapi/src/openapi/paths/user.yaml +35 -0
- package/twitter-openapi/src/openapi/paths/usertweets.yaml +94 -0
- package/twitter-openapi/src/openapi/paths/v1.1-get.yaml +25 -0
- package/twitter-openapi/src/openapi/paths/v1.1-post.yaml +25 -0
- package/twitter-openapi/src/openapi/paths/v2.0-get.yaml +15 -0
- package/twitter-openapi/src/openapi/response/error.yaml +97 -0
- package/twitter-openapi/src/openapi/schemas/content.yaml +190 -0
- package/twitter-openapi/src/openapi/schemas/general.yaml +12 -0
- package/twitter-openapi/src/openapi/schemas/instruction.yaml +90 -0
- package/twitter-openapi/src/openapi/schemas/timeline.yaml +27 -0
- package/twitter-openapi/src/openapi/schemas/tweet.yaml +264 -0
- package/twitter-openapi/src/openapi/schemas/typename.yaml +21 -0
- package/twitter-openapi/src/openapi/schemas/user.yaml +210 -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.py +79 -0
- package/twitter-openapi/tools/build_config.py +200 -0
- package/twitter-openapi/tools/hooks.py +265 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Twitter OpenAPI
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
|
|
6
|
+
paths: {}
|
|
7
|
+
|
|
8
|
+
components:
|
|
9
|
+
schemas:
|
|
10
|
+
TweetUnion:
|
|
11
|
+
oneOf:
|
|
12
|
+
- $ref: "#/components/schemas/Tweet"
|
|
13
|
+
- $ref: "#/components/schemas/TweetWithVisibilityResults"
|
|
14
|
+
- $ref: "#/components/schemas/TweetTombstone"
|
|
15
|
+
discriminator:
|
|
16
|
+
propertyName: __typename
|
|
17
|
+
mapping": # deprecated
|
|
18
|
+
Tweet: "#/components/schemas/Tweet"
|
|
19
|
+
TweetWithVisibilityResults: "#/components/schemas/TweetWithVisibilityResults"
|
|
20
|
+
TweetTombstone: "#/components/schemas/TweetTombstone"
|
|
21
|
+
|
|
22
|
+
TweetWithVisibilityResults:
|
|
23
|
+
required:
|
|
24
|
+
- "__typename"
|
|
25
|
+
- "tweet"
|
|
26
|
+
properties:
|
|
27
|
+
__typename:
|
|
28
|
+
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults
|
|
29
|
+
tweet:
|
|
30
|
+
$ref: "#/components/schemas/Tweet"
|
|
31
|
+
|
|
32
|
+
TweetTombstone: #remove tweet
|
|
33
|
+
properties:
|
|
34
|
+
__typename:
|
|
35
|
+
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults
|
|
36
|
+
# todo
|
|
37
|
+
|
|
38
|
+
Tweet:
|
|
39
|
+
required:
|
|
40
|
+
- "rest_id"
|
|
41
|
+
- "core"
|
|
42
|
+
- "edit_control"
|
|
43
|
+
- "edit_prespective"
|
|
44
|
+
- "is_translatable"
|
|
45
|
+
- "legacy"
|
|
46
|
+
- "views"
|
|
47
|
+
|
|
48
|
+
properties:
|
|
49
|
+
__typename:
|
|
50
|
+
$ref: "./typename.yaml#/components/schemas/TypeName" # null | Tweet
|
|
51
|
+
rest_id:
|
|
52
|
+
type: string
|
|
53
|
+
pattern: "^[0-9]+$"
|
|
54
|
+
core:
|
|
55
|
+
$ref: "./user.yaml#/components/schemas/UserResultCore"
|
|
56
|
+
unmention_data:
|
|
57
|
+
type: object # todo
|
|
58
|
+
edit_control:
|
|
59
|
+
type: object
|
|
60
|
+
properties:
|
|
61
|
+
edit_tweet_ids:
|
|
62
|
+
type: array
|
|
63
|
+
items:
|
|
64
|
+
type: string
|
|
65
|
+
pattern: "^[0-9]+$"
|
|
66
|
+
editable_until_msecs:
|
|
67
|
+
type: string
|
|
68
|
+
pattern: "^[0-9]+$"
|
|
69
|
+
is_edit_eligible:
|
|
70
|
+
type: boolean
|
|
71
|
+
edits_remaining:
|
|
72
|
+
type: string
|
|
73
|
+
pattern: "^[0-9]+$"
|
|
74
|
+
edit_prespective:
|
|
75
|
+
type: object
|
|
76
|
+
properties:
|
|
77
|
+
favorited:
|
|
78
|
+
type: boolean
|
|
79
|
+
retweeted:
|
|
80
|
+
type: boolean
|
|
81
|
+
is_translatable:
|
|
82
|
+
type: boolean
|
|
83
|
+
default: false
|
|
84
|
+
legacy:
|
|
85
|
+
$ref: "#/components/schemas/TweetLegacy"
|
|
86
|
+
views:
|
|
87
|
+
type: object
|
|
88
|
+
properties:
|
|
89
|
+
count:
|
|
90
|
+
type: string
|
|
91
|
+
pattern: "^[0-9]+$"
|
|
92
|
+
state:
|
|
93
|
+
type: string # enum
|
|
94
|
+
quoted_status_result:
|
|
95
|
+
$ref: "./content.yaml#/components/schemas/ItemResult"
|
|
96
|
+
|
|
97
|
+
TweetLegacy:
|
|
98
|
+
required:
|
|
99
|
+
- "bookmark_count"
|
|
100
|
+
- "bookmarked"
|
|
101
|
+
- "conversation_id_str"
|
|
102
|
+
- "created_at"
|
|
103
|
+
- "display_text_range"
|
|
104
|
+
- "entities"
|
|
105
|
+
- "favorite_count"
|
|
106
|
+
- "favorited"
|
|
107
|
+
- "full_text"
|
|
108
|
+
- "is_quote_status"
|
|
109
|
+
- "lang"
|
|
110
|
+
- "quote_count"
|
|
111
|
+
- "reply_count"
|
|
112
|
+
- "retweet_count"
|
|
113
|
+
- "retweeted"
|
|
114
|
+
- "user_id_str"
|
|
115
|
+
- "id_str"
|
|
116
|
+
properties:
|
|
117
|
+
bookmark_count:
|
|
118
|
+
type: integer
|
|
119
|
+
bookmarked:
|
|
120
|
+
type: boolean
|
|
121
|
+
created_at:
|
|
122
|
+
$ref: "./general.yaml#/components/schemas/TwitterTimeFormat"
|
|
123
|
+
conversation_id_str:
|
|
124
|
+
type: string
|
|
125
|
+
pattern: "^[0-9]+$"
|
|
126
|
+
display_text_range:
|
|
127
|
+
type: array
|
|
128
|
+
items:
|
|
129
|
+
type: integer
|
|
130
|
+
entities:
|
|
131
|
+
$ref: "#/components/schemas/Entities"
|
|
132
|
+
favorite_count:
|
|
133
|
+
type: integer
|
|
134
|
+
favorited:
|
|
135
|
+
type: boolean
|
|
136
|
+
full_text:
|
|
137
|
+
type: string
|
|
138
|
+
is_quote_status:
|
|
139
|
+
type: boolean
|
|
140
|
+
lang:
|
|
141
|
+
type: string # enum
|
|
142
|
+
possibly_sensitive:
|
|
143
|
+
type: boolean
|
|
144
|
+
default: false
|
|
145
|
+
possibly_sensitive_editable:
|
|
146
|
+
type: boolean
|
|
147
|
+
default: false
|
|
148
|
+
quote_count:
|
|
149
|
+
type: integer
|
|
150
|
+
reply_count:
|
|
151
|
+
type: integer
|
|
152
|
+
retweet_count:
|
|
153
|
+
type: integer
|
|
154
|
+
retweeted:
|
|
155
|
+
type: boolean
|
|
156
|
+
retweeted_status_result:
|
|
157
|
+
$ref: "./content.yaml#/components/schemas/ItemResult"
|
|
158
|
+
user_id_str:
|
|
159
|
+
type: string
|
|
160
|
+
pattern: "^[0-9]+$"
|
|
161
|
+
id_str:
|
|
162
|
+
type: string
|
|
163
|
+
pattern: "^[0-9]+$"
|
|
164
|
+
extended_entities:
|
|
165
|
+
$ref: "#/components/schemas/ExtendedEntities"
|
|
166
|
+
|
|
167
|
+
Entities:
|
|
168
|
+
required:
|
|
169
|
+
- "hashtags"
|
|
170
|
+
- "symbols"
|
|
171
|
+
- "user_mentions"
|
|
172
|
+
- "urls"
|
|
173
|
+
# - "media"
|
|
174
|
+
properties:
|
|
175
|
+
hashtags:
|
|
176
|
+
type: array
|
|
177
|
+
items:
|
|
178
|
+
$ref: "#/components/schemas/Hashtag"
|
|
179
|
+
symbols:
|
|
180
|
+
type: array
|
|
181
|
+
items:
|
|
182
|
+
$ref: "#/components/schemas/Symbol"
|
|
183
|
+
user_mentions:
|
|
184
|
+
type: array
|
|
185
|
+
items:
|
|
186
|
+
$ref: "#/components/schemas/UserMention"
|
|
187
|
+
urls:
|
|
188
|
+
type: array
|
|
189
|
+
items:
|
|
190
|
+
$ref: "#/components/schemas/Url"
|
|
191
|
+
media:
|
|
192
|
+
type: array
|
|
193
|
+
items:
|
|
194
|
+
$ref: "#/components/schemas/Media"
|
|
195
|
+
|
|
196
|
+
Hashtag:
|
|
197
|
+
type: object # todo
|
|
198
|
+
Symbol:
|
|
199
|
+
type: object # todo
|
|
200
|
+
UserMention:
|
|
201
|
+
type: object # todo
|
|
202
|
+
Url:
|
|
203
|
+
type: object # todo
|
|
204
|
+
|
|
205
|
+
ExtendedEntities:
|
|
206
|
+
required:
|
|
207
|
+
- "media"
|
|
208
|
+
properties:
|
|
209
|
+
media:
|
|
210
|
+
type: array
|
|
211
|
+
items:
|
|
212
|
+
$ref: "#/components/schemas/Media"
|
|
213
|
+
|
|
214
|
+
Media:
|
|
215
|
+
required:
|
|
216
|
+
- "id_str"
|
|
217
|
+
- "indices"
|
|
218
|
+
- "media_url_https"
|
|
219
|
+
- "url"
|
|
220
|
+
- "display_url"
|
|
221
|
+
- "expanded_url"
|
|
222
|
+
- "type"
|
|
223
|
+
- "sizes"
|
|
224
|
+
- "original_info"
|
|
225
|
+
properties:
|
|
226
|
+
id_str:
|
|
227
|
+
type: string
|
|
228
|
+
pattern: "^[0-9]+$"
|
|
229
|
+
indices:
|
|
230
|
+
type: array
|
|
231
|
+
items:
|
|
232
|
+
type: integer
|
|
233
|
+
media_url_https:
|
|
234
|
+
type: string
|
|
235
|
+
format: uri
|
|
236
|
+
url:
|
|
237
|
+
type: string
|
|
238
|
+
format: uri
|
|
239
|
+
display_url:
|
|
240
|
+
type: string
|
|
241
|
+
format: uri
|
|
242
|
+
expanded_url:
|
|
243
|
+
type: string
|
|
244
|
+
format: uri
|
|
245
|
+
type:
|
|
246
|
+
type: string # enum
|
|
247
|
+
sizes:
|
|
248
|
+
type: object # todo
|
|
249
|
+
original_info:
|
|
250
|
+
type: object
|
|
251
|
+
properties:
|
|
252
|
+
height:
|
|
253
|
+
type: integer
|
|
254
|
+
width:
|
|
255
|
+
type: integer
|
|
256
|
+
focus_rects:
|
|
257
|
+
type: array
|
|
258
|
+
items:
|
|
259
|
+
type: object # todo
|
|
260
|
+
media_key:
|
|
261
|
+
type: string
|
|
262
|
+
pattern: "^[0-9]+_[0-9]+$"
|
|
263
|
+
ext_media_availability:
|
|
264
|
+
type: object # todo
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Twitter OpenAPI
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
paths: {}
|
|
6
|
+
components:
|
|
7
|
+
schemas:
|
|
8
|
+
TypeName:
|
|
9
|
+
type: string
|
|
10
|
+
enum:
|
|
11
|
+
[
|
|
12
|
+
TimelineTweet,
|
|
13
|
+
TimelineTimelineItem,
|
|
14
|
+
TimelineUser,
|
|
15
|
+
TimelineTimelineCursor,
|
|
16
|
+
TweetWithVisibilityResults,
|
|
17
|
+
TimelineTimelineModule,
|
|
18
|
+
TweetTombstone,
|
|
19
|
+
Tweet,
|
|
20
|
+
User,
|
|
21
|
+
]
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Twitter OpenAPI
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
paths: {}
|
|
6
|
+
components:
|
|
7
|
+
schemas:
|
|
8
|
+
UserResultCore:
|
|
9
|
+
required:
|
|
10
|
+
- "user_results"
|
|
11
|
+
properties:
|
|
12
|
+
user_results:
|
|
13
|
+
$ref: "#/components/schemas/UserResults"
|
|
14
|
+
|
|
15
|
+
UserResults:
|
|
16
|
+
required:
|
|
17
|
+
- "result"
|
|
18
|
+
properties:
|
|
19
|
+
result:
|
|
20
|
+
$ref: "#/components/schemas/User"
|
|
21
|
+
|
|
22
|
+
User:
|
|
23
|
+
required:
|
|
24
|
+
- "__typename"
|
|
25
|
+
- "affiliates_highlighted_label"
|
|
26
|
+
- "id"
|
|
27
|
+
- "is_blue_verified"
|
|
28
|
+
- "legacy"
|
|
29
|
+
- "rest_id"
|
|
30
|
+
- "super_follow_eligible"
|
|
31
|
+
- "super_followed_by"
|
|
32
|
+
- "super_following"
|
|
33
|
+
|
|
34
|
+
properties:
|
|
35
|
+
__typename:
|
|
36
|
+
$ref: "./typename.yaml#/components/schemas/TypeName" # User
|
|
37
|
+
affiliates_highlighted_label:
|
|
38
|
+
type: object # todo
|
|
39
|
+
has_graduated_access:
|
|
40
|
+
type: boolean
|
|
41
|
+
has_nft_avatar:
|
|
42
|
+
type: boolean
|
|
43
|
+
default: false
|
|
44
|
+
id:
|
|
45
|
+
type: string
|
|
46
|
+
pattern: '^[a-z\-]+[0-9]+$'
|
|
47
|
+
is_blue_verified:
|
|
48
|
+
type: boolean
|
|
49
|
+
default: false
|
|
50
|
+
legacy:
|
|
51
|
+
$ref: "#/components/schemas/UserLegacy"
|
|
52
|
+
rest_id:
|
|
53
|
+
type: string
|
|
54
|
+
pattern: "^[0-9]+$"
|
|
55
|
+
business_account:
|
|
56
|
+
type: object # todo
|
|
57
|
+
super_follow_eligible:
|
|
58
|
+
type: boolean
|
|
59
|
+
default: false
|
|
60
|
+
super_followed_by:
|
|
61
|
+
type: boolean
|
|
62
|
+
default: false
|
|
63
|
+
super_following:
|
|
64
|
+
type: boolean
|
|
65
|
+
default: false
|
|
66
|
+
|
|
67
|
+
UserLegacy:
|
|
68
|
+
required:
|
|
69
|
+
- "blocked_by"
|
|
70
|
+
- "blocking"
|
|
71
|
+
- "can_dm"
|
|
72
|
+
- "can_media_tag"
|
|
73
|
+
- "created_at"
|
|
74
|
+
- "default_profile"
|
|
75
|
+
- "default_profile_image"
|
|
76
|
+
- "description"
|
|
77
|
+
- "entities"
|
|
78
|
+
- "fast_followers_count"
|
|
79
|
+
- "favourites_count"
|
|
80
|
+
- "follow_request_sent"
|
|
81
|
+
- "followed_by"
|
|
82
|
+
- "followers_count"
|
|
83
|
+
- "following"
|
|
84
|
+
- "friends_count"
|
|
85
|
+
- "has_custom_timelines"
|
|
86
|
+
- "is_translator"
|
|
87
|
+
- "listed_count"
|
|
88
|
+
- "location"
|
|
89
|
+
- "media_count"
|
|
90
|
+
- "muting"
|
|
91
|
+
- "name"
|
|
92
|
+
- "normal_followers_count"
|
|
93
|
+
- "notifications"
|
|
94
|
+
- "pinned_tweet_ids_str"
|
|
95
|
+
- "possibly_sensitive"
|
|
96
|
+
- "profile_image_url_https"
|
|
97
|
+
- "profile_interstitial_type"
|
|
98
|
+
- "protected"
|
|
99
|
+
- "screen_name"
|
|
100
|
+
- "status"
|
|
101
|
+
- "statuses_count"
|
|
102
|
+
- "translator_type"
|
|
103
|
+
- "verified"
|
|
104
|
+
- "want_retweets"
|
|
105
|
+
properties:
|
|
106
|
+
blocked_by:
|
|
107
|
+
type: boolean
|
|
108
|
+
default: false
|
|
109
|
+
blocking:
|
|
110
|
+
type: boolean
|
|
111
|
+
default: false
|
|
112
|
+
can_dm:
|
|
113
|
+
type: boolean
|
|
114
|
+
default: false
|
|
115
|
+
can_media_tag:
|
|
116
|
+
type: boolean
|
|
117
|
+
default: false
|
|
118
|
+
created_at:
|
|
119
|
+
$ref: "./general.yaml#/components/schemas/TwitterTimeFormat"
|
|
120
|
+
default_profile:
|
|
121
|
+
type: boolean
|
|
122
|
+
default: false
|
|
123
|
+
default_profile_image:
|
|
124
|
+
type: boolean
|
|
125
|
+
default: false
|
|
126
|
+
description:
|
|
127
|
+
type: string
|
|
128
|
+
entities:
|
|
129
|
+
type: object # todo
|
|
130
|
+
fast_followers_count:
|
|
131
|
+
type: integer
|
|
132
|
+
favourites_count:
|
|
133
|
+
type: integer
|
|
134
|
+
default: 0
|
|
135
|
+
follow_request_sent:
|
|
136
|
+
type: boolean
|
|
137
|
+
default: false
|
|
138
|
+
followed_by:
|
|
139
|
+
type: boolean
|
|
140
|
+
default: false
|
|
141
|
+
followers_count:
|
|
142
|
+
type: integer
|
|
143
|
+
default: 0
|
|
144
|
+
following:
|
|
145
|
+
type: boolean
|
|
146
|
+
default: false
|
|
147
|
+
friends_count:
|
|
148
|
+
type: integer
|
|
149
|
+
default: 0
|
|
150
|
+
has_custom_timelines:
|
|
151
|
+
type: boolean
|
|
152
|
+
default: false
|
|
153
|
+
is_translator:
|
|
154
|
+
type: boolean
|
|
155
|
+
default: false
|
|
156
|
+
listed_count:
|
|
157
|
+
type: integer
|
|
158
|
+
default: 0
|
|
159
|
+
location:
|
|
160
|
+
type: string
|
|
161
|
+
media_count:
|
|
162
|
+
type: integer
|
|
163
|
+
default: 0
|
|
164
|
+
muting:
|
|
165
|
+
type: boolean
|
|
166
|
+
default: false
|
|
167
|
+
name:
|
|
168
|
+
type: string
|
|
169
|
+
normal_followers_count:
|
|
170
|
+
type: integer
|
|
171
|
+
default: 0
|
|
172
|
+
notifications:
|
|
173
|
+
type: boolean
|
|
174
|
+
default: false
|
|
175
|
+
pinned_tweet_ids_str:
|
|
176
|
+
type: array
|
|
177
|
+
items:
|
|
178
|
+
type: string
|
|
179
|
+
possibly_sensitive:
|
|
180
|
+
type: boolean
|
|
181
|
+
default: false
|
|
182
|
+
profile_banner_extensions:
|
|
183
|
+
type: object
|
|
184
|
+
profile_banner_url:
|
|
185
|
+
type: string
|
|
186
|
+
format: uri
|
|
187
|
+
profile_image_extensions:
|
|
188
|
+
type: object
|
|
189
|
+
profile_image_url_https:
|
|
190
|
+
type: string
|
|
191
|
+
format: uri
|
|
192
|
+
profile_interstitial_type:
|
|
193
|
+
type: string
|
|
194
|
+
protected:
|
|
195
|
+
type: boolean
|
|
196
|
+
default: false
|
|
197
|
+
screen_name:
|
|
198
|
+
type: string
|
|
199
|
+
statuses_count:
|
|
200
|
+
type: integer
|
|
201
|
+
default: 0
|
|
202
|
+
translator_type:
|
|
203
|
+
type: string
|
|
204
|
+
url:
|
|
205
|
+
type: string
|
|
206
|
+
verified:
|
|
207
|
+
type: boolean
|
|
208
|
+
want_retweets:
|
|
209
|
+
type: boolean
|
|
210
|
+
default: false
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import glob
|
|
3
|
+
import json
|
|
4
|
+
import yaml
|
|
5
|
+
import shutil
|
|
6
|
+
import copy
|
|
7
|
+
import re
|
|
8
|
+
from build_config import Config
|
|
9
|
+
from hooks import OpenapiHookBase, RequestHookBase, SchemasHookBase,OtherHookBase
|
|
10
|
+
from tqdm import tqdm
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
print("=== Build Start ===")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
config = Config()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
shutil.rmtree("dist")
|
|
21
|
+
except:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
for lang, profile in tqdm(config.main().items(), leave=False):
|
|
25
|
+
dist_replace = lambda x: x.replace(
|
|
26
|
+
config.INPUT_DIR, config.OUTPUT_DIR.format(lang), 1
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
for dir in glob.glob(os.path.join(config.INPUT_DIR, "**/")):
|
|
30
|
+
os.makedirs(dist_replace(dir), exist_ok=True)
|
|
31
|
+
|
|
32
|
+
paths = {}
|
|
33
|
+
files = glob.glob(os.path.join(config.INPUT_DIR, "**/*.yaml"))
|
|
34
|
+
for file in tqdm(files, leave=False):
|
|
35
|
+
file = file.replace(os.path.sep, "/")
|
|
36
|
+
with open(file, mode="r", encoding="utf-8") as f:
|
|
37
|
+
load = yaml.safe_load(f)
|
|
38
|
+
for path in list(load["paths"]):
|
|
39
|
+
for method in list(load["paths"][path]):
|
|
40
|
+
for tag in list(load["paths"][path][method].get("tags", ["default"])):
|
|
41
|
+
key, value = path, load["paths"][path][method]
|
|
42
|
+
for hook in profile["request"][tag]:
|
|
43
|
+
hook: RequestHookBase
|
|
44
|
+
key, value = hook.hook(key, value)
|
|
45
|
+
load["paths"][path][method] = value
|
|
46
|
+
load["paths"][key] = load["paths"].pop(path)
|
|
47
|
+
|
|
48
|
+
escape = key.replace("/", "~1")
|
|
49
|
+
relative = file.replace(config.INPUT_DIR, "", 1)
|
|
50
|
+
paths.update({key: {"$ref": f".{relative}#/paths/{escape}"}})
|
|
51
|
+
for name in list(load.get("components", {}).get("schemas", {})):
|
|
52
|
+
value = load["components"]["schemas"][name]
|
|
53
|
+
for hook in profile["schemas"]:
|
|
54
|
+
hook: SchemasHookBase
|
|
55
|
+
value = hook.hook(value)
|
|
56
|
+
load["components"]["schemas"][name] = value
|
|
57
|
+
if file == "src/openapi/paths/other.yaml":
|
|
58
|
+
for hook in profile["other"]:
|
|
59
|
+
hook: OtherHookBase
|
|
60
|
+
key, value = hook.hook()
|
|
61
|
+
load["components"]["schemas"][key] = value
|
|
62
|
+
load["components"]["schemas"]["OtherResponse"]["properties"][key] = {
|
|
63
|
+
"$ref": f"#/components/schemas/{key}"
|
|
64
|
+
}
|
|
65
|
+
with open(dist_replace(file), mode="w+", encoding="utf-8") as f:
|
|
66
|
+
f.write(yaml.dump(load))
|
|
67
|
+
|
|
68
|
+
file = "src/openapi/openapi-3.0.yaml"
|
|
69
|
+
with open(file, mode="r", encoding="utf-8") as f:
|
|
70
|
+
openapi = yaml.safe_load(f)
|
|
71
|
+
for path in paths:
|
|
72
|
+
openapi["paths"] = paths
|
|
73
|
+
for hook in profile["openapi"]:
|
|
74
|
+
hook: OpenapiHookBase
|
|
75
|
+
openapi = hook.hook(openapi)
|
|
76
|
+
with open(dist_replace(file), mode="w+", encoding="utf-8") as f:
|
|
77
|
+
f.write(yaml.dump(openapi))
|
|
78
|
+
|
|
79
|
+
print("=== Build End ===")
|