types-mediawiki-response 1.0.0-alpha.1

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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/README.zh.md +57 -0
  4. package/dist/common/index.d.ts +87 -0
  5. package/dist/core/acquiretempusername.d.ts +17 -0
  6. package/dist/core/block.d.ts +98 -0
  7. package/dist/core/changeauthenticationdata.d.ts +18 -0
  8. package/dist/core/changecontentmodel.d.ts +27 -0
  9. package/dist/core/checktoken.d.ts +28 -0
  10. package/dist/core/clearhasmsg.d.ts +15 -0
  11. package/dist/core/clientlogin.d.ts +48 -0
  12. package/dist/core/compare.d.ts +92 -0
  13. package/dist/core/createaccount.d.ts +41 -0
  14. package/dist/core/delete.d.ts +45 -0
  15. package/dist/core/edit.d.ts +66 -0
  16. package/dist/core/emailuser.d.ts +27 -0
  17. package/dist/core/expandtemplates.d.ts +66 -0
  18. package/dist/core/filerevert.d.ts +20 -0
  19. package/dist/core/imagerotate.d.ts +51 -0
  20. package/dist/core/import.d.ts +29 -0
  21. package/dist/core/index.d.ts +40 -0
  22. package/dist/core/languagesearch.d.ts +24 -0
  23. package/dist/core/login.d.ts +30 -0
  24. package/dist/core/logout.d.ts +16 -0
  25. package/dist/core/managetags.d.ts +28 -0
  26. package/dist/core/mergehistory.d.ts +26 -0
  27. package/dist/core/move.d.ts +62 -0
  28. package/dist/core/options.d.ts +16 -0
  29. package/dist/core/parse.d.ts +324 -0
  30. package/dist/core/patrol.d.ts +21 -0
  31. package/dist/core/protect.d.ts +43 -0
  32. package/dist/core/purge.d.ts +61 -0
  33. package/dist/core/query/allcategories.d.ts +30 -0
  34. package/dist/core/query/alldeletedrevisions.d.ts +29 -0
  35. package/dist/core/query/allfileusages.d.ts +15 -0
  36. package/dist/core/query/allimages.d.ts +25 -0
  37. package/dist/core/query/alllinks.d.ts +34 -0
  38. package/dist/core/query/allmessages.d.ts +43 -0
  39. package/dist/core/query/allpages.d.ts +23 -0
  40. package/dist/core/query/allredirects.d.ts +23 -0
  41. package/dist/core/query/allrevisions.d.ts +30 -0
  42. package/dist/core/query/alltransclusions.d.ts +14 -0
  43. package/dist/core/query/allusers.d.ts +37 -0
  44. package/dist/core/query/authmanagerinfo.d.ts +96 -0
  45. package/dist/core/query/backlinks.d.ts +34 -0
  46. package/dist/core/query/blocks.d.ts +104 -0
  47. package/dist/core/query/categories.d.ts +28 -0
  48. package/dist/core/query/categoryinfo.d.ts +25 -0
  49. package/dist/core/query/categorymembers.d.ts +38 -0
  50. package/dist/core/query/codexicons.d.ts +40 -0
  51. package/dist/core/query/contributors.d.ts +23 -0
  52. package/dist/core/query/deletedrevisions.d.ts +21 -0
  53. package/dist/core/query/deletedrevs.d.ts +84 -0
  54. package/dist/core/query/duplicatefiles.d.ts +30 -0
  55. package/dist/core/query/embeddedin.d.ts +28 -0
  56. package/dist/core/query/extlinks.d.ts +17 -0
  57. package/dist/core/query/exturlusage.d.ts +30 -0
  58. package/dist/core/query/filearchive.d.ts +91 -0
  59. package/dist/core/query/filerepoinfo.d.ts +51 -0
  60. package/dist/core/query/fileusage.d.ts +26 -0
  61. package/dist/core/query/imageinfo.d.ts +214 -0
  62. package/dist/core/query/images.d.ts +20 -0
  63. package/dist/core/query/imageusage.d.ts +36 -0
  64. package/dist/core/query/index.d.ts +489 -0
  65. package/dist/core/query/info.d.ts +208 -0
  66. package/dist/core/query/iwbacklinks.d.ts +28 -0
  67. package/dist/core/query/iwlinks.d.ts +21 -0
  68. package/dist/core/query/langbacklinks.d.ts +28 -0
  69. package/dist/core/query/langlinks.d.ts +32 -0
  70. package/dist/core/query/languageinfo.d.ts +70 -0
  71. package/dist/core/query/links.d.ts +22 -0
  72. package/dist/core/query/linkshere.d.ts +25 -0
  73. package/dist/core/query/logevents.d.ts +77 -0
  74. package/dist/core/query/mystashedfiles.d.ts +39 -0
  75. package/dist/core/query/pagepropnames.d.ts +18 -0
  76. package/dist/core/query/pageprops.d.ts +19 -0
  77. package/dist/core/query/pageswithprop.d.ts +28 -0
  78. package/dist/core/query/prefixsearch.d.ts +27 -0
  79. package/dist/core/query/protectedtitles.d.ts +43 -0
  80. package/dist/core/query/querypage.d.ts +59 -0
  81. package/dist/core/query/random.d.ts +30 -0
  82. package/dist/core/query/recentchanges.d.ts +103 -0
  83. package/dist/core/query/redirects.d.ts +27 -0
  84. package/dist/core/query/revisions.d.ts +176 -0
  85. package/dist/core/query/search.d.ts +141 -0
  86. package/dist/core/query/siteinfo.d.ts +731 -0
  87. package/dist/core/query/stashimageinfo.d.ts +101 -0
  88. package/dist/core/query/tags.d.ts +34 -0
  89. package/dist/core/query/templates.d.ts +20 -0
  90. package/dist/core/query/tokens.d.ts +34 -0
  91. package/dist/core/query/trackingcategories.d.ts +25 -0
  92. package/dist/core/query/transcludedin.d.ts +25 -0
  93. package/dist/core/query/usercontribs.d.ts +72 -0
  94. package/dist/core/query/userinfo.d.ts +141 -0
  95. package/dist/core/query/users.d.ts +164 -0
  96. package/dist/core/query/watchlist.d.ts +109 -0
  97. package/dist/core/query/watchlistraw.d.ts +42 -0
  98. package/dist/core/removeauthenticationdata.d.ts +18 -0
  99. package/dist/core/resetpassword.d.ts +16 -0
  100. package/dist/core/revisiondelete.d.ts +83 -0
  101. package/dist/core/rollback.d.ts +27 -0
  102. package/dist/core/setnotificationtimestamp.d.ts +47 -0
  103. package/dist/core/setpagelanguage.d.ts +24 -0
  104. package/dist/core/stashedit.d.ts +25 -0
  105. package/dist/core/tag.d.ts +49 -0
  106. package/dist/core/upload.d.ts +106 -0
  107. package/dist/core/userrights.d.ts +41 -0
  108. package/dist/core/validatepassword.d.ts +28 -0
  109. package/dist/core/watch.d.ts +45 -0
  110. package/dist/envelope/index.d.ts +122 -0
  111. package/dist/extensions/abusefilters.d.ts +207 -0
  112. package/dist/extensions/babel.d.ts +32 -0
  113. package/dist/extensions/categorytree.d.ts +78 -0
  114. package/dist/extensions/checkuser.d.ts +148 -0
  115. package/dist/extensions/description.d.ts +22 -0
  116. package/dist/extensions/discussiontools.d.ts +273 -0
  117. package/dist/extensions/echo.d.ts +306 -0
  118. package/dist/extensions/extracts.d.ts +24 -0
  119. package/dist/extensions/flaggedrevs.d.ts +192 -0
  120. package/dist/extensions/gadgets.d.ts +148 -0
  121. package/dist/extensions/globalblocks.d.ts +115 -0
  122. package/dist/extensions/globalpreferences.d.ts +62 -0
  123. package/dist/extensions/globalusage.d.ts +41 -0
  124. package/dist/extensions/globaluserinfo.d.ts +95 -0
  125. package/dist/extensions/linter.d.ts +83 -0
  126. package/dist/extensions/massmessage.d.ts +108 -0
  127. package/dist/extensions/oathauth.d.ts +86 -0
  128. package/dist/extensions/pageimages.d.ts +33 -0
  129. package/dist/extensions/pageviews.d.ts +63 -0
  130. package/dist/extensions/scribunto.d.ts +61 -0
  131. package/dist/extensions/sitematrix.d.ts +109 -0
  132. package/dist/extensions/spamblacklist.d.ts +25 -0
  133. package/dist/extensions/templatedata.d.ts +130 -0
  134. package/dist/extensions/thanks.d.ts +29 -0
  135. package/dist/extensions/timedmediahandler.d.ts +121 -0
  136. package/dist/extensions/titleblacklist.d.ts +29 -0
  137. package/dist/extensions/urlshortener.d.ts +42 -0
  138. package/dist/extensions/visualeditor.d.ts +204 -0
  139. package/dist/extensions/wikibase.d.ts +100 -0
  140. package/dist/extensions/wikilove.d.ts +38 -0
  141. package/dist/index.d.ts +3 -0
  142. package/package.json +76 -0
@@ -0,0 +1,489 @@
1
+ /**
2
+ * `action=query` response skeleton and page framework.
3
+ *
4
+ * Per-module page data (`prop=info`, `prop=revisions`, ...) is contributed
5
+ * to {@link ApiPage} from each module file via declaration merging, so the
6
+ * page shape grows as coverage expands without this file depending on them.
7
+ */
8
+ import type { Flag, NamespaceIndex } from "../../common";
9
+ import type { ApiEnvelope } from "../../envelope";
10
+ /**
11
+ * Continuation tokens returned by `action=query`. @see https://www.mediawiki.org/wiki/API:Continue
12
+ *
13
+ * A module used as a generator emits its cursor under the `g`-prefixed form of
14
+ * its list-mode name (`generator=allpages` → `gapcontinue`), so each
15
+ * generator-capable module registers both forms. Modules that cannot act as
16
+ * generators have no `g`-prefixed form (e.g. `list=allusers`, `prop=extlinks`).
17
+ *
18
+ * A module with data left contributes its own cursor. A generator's `g`-prefixed
19
+ * cursor is only emitted once the `prop=` modules it drives have finished, which
20
+ * is also when `batchcomplete: true` appears; while a `prop=` module still has
21
+ * data the generator is not advanced, and only that module's cursor plus the
22
+ * generator parameters carried over come back. Once everything is finished the
23
+ * `continue` key is omitted entirely, though `batchcomplete` is still `true`.
24
+ *
25
+ * The generic {@link continue} string reads `<generator keys>||<finished modules>`:
26
+ * `-` means the generator itself is finished, a non-empty first segment names the
27
+ * generator parameters carried into the next request, and an empty first segment
28
+ * means a `prop=` module is still unfinished — it says nothing about the
29
+ * generator. The second segment names the modules a client may skip.
30
+ */
31
+ export interface ApiQueryContinue {
32
+ /** Generic opaque continue token (often `"||"` or `"-||"`). */
33
+ continue?: string;
34
+ /** `prop=revisions` */
35
+ rvcontinue?: string;
36
+ /** `generator=revisions` */
37
+ grvcontinue?: string;
38
+ /** `prop=categories` */
39
+ clcontinue?: string;
40
+ /** `generator=categories` */
41
+ gclcontinue?: string;
42
+ /** `prop=linkshere` */
43
+ lhcontinue?: string;
44
+ /** `generator=linkshere` */
45
+ glhcontinue?: string;
46
+ /** `prop=redirects` */
47
+ rdcontinue?: string;
48
+ /** `generator=redirects` */
49
+ grdcontinue?: string;
50
+ /** `prop=transcludedin` */
51
+ ticontinue?: string;
52
+ /** `generator=transcludedin` */
53
+ gticontinue?: string;
54
+ /** `prop=fileusage` */
55
+ fucontinue?: string;
56
+ /** `generator=fileusage` */
57
+ gfucontinue?: string;
58
+ /** `list=categorymembers` */
59
+ cmcontinue?: string;
60
+ /** `generator=categorymembers` */
61
+ gcmcontinue?: string;
62
+ /** `list=usercontribs` */
63
+ uccontinue?: string;
64
+ /** `list=recentchanges` */
65
+ rccontinue?: string;
66
+ /** `generator=recentchanges` */
67
+ grccontinue?: string;
68
+ /** `list=tags` */
69
+ tgcontinue?: string;
70
+ /** `prop=links` */
71
+ plcontinue?: string;
72
+ /** `generator=links` */
73
+ gplcontinue?: string;
74
+ /** `prop=images` */
75
+ imcontinue?: string;
76
+ /** `generator=images` */
77
+ gimcontinue?: string;
78
+ /** `prop=extlinks` */
79
+ elcontinue?: string;
80
+ /** `prop=templates` */
81
+ tlcontinue?: string;
82
+ /** `generator=templates` */
83
+ gtlcontinue?: string;
84
+ /** `prop=iwlinks` */
85
+ iwcontinue?: string;
86
+ /** `meta=languageinfo` */
87
+ licontinue?: string;
88
+ /** `list=allimages` */
89
+ aicontinue?: string;
90
+ /** `generator=allimages` */
91
+ gaicontinue?: string;
92
+ /** `list=allpages` */
93
+ apcontinue?: string;
94
+ /** `generator=allpages` */
95
+ gapcontinue?: string;
96
+ /** `prop=langlinks` */
97
+ llcontinue?: string;
98
+ /** `list=prefixsearch` offset (a number, like `sroffset`). */
99
+ psoffset?: number;
100
+ /** `generator=prefixsearch` offset (a number). */
101
+ gpsoffset?: number;
102
+ /** `list=allcategories` */
103
+ accontinue?: string;
104
+ /** `generator=allcategories` */
105
+ gaccontinue?: string;
106
+ /**
107
+ * `list=trackingcategories`
108
+ *
109
+ * @since MediaWiki 1.45
110
+ */
111
+ tccontinue?: string;
112
+ /**
113
+ * `generator=trackingcategories`
114
+ *
115
+ * @since MediaWiki 1.45
116
+ */
117
+ gtccontinue?: string;
118
+ /** `list=backlinks` */
119
+ blcontinue?: string;
120
+ /** `generator=backlinks` */
121
+ gblcontinue?: string;
122
+ /** `list=embeddedin` */
123
+ eicontinue?: string;
124
+ /** `generator=embeddedin` */
125
+ geicontinue?: string;
126
+ /** `list=watchlist` */
127
+ wlcontinue?: string;
128
+ /** `generator=watchlist` */
129
+ gwlcontinue?: string;
130
+ /** `list=logevents` */
131
+ lecontinue?: string;
132
+ /** `list=blocks` */
133
+ bkcontinue?: string;
134
+ /** `prop=contributors` */
135
+ pccontinue?: string;
136
+ /** `list=allusers` (name cursor) */
137
+ aufrom?: string;
138
+ /** `list=search` offset (a number, unlike most string cursors). */
139
+ sroffset?: number;
140
+ /** `generator=search` offset (a number). */
141
+ gsroffset?: number;
142
+ /** `list=random` (a `|`-joined random weight and page id, still a string). */
143
+ rncontinue?: string;
144
+ /** `generator=random` */
145
+ grncontinue?: string;
146
+ /** `list=querypage` offset (a number, like `sroffset`). */
147
+ qpoffset?: number;
148
+ /** `generator=querypage` offset (a number). */
149
+ gqpoffset?: number;
150
+ /** `list=alllinks` */
151
+ alcontinue?: string;
152
+ /** `generator=alllinks` */
153
+ galcontinue?: string;
154
+ /** `list=allredirects` */
155
+ arcontinue?: string;
156
+ /** `generator=allredirects` */
157
+ garcontinue?: string;
158
+ /** `list=alltransclusions` */
159
+ atcontinue?: string;
160
+ /** `generator=alltransclusions` */
161
+ gatcontinue?: string;
162
+ /** `list=exturlusage` */
163
+ eucontinue?: string;
164
+ /** `generator=exturlusage` */
165
+ geucontinue?: string;
166
+ /** `list=pageswithprop` */
167
+ pwpcontinue?: string;
168
+ /** `generator=pageswithprop` */
169
+ gpwpcontinue?: string;
170
+ /** `list=pagepropnames` */
171
+ ppncontinue?: string;
172
+ /** `list=imageusage` */
173
+ iucontinue?: string;
174
+ /** `generator=imageusage` */
175
+ giucontinue?: string;
176
+ /** `list=iwbacklinks` */
177
+ iwblcontinue?: string;
178
+ /** `generator=iwbacklinks` */
179
+ giwblcontinue?: string;
180
+ /** `list=langbacklinks` */
181
+ lblcontinue?: string;
182
+ /** `generator=langbacklinks` */
183
+ glblcontinue?: string;
184
+ /** `list=protectedtitles` */
185
+ ptcontinue?: string;
186
+ /** `generator=protectedtitles` */
187
+ gptcontinue?: string;
188
+ /** `list=watchlistraw` */
189
+ wrcontinue?: string;
190
+ /** `generator=watchlistraw` */
191
+ gwrcontinue?: string;
192
+ /** `prop=deletedrevisions` */
193
+ drvcontinue?: string;
194
+ /** `generator=deletedrevisions` */
195
+ gdrvcontinue?: string;
196
+ /** `list=alldeletedrevisions` */
197
+ adrcontinue?: string;
198
+ /** `generator=alldeletedrevisions` */
199
+ gadrcontinue?: string;
200
+ /** `list=allrevisions` */
201
+ arvcontinue?: string;
202
+ /** `generator=allrevisions` */
203
+ garvcontinue?: string;
204
+ /** `list=allfileusages` */
205
+ afcontinue?: string;
206
+ /** `generator=allfileusages` */
207
+ gafcontinue?: string;
208
+ /** `list=deletedrevs` (deprecated module) */
209
+ drcontinue?: string;
210
+ /** `list=filearchive` */
211
+ facontinue?: string;
212
+ /** `list=mystashedfiles` (numeric `uploadstash` row id) */
213
+ msfcontinue?: string;
214
+ /** `prop=duplicatefiles` */
215
+ dfcontinue?: string;
216
+ /** `generator=duplicatefiles` */
217
+ gdfcontinue?: string;
218
+ /** `prop=info` */
219
+ incontinue?: string;
220
+ /** `prop=imageinfo` */
221
+ iistart?: string;
222
+ /** `prop=imageinfo` */
223
+ iicontinue?: string;
224
+ /** `prop=pageprops` */
225
+ ppcontinue?: string;
226
+ /** `prop=categoryinfo` */
227
+ cicontinue?: string;
228
+ /** `list=users` (remaining names, pipe-joined) */
229
+ ususers?: string;
230
+ /** `list=users` queried by id (remaining ids, pipe-joined) */
231
+ ususerids?: string;
232
+ /** `meta=siteinfo` (unprocessed `siprop` values, pipe-joined) */
233
+ siprop?: string;
234
+ /** `meta=allmessages` */
235
+ amfrom?: string;
236
+ /** `meta=tokens` (unprocessed token types, pipe-joined) */
237
+ type?: string;
238
+ [key: string]: string | number | undefined;
239
+ }
240
+ /** One title normalization performed by the query framework. */
241
+ export interface ApiQueryNormalized {
242
+ /** `true` when the input title was percent-encoded. */
243
+ fromencoded?: boolean;
244
+ /** The title as supplied by the request. */
245
+ from?: string;
246
+ /** The normalized title used for the lookup. */
247
+ to?: string;
248
+ }
249
+ /**
250
+ * Framework identity fields present on every `query.pages` entry, regardless
251
+ * of which `prop=` modules were requested.
252
+ */
253
+ export interface ApiPageIdentity {
254
+ /**
255
+ * Page id. Absent when the id is unknown: a missing page requested by page
256
+ * id keeps its `pageid` alongside `missing`, while title-supplied
257
+ * missing/invalid pages and special pages carry no `pageid`.
258
+ */
259
+ pageid?: number;
260
+ /** Namespace index. */
261
+ ns?: NamespaceIndex;
262
+ /** Full, normalized page title. */
263
+ title?: string;
264
+ /** `true` when the page does not exist. */
265
+ missing?: Flag;
266
+ /**
267
+ * `true` when the page does not exist but its content is known (e.g. a
268
+ * defined but unsaved interface message). Emitted by the framework itself,
269
+ * without requesting `prop=info`.
270
+ */
271
+ known?: Flag;
272
+ /** `true` when the supplied title is not a valid title. */
273
+ invalid?: Flag;
274
+ /** Human-readable reason a title is `invalid`. */
275
+ invalidreason?: string;
276
+ /** `true` for pages in a special namespace. */
277
+ special?: Flag;
278
+ }
279
+ /**
280
+ * A `query.pages` entry carrying the union of all covered `prop=` fields.
281
+ * `prop=` modules widen this via declaration merging (see `./info`); every
282
+ * field is optional because pages may be missing/invalid and because a response
283
+ * only contains the props that were requested.
284
+ *
285
+ * For a view scoped to the props you actually requested, use {@link QueryPage}.
286
+ */
287
+ export interface ApiPage extends ApiPageIdentity {
288
+ /**
289
+ * 1-based rank of the page in the generator's ordering; injected by the query
290
+ * framework for `generator=search` and `generator=prefixsearch`, absent
291
+ * otherwise. A page reached through a redirect takes the smaller of the two
292
+ * ranks.
293
+ */
294
+ index?: number;
295
+ }
296
+ /**
297
+ * A page scoped to a chosen set of `prop=` fields: identity fields plus the
298
+ * named keys only. Lets callers reflect what they requested and get a compile
299
+ * error when reading a prop they did not ask for. The generator-injected
300
+ * {@link ApiPage.index} is always offered as well, because it comes from the
301
+ * query framework rather than from a `prop=`.
302
+ *
303
+ * @example
304
+ * // identity + revisions only (categories/links/... are not offered)
305
+ * const pages = Object.values(res.query.pages) as QueryPage<'revisions'>[];
306
+ */
307
+ export type QueryPage<K extends keyof ApiPage> = ApiPageIdentity & Pick<ApiPage, K | "index">;
308
+ /** Makes the listed keys of `T` required while leaving every other key as-is. */
309
+ type Require<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
310
+ /**
311
+ * A `query.pages` entry whose page exists. The framework resolves `pageid`,
312
+ * `ns` and `title` for every existing entry, so they are required here instead
313
+ * of optional as on the merged {@link ApiPage}.
314
+ *
315
+ * The other entry states do not carry all three, which is why the merged
316
+ * {@link ApiPage} keeps them optional: a title-supplied `missing` entry has no
317
+ * `pageid`; a page-id-supplied `missing` entry has neither `ns` nor `title`; an
318
+ * `invalid` title has only `title`/`invalidreason`; a `special` entry has no
319
+ * `pageid`. Narrow to this type only when the request cannot yield those states
320
+ * — a `generator=` feed, or `pageids=` with known-good ids.
321
+ */
322
+ export type ApiPageExisting = Require<ApiPage, "pageid" | "ns" | "title">;
323
+ /**
324
+ * {@link QueryPage} for a page that exists: the identity fields are required
325
+ * rather than optional. See {@link ApiPageExisting} for when this holds.
326
+ *
327
+ * @example
328
+ * // identity + revisions only, with pageid/ns/title guaranteed
329
+ * const pages = Object.values(res.query.pages) as QueryPageExisting<'revisions'>[];
330
+ */
331
+ export type QueryPageExisting<K extends keyof ApiPage> = Require<QueryPage<K>, "pageid" | "ns" | "title">;
332
+ /** A `{ from, to }` title pair emitted by the query framework. */
333
+ export interface ApiQueryTitlePair {
334
+ /** The title as supplied. */
335
+ from?: string;
336
+ /** The title it resolved to. */
337
+ to?: string;
338
+ }
339
+ /** One title resolved to a foreign wiki through an interwiki prefix. */
340
+ export interface ApiQueryInterwikiTitle {
341
+ /** The supplied title, including its interwiki prefix. */
342
+ title: string;
343
+ /** Interwiki prefix that claimed the title. */
344
+ iw: string;
345
+ /** URL of the target page on the foreign wiki (`iwurl=1`). */
346
+ url?: string;
347
+ }
348
+ /** One redirect resolved by the framework (`redirects=1`). */
349
+ export interface ApiQueryResolvedRedirect extends ApiQueryTitlePair {
350
+ /** Fragment of the target title, when it carries one. */
351
+ tofragment?: string;
352
+ /** Interwiki prefix of the target, when it points off-site. */
353
+ tointerwiki?: string;
354
+ /**
355
+ * 1-based rank of the redirect source in the generator's ordering, present
356
+ * only when that source was fed by a generator (`generator=search` /
357
+ * `generator=prefixsearch`). The rest of the source's generator data is
358
+ * merged into the entry as well, while `from`/`to`/`tofragment`/`tointerwiki`
359
+ * always win over it.
360
+ */
361
+ index?: number;
362
+ }
363
+ /** One requested `revid` that does not exist, keyed by revision id. */
364
+ export interface ApiQueryBadRev {
365
+ /** The requested revision id. */
366
+ revid?: number;
367
+ /** The revision does not exist. A {@link Flag}. */
368
+ missing?: Flag;
369
+ }
370
+ /**
371
+ * Accumulated shape of the `query` result object.
372
+ *
373
+ * Framework-level keys live here; per-module list/meta keys are merged in by
374
+ * their own files via declaration merging, keeping this open to extension.
375
+ */
376
+ export interface ApiQueryResult {
377
+ /** Title normalizations applied to the request. */
378
+ normalized?: ApiQueryNormalized[];
379
+ /** Page entries, present for title/pageid/generator-based queries. */
380
+ pages?: ApiPage[];
381
+ /**
382
+ * Title conversions applied on a language-variant wiki when the request
383
+ * allowed them (`converttitles`), as `{ from, to }` pairs.
384
+ */
385
+ converted?: ApiQueryTitlePair[];
386
+ /**
387
+ * Titles that resolved to an interwiki prefix; the framework does not
388
+ * process them further.
389
+ */
390
+ interwiki?: ApiQueryInterwikiTitle[];
391
+ /** Redirects resolved when the request set `redirects=1`. */
392
+ redirects?: ApiQueryResolvedRedirect[];
393
+ /**
394
+ * Requested `revids` that do not exist, keyed by revision id. Emitted
395
+ * instead of a `pages` entry for that revision.
396
+ */
397
+ badrevids?: Record<string, ApiQueryBadRev>;
398
+ /**
399
+ * Page ids of the returned pages (`indexpageids=1`). JSON map keys are
400
+ * strings, so ids are strings here even under `formatversion=2`.
401
+ */
402
+ pageids?: string[];
403
+ /** XML dump of the returned pages (`export=1`). */
404
+ export?: string;
405
+ }
406
+ /** Response of `action=query`. `query` widens as modules get covered. */
407
+ export interface ApiQueryResponse extends ApiEnvelope {
408
+ continue?: ApiQueryContinue;
409
+ query: ApiQueryResult;
410
+ /** Effective limits per module, keyed by module name (e.g. `{ categories: 500 }`). */
411
+ limits?: Record<string, number>;
412
+ /**
413
+ * Legacy continuation cursors, keyed by module and then by parameter name,
414
+ * emitted at the root level (not under `query`) when the request sets
415
+ * `rawcontinue=1`. It replaces `continue` / `batchcomplete`, which are not
416
+ * emitted in that mode; `query-noncontinue` may appear alongside it.
417
+ */
418
+ "query-continue"?: Record<string, Record<string, string | number>>;
419
+ /**
420
+ * Parameters carried over from the previous batch that are not continuation
421
+ * cursors, keyed by module and then by parameter name (`rawcontinue=1`).
422
+ * Array values are joined with `|` before serialization.
423
+ */
424
+ "query-noncontinue"?: Record<string, Record<string, string | number>>;
425
+ }
426
+ export * from "./info";
427
+ export * from "./categories";
428
+ export * from "./revisions";
429
+ export * from "./linkshere";
430
+ export * from "./redirects";
431
+ export * from "./transcludedin";
432
+ export * from "./fileusage";
433
+ export * from "./categorymembers";
434
+ export * from "./usercontribs";
435
+ export * from "./recentchanges";
436
+ export * from "./search";
437
+ export * from "./users";
438
+ export * from "./allusers";
439
+ export * from "./tags";
440
+ export * from "./logevents";
441
+ export * from "./blocks";
442
+ export * from "./contributors";
443
+ export * from "./imageinfo";
444
+ export * from "./links";
445
+ export * from "./images";
446
+ export * from "./extlinks";
447
+ export * from "./categoryinfo";
448
+ export * from "./allimages";
449
+ export * from "./allpages";
450
+ export * from "./langlinks";
451
+ export * from "./pageprops";
452
+ export * from "./prefixsearch";
453
+ export * from "./allcategories";
454
+ export * from "./backlinks";
455
+ export * from "./embeddedin";
456
+ export * from "./userinfo";
457
+ export * from "./watchlist";
458
+ export * from "./tokens";
459
+ export * from "./siteinfo";
460
+ export * from "./allmessages";
461
+ export * from "./templates";
462
+ export * from "./iwlinks";
463
+ export * from "./languageinfo";
464
+ export * from "./random";
465
+ export * from "./querypage";
466
+ export * from "./alllinks";
467
+ export * from "./allredirects";
468
+ export * from "./alltransclusions";
469
+ export * from "./exturlusage";
470
+ export * from "./pageswithprop";
471
+ export * from "./pagepropnames";
472
+ export * from "./imageusage";
473
+ export * from "./iwbacklinks";
474
+ export * from "./langbacklinks";
475
+ export * from "./filerepoinfo";
476
+ export * from "./protectedtitles";
477
+ export * from "./watchlistraw";
478
+ export * from "./deletedrevisions";
479
+ export * from "./alldeletedrevisions";
480
+ export * from "./allrevisions";
481
+ export * from "./allfileusages";
482
+ export * from "./deletedrevs";
483
+ export * from "./filearchive";
484
+ export * from "./mystashedfiles";
485
+ export * from "./duplicatefiles";
486
+ export * from "./stashimageinfo";
487
+ export * from "./authmanagerinfo";
488
+ export * from "./codexicons";
489
+ export * from "./trackingcategories";
@@ -0,0 +1,208 @@
1
+ /**
2
+ * `prop=info` page fields, merged into the shared {@link ApiPage} shape via
3
+ * declaration merging so `query.pages[]` gains these fields when `info` is
4
+ * requested. Extra fields are selected with `inprop=`.
5
+ *
6
+ * @see https://www.mediawiki.org/wiki/API:Info
7
+ */
8
+ import type { ApiWatchlistLabel, ContentFormat, ContentModel, Flag, Timestamp } from "../../common";
9
+ /** One entry of a page's `protection` array (`inprop=protection`). */
10
+ export interface ApiPageProtection {
11
+ /** Restriction kind, e.g. `edit` / `move`. Open union. */
12
+ type: string;
13
+ /** Required right/group level, e.g. `sysop` / `autoconfirmed`. Empty when unrestricted. */
14
+ level: string;
15
+ /** Expiry, or `infinity` / `infinite` when permanent. */
16
+ expiry: Timestamp;
17
+ /**
18
+ * Whether this restriction cascades to transcluded pages. Appears only when
19
+ * the page has `cascade=true` set (see `action=protect`), and is a {@link Flag}.
20
+ */
21
+ cascade?: Flag;
22
+ /**
23
+ * Title of the page whose protection cascades onto this one. Present only on
24
+ * entries inherited through cascading protection, i.e. never together with
25
+ * {@link cascade} on the same entry.
26
+ */
27
+ source?: string;
28
+ }
29
+ /**
30
+ * One permission-check failure reported under `intestactionsdetail=full|quick`.
31
+ * The exact keys depend on the request's `errorformat`.
32
+ */
33
+ export interface ApiActionPermission {
34
+ /** Machine-readable code, e.g. `sitejsprotected`. */
35
+ code?: string;
36
+ /** Rendered message text. */
37
+ text?: string;
38
+ /** i18n message key, when the server supplies the raw message instead. */
39
+ message?: string;
40
+ /** Parameters substituted into the message. */
41
+ params?: unknown[];
42
+ }
43
+ declare module "./index" {
44
+ interface ApiPage {
45
+ /** Content model of the page's current revision. */
46
+ contentmodel?: ContentModel;
47
+ /** Page language code, e.g. `en`. */
48
+ pagelanguage?: string;
49
+ /** HTML `lang` attribute value for the page language. */
50
+ pagelanguagehtmlcode?: string;
51
+ /** Writing direction of the page language. Open union for forward compatibility. */
52
+ pagelanguagedir?: "ltr" | "rtl" | (string & {});
53
+ /** When the page was last touched (cache/link invalidation), not last edited. Existing pages only. */
54
+ touched?: Timestamp;
55
+ /** Revision id of the latest revision. Existing pages only. */
56
+ lastrevid?: number;
57
+ /** Length of the page content in bytes. Existing pages only. */
58
+ length?: number;
59
+ /** `true` when the page is a redirect. A {@link Flag} (appears only when true). */
60
+ redirect?: Flag;
61
+ /**
62
+ * `true` when the page is in the new-pages list (no other page links to it and
63
+ * it has a single revision). A {@link Flag} — absent for established pages.
64
+ */
65
+ new?: Flag;
66
+ /**
67
+ * Whether the requesting user watches the page. A **real `boolean`** (`false` is
68
+ * returned), unlike most watch markers. `inprop=watched`; requires being
69
+ * logged in with the `viewmywatchlist` right.
70
+ */
71
+ watched?: boolean;
72
+ /**
73
+ * Number of users watching the page. For callers without the `unwatchedpages`
74
+ * right the count is withheld entirely while it stays below
75
+ * `$wgUnwatchedPageThreshold`; `0` is only reported to callers with that
76
+ * right. `inprop=watchers`.
77
+ */
78
+ watchers?: number;
79
+ /**
80
+ * Number of watchers who have visited the page since their notification
81
+ * timestamp. Same withholding rule as {@link watchers}.
82
+ * `inprop=visitingwatchers`.
83
+ */
84
+ visitingwatchers?: number;
85
+ /**
86
+ * When the requesting user's watch of this page expires. Requires
87
+ * `inprop=watched`; present only when the page is watched **with** an
88
+ * expiry (`action=watch&expiry=`).
89
+ */
90
+ watchlistexpiry?: Timestamp;
91
+ /**
92
+ * Watchlist labels attached to this page by the requesting user.
93
+ * `inprop=watchlistlabels`; requires being logged in with the
94
+ * `viewmywatchlist` right (like {@link watched}) and
95
+ * `$wgEnableWatchlistLabels`, and is `[]` when the page has none.
96
+ *
97
+ * @since MediaWiki 1.46
98
+ */
99
+ watchlistlabels?: ApiWatchlistLabel[];
100
+ /**
101
+ * Per-action permission test results, keyed by action name. Set by
102
+ * `intestactions=`: `intestactionsdetail=boolean` yields a `boolean` per
103
+ * action, while `full`/`quick` yields the array of blocking messages
104
+ * (empty when the action is allowed). A PHP map, so an empty result
105
+ * serializes as `[]`.
106
+ */
107
+ actions?: Record<string, boolean | ApiActionPermission[]> | unknown[];
108
+ /**
109
+ * Whether a temporary account would be auto-created for each tested action.
110
+ * `intestactionsautocreate=1` alongside `intestactions=`. A PHP map, hence
111
+ * the `unknown[]` empty case.
112
+ *
113
+ * @since MediaWiki 1.41
114
+ */
115
+ wouldautocreate?: Record<string, boolean> | unknown[];
116
+ /**
117
+ * When the requesting user last saw the page. An **empty string** when never
118
+ * visited (or when notifications are off), otherwise a timestamp.
119
+ * `inprop=notificationtimestamp`.
120
+ */
121
+ notificationtimestamp?: Timestamp | "";
122
+ /**
123
+ * Whether the current user may read the page. A real `boolean` (`false` included).
124
+ * `inprop=readable`.
125
+ *
126
+ * @deprecated since MediaWiki 1.32; use `intestactions=read` instead.
127
+ */
128
+ readable?: boolean;
129
+ /**
130
+ * Text pre-filled into the edit box for a missing page, from the
131
+ * `EditFormPreloadText` hook. `''` when the page exists.
132
+ * `inprop=preload`.
133
+ *
134
+ * @deprecated since MediaWiki 1.41 in favour of {@link preloadcontent}, which also
135
+ * reports the content model and format.
136
+ */
137
+ preload?: string;
138
+ /**
139
+ * Content the edit form would preload: for a page that does not exist yet,
140
+ * or for an existing page when a new section would be added
141
+ * (`preloadnewsection=1`). `inprop=preloadcontent`; only for a single
142
+ * title/revision per query.
143
+ *
144
+ * @since MediaWiki 1.41
145
+ */
146
+ preloadcontent?: ApiPreloadedContent;
147
+ /**
148
+ * Whether {@link preloadcontent} is identical to the page's default content, in
149
+ * which case saving it would be a no-op. `inprop=preloadcontent`.
150
+ *
151
+ * @since MediaWiki 1.41
152
+ */
153
+ preloadisdefault?: boolean;
154
+ /**
155
+ * Notices the edit form should show, keyed by message name (e.g.
156
+ * `newarticletext`) with HTML values. Drawn from the whole edit-form intro
157
+ * message set — `newarticletext`, `talkpagetext`, per-namespace editnotices,
158
+ * `Editintro` pages, … — not only `MediaWiki:Editintro*` pages.
159
+ * `inprop=editintro`; only for a single title per query.
160
+ *
161
+ * @since MediaWiki 1.41
162
+ */
163
+ editintro?: Record<string, string>;
164
+ /** Protection entries; empty array when unrestricted. `inprop=protection`. */
165
+ protection?: ApiPageProtection[];
166
+ /** Restriction types that apply, e.g. `edit`, `move`, `create`. `inprop=protection`. */
167
+ restrictiontypes?: string[];
168
+ /**
169
+ * Related page: the talk page for a subject, or vice versa.
170
+ * `inprop=associatedpage`; subject/talk namespaces only — not emitted on
171
+ * special or `Media:` pages.
172
+ */
173
+ associatedpage?: string;
174
+ /** Page id of the associated talk page. `inprop=talkid` (subject pages only). */
175
+ talkid?: number;
176
+ /** Page id of the associated subject page. `inprop=subjectid` (talk pages only). */
177
+ subjectid?: number;
178
+ /** Fully-resolved canonical article URL. `inprop=url`. */
179
+ fullurl?: string;
180
+ /** Edit-page URL. `inprop=url`. */
181
+ editurl?: string;
182
+ /** Canonical URL. `inprop=url`. */
183
+ canonicalurl?: string;
184
+ /** HTML title used for display. `inprop=displaytitle`. */
185
+ displaytitle?: string;
186
+ /**
187
+ * Display titles per language variant, keyed by variant code (e.g.
188
+ * `zh-hans`). Also populated on wikis without language variants, where the
189
+ * single key is the content language itself. `inprop=varianttitles`.
190
+ */
191
+ varianttitles?: Record<string, string>;
192
+ /**
193
+ * CSS classes to apply to links to this page (core marks redirects
194
+ * `mw-redirect`; extensions may add more). `inprop=linkclasses`; emitted
195
+ * for every requested page, `[]` when there is no class for it.
196
+ */
197
+ linkclasses?: string[];
198
+ }
199
+ }
200
+ /** Preloaded edit content (`inprop=preloadcontent`), which fills the main slot. */
201
+ export interface ApiPreloadedContent {
202
+ /** Content model of the preloaded text, e.g. `wikitext`. */
203
+ contentmodel?: ContentModel;
204
+ /** Serialization format, e.g. `text/x-wiki`. */
205
+ contentformat?: ContentFormat;
206
+ /** The preloaded body; `''` when nothing is configured for the title. */
207
+ content?: string;
208
+ }