twitter-openapi-typescript-generated 0.0.6 → 0.0.8

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 (241) hide show
  1. package/.openapi-generator/FILES +18 -1
  2. package/README.md +2 -2
  3. package/dist/apis/DefaultApi.d.ts +0 -1
  4. package/dist/apis/DefaultApi.d.ts.map +1 -1
  5. package/dist/apis/DefaultApi.js +0 -6
  6. package/dist/apis/DefaultApi.js.map +1 -1
  7. package/dist/apis/TweetApi.d.ts +17 -12
  8. package/dist/apis/TweetApi.d.ts.map +1 -1
  9. package/dist/apis/TweetApi.js +90 -55
  10. package/dist/apis/TweetApi.js.map +1 -1
  11. package/dist/apis/UserApi.d.ts +27 -2
  12. package/dist/apis/UserApi.d.ts.map +1 -1
  13. package/dist/apis/UserApi.js +166 -6
  14. package/dist/apis/UserApi.js.map +1 -1
  15. package/dist/apis/UserListApi.d.ts +41 -3
  16. package/dist/apis/UserListApi.d.ts.map +1 -1
  17. package/dist/apis/UserListApi.js +255 -12
  18. package/dist/apis/UserListApi.js.map +1 -1
  19. package/dist/models/ContentItemType.d.ts +2 -0
  20. package/dist/models/ContentItemType.d.ts.map +1 -1
  21. package/dist/models/ContentItemType.js +3 -1
  22. package/dist/models/ContentItemType.js.map +1 -1
  23. package/dist/models/InstructionType.d.ts +3 -0
  24. package/dist/models/InstructionType.d.ts.map +1 -1
  25. package/dist/models/InstructionType.js +3 -0
  26. package/dist/models/InstructionType.js.map +1 -1
  27. package/dist/models/InstructionUnion.d.ts +9 -0
  28. package/dist/models/InstructionUnion.d.ts.map +1 -1
  29. package/dist/models/InstructionUnion.js +15 -0
  30. package/dist/models/InstructionUnion.js.map +1 -1
  31. package/dist/models/ItemContentUnion.d.ts +6 -0
  32. package/dist/models/ItemContentUnion.d.ts.map +1 -1
  33. package/dist/models/ItemContentUnion.js +10 -0
  34. package/dist/models/ItemContentUnion.js.map +1 -1
  35. package/dist/models/ListLatestTweetsTimelineResponse.d.ts +33 -0
  36. package/dist/models/ListLatestTweetsTimelineResponse.d.ts.map +1 -0
  37. package/dist/models/ListLatestTweetsTimelineResponse.js +52 -0
  38. package/dist/models/ListLatestTweetsTimelineResponse.js.map +1 -0
  39. package/dist/models/SearchByRawQuery.d.ts +33 -0
  40. package/dist/models/SearchByRawQuery.d.ts.map +1 -0
  41. package/dist/models/SearchByRawQuery.js +52 -0
  42. package/dist/models/SearchByRawQuery.js.map +1 -0
  43. package/dist/models/SearchTimeline.d.ts +33 -0
  44. package/dist/models/SearchTimeline.d.ts.map +1 -0
  45. package/dist/models/SearchTimeline.js +52 -0
  46. package/dist/models/SearchTimeline.js.map +1 -0
  47. package/dist/models/SearchTimelineData.d.ts +33 -0
  48. package/dist/models/SearchTimelineData.d.ts.map +1 -0
  49. package/dist/models/SearchTimelineData.js +52 -0
  50. package/dist/models/SearchTimelineData.js.map +1 -0
  51. package/dist/models/SearchTimelineResponse.d.ts +33 -0
  52. package/dist/models/SearchTimelineResponse.d.ts.map +1 -0
  53. package/dist/models/SearchTimelineResponse.js +52 -0
  54. package/dist/models/SearchTimelineResponse.js.map +1 -0
  55. package/dist/models/TimelineAddToModule.d.ts +52 -0
  56. package/dist/models/TimelineAddToModule.d.ts.map +1 -0
  57. package/dist/models/TimelineAddToModule.js +62 -0
  58. package/dist/models/TimelineAddToModule.js.map +1 -0
  59. package/dist/models/TimelineMessagePrompt.d.ts +33 -0
  60. package/dist/models/TimelineMessagePrompt.d.ts.map +1 -0
  61. package/dist/models/TimelineMessagePrompt.js +52 -0
  62. package/dist/models/TimelineMessagePrompt.js.map +1 -0
  63. package/dist/models/TimelinePrompt.d.ts +33 -0
  64. package/dist/models/TimelinePrompt.d.ts.map +1 -0
  65. package/dist/models/TimelinePrompt.js +52 -0
  66. package/dist/models/TimelinePrompt.js.map +1 -0
  67. package/dist/models/TimelineReplaceEntry.d.ts +46 -0
  68. package/dist/models/TimelineReplaceEntry.d.ts.map +1 -0
  69. package/dist/models/TimelineReplaceEntry.js +59 -0
  70. package/dist/models/TimelineReplaceEntry.js.map +1 -0
  71. package/dist/models/TimelineShowAlert.d.ts +97 -0
  72. package/dist/models/TimelineShowAlert.d.ts.map +1 -0
  73. package/dist/models/TimelineShowAlert.js +85 -0
  74. package/dist/models/TimelineShowAlert.js.map +1 -0
  75. package/dist/models/TimelineShowAlertRichText.d.ts +38 -0
  76. package/dist/models/TimelineShowAlertRichText.d.ts.map +1 -0
  77. package/dist/models/TimelineShowAlertRichText.js +53 -0
  78. package/dist/models/TimelineShowAlertRichText.js.map +1 -0
  79. package/dist/models/TweetFavoritersResponse.d.ts +33 -0
  80. package/dist/models/TweetFavoritersResponse.d.ts.map +1 -0
  81. package/dist/models/TweetFavoritersResponse.js +52 -0
  82. package/dist/models/TweetFavoritersResponse.js.map +1 -0
  83. package/dist/models/TweetFavoritersResponseData.d.ts +33 -0
  84. package/dist/models/TweetFavoritersResponseData.d.ts.map +1 -0
  85. package/dist/models/TweetFavoritersResponseData.js +52 -0
  86. package/dist/models/TweetFavoritersResponseData.js.map +1 -0
  87. package/dist/models/TweetLegacy.d.ts +7 -0
  88. package/dist/models/TweetLegacy.d.ts.map +1 -1
  89. package/dist/models/TweetLegacy.js +3 -0
  90. package/dist/models/TweetLegacy.js.map +1 -1
  91. package/dist/models/TweetLegacySelfThread.d.ts +32 -0
  92. package/dist/models/TweetLegacySelfThread.d.ts.map +1 -0
  93. package/dist/models/TweetLegacySelfThread.js +51 -0
  94. package/dist/models/TweetLegacySelfThread.js.map +1 -0
  95. package/dist/models/TweetRetweetersResponse.d.ts +33 -0
  96. package/dist/models/TweetRetweetersResponse.d.ts.map +1 -0
  97. package/dist/models/TweetRetweetersResponse.js +52 -0
  98. package/dist/models/TweetRetweetersResponse.js.map +1 -0
  99. package/dist/models/TweetRetweetersResponseData.d.ts +33 -0
  100. package/dist/models/TweetRetweetersResponseData.d.ts.map +1 -0
  101. package/dist/models/TweetRetweetersResponseData.js +52 -0
  102. package/dist/models/TweetRetweetersResponseData.js.map +1 -0
  103. package/dist/models/UsersResponse.d.ts +33 -0
  104. package/dist/models/UsersResponse.d.ts.map +1 -0
  105. package/dist/models/UsersResponse.js +52 -0
  106. package/dist/models/UsersResponse.js.map +1 -0
  107. package/dist/models/UsersResponseData.d.ts +33 -0
  108. package/dist/models/UsersResponseData.d.ts.map +1 -0
  109. package/dist/models/UsersResponseData.js +52 -0
  110. package/dist/models/UsersResponseData.js.map +1 -0
  111. package/dist/models/index.d.ts +18 -1
  112. package/dist/models/index.d.ts.map +1 -1
  113. package/dist/models/index.js +18 -1
  114. package/dist/models/index.js.map +1 -1
  115. package/package.json +3 -2
  116. package/src/apis/DefaultApi.ts +0 -9
  117. package/src/apis/TweetApi.ts +102 -87
  118. package/src/apis/UserApi.ts +171 -9
  119. package/src/apis/UserListApi.ts +267 -18
  120. package/src/models/ContentItemType.ts +3 -1
  121. package/src/models/InstructionType.ts +3 -0
  122. package/src/models/InstructionUnion.ts +34 -1
  123. package/src/models/ItemContentUnion.ts +23 -1
  124. package/src/models/{ListTweetsTimelineResponse.ts → ListLatestTweetsTimelineResponse.ts} +9 -9
  125. package/src/models/SearchByRawQuery.ts +73 -0
  126. package/src/models/SearchTimeline.ts +73 -0
  127. package/src/models/SearchTimelineData.ts +73 -0
  128. package/src/models/SearchTimelineResponse.ts +73 -0
  129. package/src/models/TimelineAddToModule.ts +105 -0
  130. package/src/models/TimelineMessagePrompt.ts +72 -0
  131. package/src/models/TimelinePrompt.ts +72 -0
  132. package/src/models/TimelineReplaceEntry.ts +97 -0
  133. package/src/models/TimelineShowAlert.ts +169 -0
  134. package/src/models/TimelineShowAlertRichText.ts +73 -0
  135. package/src/models/TweetFavoritersResponse.ts +73 -0
  136. package/src/models/TweetFavoritersResponseData.ts +73 -0
  137. package/src/models/TweetLegacy.ts +14 -0
  138. package/src/models/TweetLegacySelfThread.ts +66 -0
  139. package/src/models/TweetRetweetersResponse.ts +73 -0
  140. package/src/models/TweetRetweetersResponseData.ts +73 -0
  141. package/src/models/UsersResponse.ts +73 -0
  142. package/src/models/UsersResponseData.ts +73 -0
  143. package/src/models/index.ts +18 -1
  144. package/tools/openapi-generator-config.yaml +2 -2
  145. package/tools/win/replace.py +1 -1
  146. package/twitter-openapi/dist/{test → compatible}/openapi-3.0.yaml +12 -0
  147. package/twitter-openapi/dist/{typescript → compatible}/paths/bookmarks.yaml +0 -7
  148. package/twitter-openapi/dist/{dart → compatible}/paths/follow.yaml +82 -63
  149. package/twitter-openapi/dist/{test → compatible}/paths/profile.yaml +0 -7
  150. package/twitter-openapi/dist/{dart → compatible}/paths/timeline.yaml +118 -111
  151. package/twitter-openapi/dist/compatible/paths/tweet.yaml +297 -0
  152. package/twitter-openapi/dist/compatible/paths/user.yaml +227 -0
  153. package/twitter-openapi/dist/{test → compatible}/paths/usertweets.yaml +0 -28
  154. package/twitter-openapi/dist/{typescript → compatible}/schemas/content.yaml +14 -0
  155. package/twitter-openapi/dist/compatible/schemas/instruction.yaml +160 -0
  156. package/twitter-openapi/dist/{dart → compatible}/schemas/tweet.yaml +8 -0
  157. package/twitter-openapi/dist/docs/openapi-3.0.yaml +12 -0
  158. package/twitter-openapi/dist/docs/paths/bookmarks.yaml +0 -56
  159. package/twitter-openapi/dist/docs/paths/follow.yaml +193 -112
  160. package/twitter-openapi/dist/docs/paths/profile.yaml +0 -35
  161. package/twitter-openapi/dist/docs/paths/timeline.yaml +225 -173
  162. package/twitter-openapi/dist/docs/paths/tweet.yaml +382 -61
  163. package/twitter-openapi/dist/docs/paths/user.yaml +214 -41
  164. package/twitter-openapi/dist/docs/paths/usertweets.yaml +0 -238
  165. package/twitter-openapi/dist/docs/schemas/content.yaml +14 -0
  166. package/twitter-openapi/dist/docs/schemas/instruction.yaml +77 -0
  167. package/twitter-openapi/dist/docs/schemas/tweet.yaml +8 -0
  168. package/twitter-openapi/src/config/placeholder.json +155 -0
  169. package/twitter-openapi/src/openapi/paths/follow.yaml +14 -0
  170. package/twitter-openapi/src/openapi/paths/timeline.yaml +44 -2
  171. package/twitter-openapi/src/openapi/paths/tweet.yaml +56 -0
  172. package/twitter-openapi/src/openapi/paths/user.yaml +44 -0
  173. package/twitter-openapi/src/openapi/schemas/content.yaml +23 -1
  174. package/twitter-openapi/src/openapi/schemas/instruction.yaml +78 -0
  175. package/twitter-openapi/src/openapi/schemas/tweet.yaml +8 -0
  176. package/twitter-openapi/tools/__pycache__/build_config.cpython-310.pyc +0 -0
  177. package/twitter-openapi/tools/__pycache__/hooks.cpython-310.pyc +0 -0
  178. package/twitter-openapi/tools/build_config.py +67 -190
  179. package/twitter-openapi/tools/hooks.py +28 -7
  180. package/dist/models/ListTweetsTimelineResponse.d.ts +0 -33
  181. package/dist/models/ListTweetsTimelineResponse.d.ts.map +0 -1
  182. package/dist/models/ListTweetsTimelineResponse.js +0 -52
  183. package/dist/models/ListTweetsTimelineResponse.js.map +0 -1
  184. package/twitter-openapi/dist/dart/openapi-3.0.yaml +0 -117
  185. package/twitter-openapi/dist/dart/paths/bookmarks.yaml +0 -141
  186. package/twitter-openapi/dist/dart/paths/post.yaml +0 -876
  187. package/twitter-openapi/dist/dart/paths/profile.yaml +0 -159
  188. package/twitter-openapi/dist/dart/paths/tweet.yaml +0 -141
  189. package/twitter-openapi/dist/dart/paths/user.yaml +0 -119
  190. package/twitter-openapi/dist/dart/paths/usertweets.yaml +0 -512
  191. package/twitter-openapi/dist/dart/paths/v1.1-get.yaml +0 -300
  192. package/twitter-openapi/dist/dart/paths/v1.1-post.yaml +0 -295
  193. package/twitter-openapi/dist/dart/paths/v2.0-get.yaml +0 -331
  194. package/twitter-openapi/dist/dart/schemas/content.yaml +0 -181
  195. package/twitter-openapi/dist/dart/schemas/instruction.yaml +0 -83
  196. package/twitter-openapi/dist/test/paths/bookmarks.yaml +0 -112
  197. package/twitter-openapi/dist/test/paths/follow.yaml +0 -218
  198. package/twitter-openapi/dist/test/paths/other.yaml +0 -96
  199. package/twitter-openapi/dist/test/paths/post.yaml +0 -527
  200. package/twitter-openapi/dist/test/paths/timeline.yaml +0 -314
  201. package/twitter-openapi/dist/test/paths/tweet.yaml +0 -112
  202. package/twitter-openapi/dist/test/paths/user.yaml +0 -90
  203. package/twitter-openapi/dist/test/paths/v1.1-get.yaml +0 -242
  204. package/twitter-openapi/dist/test/paths/v1.1-post.yaml +0 -277
  205. package/twitter-openapi/dist/test/paths/v2.0-get.yaml +0 -302
  206. package/twitter-openapi/dist/test/resources/parameters.yaml +0 -13
  207. package/twitter-openapi/dist/test/response/error.yaml +0 -90
  208. package/twitter-openapi/dist/test/schemas/content.yaml +0 -181
  209. package/twitter-openapi/dist/test/schemas/general.yaml +0 -13
  210. package/twitter-openapi/dist/test/schemas/instruction.yaml +0 -83
  211. package/twitter-openapi/dist/test/schemas/timeline.yaml +0 -25
  212. package/twitter-openapi/dist/test/schemas/tweet.yaml +0 -308
  213. package/twitter-openapi/dist/test/schemas/typename.yaml +0 -19
  214. package/twitter-openapi/dist/test/schemas/user.yaml +0 -206
  215. package/twitter-openapi/dist/typescript/openapi-3.0.yaml +0 -141
  216. package/twitter-openapi/dist/typescript/paths/follow.yaml +0 -218
  217. package/twitter-openapi/dist/typescript/paths/other.yaml +0 -96
  218. package/twitter-openapi/dist/typescript/paths/profile.yaml +0 -130
  219. package/twitter-openapi/dist/typescript/paths/timeline.yaml +0 -314
  220. package/twitter-openapi/dist/typescript/paths/tweet.yaml +0 -112
  221. package/twitter-openapi/dist/typescript/paths/user.yaml +0 -90
  222. package/twitter-openapi/dist/typescript/paths/usertweets.yaml +0 -396
  223. package/twitter-openapi/dist/typescript/resources/parameters.yaml +0 -13
  224. package/twitter-openapi/dist/typescript/response/error.yaml +0 -90
  225. package/twitter-openapi/dist/typescript/schemas/general.yaml +0 -13
  226. package/twitter-openapi/dist/typescript/schemas/instruction.yaml +0 -83
  227. package/twitter-openapi/dist/typescript/schemas/timeline.yaml +0 -25
  228. package/twitter-openapi/dist/typescript/schemas/tweet.yaml +0 -308
  229. package/twitter-openapi/dist/typescript/schemas/typename.yaml +0 -19
  230. package/twitter-openapi/dist/typescript/schemas/user.yaml +0 -206
  231. /package/twitter-openapi/dist/{dart → compatible}/paths/other.yaml +0 -0
  232. /package/twitter-openapi/dist/{typescript → compatible}/paths/post.yaml +0 -0
  233. /package/twitter-openapi/dist/{typescript → compatible}/paths/v1.1-get.yaml +0 -0
  234. /package/twitter-openapi/dist/{typescript → compatible}/paths/v1.1-post.yaml +0 -0
  235. /package/twitter-openapi/dist/{typescript → compatible}/paths/v2.0-get.yaml +0 -0
  236. /package/twitter-openapi/dist/{dart → compatible}/resources/parameters.yaml +0 -0
  237. /package/twitter-openapi/dist/{dart → compatible}/response/error.yaml +0 -0
  238. /package/twitter-openapi/dist/{dart → compatible}/schemas/general.yaml +0 -0
  239. /package/twitter-openapi/dist/{dart → compatible}/schemas/timeline.yaml +0 -0
  240. /package/twitter-openapi/dist/{dart → compatible}/schemas/typename.yaml +0 -0
  241. /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
- "openapi": [AddSecuritySchemesOnSecuritySchemes()],
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__(self, split: str = 1, schemaType: str | None = None):
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__(self, split: str = 1, contentType: str = "application/json"):
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,33 +0,0 @@
1
- /**
2
- * Twitter OpenAPI
3
- * Twitter OpenAPI(Swagger) specification
4
- *
5
- * The version of the OpenAPI document: 0.0.1
6
- * Contact: yuki@yuki0311.com
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import type { ListTweetsTimelineData } from './ListTweetsTimelineData';
13
- /**
14
- *
15
- * @export
16
- * @interface ListTweetsTimelineResponse
17
- */
18
- export interface ListTweetsTimelineResponse {
19
- /**
20
- *
21
- * @type {ListTweetsTimelineData}
22
- * @memberof ListTweetsTimelineResponse
23
- */
24
- data: ListTweetsTimelineData;
25
- }
26
- /**
27
- * Check if a given object implements the ListTweetsTimelineResponse interface.
28
- */
29
- export declare function instanceOfListTweetsTimelineResponse(value: object): boolean;
30
- export declare function ListTweetsTimelineResponseFromJSON(json: any): ListTweetsTimelineResponse;
31
- export declare function ListTweetsTimelineResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListTweetsTimelineResponse;
32
- export declare function ListTweetsTimelineResponseToJSON(value?: ListTweetsTimelineResponse | null): any;
33
- //# sourceMappingURL=ListTweetsTimelineResponse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListTweetsTimelineResponse.d.ts","sourceRoot":"","sources":["../../src/models/ListTweetsTimelineResponse.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAOvE;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;;OAIG;IACH,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK3E;AAED,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,GAAG,GAAG,0BAA0B,CAExF;AAED,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,GAAG,EAAE,mBAAmB,EAAE,OAAO,GAAG,0BAA0B,CAQ3H;AAED,wBAAgB,gCAAgC,CAAC,KAAK,CAAC,EAAE,0BAA0B,GAAG,IAAI,GAAG,GAAG,CAW/F"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Twitter OpenAPI
6
- * Twitter OpenAPI(Swagger) specification
7
- *
8
- * The version of the OpenAPI document: 0.0.1
9
- * Contact: yuki@yuki0311.com
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.ListTweetsTimelineResponseToJSON = exports.ListTweetsTimelineResponseFromJSONTyped = exports.ListTweetsTimelineResponseFromJSON = exports.instanceOfListTweetsTimelineResponse = void 0;
17
- var ListTweetsTimelineData_1 = require("./ListTweetsTimelineData");
18
- /**
19
- * Check if a given object implements the ListTweetsTimelineResponse interface.
20
- */
21
- function instanceOfListTweetsTimelineResponse(value) {
22
- var isInstance = true;
23
- isInstance = isInstance && "data" in value;
24
- return isInstance;
25
- }
26
- exports.instanceOfListTweetsTimelineResponse = instanceOfListTweetsTimelineResponse;
27
- function ListTweetsTimelineResponseFromJSON(json) {
28
- return ListTweetsTimelineResponseFromJSONTyped(json, false);
29
- }
30
- exports.ListTweetsTimelineResponseFromJSON = ListTweetsTimelineResponseFromJSON;
31
- function ListTweetsTimelineResponseFromJSONTyped(json, ignoreDiscriminator) {
32
- if ((json === undefined) || (json === null)) {
33
- return json;
34
- }
35
- return {
36
- 'data': (0, ListTweetsTimelineData_1.ListTweetsTimelineDataFromJSON)(json['data']),
37
- };
38
- }
39
- exports.ListTweetsTimelineResponseFromJSONTyped = ListTweetsTimelineResponseFromJSONTyped;
40
- function ListTweetsTimelineResponseToJSON(value) {
41
- if (value === undefined) {
42
- return undefined;
43
- }
44
- if (value === null) {
45
- return null;
46
- }
47
- return {
48
- 'data': (0, ListTweetsTimelineData_1.ListTweetsTimelineDataToJSON)(value.data),
49
- };
50
- }
51
- exports.ListTweetsTimelineResponseToJSON = ListTweetsTimelineResponseToJSON;
52
- //# sourceMappingURL=ListTweetsTimelineResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListTweetsTimelineResponse.js","sourceRoot":"","sources":["../../src/models/ListTweetsTimelineResponse.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;AAIH,mEAIkC;AAgBlC;;GAEG;AACH,SAAgB,oCAAoC,CAAC,KAAa;IAC9D,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,UAAU,GAAG,UAAU,IAAI,MAAM,IAAI,KAAK,CAAC;IAE3C,OAAO,UAAU,CAAC;AACtB,CAAC;AALD,oFAKC;AAED,SAAgB,kCAAkC,CAAC,IAAS;IACxD,OAAO,uCAAuC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC;AAFD,gFAEC;AAED,SAAgB,uCAAuC,CAAC,IAAS,EAAE,mBAA4B;IAC3F,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE;QACzC,OAAO,IAAI,CAAC;KACf;IACD,OAAO;QAEH,MAAM,EAAE,IAAA,uDAA8B,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvD,CAAC;AACN,CAAC;AARD,0FAQC;AAED,SAAgB,gCAAgC,CAAC,KAAyC;IACtF,IAAI,KAAK,KAAK,SAAS,EAAE;QACrB,OAAO,SAAS,CAAC;KACpB;IACD,IAAI,KAAK,KAAK,IAAI,EAAE;QAChB,OAAO,IAAI,CAAC;KACf;IACD,OAAO;QAEH,MAAM,EAAE,IAAA,qDAA4B,EAAC,KAAK,CAAC,IAAI,CAAC;KACnD,CAAC;AACN,CAAC;AAXD,4EAWC"}
@@ -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