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.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/README.zh.md +57 -0
- package/dist/common/index.d.ts +87 -0
- package/dist/core/acquiretempusername.d.ts +17 -0
- package/dist/core/block.d.ts +98 -0
- package/dist/core/changeauthenticationdata.d.ts +18 -0
- package/dist/core/changecontentmodel.d.ts +27 -0
- package/dist/core/checktoken.d.ts +28 -0
- package/dist/core/clearhasmsg.d.ts +15 -0
- package/dist/core/clientlogin.d.ts +48 -0
- package/dist/core/compare.d.ts +92 -0
- package/dist/core/createaccount.d.ts +41 -0
- package/dist/core/delete.d.ts +45 -0
- package/dist/core/edit.d.ts +66 -0
- package/dist/core/emailuser.d.ts +27 -0
- package/dist/core/expandtemplates.d.ts +66 -0
- package/dist/core/filerevert.d.ts +20 -0
- package/dist/core/imagerotate.d.ts +51 -0
- package/dist/core/import.d.ts +29 -0
- package/dist/core/index.d.ts +40 -0
- package/dist/core/languagesearch.d.ts +24 -0
- package/dist/core/login.d.ts +30 -0
- package/dist/core/logout.d.ts +16 -0
- package/dist/core/managetags.d.ts +28 -0
- package/dist/core/mergehistory.d.ts +26 -0
- package/dist/core/move.d.ts +62 -0
- package/dist/core/options.d.ts +16 -0
- package/dist/core/parse.d.ts +324 -0
- package/dist/core/patrol.d.ts +21 -0
- package/dist/core/protect.d.ts +43 -0
- package/dist/core/purge.d.ts +61 -0
- package/dist/core/query/allcategories.d.ts +30 -0
- package/dist/core/query/alldeletedrevisions.d.ts +29 -0
- package/dist/core/query/allfileusages.d.ts +15 -0
- package/dist/core/query/allimages.d.ts +25 -0
- package/dist/core/query/alllinks.d.ts +34 -0
- package/dist/core/query/allmessages.d.ts +43 -0
- package/dist/core/query/allpages.d.ts +23 -0
- package/dist/core/query/allredirects.d.ts +23 -0
- package/dist/core/query/allrevisions.d.ts +30 -0
- package/dist/core/query/alltransclusions.d.ts +14 -0
- package/dist/core/query/allusers.d.ts +37 -0
- package/dist/core/query/authmanagerinfo.d.ts +96 -0
- package/dist/core/query/backlinks.d.ts +34 -0
- package/dist/core/query/blocks.d.ts +104 -0
- package/dist/core/query/categories.d.ts +28 -0
- package/dist/core/query/categoryinfo.d.ts +25 -0
- package/dist/core/query/categorymembers.d.ts +38 -0
- package/dist/core/query/codexicons.d.ts +40 -0
- package/dist/core/query/contributors.d.ts +23 -0
- package/dist/core/query/deletedrevisions.d.ts +21 -0
- package/dist/core/query/deletedrevs.d.ts +84 -0
- package/dist/core/query/duplicatefiles.d.ts +30 -0
- package/dist/core/query/embeddedin.d.ts +28 -0
- package/dist/core/query/extlinks.d.ts +17 -0
- package/dist/core/query/exturlusage.d.ts +30 -0
- package/dist/core/query/filearchive.d.ts +91 -0
- package/dist/core/query/filerepoinfo.d.ts +51 -0
- package/dist/core/query/fileusage.d.ts +26 -0
- package/dist/core/query/imageinfo.d.ts +214 -0
- package/dist/core/query/images.d.ts +20 -0
- package/dist/core/query/imageusage.d.ts +36 -0
- package/dist/core/query/index.d.ts +489 -0
- package/dist/core/query/info.d.ts +208 -0
- package/dist/core/query/iwbacklinks.d.ts +28 -0
- package/dist/core/query/iwlinks.d.ts +21 -0
- package/dist/core/query/langbacklinks.d.ts +28 -0
- package/dist/core/query/langlinks.d.ts +32 -0
- package/dist/core/query/languageinfo.d.ts +70 -0
- package/dist/core/query/links.d.ts +22 -0
- package/dist/core/query/linkshere.d.ts +25 -0
- package/dist/core/query/logevents.d.ts +77 -0
- package/dist/core/query/mystashedfiles.d.ts +39 -0
- package/dist/core/query/pagepropnames.d.ts +18 -0
- package/dist/core/query/pageprops.d.ts +19 -0
- package/dist/core/query/pageswithprop.d.ts +28 -0
- package/dist/core/query/prefixsearch.d.ts +27 -0
- package/dist/core/query/protectedtitles.d.ts +43 -0
- package/dist/core/query/querypage.d.ts +59 -0
- package/dist/core/query/random.d.ts +30 -0
- package/dist/core/query/recentchanges.d.ts +103 -0
- package/dist/core/query/redirects.d.ts +27 -0
- package/dist/core/query/revisions.d.ts +176 -0
- package/dist/core/query/search.d.ts +141 -0
- package/dist/core/query/siteinfo.d.ts +731 -0
- package/dist/core/query/stashimageinfo.d.ts +101 -0
- package/dist/core/query/tags.d.ts +34 -0
- package/dist/core/query/templates.d.ts +20 -0
- package/dist/core/query/tokens.d.ts +34 -0
- package/dist/core/query/trackingcategories.d.ts +25 -0
- package/dist/core/query/transcludedin.d.ts +25 -0
- package/dist/core/query/usercontribs.d.ts +72 -0
- package/dist/core/query/userinfo.d.ts +141 -0
- package/dist/core/query/users.d.ts +164 -0
- package/dist/core/query/watchlist.d.ts +109 -0
- package/dist/core/query/watchlistraw.d.ts +42 -0
- package/dist/core/removeauthenticationdata.d.ts +18 -0
- package/dist/core/resetpassword.d.ts +16 -0
- package/dist/core/revisiondelete.d.ts +83 -0
- package/dist/core/rollback.d.ts +27 -0
- package/dist/core/setnotificationtimestamp.d.ts +47 -0
- package/dist/core/setpagelanguage.d.ts +24 -0
- package/dist/core/stashedit.d.ts +25 -0
- package/dist/core/tag.d.ts +49 -0
- package/dist/core/upload.d.ts +106 -0
- package/dist/core/userrights.d.ts +41 -0
- package/dist/core/validatepassword.d.ts +28 -0
- package/dist/core/watch.d.ts +45 -0
- package/dist/envelope/index.d.ts +122 -0
- package/dist/extensions/abusefilters.d.ts +207 -0
- package/dist/extensions/babel.d.ts +32 -0
- package/dist/extensions/categorytree.d.ts +78 -0
- package/dist/extensions/checkuser.d.ts +148 -0
- package/dist/extensions/description.d.ts +22 -0
- package/dist/extensions/discussiontools.d.ts +273 -0
- package/dist/extensions/echo.d.ts +306 -0
- package/dist/extensions/extracts.d.ts +24 -0
- package/dist/extensions/flaggedrevs.d.ts +192 -0
- package/dist/extensions/gadgets.d.ts +148 -0
- package/dist/extensions/globalblocks.d.ts +115 -0
- package/dist/extensions/globalpreferences.d.ts +62 -0
- package/dist/extensions/globalusage.d.ts +41 -0
- package/dist/extensions/globaluserinfo.d.ts +95 -0
- package/dist/extensions/linter.d.ts +83 -0
- package/dist/extensions/massmessage.d.ts +108 -0
- package/dist/extensions/oathauth.d.ts +86 -0
- package/dist/extensions/pageimages.d.ts +33 -0
- package/dist/extensions/pageviews.d.ts +63 -0
- package/dist/extensions/scribunto.d.ts +61 -0
- package/dist/extensions/sitematrix.d.ts +109 -0
- package/dist/extensions/spamblacklist.d.ts +25 -0
- package/dist/extensions/templatedata.d.ts +130 -0
- package/dist/extensions/thanks.d.ts +29 -0
- package/dist/extensions/timedmediahandler.d.ts +121 -0
- package/dist/extensions/titleblacklist.d.ts +29 -0
- package/dist/extensions/urlshortener.d.ts +42 -0
- package/dist/extensions/visualeditor.d.ts +204 -0
- package/dist/extensions/wikibase.d.ts +100 -0
- package/dist/extensions/wikilove.d.ts +38 -0
- package/dist/index.d.ts +3 -0
- package/package.json +76 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `action=parse` response — parses content and returns the result under a
|
|
3
|
+
* top-level `parse` object (not under `query`).
|
|
4
|
+
*
|
|
5
|
+
* Which sub-objects appear depends on `prop`. The rendered HTML is `parse.text`
|
|
6
|
+
* as a plain string, and category/link entries use named keys (`category`,
|
|
7
|
+
* `title`).
|
|
8
|
+
*
|
|
9
|
+
* @see https://www.mediawiki.org/wiki/API:Parsing_wikitext
|
|
10
|
+
*/
|
|
11
|
+
import type { Flag, NamespaceIndex } from "../common";
|
|
12
|
+
import type { ApiEnvelope } from "../envelope";
|
|
13
|
+
/** A category the parsed page would add itself to (`prop=categories`). */
|
|
14
|
+
export interface ApiParseCategory {
|
|
15
|
+
/**
|
|
16
|
+
* Sort key text — the piped sortkey or `{{DEFAULTSORT:…}}` value; `''` when
|
|
17
|
+
* the default applies.
|
|
18
|
+
*/
|
|
19
|
+
sortkey: string;
|
|
20
|
+
/** Category name, without the `Category:` prefix. */
|
|
21
|
+
category: string;
|
|
22
|
+
/** Whether the category is hidden. `prop=categories`. */
|
|
23
|
+
hidden?: Flag;
|
|
24
|
+
/** Whether the category page is missing. `prop=categories`. */
|
|
25
|
+
missing?: Flag;
|
|
26
|
+
/** A `missing` category that is nonetheless "known" (a redlinked category). A {@link Flag}. */
|
|
27
|
+
known?: Flag;
|
|
28
|
+
}
|
|
29
|
+
/** A wikilink or template used by the parsed page (`prop=links` / `prop=templates`). */
|
|
30
|
+
export interface ApiParseLink {
|
|
31
|
+
/** Namespace index. */
|
|
32
|
+
ns: NamespaceIndex;
|
|
33
|
+
/** Target page title. */
|
|
34
|
+
title: string;
|
|
35
|
+
/** Whether the target page exists; an explicit `false` for redlinks. */
|
|
36
|
+
exists: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** An interlanguage link (`prop=langlinks`). */
|
|
39
|
+
export interface ApiParseLangLink {
|
|
40
|
+
/** Language code. */
|
|
41
|
+
lang: string;
|
|
42
|
+
/** Full URL of the target page. */
|
|
43
|
+
url?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Localized language name, in the request `uselang` language. Always emitted
|
|
46
|
+
* when the target title is valid (`action=parse` has no `llprop` parameter).
|
|
47
|
+
*/
|
|
48
|
+
langname?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Native language name. Always emitted when the target title is valid
|
|
51
|
+
* (`action=parse` has no `llprop` parameter).
|
|
52
|
+
*/
|
|
53
|
+
autonym?: string;
|
|
54
|
+
/** Target page title. */
|
|
55
|
+
title: string;
|
|
56
|
+
}
|
|
57
|
+
/** An interwiki link (`prop=iwlinks`). */
|
|
58
|
+
export interface ApiParseIWLink {
|
|
59
|
+
/** Interwiki prefix. */
|
|
60
|
+
prefix: string;
|
|
61
|
+
/** Full URL of the target page. */
|
|
62
|
+
url?: string;
|
|
63
|
+
/** Target page title. */
|
|
64
|
+
title: string;
|
|
65
|
+
}
|
|
66
|
+
/** One redirect resolution (with `redirects=1`, when parsing `page=`/`pageid=`). */
|
|
67
|
+
export interface ApiParseRedirect {
|
|
68
|
+
/** Redirect source title. */
|
|
69
|
+
from?: string;
|
|
70
|
+
/** Title the redirect points to. */
|
|
71
|
+
to?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A table-of-contents entry (`prop=sections`) — the legacy projection of the
|
|
75
|
+
* same outline `prop=tocdata` emits, with lowercase keys here (`fromtitle`,
|
|
76
|
+
* `byteoffset`) against camelCase there (`fromTitle`, `codepointOffset`); see
|
|
77
|
+
* {@link ApiParseTocSection}.
|
|
78
|
+
*
|
|
79
|
+
* `SectionMetadata::toLegacy()` fills every key below unconditionally except
|
|
80
|
+
* `extensionData`, which is only emitted when non-empty.
|
|
81
|
+
*/
|
|
82
|
+
export interface ApiParseSection {
|
|
83
|
+
/** Nesting level in the TOC. */
|
|
84
|
+
toclevel: number;
|
|
85
|
+
/** Heading level, as a string (`"1"` for `= … =`). */
|
|
86
|
+
level: string;
|
|
87
|
+
/** Heading text (HTML). */
|
|
88
|
+
line: string;
|
|
89
|
+
/** Section number in the outline, e.g. `1.1`. */
|
|
90
|
+
number: string;
|
|
91
|
+
/** `edit` parameter value for this section. */
|
|
92
|
+
index: string;
|
|
93
|
+
/**
|
|
94
|
+
* Title the section came from; `false` when it has none — the legacy
|
|
95
|
+
* serialization of a null title, where `prop=tocdata` omits the key instead.
|
|
96
|
+
*/
|
|
97
|
+
fromtitle: string | false;
|
|
98
|
+
/**
|
|
99
|
+
* Offset of the heading in the source, in **code points** despite the legacy
|
|
100
|
+
* name; `null` for a heading that is not a "preprocessor section" (e.g. one
|
|
101
|
+
* written as a literal `<h_>` tag).
|
|
102
|
+
*/
|
|
103
|
+
byteoffset: number | null;
|
|
104
|
+
/** Anchor name for links. */
|
|
105
|
+
anchor: string;
|
|
106
|
+
/**
|
|
107
|
+
* Anchor used by the section's own edit link.
|
|
108
|
+
*
|
|
109
|
+
* @since MediaWiki 1.40
|
|
110
|
+
*/
|
|
111
|
+
linkAnchor?: string;
|
|
112
|
+
/** Extension-supplied data for this section; only when non-empty. */
|
|
113
|
+
extensionData?: Record<string, unknown> | unknown[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One `tocdata` section (`prop=tocdata`) — the same outline as
|
|
117
|
+
* {@link ApiParseSection} but camelCased, with an HTML heading level instead of a
|
|
118
|
+
* wikitext `level` and a code-point offset instead of a byte offset.
|
|
119
|
+
*/
|
|
120
|
+
export interface ApiParseTocSection {
|
|
121
|
+
/** Nesting level in the TOC. */
|
|
122
|
+
tocLevel?: number;
|
|
123
|
+
/** HTML heading level, as a number (1 for `<h1>`, 2 for `<h2>`, …). */
|
|
124
|
+
hLevel?: number;
|
|
125
|
+
/** Heading text (HTML). */
|
|
126
|
+
line?: string;
|
|
127
|
+
/** Section number in the outline, e.g. `1.1`. */
|
|
128
|
+
number?: string;
|
|
129
|
+
/** `edit` parameter value for this section. */
|
|
130
|
+
index?: string;
|
|
131
|
+
/** Title the section came from. */
|
|
132
|
+
fromTitle?: string;
|
|
133
|
+
/** Offset of the heading in code points, not bytes. */
|
|
134
|
+
codepointOffset?: number;
|
|
135
|
+
/** Anchor name for links. */
|
|
136
|
+
anchor?: string;
|
|
137
|
+
/** Anchor used by the section's own edit link (leading `#` included). */
|
|
138
|
+
linkAnchor?: string;
|
|
139
|
+
/** Extension-supplied data for this section; `[]` when empty. */
|
|
140
|
+
extensionData?: Record<string, unknown> | unknown[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The `tocdata` object (`prop=tocdata`). `TOCData::toJsonArray()` writes both
|
|
144
|
+
* keys unconditionally; individual section keys are the conditional ones (see
|
|
145
|
+
* {@link ApiParseTocSection}).
|
|
146
|
+
*/
|
|
147
|
+
export interface ApiParseTocData {
|
|
148
|
+
/** The outline, in camelCase keys. */
|
|
149
|
+
sections: ApiParseTocSection[];
|
|
150
|
+
/** Extension-supplied TOC data, keyed by extension; `[]` when empty. */
|
|
151
|
+
extensionData: Record<string, unknown> | unknown[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* One row of `limitreportdata` (`prop=limitreportdata`). fv2 keeps the PHP
|
|
155
|
+
* array's numeric keys, so the measurement(s) sit under `"0"`/`"1"`.
|
|
156
|
+
*/
|
|
157
|
+
export interface ApiParseLimitReportEntry {
|
|
158
|
+
/** Report key, e.g. `limitreport-cputime` or `cachereport-ttl`. */
|
|
159
|
+
name?: string;
|
|
160
|
+
/**
|
|
161
|
+
* `"0"` is the measured value; `"1"` is the configured limit for used/limit
|
|
162
|
+
* pairs. Values are strings, numbers, or booleans depending on the row.
|
|
163
|
+
*/
|
|
164
|
+
[value: string]: string | number | boolean | undefined;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* One raw `<head>` element (`prop=headitems`).
|
|
168
|
+
*
|
|
169
|
+
* @deprecated since MediaWiki 1.28; see {@link ApiParse.headitems}.
|
|
170
|
+
*/
|
|
171
|
+
export interface ApiParseHeadItem {
|
|
172
|
+
/** Element name the item was collected under (often a numeric key). */
|
|
173
|
+
tag: string;
|
|
174
|
+
/** Markup of the head item. */
|
|
175
|
+
content: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The `parse` object of a successful `action=parse` response. `title` and
|
|
179
|
+
* `pageid` are written before any `prop` value is considered; with `onlypst=1`
|
|
180
|
+
* the module returns a different, metadata-free shape instead — see
|
|
181
|
+
* {@link ApiParseOnlyPstResponse}.
|
|
182
|
+
*/
|
|
183
|
+
export interface ApiParse {
|
|
184
|
+
/** Page title the content was parsed as. */
|
|
185
|
+
title: string;
|
|
186
|
+
/**
|
|
187
|
+
* Page id of the context title — the parsed page, or the `title` parameter
|
|
188
|
+
* (default `API`) when parsing text. `0` only when that title does not exist.
|
|
189
|
+
*/
|
|
190
|
+
pageid: number;
|
|
191
|
+
/** The revision's text was deleted. A {@link Flag}. */
|
|
192
|
+
textdeleted?: Flag;
|
|
193
|
+
/** The revision's text was suppressed. A {@link Flag}. */
|
|
194
|
+
textsuppressed?: Flag;
|
|
195
|
+
/**
|
|
196
|
+
* Revision id the content was parsed from. Emitted whenever `oldid` was
|
|
197
|
+
* given, or when parsing a page with `prop=revid`.
|
|
198
|
+
*/
|
|
199
|
+
revid?: number;
|
|
200
|
+
/** Redirect resolutions (with `redirects=1`). */
|
|
201
|
+
redirects?: ApiParseRedirect[];
|
|
202
|
+
/**
|
|
203
|
+
* Rendered HTML output (`formatversion=2`: a plain string). `prop=text`.
|
|
204
|
+
* With `onlypst=1`, the pre-save-transformed wikitext instead.
|
|
205
|
+
*/
|
|
206
|
+
text?: string;
|
|
207
|
+
/** Source wikitext. `prop=wikitext`. */
|
|
208
|
+
wikitext?: string;
|
|
209
|
+
/** Pre-save-transformed wikitext (`prop=wikitext` + `pst=1`). */
|
|
210
|
+
psttext?: string;
|
|
211
|
+
/** Parsed edit summary (`summary=` given, or `sectiontitle=` with `section=new`). */
|
|
212
|
+
parsedsummary?: string;
|
|
213
|
+
/** HTML for the display title. `prop=displaytitle`. */
|
|
214
|
+
displaytitle?: string;
|
|
215
|
+
/** Categories the page would be added to. `prop=categories`. */
|
|
216
|
+
categories?: ApiParseCategory[];
|
|
217
|
+
/** Pages linked from the content. `prop=links`. */
|
|
218
|
+
links?: ApiParseLink[];
|
|
219
|
+
/** Pages transcluded by the content. `prop=templates`. */
|
|
220
|
+
templates?: ApiParseLink[];
|
|
221
|
+
/** File names used by the content. `prop=images`. */
|
|
222
|
+
images?: string[];
|
|
223
|
+
/** External URLs linked by the content. `prop=externallinks`. */
|
|
224
|
+
externallinks?: string[];
|
|
225
|
+
/** Interlanguage links. `prop=langlinks`. */
|
|
226
|
+
langlinks?: ApiParseLangLink[];
|
|
227
|
+
/** Interwiki links. `prop=iwlinks`. */
|
|
228
|
+
iwlinks?: ApiParseIWLink[];
|
|
229
|
+
/** Section outline. `prop=sections`. */
|
|
230
|
+
sections?: ApiParseSection[];
|
|
231
|
+
/** HTML for the categories, keyed like {@link categories}. `prop=categorieshtml`. */
|
|
232
|
+
categorieshtml?: string;
|
|
233
|
+
/** Page subtitle. `prop=subtitle`. */
|
|
234
|
+
subtitle?: string;
|
|
235
|
+
/** HTML page-indicator hooks. `prop=indicators`. */
|
|
236
|
+
indicators?: Record<string, string>;
|
|
237
|
+
/** Parser warnings for the input. `prop=parsewarnings`. */
|
|
238
|
+
parsewarnings?: string[];
|
|
239
|
+
/**
|
|
240
|
+
* Extension-registered display properties (values are numbers, strings, or
|
|
241
|
+
* arrays). `prop=properties`; the set is open-ended.
|
|
242
|
+
*/
|
|
243
|
+
properties?: Record<string, unknown>;
|
|
244
|
+
/** ResourceLoader modules required by the output. `prop=modules` (also emits
|
|
245
|
+
* {@link modulescripts} and {@link modulestyles}); must be paired with
|
|
246
|
+
* `jsconfigvars`/`encodedjsconfigvars` or the API warns. */
|
|
247
|
+
modules?: string[];
|
|
248
|
+
/**
|
|
249
|
+
* The script-bearing subset of {@link modules}.
|
|
250
|
+
*
|
|
251
|
+
* @deprecated since MediaWiki 1.32 — core hard-codes this to `[]`, so it is always
|
|
252
|
+
* empty; read {@link modules} instead.
|
|
253
|
+
*/
|
|
254
|
+
modulescripts?: never[];
|
|
255
|
+
/**
|
|
256
|
+
* The style-bearing subset of {@link modules}. `prop=modules` — a plain
|
|
257
|
+
* module-name list.
|
|
258
|
+
*/
|
|
259
|
+
modulestyles?: string[];
|
|
260
|
+
/**
|
|
261
|
+
* `window.mw.config` values needed by {@link modules}, keyed by variable name.
|
|
262
|
+
* `prop=jsconfigvars`.
|
|
263
|
+
*/
|
|
264
|
+
jsconfigvars?: Record<string, unknown>;
|
|
265
|
+
/**
|
|
266
|
+
* {@link jsconfigvars} as a JSON string, ready to inline. `prop=encodedjsconfigvars`.
|
|
267
|
+
*/
|
|
268
|
+
encodedjsconfigvars?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Table of contents with camelCased entries. `prop=tocdata`.
|
|
271
|
+
*
|
|
272
|
+
* @since MediaWiki 1.43
|
|
273
|
+
*/
|
|
274
|
+
tocdata?: ApiParseTocData;
|
|
275
|
+
/** Whether the output should show a TOC. `prop=tocdata` or `prop=sections`; a real `boolean`. */
|
|
276
|
+
showtoc?: boolean;
|
|
277
|
+
/** HTML list of parser warnings. `prop=parsewarningshtml`. */
|
|
278
|
+
parsewarningshtml?: string[];
|
|
279
|
+
/**
|
|
280
|
+
* Parser profiling rows. `prop=limitreportdata` — emitted regardless of
|
|
281
|
+
* `disablelimitreport` (that only strips the table from the rendered text).
|
|
282
|
+
*/
|
|
283
|
+
limitreportdata?: ApiParseLimitReportEntry[];
|
|
284
|
+
/**
|
|
285
|
+
* Parser profiling rendered as a preview HTML table. `prop=limitreporthtml`.
|
|
286
|
+
* Its numbers change on every request.
|
|
287
|
+
*/
|
|
288
|
+
limitreporthtml?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Raw `<head>` elements, one `{tag, content}` entry each. `prop=headitems`.
|
|
291
|
+
*
|
|
292
|
+
* @deprecated since MediaWiki 1.28 — use {@link headhtml} to build a document, or
|
|
293
|
+
* {@link modules} + `jsconfigvars` to update one client-side.
|
|
294
|
+
*/
|
|
295
|
+
headitems?: ApiParseHeadItem[];
|
|
296
|
+
/**
|
|
297
|
+
* The preprocessor result as an XML tree. `prop=parsetree`; requires a wikitext
|
|
298
|
+
* content model (otherwise the call fails with the `notwikitext` error code).
|
|
299
|
+
* Not flagged deprecated by 1.43, unlike the `generatexml` parameter that also
|
|
300
|
+
* produces it.
|
|
301
|
+
*/
|
|
302
|
+
parsetree?: string;
|
|
303
|
+
/** Full HTML document head. `prop=headhtml`. */
|
|
304
|
+
headhtml?: string;
|
|
305
|
+
}
|
|
306
|
+
/** Response of `action=parse`. */
|
|
307
|
+
export interface ApiParseResponse extends ApiEnvelope {
|
|
308
|
+
parse: ApiParse;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Response of `action=parse&onlypst=1`: the module builds the payload before it
|
|
312
|
+
* resolves a title, so only the pre-save-transformed text comes back — no
|
|
313
|
+
* `title`/`pageid` and none of the `prop` sub-objects of {@link ApiParse}.
|
|
314
|
+
*/
|
|
315
|
+
export interface ApiParseOnlyPstResponse extends ApiEnvelope {
|
|
316
|
+
parse: {
|
|
317
|
+
/** Pre-save-transformed wikitext. */
|
|
318
|
+
text: string;
|
|
319
|
+
/** Source wikitext (`prop=wikitext`). */
|
|
320
|
+
wikitext?: string;
|
|
321
|
+
/** Parsed edit summary (`summary=`, or `sectiontitle=` with `section=new`). */
|
|
322
|
+
parsedsummary?: string;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `action=patrol` response — marks a recent change as patrolled. Requires the
|
|
3
|
+
* `patrol` right and the dedicated `patroltoken` (`meta=tokens&type=patrol`).
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Patrol
|
|
6
|
+
*/
|
|
7
|
+
import type { NamespaceIndex } from "../common";
|
|
8
|
+
import type { ApiEnvelope } from "../envelope";
|
|
9
|
+
/** The `patrol` object of a successful `action=patrol` response. */
|
|
10
|
+
export interface ApiPatrolResult {
|
|
11
|
+
/** Recent-changes id that was patrolled. */
|
|
12
|
+
rcid: number;
|
|
13
|
+
/** Namespace of the patrolled page. */
|
|
14
|
+
ns: NamespaceIndex;
|
|
15
|
+
/** Title of the patrolled page. */
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
/** Response of `action=patrol`. */
|
|
19
|
+
export interface ApiPatrolResponse extends ApiEnvelope {
|
|
20
|
+
patrol: ApiPatrolResult;
|
|
21
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `action=protect` response — changes a page's protection levels. Requires the
|
|
3
|
+
* `protect` right and a CSRF token. Returns the applied protection under a
|
|
4
|
+
* top-level `protect` object.
|
|
5
|
+
*
|
|
6
|
+
* `protections` is a per-restriction array: each entry keys the restriction type
|
|
7
|
+
* (e.g. `edit`, `move`) to its level, alongside that restriction's `expiry`
|
|
8
|
+
* (a timestamp or `infinite`).
|
|
9
|
+
*
|
|
10
|
+
* @see https://www.mediawiki.org/wiki/API:Protect
|
|
11
|
+
*/
|
|
12
|
+
import type { Flag } from "../common";
|
|
13
|
+
import type { ApiEnvelope } from "../envelope";
|
|
14
|
+
/** One applied protection (`type` → level, plus `expiry`). */
|
|
15
|
+
export interface ApiProtectionEntry {
|
|
16
|
+
/** Edit-protection level (right/group name), when the `edit` restriction is set. */
|
|
17
|
+
edit?: string;
|
|
18
|
+
/** Move-protection level, when the `move` restriction is set. */
|
|
19
|
+
move?: string;
|
|
20
|
+
/** Create-protection level, when the `create` restriction is set. */
|
|
21
|
+
create?: string;
|
|
22
|
+
/** Upload-protection level, when the `upload` restriction is set. */
|
|
23
|
+
upload?: string;
|
|
24
|
+
/** Expiry for this restriction, or `infinite`. */
|
|
25
|
+
expiry: string;
|
|
26
|
+
/** Extension-provided restriction types are carried through as string levels. */
|
|
27
|
+
[type: string]: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
/** The `protect` object of an `action=protect` response. */
|
|
30
|
+
export interface ApiProtectResult {
|
|
31
|
+
/** Protected page title. */
|
|
32
|
+
title: string;
|
|
33
|
+
/** Protection reason (echoed back). */
|
|
34
|
+
reason: string;
|
|
35
|
+
/** The protection cascades to the pages transcluded here (`cascade=1`). A {@link Flag}. */
|
|
36
|
+
cascade?: Flag;
|
|
37
|
+
/** Applied restrictions, one entry per restriction type. */
|
|
38
|
+
protections: ApiProtectionEntry[];
|
|
39
|
+
}
|
|
40
|
+
/** Response of `action=protect`. */
|
|
41
|
+
export interface ApiProtectResponse extends ApiEnvelope {
|
|
42
|
+
protect: ApiProtectResult;
|
|
43
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `action=purge` response — refreshes the cached parsing of one or more pages;
|
|
3
|
+
* the result is a top-level `purge` **array** (one entry per title). Titles the
|
|
4
|
+
* pageSet could not resolve (invalid, special, interwiki, missing) come back as
|
|
5
|
+
* problem entries without a `purged` flag.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.mediawiki.org/wiki/API:Purge
|
|
8
|
+
*/
|
|
9
|
+
import type { Flag, NamespaceIndex } from "../common";
|
|
10
|
+
import type { ApiEnvelope } from "../envelope";
|
|
11
|
+
import type { ApiQueryNormalized, ApiQueryTitlePair } from "./query";
|
|
12
|
+
/** One purged page. */
|
|
13
|
+
export interface ApiPurgeEntry {
|
|
14
|
+
/** Namespace index. */
|
|
15
|
+
ns?: NamespaceIndex;
|
|
16
|
+
/** Page title. */
|
|
17
|
+
title?: string;
|
|
18
|
+
/** Whether the page was actually purged. A {@link Flag} (appears when purged). */
|
|
19
|
+
purged?: Flag;
|
|
20
|
+
/**
|
|
21
|
+
* Whether a link table update was queued (with `forcelinkupdate` or
|
|
22
|
+
* `forcerecursivelinkupdate`). A {@link Flag}.
|
|
23
|
+
*/
|
|
24
|
+
linkupdate?: Flag;
|
|
25
|
+
/** Page id, for entries describing a `pageids=` value that did not resolve. */
|
|
26
|
+
pageid?: number;
|
|
27
|
+
/** Revision id, for entries describing a `revids=` value that did not resolve. */
|
|
28
|
+
revid?: number;
|
|
29
|
+
/** The requested title does not correspond to an existing page. A {@link Flag}. */
|
|
30
|
+
missing?: Flag;
|
|
31
|
+
/** A `missing` title that is nonetheless "known" (e.g. a redlinked page). A {@link Flag}. */
|
|
32
|
+
known?: Flag;
|
|
33
|
+
/** The requested title is malformed or otherwise invalid. A {@link Flag}. */
|
|
34
|
+
invalid?: Flag;
|
|
35
|
+
/** Reason the title is invalid (localized wikitext), alongside `invalid`. */
|
|
36
|
+
invalidreason?: string;
|
|
37
|
+
/** The requested title is a Special: page (not purged). A {@link Flag}. */
|
|
38
|
+
special?: Flag;
|
|
39
|
+
/** Interwiki prefix, for entries describing an interwiki title. */
|
|
40
|
+
iw?: string;
|
|
41
|
+
}
|
|
42
|
+
/** One resolved redirect (with `redirects=1`). */
|
|
43
|
+
export interface ApiPurgeRedirect {
|
|
44
|
+
/** Redirect source title. */
|
|
45
|
+
from?: string;
|
|
46
|
+
/** Title the redirect points to. */
|
|
47
|
+
to?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Response of `action=purge`. */
|
|
50
|
+
export interface ApiPurgeResponse extends ApiEnvelope {
|
|
51
|
+
purge: ApiPurgeEntry[];
|
|
52
|
+
/**
|
|
53
|
+
* Title normalizations the pageSet applied before the purge (e.g. underscore
|
|
54
|
+
* and capitalization fixes), same shape as `query.normalized`.
|
|
55
|
+
*/
|
|
56
|
+
normalized?: ApiQueryNormalized[];
|
|
57
|
+
/** Title conversions on a language-variant wiki, same shape as `query.converted`. */
|
|
58
|
+
converted?: ApiQueryTitlePair[];
|
|
59
|
+
/** Redirect resolutions (with `redirects=1`). */
|
|
60
|
+
redirects?: ApiPurgeRedirect[];
|
|
61
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=allcategories` — enumerate all categories with their sizes, merged into
|
|
3
|
+
* {@link ApiQueryResult}.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Allcategories
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* One category summary. `acprop=size|hidden` selects the optional fields;
|
|
9
|
+
* `category` is always present.
|
|
10
|
+
*/
|
|
11
|
+
export interface ApiAllCategory {
|
|
12
|
+
/** Category name, without the `Category:` prefix. */
|
|
13
|
+
category: string;
|
|
14
|
+
/** Total members (pages + subcats + files). `acprop=size`. */
|
|
15
|
+
size?: number;
|
|
16
|
+
/** Number of pages. `acprop=size`. */
|
|
17
|
+
pages?: number;
|
|
18
|
+
/** Number of files. `acprop=size`. */
|
|
19
|
+
files?: number;
|
|
20
|
+
/** Number of subcategories. `acprop=size`. */
|
|
21
|
+
subcats?: number;
|
|
22
|
+
/** Whether the category is hidden. `acprop=hidden`; a real `boolean`. */
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare module "./index" {
|
|
26
|
+
interface ApiQueryResult {
|
|
27
|
+
/** Categories listed by `list=allcategories`. */
|
|
28
|
+
allcategories?: ApiAllCategory[];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=alldeletedrevisions` — deleted revisions across the wiki, grouped per
|
|
3
|
+
* page, merged into {@link ApiQueryResult}. The list-side counterpart of
|
|
4
|
+
* `prop=deletedrevisions` (which is keyed by the titles you ask for).
|
|
5
|
+
*
|
|
6
|
+
* Grouping keys the page with `pageid: 0` when the page itself is deleted rather
|
|
7
|
+
* than merely some of its revisions, so `0` is meaningful, not a placeholder.
|
|
8
|
+
*
|
|
9
|
+
* @see https://www.mediawiki.org/wiki/API:Alldeletedrevisions
|
|
10
|
+
*/
|
|
11
|
+
import type { NamespaceIndex } from "../../common";
|
|
12
|
+
import type { ApiRevision } from "./revisions";
|
|
13
|
+
/** One page carrying at least one deleted revision. */
|
|
14
|
+
export interface ApiAllDeletedRevisions {
|
|
15
|
+
/** Page id; `0` when the whole page is deleted. */
|
|
16
|
+
pageid: number;
|
|
17
|
+
/** Namespace index. */
|
|
18
|
+
ns: NamespaceIndex;
|
|
19
|
+
/** Full page title. */
|
|
20
|
+
title: string;
|
|
21
|
+
/** The page's deleted revisions, ordered per `ardir` (default `older`). */
|
|
22
|
+
revisions: ApiRevision[];
|
|
23
|
+
}
|
|
24
|
+
declare module "./index" {
|
|
25
|
+
interface ApiQueryResult {
|
|
26
|
+
/** Deleted revisions grouped by page (`list=alldeletedrevisions`). */
|
|
27
|
+
alldeletedrevisions?: ApiAllDeletedRevisions[];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=allfileusages` — enumerate file titles that are used, merged into
|
|
3
|
+
* {@link ApiQueryResult}. Part of the `alllinks` family (`ApiQueryAllLinks` over
|
|
4
|
+
* the `imagelinks` table, `af*` parameters), so rows share {@link ApiAllLink} —
|
|
5
|
+
* including the `afunique` / `afprop=ids` exclusivity.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.mediawiki.org/wiki/API:Allfileusages
|
|
8
|
+
*/
|
|
9
|
+
import type { ApiAllLink } from "./alllinks";
|
|
10
|
+
declare module "./index" {
|
|
11
|
+
interface ApiQueryResult {
|
|
12
|
+
/** Used file titles, one row per usage (`list=allfileusages`). */
|
|
13
|
+
allfileusages?: ApiAllLink[];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=allimages` — enumerate uploaded files, merged into {@link ApiQueryResult}.
|
|
3
|
+
* Each entry carries the image-info fields selected by `aiprop` (default
|
|
4
|
+
* `timestamp|url`) plus the identifying `name` / `ns` / `title`; `aimime` only
|
|
5
|
+
* filters which files are listed.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.mediawiki.org/wiki/API:Allimages
|
|
8
|
+
*/
|
|
9
|
+
import type { NamespaceIndex } from "../../common";
|
|
10
|
+
import type { ApiImageInfo } from "./imageinfo";
|
|
11
|
+
/** One file listed by `list=allimages`. */
|
|
12
|
+
export interface ApiAllImage extends ApiImageInfo {
|
|
13
|
+
/** File name without the `File:` prefix. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Namespace index (the File namespace, 6). */
|
|
16
|
+
ns: NamespaceIndex;
|
|
17
|
+
/** Full file title, e.g. `File:Wiki.png`. */
|
|
18
|
+
title: string;
|
|
19
|
+
}
|
|
20
|
+
declare module "./index" {
|
|
21
|
+
interface ApiQueryResult {
|
|
22
|
+
/** Uploaded files (`list=allimages`). */
|
|
23
|
+
allimages?: ApiAllImage[];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=alllinks` — enumerate titles that are linked to, merged into
|
|
3
|
+
* {@link ApiQueryResult}.
|
|
4
|
+
*
|
|
5
|
+
* MediaWiki implements `alllinks`, `allredirects` and `alltransclusions` with one
|
|
6
|
+
* class, so all three emit the same row shape ({@link ApiAllLink}); the other two
|
|
7
|
+
* merge their own result keys in their own files.
|
|
8
|
+
*
|
|
9
|
+
* @see https://www.mediawiki.org/wiki/API:Alllinks
|
|
10
|
+
*/
|
|
11
|
+
import type { NamespaceIndex } from "../../common";
|
|
12
|
+
/** One linked (or redirected-to / transcluded) title. */
|
|
13
|
+
export interface ApiAllLink {
|
|
14
|
+
/**
|
|
15
|
+
* Page id of the page holding the link (`alprop=ids`). Without `alunique` a
|
|
16
|
+
* target appears once per linking page, each row carrying that page's id;
|
|
17
|
+
* `alunique` deduplicates targets with DISTINCT and never selects the source
|
|
18
|
+
* column, which is why it cannot be combined with `*prop=ids`.
|
|
19
|
+
*/
|
|
20
|
+
fromid?: number;
|
|
21
|
+
/** Namespace index of the linked title. `alprop=title` (default). */
|
|
22
|
+
ns?: NamespaceIndex;
|
|
23
|
+
/** Full title of the linked page. */
|
|
24
|
+
title?: string;
|
|
25
|
+
}
|
|
26
|
+
declare module "./index" {
|
|
27
|
+
interface ApiQueryResult {
|
|
28
|
+
/**
|
|
29
|
+
* Titles linked to (`list=alllinks`), ordered by link target — title, or
|
|
30
|
+
* target id on the linktarget schema — then by source page id.
|
|
31
|
+
*/
|
|
32
|
+
alllinks?: ApiAllLink[];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `meta=allmessages` — interface (system) messages, merged into
|
|
3
|
+
* {@link ApiQueryResult} via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* The message body is the `content` field. Selecting keys with `ammessages=`
|
|
6
|
+
* keeps responses small.
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.mediawiki.org/wiki/API:Allmessages
|
|
9
|
+
*/
|
|
10
|
+
import type { Flag } from "../../common";
|
|
11
|
+
/** One interface message. */
|
|
12
|
+
export interface ApiAllMessage {
|
|
13
|
+
/** Message key. */
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Key normalized for lookup: first letter lowercased and spaces replaced
|
|
17
|
+
* with underscores. Emitted on every entry, independent of `amprop`.
|
|
18
|
+
*/
|
|
19
|
+
normalizedname: string;
|
|
20
|
+
/** Message body. Absent when the message does not exist. */
|
|
21
|
+
content?: string;
|
|
22
|
+
/** Default (untranslated) value. `amprop=default`. */
|
|
23
|
+
default?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The message exists on the wiki (e.g. a custom `MediaWiki:` page) but the
|
|
26
|
+
* software ships no built-in default for it. Emitted instead of
|
|
27
|
+
* {@link default} under `amprop=default`. A {@link Flag}.
|
|
28
|
+
*/
|
|
29
|
+
defaultmissing?: Flag;
|
|
30
|
+
/**
|
|
31
|
+
* Present only when filtering with `amcustomised=modified`, which restricts
|
|
32
|
+
* the result to customised messages, so always `true`. A {@link Flag}.
|
|
33
|
+
*/
|
|
34
|
+
customised?: Flag;
|
|
35
|
+
/** `true` when the message is not defined. */
|
|
36
|
+
missing?: true;
|
|
37
|
+
}
|
|
38
|
+
declare module "./index" {
|
|
39
|
+
interface ApiQueryResult {
|
|
40
|
+
/** Interface messages (`meta=allmessages`). */
|
|
41
|
+
allmessages?: ApiAllMessage[];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=allpages` — enumerate all pages in a namespace, merged into
|
|
3
|
+
* {@link ApiQueryResult}. Each entry carries only the page identity:
|
|
4
|
+
* `{ pageid, ns, title }`.
|
|
5
|
+
*
|
|
6
|
+
* @see https://www.mediawiki.org/wiki/API:Allpages
|
|
7
|
+
*/
|
|
8
|
+
import type { NamespaceIndex } from "../../common";
|
|
9
|
+
/** One page listed by `list=allpages`. */
|
|
10
|
+
export interface ApiAllPage {
|
|
11
|
+
/** Page id. */
|
|
12
|
+
pageid: number;
|
|
13
|
+
/** Namespace index. */
|
|
14
|
+
ns: NamespaceIndex;
|
|
15
|
+
/** Page title. */
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
declare module "./index" {
|
|
19
|
+
interface ApiQueryResult {
|
|
20
|
+
/** Enumerated pages (`list=allpages`). */
|
|
21
|
+
allpages?: ApiAllPage[];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=allredirects` — enumerate titles that are redirect targets, merged into
|
|
3
|
+
* {@link ApiQueryResult}. Shares {@link ApiAllLink} with the `alllinks` family
|
|
4
|
+
* (same MediaWiki class, `ar*` parameters); the redirect-table columns below are
|
|
5
|
+
* this module's own `arprop` values, merged into the shared shape.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.mediawiki.org/wiki/API:Allredirects
|
|
8
|
+
*/
|
|
9
|
+
import type { ApiAllLink } from "./alllinks";
|
|
10
|
+
declare module "./alllinks" {
|
|
11
|
+
interface ApiAllLink {
|
|
12
|
+
/** Fragment of the redirect target title. `arprop=fragment`. */
|
|
13
|
+
fragment?: string;
|
|
14
|
+
/** Interwiki prefix of the redirect target, when it points off-site. `arprop=interwiki`. */
|
|
15
|
+
interwiki?: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare module "./index" {
|
|
19
|
+
interface ApiQueryResult {
|
|
20
|
+
/** Redirect targets on the wiki (`list=allredirects`). */
|
|
21
|
+
allredirects?: ApiAllLink[];
|
|
22
|
+
}
|
|
23
|
+
}
|