types-mediawiki-response 1.0.0-alpha.1 → 1.0.0

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 (101) hide show
  1. package/dist/common/index.d.ts +21 -0
  2. package/dist/core/block.d.ts +6 -6
  3. package/dist/core/changeauthenticationdata.d.ts +3 -1
  4. package/dist/core/changecontentmodel.d.ts +3 -2
  5. package/dist/core/checktoken.d.ts +1 -0
  6. package/dist/core/clientlogin.d.ts +1 -0
  7. package/dist/core/compare.d.ts +1 -0
  8. package/dist/core/createaccount.d.ts +6 -6
  9. package/dist/core/delete.d.ts +2 -0
  10. package/dist/core/edit.d.ts +23 -3
  11. package/dist/core/emailuser.d.ts +1 -0
  12. package/dist/core/expandtemplates.d.ts +1 -0
  13. package/dist/core/filerevert.d.ts +1 -0
  14. package/dist/core/imagerotate.d.ts +4 -18
  15. package/dist/core/import.d.ts +2 -2
  16. package/dist/core/login.d.ts +1 -0
  17. package/dist/core/managetags.d.ts +1 -0
  18. package/dist/core/mergehistory.d.ts +1 -0
  19. package/dist/core/move.d.ts +3 -2
  20. package/dist/core/options.d.ts +2 -1
  21. package/dist/core/parse.d.ts +8 -14
  22. package/dist/core/patrol.d.ts +1 -0
  23. package/dist/core/protect.d.ts +1 -0
  24. package/dist/core/purge.d.ts +5 -27
  25. package/dist/core/query/allcategories.d.ts +1 -4
  26. package/dist/core/query/alldeletedrevisions.d.ts +2 -6
  27. package/dist/core/query/alllinks.d.ts +2 -2
  28. package/dist/core/query/allpages.d.ts +2 -8
  29. package/dist/core/query/allrevisions.d.ts +2 -8
  30. package/dist/core/query/allusers.d.ts +1 -1
  31. package/dist/core/query/authmanagerinfo.d.ts +0 -2
  32. package/dist/core/query/backlinks.d.ts +4 -9
  33. package/dist/core/query/blocks.d.ts +5 -2
  34. package/dist/core/query/contributors.d.ts +17 -5
  35. package/dist/core/query/deletedrevs.d.ts +4 -10
  36. package/dist/core/query/duplicatefiles.d.ts +1 -2
  37. package/dist/core/query/embeddedin.d.ts +4 -9
  38. package/dist/core/query/filearchive.d.ts +3 -8
  39. package/dist/core/query/imageinfo.d.ts +40 -27
  40. package/dist/core/query/imageusage.d.ts +4 -9
  41. package/dist/core/query/index.d.ts +27 -5
  42. package/dist/core/query/info.d.ts +172 -154
  43. package/dist/core/query/iwbacklinks.d.ts +3 -8
  44. package/dist/core/query/langbacklinks.d.ts +3 -8
  45. package/dist/core/query/langlinks.d.ts +1 -2
  46. package/dist/core/query/logevents.d.ts +2 -10
  47. package/dist/core/query/protectedtitles.d.ts +2 -2
  48. package/dist/core/query/recentchanges.d.ts +3 -12
  49. package/dist/core/query/revisions.d.ts +3 -8
  50. package/dist/core/query/search.d.ts +6 -0
  51. package/dist/core/query/shared.d.ts +29 -0
  52. package/dist/core/query/siteinfo.d.ts +37 -11
  53. package/dist/core/query/tags.d.ts +1 -4
  54. package/dist/core/query/usercontribs.d.ts +4 -10
  55. package/dist/core/query/userinfo.d.ts +8 -19
  56. package/dist/core/query/users.d.ts +25 -21
  57. package/dist/core/query/watchlist.d.ts +2 -6
  58. package/dist/core/query/watchlistraw.d.ts +1 -0
  59. package/dist/core/removeauthenticationdata.d.ts +3 -1
  60. package/dist/core/resetpassword.d.ts +1 -0
  61. package/dist/core/revisiondelete.d.ts +1 -0
  62. package/dist/core/rollback.d.ts +1 -0
  63. package/dist/core/setnotificationtimestamp.d.ts +1 -0
  64. package/dist/core/setpagelanguage.d.ts +1 -0
  65. package/dist/core/stashedit.d.ts +1 -0
  66. package/dist/core/tag.d.ts +1 -0
  67. package/dist/core/upload.d.ts +3 -0
  68. package/dist/core/userrights.d.ts +6 -7
  69. package/dist/core/validatepassword.d.ts +1 -0
  70. package/dist/core/watch.d.ts +5 -4
  71. package/dist/envelope/index.d.ts +29 -10
  72. package/dist/extensions/abusefilters.d.ts +12 -4
  73. package/dist/extensions/babel.d.ts +1 -0
  74. package/dist/extensions/categorytree.d.ts +5 -53
  75. package/dist/extensions/checkuser.d.ts +3 -2
  76. package/dist/extensions/description.d.ts +2 -0
  77. package/dist/extensions/discussiontools.d.ts +11 -3
  78. package/dist/extensions/echo.d.ts +27 -12
  79. package/dist/extensions/extracts.d.ts +1 -0
  80. package/dist/extensions/flaggedrevs.d.ts +24 -26
  81. package/dist/extensions/gadgets.d.ts +2 -0
  82. package/dist/extensions/globalblocks.d.ts +20 -11
  83. package/dist/extensions/globalpreferences.d.ts +6 -2
  84. package/dist/extensions/globalusage.d.ts +2 -4
  85. package/dist/extensions/globaluserinfo.d.ts +3 -2
  86. package/dist/extensions/linter.d.ts +8 -11
  87. package/dist/extensions/massmessage.d.ts +6 -2
  88. package/dist/extensions/oathauth.d.ts +9 -0
  89. package/dist/extensions/pageimages.d.ts +3 -0
  90. package/dist/extensions/scribunto.d.ts +1 -1
  91. package/dist/extensions/sitematrix.d.ts +2 -1
  92. package/dist/extensions/spamblacklist.d.ts +1 -0
  93. package/dist/extensions/templatedata.d.ts +8 -6
  94. package/dist/extensions/thanks.d.ts +4 -4
  95. package/dist/extensions/timedmediahandler.d.ts +29 -10
  96. package/dist/extensions/titleblacklist.d.ts +1 -0
  97. package/dist/extensions/urlshortener.d.ts +1 -0
  98. package/dist/extensions/visualeditor.d.ts +11 -3
  99. package/dist/extensions/wikibase.d.ts +2 -1
  100. package/dist/extensions/wikilove.d.ts +1 -0
  101. package/package.json +6 -2
@@ -12,6 +12,17 @@ export type Flag = true;
12
12
  * e.g. `2024-01-15T08:30:00Z`.
13
13
  */
14
14
  export type Timestamp = string;
15
+ /**
16
+ * Expiry of a temporary state: a timestamp, or the literal `infinity` when it
17
+ * does not expire. Block records spell the permanent case `infinite` instead
18
+ * — see {@link BlockExpiry}.
19
+ */
20
+ export type Expiry = Timestamp | "infinity";
21
+ /**
22
+ * Expiry of a block as an action result reports it: a timestamp, or the
23
+ * literal `infinite` for an indefinite block.
24
+ */
25
+ export type BlockExpiry = Timestamp | "infinite";
15
26
  /**
16
27
  * A block of plain text (as opposed to HTML), e.g. a TextExtracts excerpt
17
28
  * requested with `explaintext`. Kept distinct from HTML-bearing string fields.
@@ -19,6 +30,16 @@ export type Timestamp = string;
19
30
  export type PlainText = string;
20
31
  /** Namespace index. Negative indexes are pseudo-namespaces. */
21
32
  export type NamespaceIndex = number;
33
+ /**
34
+ * `success` — or the actual outcome string when an operation did not succeed.
35
+ * **Open union**: `(string & {})` keeps other outcomes forward-compatible.
36
+ */
37
+ export type SuccessStatus = "success" | (string & {});
38
+ /**
39
+ * `Success` — or the actual result string when an operation did not succeed.
40
+ * **Open union**: `(string & {})` keeps other outcomes forward-compatible.
41
+ */
42
+ export type SuccessResult = "Success" | (string & {});
22
43
  /**
23
44
  * A structured in-band message — a serialized MediaWiki `Message`/`FatalError`
24
45
  * spec (`{ message, params, code, type }`) nested inside an action result
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @see https://www.mediawiki.org/wiki/API:Block
11
11
  */
12
- import type { Timestamp } from "../common";
12
+ import type { BlockExpiry, Timestamp } from "../common";
13
13
  import type { ApiEnvelope } from "../envelope";
14
14
  /** The `block` object of an `action=block` response. */
15
15
  export interface ApiBlockResult {
@@ -20,7 +20,7 @@ export interface ApiBlockResult {
20
20
  /** Block id. */
21
21
  id: number;
22
22
  /** Expiry timestamp, or `infinite` for an indefinite block. */
23
- expiry: Timestamp | "infinite";
23
+ expiry: BlockExpiry;
24
24
  /** Block reason (echoed back). */
25
25
  reason: string;
26
26
  /** Block only anonymous users editing from an IP address range. */
@@ -60,10 +60,8 @@ export interface ApiBlockResult {
60
60
  */
61
61
  timestamp?: Timestamp;
62
62
  /**
63
- * Extra statuses set by extensions during a successful block. Always
64
- * emitted; core never fills it, so it is `[]` unless `$wgEnableMultiBlocks`
65
- * is on and an extension populates it via the `ApiBlockSucceeded` hook, in
66
- * which case a PHP map (thus the `unknown[]` empty case).
63
+ * Extra statuses set by extensions during a successful block; `[]` when none
64
+ * is set.
67
65
  *
68
66
  * @since MediaWiki 1.46
69
67
  */
@@ -71,6 +69,7 @@ export interface ApiBlockResult {
71
69
  }
72
70
  /** Response of `action=block`. */
73
71
  export interface ApiBlockResponse extends ApiEnvelope {
72
+ /** Result of `action=block`. */
74
73
  block: ApiBlockResult;
75
74
  }
76
75
  /** The `unblock` object of an `action=unblock` response. */
@@ -94,5 +93,6 @@ export interface ApiUnblockResult {
94
93
  }
95
94
  /** Response of `action=unblock`. */
96
95
  export interface ApiUnblockResponse extends ApiEnvelope {
96
+ /** Result of `action=unblock`. */
97
97
  unblock: ApiUnblockResult;
98
98
  }
@@ -8,11 +8,13 @@
8
8
  *
9
9
  * @see https://www.mediawiki.org/wiki/API:Changeauthenticationdata
10
10
  */
11
+ import type { SuccessStatus } from "../common";
11
12
  import type { ApiEnvelope } from "../envelope";
12
13
  /** Response of `action=changeauthenticationdata`. */
13
14
  export interface ApiChangeAuthenticationDataResponse extends ApiEnvelope {
15
+ /** Result of `action=changeauthenticationdata`. */
14
16
  changeauthenticationdata: {
15
17
  /** Flow outcome; `success` when the change was applied. */
16
- status: "success" | (string & {});
18
+ status: SuccessStatus;
17
19
  };
18
20
  }
@@ -6,13 +6,14 @@
6
6
  *
7
7
  * @see https://www.mediawiki.org/wiki/API:Changecontentmodel
8
8
  */
9
- import type { ContentModel } from "../common";
9
+ import type { ContentModel, SuccessResult } from "../common";
10
10
  import type { ApiEnvelope } from "../envelope";
11
11
  /** Response of `action=changecontentmodel`. */
12
12
  export interface ApiChangeContentModelResponse extends ApiEnvelope {
13
+ /** Result of `action=changecontentmodel`. */
13
14
  changecontentmodel: {
14
15
  /** `Success` when the model was changed. */
15
- result: "Success" | (string & {});
16
+ result: SuccessResult;
16
17
  /** Page title. */
17
18
  title: string;
18
19
  /** Page id. */
@@ -16,6 +16,7 @@ import type { ApiEnvelope } from "../envelope";
16
16
  export type ApiCheckTokenResult = "valid" | "expired" | "invalid" | (string & {});
17
17
  /** Response of `action=checktoken`. */
18
18
  export interface ApiCheckTokenResponse extends ApiEnvelope {
19
+ /** Result of `action=checktoken`. */
19
20
  checktoken: {
20
21
  /** Outcome of the token check. */
21
22
  result: ApiCheckTokenResult;
@@ -44,5 +44,6 @@ export interface ApiClientLogin {
44
44
  }
45
45
  /** Response of `action=clientlogin`. */
46
46
  export interface ApiClientLoginResponse extends ApiEnvelope {
47
+ /** Result of `action=clientlogin`. */
47
48
  clientlogin: ApiClientLogin;
48
49
  }
@@ -88,5 +88,6 @@ export interface ApiCompareResult {
88
88
  }
89
89
  /** Response of `action=compare`. */
90
90
  export interface ApiCompareResponse extends ApiEnvelope {
91
+ /** Result of `action=compare`. */
91
92
  compare: ApiCompareResult;
92
93
  }
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * `action=createaccount` response — AuthManager-driven account creation. The
3
- * result keys under `createaccount`, produced by `ApiAuthManagerHelper::
4
- * formatAuthenticationResponse` (the same builder as `clientlogin`): `status`
5
- * drives the flow (`PASS` on success, plus in-band `FAIL`/`UI`/`RESTART`/
6
- * `REDIRECT`), and failures carry `message`/`messagecode`.
3
+ * result keys under `createaccount`: `status` drives the flow (`PASS` on
4
+ * success, plus in-band `FAIL`/`UI`/`RESTART`/`REDIRECT`), and failures carry
5
+ * `message`/`messagecode`.
7
6
  *
8
7
  * These are **in-band** AuthManager outcomes, not a top-level
9
8
  * {@link ApiErrorResponse}. `username` appears on `PASS`; `UI`/`RESTART`/
@@ -12,10 +11,11 @@
12
11
  *
13
12
  * @see https://www.mediawiki.org/wiki/API:Createaccount
14
13
  */
15
- import type { ApiAuthManagerMessage, ApiAuthManagerStatus } from "./query/authmanagerinfo";
14
+ import type { ApiAuthManagerMessage, ApiAuthManagerStatus, ApiQueryAuthManagerInfoRequest } from "./query/authmanagerinfo";
16
15
  import type { ApiEnvelope } from "../envelope";
17
16
  /** Response of `action=createaccount`. */
18
17
  export interface ApiCreateAccountResponse extends ApiEnvelope {
18
+ /** Result of `action=createaccount`. */
19
19
  createaccount: {
20
20
  /** AuthManager outcome of the account-creation flow. */
21
21
  status?: ApiAuthManagerStatus;
@@ -36,6 +36,6 @@ export interface ApiCreateAccountResponse extends ApiEnvelope {
36
36
  /** Extra API data accompanying a `REDIRECT` outcome. */
37
37
  redirectdata?: Record<string, unknown>;
38
38
  /** AuthManager request descriptors for interactive (`UI`/`RESTART`) and `REDIRECT` steps. */
39
- requests?: Record<string, unknown>[];
39
+ requests?: ApiQueryAuthManagerInfoRequest[];
40
40
  };
41
41
  }
@@ -26,6 +26,7 @@ export interface ApiDeleteResult {
26
26
  }
27
27
  /** Response of `action=delete`. */
28
28
  export interface ApiDeleteResponse extends ApiEnvelope {
29
+ /** Result of `action=delete`. */
29
30
  delete: ApiDeleteResult;
30
31
  }
31
32
  /** The `undelete` object of an `action=undelete` response. */
@@ -41,5 +42,6 @@ export interface ApiUndeleteResult {
41
42
  }
42
43
  /** Response of `action=undelete`. */
43
44
  export interface ApiUndeleteResponse extends ApiEnvelope {
45
+ /** Result of `action=undelete`. */
44
46
  undelete: ApiUndeleteResult;
45
47
  }
@@ -6,9 +6,11 @@
6
6
  * - create: `new: true` plus `oldrevid: 0` / `newrevid` / `newtimestamp`;
7
7
  * - changed: `oldrevid` / `newrevid` / `newtimestamp` (no `new`);
8
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"`.
9
+ * A save aborted by a hook that carries status data (ConfirmEdit's captcha
10
+ * challenge) returns the in-band failure branch: `result: "Failure"` plus that
11
+ * data and no revision ids. Most hard failures (bad token, protected page,
12
+ * `createonly` on an existing page) surface as a top-level
13
+ * {@link ApiErrorResponse}, not `result: "Failure"`.
12
14
  *
13
15
  * @see https://www.mediawiki.org/wiki/API:Edit
14
16
  */
@@ -59,8 +61,26 @@ export interface ApiEditResult {
59
61
  code?: string;
60
62
  /** Human-readable failure description. */
61
63
  info?: string;
64
+ /**
65
+ * Captcha challenge returned when ConfirmEdit aborted the save. Present only
66
+ * in the in-band failure branch; {@link ApiEditCaptcha.id} and
67
+ * {@link ApiEditCaptcha.question} are per-request random values.
68
+ */
69
+ captcha?: ApiEditCaptcha;
70
+ }
71
+ /** The captcha challenge of a `result: "Failure"` edit, as emitted by ConfirmEdit. */
72
+ export interface ApiEditCaptcha {
73
+ /** Captcha implementation, e.g. `simple` (arithmetic challenge) or `image`. Open union. */
74
+ type?: string;
75
+ /** MIME type the challenge renders as, e.g. `text/plain`, `image/png`, `text/html`. */
76
+ mime?: string;
77
+ /** Cache key of the pending challenge; pass it back as `captchaid` alongside the `captchaword` answer. */
78
+ id?: string;
79
+ /** Challenge text: an arithmetic expression for the sample implementation, the prompt for a question captcha. */
80
+ question?: string;
62
81
  }
63
82
  /** Response of `action=edit`. */
64
83
  export interface ApiEditResponse extends ApiEnvelope {
84
+ /** Result of `action=edit`. */
65
85
  edit: ApiEditResult;
66
86
  }
@@ -16,6 +16,7 @@ import type { ApiSpecMessage } from "../common";
16
16
  import type { ApiEnvelope } from "../envelope";
17
17
  /** Response of `action=emailuser`. */
18
18
  export interface ApiEmailUserResponse extends ApiEnvelope {
19
+ /** Result of `action=emailuser`. */
19
20
  emailuser: {
20
21
  /** Whether the message was accepted, or accepted with warnings, or failed. */
21
22
  result: "Success" | "Warnings" | "Failure" | (string & {});
@@ -53,6 +53,7 @@ export interface ApiExpandTemplatesResult {
53
53
  }
54
54
  /** Response of `action=expandtemplates`. */
55
55
  export interface ApiExpandTemplatesResponse extends ApiEnvelope {
56
+ /** Result of `action=expandtemplates`. */
56
57
  expandtemplates: ApiExpandTemplatesResult;
57
58
  /**
58
59
  * XML parse tree of the input wikitext, emitted at the root level (outside
@@ -11,6 +11,7 @@ import type { ApiSpecMessage } from "../common";
11
11
  import type { ApiEnvelope } from "../envelope";
12
12
  /** Response of `action=filerevert`. */
13
13
  export interface ApiFileRevertResponse extends ApiEnvelope {
14
+ /** Result of `action=filerevert`. */
14
15
  filerevert: {
15
16
  /** Outcome of the revert. */
16
17
  result: "Success" | "Failure" | (string & {});
@@ -14,30 +14,15 @@
14
14
  *
15
15
  * @see https://www.mediawiki.org/wiki/API:Imagerotate
16
16
  */
17
- import type { Flag, NamespaceIndex, ApiSpecMessage } from "../common";
17
+ import type { ApiSpecMessage } from "../common";
18
18
  import type { ApiEnvelope } from "../envelope";
19
+ import type { ApiPageIdentity } from "./query";
19
20
  /** One file entry of an `action=imagerotate` response. */
20
- export interface ApiImageRotateEntry {
21
+ export interface ApiImageRotateEntry extends ApiPageIdentity {
21
22
  /** Page id of the file (keyed as `id`, not `pageid`). */
22
23
  id?: number;
23
- /** Page id, for entries describing a `pageid=` that did not resolve. */
24
- pageid?: number;
25
24
  /** Revision id, for entries describing a `revid=` that did not resolve. */
26
25
  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
26
  /** Interwiki prefix, for entries describing an interwiki title. */
42
27
  iw?: string;
43
28
  /** Per-file outcome. */
@@ -47,5 +32,6 @@ export interface ApiImageRotateEntry {
47
32
  }
48
33
  /** Response of `action=imagerotate`. */
49
34
  export interface ApiImageRotateResponse extends ApiEnvelope {
35
+ /** Result of `action=imagerotate`; one entry per rotated image. */
50
36
  imagerotate: ApiImageRotateEntry[];
51
37
  }
@@ -4,8 +4,7 @@
4
4
  * uploads) right. The result is a top-level `import` **array**, one entry per
5
5
  * imported page.
6
6
  *
7
- * Shape comes from `ApiImportReporter::reportPage` (via `ApiQueryBase::addTitleInfo`):
8
- * a successful page carries `ns`/`title` plus a `revisions` count; an
7
+ * A successful page carries `ns`/`title` plus a `revisions` count; an
9
8
  * un-importable title carries `title` + an `invalid` flag.
10
9
  *
11
10
  * @see https://www.mediawiki.org/wiki/API:Import
@@ -25,5 +24,6 @@ export interface ApiImportEntry {
25
24
  }
26
25
  /** Response of `action=import`. */
27
26
  export interface ApiImportResponse extends ApiEnvelope {
27
+ /** Result of `action=import`; one entry per imported page. */
28
28
  import: ApiImportEntry[];
29
29
  }
@@ -15,6 +15,7 @@
15
15
  import type { ApiEnvelope } from "../envelope";
16
16
  /** Response of the deprecated `action=login`. */
17
17
  export interface ApiLoginResponse extends ApiEnvelope {
18
+ /** Result of `action=login`. */
18
19
  login: {
19
20
  /** Login outcome. */
20
21
  result: "Success" | "Failed" | "NeedToken" | "WrongToken" | "Aborted" | (string & {});
@@ -13,6 +13,7 @@ import type { ApiEnvelope } from "../envelope";
13
13
  export type ApiManageTagsOperation = "activate" | "create" | "deactivate" | "delete" | (string & {});
14
14
  /** Response of `action=managetags`. */
15
15
  export interface ApiManageTagsResponse extends ApiEnvelope {
16
+ /** Result of `action=managetags`. */
16
17
  managetags: {
17
18
  /** The operation that was performed. */
18
19
  operation: ApiManageTagsOperation;
@@ -9,6 +9,7 @@ import type { Timestamp } from "../common";
9
9
  import type { ApiEnvelope } from "../envelope";
10
10
  /** Response of `action=mergehistory`. */
11
11
  export interface ApiMergeHistoryResponse extends ApiEnvelope {
12
+ /** Result of `action=mergehistory`. */
12
13
  mergehistory: {
13
14
  /** Source page title (history moved out of). */
14
15
  from: string;
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * Note under `formatversion=2`: `redirectcreated` / `moveoverredirect` /
6
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
7
+ * `''` when none was supplied, and there is **no `result` key** on a
8
+ * successful move. `subpages` is polymorphic: an array of per-subpage
9
9
  * outcomes when any subpage could be processed, or an object `{ errors }` when
10
10
  * the whole subpage move failed (e.g. the namespace forbids them).
11
11
  *
@@ -58,5 +58,6 @@ export interface ApiMoveResult {
58
58
  }
59
59
  /** Response of `action=move`. */
60
60
  export interface ApiMoveResponse extends ApiEnvelope {
61
+ /** Result of `action=move`. */
61
62
  move: ApiMoveResult;
62
63
  }
@@ -8,9 +8,10 @@
8
8
  *
9
9
  * @see https://www.mediawiki.org/wiki/API:Options
10
10
  */
11
+ import type { SuccessStatus } from "../common";
11
12
  import type { ApiEnvelope } from "../envelope";
12
13
  /** Response of `action=options`. */
13
14
  export interface ApiOptionsResponse extends ApiEnvelope {
14
15
  /** Success sentinel (`"success"`); failures come back as a top-level error. */
15
- options: "success" | (string & {});
16
+ options: SuccessStatus;
16
17
  }
@@ -42,12 +42,12 @@ export interface ApiParseLangLink {
42
42
  /** Full URL of the target page. */
43
43
  url?: string;
44
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).
45
+ * Localized language name, in the request `uselang` language. Present when
46
+ * the target title is valid (`action=parse` has no `llprop` parameter).
47
47
  */
48
48
  langname?: string;
49
49
  /**
50
- * Native language name. Always emitted when the target title is valid
50
+ * Native language name. Present when the target title is valid
51
51
  * (`action=parse` has no `llprop` parameter).
52
52
  */
53
53
  autonym?: string;
@@ -74,10 +74,7 @@ export interface ApiParseRedirect {
74
74
  * A table-of-contents entry (`prop=sections`) — the legacy projection of the
75
75
  * same outline `prop=tocdata` emits, with lowercase keys here (`fromtitle`,
76
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.
77
+ * {@link ApiParseTocSection}. `extensionData` appears only when non-empty.
81
78
  */
82
79
  export interface ApiParseSection {
83
80
  /** Nesting level in the TOC. */
@@ -139,11 +136,7 @@ export interface ApiParseTocSection {
139
136
  /** Extension-supplied data for this section; `[]` when empty. */
140
137
  extensionData?: Record<string, unknown> | unknown[];
141
138
  }
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
- */
139
+ /** The `tocdata` object (`prop=tocdata`). */
147
140
  export interface ApiParseTocData {
148
141
  /** The outline, in camelCase keys. */
149
142
  sections: ApiParseTocSection[];
@@ -248,8 +241,7 @@ export interface ApiParse {
248
241
  /**
249
242
  * The script-bearing subset of {@link modules}.
250
243
  *
251
- * @deprecated since MediaWiki 1.32 — core hard-codes this to `[]`, so it is always
252
- * empty; read {@link modules} instead.
244
+ * @deprecated since MediaWiki 1.32 — always empty; read {@link modules} instead.
253
245
  */
254
246
  modulescripts?: never[];
255
247
  /**
@@ -305,6 +297,7 @@ export interface ApiParse {
305
297
  }
306
298
  /** Response of `action=parse`. */
307
299
  export interface ApiParseResponse extends ApiEnvelope {
300
+ /** Result of `action=parse`. */
308
301
  parse: ApiParse;
309
302
  }
310
303
  /**
@@ -313,6 +306,7 @@ export interface ApiParseResponse extends ApiEnvelope {
313
306
  * `title`/`pageid` and none of the `prop` sub-objects of {@link ApiParse}.
314
307
  */
315
308
  export interface ApiParseOnlyPstResponse extends ApiEnvelope {
309
+ /** Result of `action=parse&onlypst=1`. */
316
310
  parse: {
317
311
  /** Pre-save-transformed wikitext. */
318
312
  text: string;
@@ -17,5 +17,6 @@ export interface ApiPatrolResult {
17
17
  }
18
18
  /** Response of `action=patrol`. */
19
19
  export interface ApiPatrolResponse extends ApiEnvelope {
20
+ /** Result of `action=patrol`. */
20
21
  patrol: ApiPatrolResult;
21
22
  }
@@ -39,5 +39,6 @@ export interface ApiProtectResult {
39
39
  }
40
40
  /** Response of `action=protect`. */
41
41
  export interface ApiProtectResponse extends ApiEnvelope {
42
+ /** Result of `action=protect`. */
42
43
  protect: ApiProtectResult;
43
44
  }
@@ -6,15 +6,11 @@
6
6
  *
7
7
  * @see https://www.mediawiki.org/wiki/API:Purge
8
8
  */
9
- import type { Flag, NamespaceIndex } from "../common";
9
+ import type { Flag } from "../common";
10
10
  import type { ApiEnvelope } from "../envelope";
11
- import type { ApiQueryNormalized, ApiQueryTitlePair } from "./query";
11
+ import type { ApiPageIdentity, ApiQueryNormalized, ApiQueryTitlePair } from "./query";
12
12
  /** One purged page. */
13
- export interface ApiPurgeEntry {
14
- /** Namespace index. */
15
- ns?: NamespaceIndex;
16
- /** Page title. */
17
- title?: string;
13
+ export interface ApiPurgeEntry extends ApiPageIdentity {
18
14
  /** Whether the page was actually purged. A {@link Flag} (appears when purged). */
19
15
  purged?: Flag;
20
16
  /**
@@ -22,32 +18,14 @@ export interface ApiPurgeEntry {
22
18
  * `forcerecursivelinkupdate`). A {@link Flag}.
23
19
  */
24
20
  linkupdate?: Flag;
25
- /** Page id, for entries describing a `pageids=` value that did not resolve. */
26
- pageid?: number;
27
21
  /** Revision id, for entries describing a `revids=` value that did not resolve. */
28
22
  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
23
  /** Interwiki prefix, for entries describing an interwiki title. */
40
24
  iw?: string;
41
25
  }
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
26
  /** Response of `action=purge`. */
50
27
  export interface ApiPurgeResponse extends ApiEnvelope {
28
+ /** Result of `action=purge`; one entry per targeted page. */
51
29
  purge: ApiPurgeEntry[];
52
30
  /**
53
31
  * Title normalizations the pageSet applied before the purge (e.g. underscore
@@ -57,5 +35,5 @@ export interface ApiPurgeResponse extends ApiEnvelope {
57
35
  /** Title conversions on a language-variant wiki, same shape as `query.converted`. */
58
36
  converted?: ApiQueryTitlePair[];
59
37
  /** Redirect resolutions (with `redirects=1`). */
60
- redirects?: ApiPurgeRedirect[];
38
+ redirects?: ApiQueryTitlePair[];
61
39
  }
@@ -4,10 +4,7 @@
4
4
  *
5
5
  * @see https://www.mediawiki.org/wiki/API:Allcategories
6
6
  */
7
- /**
8
- * One category summary. `acprop=size|hidden` selects the optional fields;
9
- * `category` is always present.
10
- */
7
+ /** One category summary. `acprop=size|hidden` selects the optional fields. */
11
8
  export interface ApiAllCategory {
12
9
  /** Category name, without the `Category:` prefix. */
13
10
  category: string;
@@ -8,16 +8,12 @@
8
8
  *
9
9
  * @see https://www.mediawiki.org/wiki/API:Alldeletedrevisions
10
10
  */
11
- import type { NamespaceIndex } from "../../common";
11
+ import type { ApiPageRef } from "./shared";
12
12
  import type { ApiRevision } from "./revisions";
13
13
  /** One page carrying at least one deleted revision. */
14
- export interface ApiAllDeletedRevisions {
14
+ export interface ApiAllDeletedRevisions extends ApiPageRef {
15
15
  /** Page id; `0` when the whole page is deleted. */
16
16
  pageid: number;
17
- /** Namespace index. */
18
- ns: NamespaceIndex;
19
- /** Full page title. */
20
- title: string;
21
17
  /** The page's deleted revisions, ordered per `ardir` (default `older`). */
22
18
  revisions: ApiRevision[];
23
19
  }
@@ -14,8 +14,8 @@ export interface ApiAllLink {
14
14
  /**
15
15
  * Page id of the page holding the link (`alprop=ids`). Without `alunique` a
16
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`.
17
+ * `alunique` lists each target once and drops the source page id, so it
18
+ * cannot be combined with `*prop=ids`.
19
19
  */
20
20
  fromid?: number;
21
21
  /** Namespace index of the linked title. `alprop=title` (default). */
@@ -5,15 +5,9 @@
5
5
  *
6
6
  * @see https://www.mediawiki.org/wiki/API:Allpages
7
7
  */
8
- import type { NamespaceIndex } from "../../common";
8
+ import type { ApiPageRef } from "./shared";
9
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;
10
+ export interface ApiAllPage extends ApiPageRef {
17
11
  }
18
12
  declare module "./index" {
19
13
  interface ApiQueryResult {
@@ -9,16 +9,10 @@
9
9
  *
10
10
  * @see https://www.mediawiki.org/wiki/API:Allrevisions
11
11
  */
12
- import type { NamespaceIndex } from "../../common";
12
+ import type { ApiPageRef } from "./shared";
13
13
  import type { ApiRevision } from "./revisions";
14
14
  /** One page with the revisions requested for it. */
15
- export interface ApiAllRevisions {
16
- /** Page id. */
17
- pageid: number;
18
- /** Namespace index. */
19
- ns: NamespaceIndex;
20
- /** Full page title. */
21
- title: string;
15
+ export interface ApiAllRevisions extends ApiPageRef {
22
16
  /** Revisions of the page, ordered per `arvdir`. */
23
17
  revisions: ApiRevision[];
24
18
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `list=allusers` — enumerate all registered users, merged into
3
3
  * {@link ApiQueryResult} via declaration merging. `auprop` selects which fields
4
- * appear, and every entry always carries `userid` and `name`.
4
+ * appear, and every entry carries `userid` and `name`.
5
5
  *
6
6
  * Entries share the `list=users` shape ({@link ApiUser}) minus the fields this
7
7
  * module can never emit: `gender`, `emailable`, `cancreate`,
@@ -57,8 +57,6 @@ export interface ApiQueryAuthManagerField {
57
57
  optional?: boolean;
58
58
  /** The field carries a secret (password) and is masked. */
59
59
  sensitive?: boolean;
60
- /** Additional provider-specific field metadata. */
61
- [extra: string]: unknown;
62
60
  }
63
61
  /** The `authmanagerinfo` object returned under `query`. */
64
62
  export interface ApiQueryAuthManagerInfo {