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,66 @@
1
+ /**
2
+ * `action=edit` response — result of a page edit, returned under a top-level
3
+ * `edit` object.
4
+ *
5
+ * Fields present depend on the outcome:
6
+ * - create: `new: true` plus `oldrevid: 0` / `newrevid` / `newtimestamp`;
7
+ * - changed: `oldrevid` / `newrevid` / `newtimestamp` (no `new`);
8
+ * - nochange: `nochange: true`, no revision ids.
9
+ * `watched` appears when the edit applied a watch. Most hard failures (bad
10
+ * token, protected page, `createonly` on an existing page) surface as a
11
+ * top-level {@link ApiErrorResponse}, not `result: "Failure"`.
12
+ *
13
+ * @see https://www.mediawiki.org/wiki/API:Edit
14
+ */
15
+ import type { ContentModel, Flag, Timestamp } from "../common";
16
+ import type { ApiEnvelope } from "../envelope";
17
+ /** The `edit` object of an `action=edit` response. */
18
+ export interface ApiEditResult {
19
+ /** Outcome of the request. Open union; the failure branch is documented below. */
20
+ result: "Success" | "Failure" | (string & {});
21
+ /** Page id of the edited page. */
22
+ pageid?: number;
23
+ /** Normalized page title. */
24
+ title?: string;
25
+ /** Content model of the page. */
26
+ contentmodel?: ContentModel;
27
+ /** `true` when the edit created the page. A {@link Flag}. */
28
+ new?: Flag;
29
+ /** `true` when the supplied text equaled the current text. A {@link Flag}. */
30
+ nochange?: Flag;
31
+ /** `true` when the page was added to the user's watchlist. A {@link Flag}. */
32
+ watched?: Flag;
33
+ /**
34
+ * When the watch applied by this edit expires. Only alongside
35
+ * {@link watched}, and only when the watch carries an expiry.
36
+ */
37
+ watchlistexpiry?: Timestamp;
38
+ /** Revision id before the edit; `0` when the page was created. */
39
+ oldrevid?: number;
40
+ /** Revision id created by the edit. */
41
+ newrevid?: number;
42
+ /** Timestamp of the new revision. */
43
+ newtimestamp?: Timestamp;
44
+ /**
45
+ * `true` when the edit auto-created a temporary account for the (formerly
46
+ * anonymous) editor. A {@link Flag}.
47
+ *
48
+ * @since MediaWiki 1.41
49
+ */
50
+ tempusercreated?: Flag;
51
+ /**
52
+ * Full URL to redirect to after a temporary-account auto-creation.
53
+ * Present only alongside {@link tempusercreated}.
54
+ *
55
+ * @since MediaWiki 1.41
56
+ */
57
+ tempusercreatedredirect?: string;
58
+ /** Machine-readable failure code. */
59
+ code?: string;
60
+ /** Human-readable failure description. */
61
+ info?: string;
62
+ }
63
+ /** Response of `action=edit`. */
64
+ export interface ApiEditResponse extends ApiEnvelope {
65
+ edit: ApiEditResult;
66
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `action=emailuser` response — sends an email to another user; needs CSRF and
3
+ * both the sender's `sendemail` right and a confirmed address. The result keys
4
+ * under `emailuser`.
5
+ *
6
+ * `ApiEmailUser` reports the outcome **in-band** (not as a top-level
7
+ * {@link ApiErrorResponse}): `result` is `Success`, `Warnings`, or `Failure`,
8
+ * and `warnings`/`errors` carry message specs. The keys are dropped when the
9
+ * status carries none of that kind — except under the default `bc`
10
+ * `errorformat`, which keeps them as empty arrays. A `Failure` also occurs on
11
+ * a wiki without a mail transport.
12
+ *
13
+ * @see https://www.mediawiki.org/wiki/API:Email
14
+ */
15
+ import type { ApiSpecMessage } from "../common";
16
+ import type { ApiEnvelope } from "../envelope";
17
+ /** Response of `action=emailuser`. */
18
+ export interface ApiEmailUserResponse extends ApiEnvelope {
19
+ emailuser: {
20
+ /** Whether the message was accepted, or accepted with warnings, or failed. */
21
+ result: "Success" | "Warnings" | "Failure" | (string & {});
22
+ /** Non-fatal messages (e.g. subject/text transformations). */
23
+ warnings?: ApiSpecMessage[];
24
+ /** In-band delivery errors (present when `result` is `Failure`). */
25
+ errors?: ApiSpecMessage[];
26
+ };
27
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * `action=expandtemplates` response — expands wikitext (resolving templates and
3
+ * variables) without a full page parse, returned under a top-level
4
+ * `expandtemplates` object. Useful to preview template output or collect the
5
+ * page properties a snippet would set.
6
+ *
7
+ * Under `formatversion=2` `volatile` is a real boolean. `properties` carries
8
+ * settings parsed from magic words (e.g. `defaultsort` from `{{DEFAULTSORT}}`).
9
+ *
10
+ * @see https://www.mediawiki.org/wiki/API:Parsing_wikitext#expandtemplates
11
+ */
12
+ import type { ApiEnvelope } from "../envelope";
13
+ /** Page settings surfaced by `prop=properties`. Open key set. */
14
+ export interface ApiExpandTemplatesProperties {
15
+ /** Sort key set by `{{DEFAULTSORT}}`. */
16
+ defaultsort?: string;
17
+ /** Display title set by `{{DISPLAYTITLE}}`. */
18
+ displaytitle?: string;
19
+ /** Other page properties set by parser functions or hooks. */
20
+ [key: string]: unknown;
21
+ }
22
+ /** One category the output would add. */
23
+ export interface ApiExpandTemplatesCategory {
24
+ /** Category name. */
25
+ category: string;
26
+ /** Sort key; empty string when the default sort key applies. */
27
+ sortkey: string;
28
+ }
29
+ /** The `expandtemplates` object of a successful response. */
30
+ export interface ApiExpandTemplatesResult {
31
+ /** The expanded wikitext. `prop=wikitext`. */
32
+ wikitext?: string;
33
+ /** XML parse tree of the input wikitext. `prop=parsetree`. */
34
+ parsetree?: string;
35
+ /** Whether the result varies per-user / request. `prop=volatile`; a real `boolean`. */
36
+ volatile?: boolean;
37
+ /** Cache TTL in seconds; `prop=ttl`, present only when the frame carries one. */
38
+ ttl?: number;
39
+ /** Page settings parsed from the output. `prop=properties`. */
40
+ properties?: ApiExpandTemplatesProperties;
41
+ /** Categories the output would add. `prop=categories`; absent when the output adds none. */
42
+ categories?: ApiExpandTemplatesCategory[];
43
+ /** ResourceLoader modules the output depends on. `prop=modules`. */
44
+ modules?: string[];
45
+ /** Always empty; deprecated. Emitted with `prop=modules`. */
46
+ modulescripts?: never[];
47
+ /** ResourceLoader module styles the output depends on. `prop=modules`. */
48
+ modulestyles?: string[];
49
+ /** Parser-magic JS config variables. `prop=jsconfigvars`. */
50
+ jsconfigvars?: unknown;
51
+ /** The JS config variables serialized as a JSON string. `prop=encodedjsconfigvars`. */
52
+ encodedjsconfigvars?: string;
53
+ }
54
+ /** Response of `action=expandtemplates`. */
55
+ export interface ApiExpandTemplatesResponse extends ApiEnvelope {
56
+ expandtemplates: ApiExpandTemplatesResult;
57
+ /**
58
+ * XML parse tree of the input wikitext, emitted at the root level (outside
59
+ * {@link expandtemplates}) by the legacy `generatexml` parameter; with
60
+ * `prop=parsetree` the same tree is reported inside
61
+ * {@link ApiExpandTemplatesResult.parsetree} instead.
62
+ *
63
+ * @deprecated since MediaWiki 1.25 (`generatexml`); use `prop=parsetree`.
64
+ */
65
+ parsetree?: string;
66
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `action=filerevert` response — reverts a file to an older archived version;
3
+ * needs CSRF, title-level `edit`/`upload` rights on the file, and `reupload`
4
+ * (or `reupload-own` when reverting one's own upload). The result keys under
5
+ * `filerevert`: `result` is `Success`, or `Failure` with an in-band `errors`
6
+ * array (a per-item outcome, not a top-level {@link ApiErrorResponse}).
7
+ *
8
+ * @see https://www.mediawiki.org/wiki/API:Filerevert
9
+ */
10
+ import type { ApiSpecMessage } from "../common";
11
+ import type { ApiEnvelope } from "../envelope";
12
+ /** Response of `action=filerevert`. */
13
+ export interface ApiFileRevertResponse extends ApiEnvelope {
14
+ filerevert: {
15
+ /** Outcome of the revert. */
16
+ result: "Success" | "Failure" | (string & {});
17
+ /** In-band messages when the revert did not apply. */
18
+ errors?: ApiSpecMessage[];
19
+ };
20
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * `action=imagerotate` response — rotates a file by 90/180/270°, creating a new
3
+ * archived version; needs CSRF and title-level `edit`/`upload` rights on the
4
+ * file. The result is a top-level `imagerotate` **array** with one entry per
5
+ * targeted file.
6
+ *
7
+ * A per-file failure is reported in-band (`result:"Failure"` plus an `errors`
8
+ * array), not as a top-level error: the hard checks fail with
9
+ * `apierror-filedoesnotexist` / `apierror-filetypecannotberotated` /
10
+ * `apierror-filenopath`, and an otherwise failed rotation/upload surfaces the
11
+ * message codes of its Status (e.g. `backend-fail-*` from file storage).
12
+ * Titles the pageSet could not resolve (invalid, special, interwiki, missing)
13
+ * come back as problem entries without a `result`.
14
+ *
15
+ * @see https://www.mediawiki.org/wiki/API:Imagerotate
16
+ */
17
+ import type { Flag, NamespaceIndex, ApiSpecMessage } from "../common";
18
+ import type { ApiEnvelope } from "../envelope";
19
+ /** One file entry of an `action=imagerotate` response. */
20
+ export interface ApiImageRotateEntry {
21
+ /** Page id of the file (keyed as `id`, not `pageid`). */
22
+ id?: number;
23
+ /** Page id, for entries describing a `pageid=` that did not resolve. */
24
+ pageid?: number;
25
+ /** Revision id, for entries describing a `revid=` that did not resolve. */
26
+ revid?: number;
27
+ /** Namespace index (6 = File). */
28
+ ns?: NamespaceIndex;
29
+ /** File title. */
30
+ title?: string;
31
+ /** The title does not correspond to an existing page. A {@link Flag}. */
32
+ missing?: Flag;
33
+ /** A `missing` title that is nonetheless "known" (e.g. a redlinked file). A {@link Flag}. */
34
+ known?: Flag;
35
+ /** The requested title is malformed or otherwise invalid. A {@link Flag}. */
36
+ invalid?: Flag;
37
+ /** Reason the title is invalid (localized wikitext), alongside `invalid`. */
38
+ invalidreason?: string;
39
+ /** The requested title is a Special: page (not rotated). A {@link Flag}. */
40
+ special?: Flag;
41
+ /** Interwiki prefix, for entries describing an interwiki title. */
42
+ iw?: string;
43
+ /** Per-file outcome. */
44
+ result?: "Success" | "Failure" | (string & {});
45
+ /** In-band messages when the rotation failed. */
46
+ errors?: ApiSpecMessage[];
47
+ }
48
+ /** Response of `action=imagerotate`. */
49
+ export interface ApiImageRotateResponse extends ApiEnvelope {
50
+ imagerotate: ApiImageRotateEntry[];
51
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `action=import` response — imports pages from an XML dump (uploaded file or an
3
+ * interwiki source); needs CSRF and the `import` (and `importupload` for file
4
+ * uploads) right. The result is a top-level `import` **array**, one entry per
5
+ * imported page.
6
+ *
7
+ * Shape comes from `ApiImportReporter::reportPage` (via `ApiQueryBase::addTitleInfo`):
8
+ * a successful page carries `ns`/`title` plus a `revisions` count; an
9
+ * un-importable title carries `title` + an `invalid` flag.
10
+ *
11
+ * @see https://www.mediawiki.org/wiki/API:Import
12
+ */
13
+ import type { Flag, NamespaceIndex } from "../common";
14
+ import type { ApiEnvelope } from "../envelope";
15
+ /** One imported page reported by `action=import`. */
16
+ export interface ApiImportEntry {
17
+ /** Target namespace the page was imported into. */
18
+ ns?: NamespaceIndex;
19
+ /** Imported page title. */
20
+ title?: string;
21
+ /** Number of revisions successfully imported. */
22
+ revisions?: number;
23
+ /** The title was invalid or non-importable. A {@link Flag}. */
24
+ invalid?: Flag;
25
+ }
26
+ /** Response of `action=import`. */
27
+ export interface ApiImportResponse extends ApiEnvelope {
28
+ import: ApiImportEntry[];
29
+ }
@@ -0,0 +1,40 @@
1
+ export * from "./query";
2
+ export * from "./parse";
3
+ export * from "./compare";
4
+ export * from "./edit";
5
+ export * from "./move";
6
+ export * from "./purge";
7
+ export * from "./delete";
8
+ export * from "./block";
9
+ export * from "./watch";
10
+ export * from "./rollback";
11
+ export * from "./patrol";
12
+ export * from "./options";
13
+ export * from "./expandtemplates";
14
+ export * from "./protect";
15
+ export * from "./revisiondelete";
16
+ export * from "./checktoken";
17
+ export * from "./languagesearch";
18
+ export * from "./acquiretempusername";
19
+ export * from "./clearhasmsg";
20
+ export * from "./validatepassword";
21
+ export * from "./userrights";
22
+ export * from "./changecontentmodel";
23
+ export * from "./setpagelanguage";
24
+ export * from "./managetags";
25
+ export * from "./tag";
26
+ export * from "./mergehistory";
27
+ export * from "./setnotificationtimestamp";
28
+ export * from "./emailuser";
29
+ export * from "./clientlogin";
30
+ export * from "./resetpassword";
31
+ export * from "./createaccount";
32
+ export * from "./changeauthenticationdata";
33
+ export * from "./removeauthenticationdata";
34
+ export * from "./login";
35
+ export * from "./logout";
36
+ export * from "./filerevert";
37
+ export * from "./imagerotate";
38
+ export * from "./stashedit";
39
+ export * from "./upload";
40
+ export * from "./import";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `action=languagesearch` response — searches language names for autocomplete
3
+ * UIs. Matches by exact code, then by prefix/infix on the name in the user's
4
+ * language or the autonym; `typos` enables Levenshtein-tolerant matching
5
+ * (default 1).
6
+ *
7
+ * Core since 1.46 (previously served by the Universal Language Selector
8
+ * extension).
9
+ *
10
+ * @see https://www.mediawiki.org/wiki/API:Languagesearch
11
+ * @since MediaWiki 1.46
12
+ */
13
+ import type { ApiEnvelope } from "../envelope";
14
+ /** Response of `action=languagesearch`. */
15
+ export interface ApiLanguageSearchResponse extends ApiEnvelope {
16
+ /**
17
+ * Matched languages keyed by language code, with the display name as the
18
+ * value (e.g. `"zh": "zh – chinese"`). Exact code matches come first; the
19
+ * remaining order is deterministic (grouped by the script of the first
20
+ * character, prefix matches before infix). A PHP map, so an empty result
21
+ * serializes as `[]`.
22
+ */
23
+ languagesearch?: Record<string, string> | unknown[];
24
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `action=login` response — the legacy main-account login. **Deprecated** in
3
+ * favour of `action=clientlogin`; core emits a `login` deprecation warning
4
+ * (an {@link ApiEnvelope} `warnings` fact) alongside the result. Modeled anyway
5
+ * because clients still call it.
6
+ *
7
+ * `ApiLogin` emits `result` (`Success`/`Failed`/`NeedToken`/`WrongToken`/
8
+ * `Aborted`) plus, on success, `lguserid`/`lgusername`; `token` and `reason`
9
+ * appear on the respective paths. Throttled logins are not a separate result —
10
+ * they surface as `Failed` with a `login-throttled` reason. The response
11
+ * carries no `cookieprefix`/`sessionid`.
12
+ *
13
+ * @see https://www.mediawiki.org/wiki/API:Login
14
+ */
15
+ import type { ApiEnvelope } from "../envelope";
16
+ /** Response of the deprecated `action=login`. */
17
+ export interface ApiLoginResponse extends ApiEnvelope {
18
+ login: {
19
+ /** Login outcome. */
20
+ result: "Success" | "Failed" | "NeedToken" | "WrongToken" | "Aborted" | (string & {});
21
+ /** Human-readable reason, emitted when `result` is `Failed` or `Aborted`. */
22
+ reason?: string;
23
+ /** Login token echoed back on a `NeedToken` round trip. */
24
+ token?: string;
25
+ /** User id of the logged-in account (legacy `lguserid` spelling). */
26
+ lguserid?: number;
27
+ /** User name of the logged-in account (legacy `lgusername` spelling). */
28
+ lgusername?: string;
29
+ };
30
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `action=logout` response — logs the current session out; needs CSRF. 1.43's
3
+ * `ApiLogout` calls `addValue` on **no** key: a successful logout returns an
4
+ * empty body (only the response {@link ApiEnvelope} remains). Logging out an
5
+ * anonymous session adds a `notloggedin` warning to the envelope.
6
+ *
7
+ * @see https://www.mediawiki.org/wiki/API:Logout
8
+ */
9
+ import type { ApiEnvelope } from "../envelope";
10
+ /**
11
+ * Response of `action=logout`. No payload keys are emitted on success; the type
12
+ * exists so the shape is explicit (the `logout.status` object older builds
13
+ * returned is gone in 1.43).
14
+ */
15
+ export interface ApiLogoutResponse extends ApiEnvelope {
16
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `action=managetags` response — defines/removes change tags; needs CSRF. As
3
+ * written in 1.43 core, every operation (including non-delete ones) requires
4
+ * the `deletechangetags` right, and operations other than `delete` additionally
5
+ * require `managechangetags`. The result echoes the operation under
6
+ * `managetags`.
7
+ *
8
+ * @see https://www.mediawiki.org/wiki/API:Managetags
9
+ */
10
+ import type { ApiSpecMessage } from "../common";
11
+ import type { ApiEnvelope } from "../envelope";
12
+ /** `action=managetags` operation. Open union for forward compatibility. */
13
+ export type ApiManageTagsOperation = "activate" | "create" | "deactivate" | "delete" | (string & {});
14
+ /** Response of `action=managetags`. */
15
+ export interface ApiManageTagsResponse extends ApiEnvelope {
16
+ managetags: {
17
+ /** The operation that was performed. */
18
+ operation: ApiManageTagsOperation;
19
+ /** Tag name acted on. */
20
+ tag: string;
21
+ /** Whether the operation succeeded. */
22
+ success: boolean;
23
+ /** Log entry id recorded for the operation. */
24
+ logid?: number;
25
+ /** Non-fatal messages (e.g. a deprecation notice). */
26
+ warnings?: ApiSpecMessage[];
27
+ };
28
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `action=mergehistory` response — merges the revision history of one page into
3
+ * another; needs CSRF and the `mergehistory` (sysop) right. The result keys under
4
+ * `mergehistory`.
5
+ *
6
+ * @see https://www.mediawiki.org/wiki/API:Mergehistory
7
+ */
8
+ import type { Timestamp } from "../common";
9
+ import type { ApiEnvelope } from "../envelope";
10
+ /** Response of `action=mergehistory`. */
11
+ export interface ApiMergeHistoryResponse extends ApiEnvelope {
12
+ mergehistory: {
13
+ /** Source page title (history moved out of). */
14
+ from: string;
15
+ /** Destination page title (history merged into). */
16
+ to: string;
17
+ /**
18
+ * Cutoff timestamp up to which revisions were merged, as ISO 8601. Echoes
19
+ * the `timestamp` parameter when supplied; with a full-history merge (no
20
+ * `timestamp` given) it is the current server time.
21
+ */
22
+ timestamp: Timestamp;
23
+ /** Reason supplied with the merge; `''` when none was given. */
24
+ reason: string;
25
+ };
26
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * `action=move` response — result of renaming/moving a page, returned under a
3
+ * top-level `move` object.
4
+ *
5
+ * Note under `formatversion=2`: `redirectcreated` / `moveoverredirect` /
6
+ * `talkmoveoverredirect` are real booleans (present as `false`), `reason` is
7
+ * always present (`''` when none was supplied), and there is **no `result`
8
+ * key** on a successful move. `subpages` is polymorphic: an array of per-subpage
9
+ * outcomes when any subpage could be processed, or an object `{ errors }` when
10
+ * the whole subpage move failed (e.g. the namespace forbids them).
11
+ *
12
+ * @see https://www.mediawiki.org/wiki/API:Move
13
+ */
14
+ import type { ApiSpecMessage } from "../common";
15
+ import type { ApiEnvelope } from "../envelope";
16
+ /** One subpage move outcome within `subpages`/`subpages-talk`. */
17
+ export interface ApiMoveSubpage {
18
+ /** Old subpage title. */
19
+ from?: string;
20
+ /** New subpage title, when the subpage moved. */
21
+ to?: string;
22
+ /** Why the subpage did not move, when it failed. */
23
+ errors?: ApiSpecMessage[];
24
+ }
25
+ /** The object form of `subpages`, returned only when the whole move failed. */
26
+ export interface ApiMoveSubpageErrors {
27
+ /** Why no subpage could be moved. */
28
+ errors?: ApiSpecMessage[];
29
+ }
30
+ /** The `move` object of a successful `action=move` response. */
31
+ export interface ApiMoveResult {
32
+ /** Original title. */
33
+ from: string;
34
+ /** New title. */
35
+ to: string;
36
+ /** Move reason (the edit summary); `''` when none was supplied. */
37
+ reason: string;
38
+ /** Whether a redirect was left at `from`. A real `boolean`. */
39
+ redirectcreated: boolean;
40
+ /** Whether the destination title already existed (redirect or not). A real `boolean`. */
41
+ moveoverredirect: boolean;
42
+ /** Original talk-page title (present with `movetalk=1`). */
43
+ talkfrom?: string;
44
+ /** New talk-page title (present with `movetalk=1`). */
45
+ talkto?: string;
46
+ /** Whether the talk-page destination already existed (redirect or not). A real `boolean`. */
47
+ talkmoveoverredirect?: boolean;
48
+ /** Why the talk-page move failed, instead of `talkfrom`/`talkto`. */
49
+ "talkmove-errors"?: ApiSpecMessage[];
50
+ /**
51
+ * Subpage move outcome (`movesubpages=1`). `formatversion=2` returns either
52
+ * an array of per-subpage outcomes or an object of errors, so both shapes are
53
+ * allowed.
54
+ */
55
+ subpages?: ApiMoveSubpage[] | ApiMoveSubpageErrors;
56
+ /** Talk subpage outcome (`movesubpages=1` + `movetalk=1`); same polymorphism as `subpages`. */
57
+ "subpages-talk"?: ApiMoveSubpage[] | ApiMoveSubpageErrors;
58
+ }
59
+ /** Response of `action=move`. */
60
+ export interface ApiMoveResponse extends ApiEnvelope {
61
+ move: ApiMoveResult;
62
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `action=options` response — changing (or resetting) user preferences. Set via
3
+ * `optionname`/`optionvalue` (or `change=name=value&…`, or `reset=1`), with a
4
+ * CSRF token.
5
+ *
6
+ * On success `options` is the plain string `"success"`. Errors surface as a
7
+ * top-level {@link ApiErrorResponse}.
8
+ *
9
+ * @see https://www.mediawiki.org/wiki/API:Options
10
+ */
11
+ import type { ApiEnvelope } from "../envelope";
12
+ /** Response of `action=options`. */
13
+ export interface ApiOptionsResponse extends ApiEnvelope {
14
+ /** Success sentinel (`"success"`); failures come back as a top-level error. */
15
+ options: "success" | (string & {});
16
+ }