types-mediawiki-response 1.0.0-alpha.1 → 1.0.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/dist/common/index.d.ts +21 -0
- package/dist/core/block.d.ts +11 -35
- package/dist/core/changeauthenticationdata.d.ts +4 -2
- package/dist/core/changecontentmodel.d.ts +3 -2
- package/dist/core/checktoken.d.ts +1 -0
- package/dist/core/clientlogin.d.ts +1 -0
- package/dist/core/compare.d.ts +1 -0
- package/dist/core/createaccount.d.ts +7 -7
- package/dist/core/delete.d.ts +3 -17
- package/dist/core/edit.d.ts +23 -3
- package/dist/core/emailuser.d.ts +11 -10
- package/dist/core/expandtemplates.d.ts +1 -0
- package/dist/core/filerevert.d.ts +5 -4
- package/dist/core/imagerotate.d.ts +7 -21
- package/dist/core/import.d.ts +2 -2
- package/dist/core/index.d.ts +2 -0
- package/dist/core/login.d.ts +8 -3
- package/dist/core/managetags.d.ts +4 -3
- package/dist/core/mergehistory.d.ts +1 -0
- package/dist/core/move.d.ts +10 -9
- package/dist/core/options.d.ts +3 -2
- package/dist/core/parse.d.ts +8 -14
- package/dist/core/patrol.d.ts +1 -0
- package/dist/core/protect.d.ts +1 -0
- package/dist/core/purge.d.ts +5 -27
- package/dist/core/query/allcategories.d.ts +1 -4
- package/dist/core/query/alldeletedrevisions.d.ts +2 -6
- package/dist/core/query/alllinks.d.ts +2 -2
- package/dist/core/query/allpages.d.ts +2 -8
- package/dist/core/query/allrevisions.d.ts +2 -8
- package/dist/core/query/allusers.d.ts +1 -1
- package/dist/core/query/authmanagerinfo.d.ts +0 -2
- package/dist/core/query/backlinks.d.ts +4 -9
- package/dist/core/query/blocks.d.ts +5 -2
- package/dist/core/query/contributors.d.ts +17 -5
- package/dist/core/query/deletedrevs.d.ts +4 -10
- package/dist/core/query/duplicatefiles.d.ts +1 -2
- package/dist/core/query/embeddedin.d.ts +4 -9
- package/dist/core/query/filearchive.d.ts +3 -8
- package/dist/core/query/filerepoinfo.d.ts +1 -1
- package/dist/core/query/imageinfo.d.ts +40 -27
- package/dist/core/query/imageusage.d.ts +4 -9
- package/dist/core/query/index.d.ts +33 -8
- package/dist/core/query/info.d.ts +185 -161
- package/dist/core/query/iwbacklinks.d.ts +3 -8
- package/dist/core/query/langbacklinks.d.ts +3 -8
- package/dist/core/query/langlinks.d.ts +1 -2
- package/dist/core/query/logevents.d.ts +2 -10
- package/dist/core/query/protectedtitles.d.ts +2 -2
- package/dist/core/query/recentchanges.d.ts +3 -12
- package/dist/core/query/revisions.d.ts +3 -8
- package/dist/core/query/search.d.ts +6 -0
- package/dist/core/query/shared.d.ts +29 -0
- package/dist/core/query/siteinfo.d.ts +37 -11
- package/dist/core/query/tags.d.ts +1 -4
- package/dist/core/query/usercontribs.d.ts +4 -10
- package/dist/core/query/userinfo.d.ts +8 -19
- package/dist/core/query/users.d.ts +29 -24
- package/dist/core/query/watchlist.d.ts +2 -6
- package/dist/core/query/watchlistraw.d.ts +1 -0
- package/dist/core/removeauthenticationdata.d.ts +4 -2
- package/dist/core/resetpassword.d.ts +2 -1
- package/dist/core/revisiondelete.d.ts +10 -9
- package/dist/core/rollback.d.ts +1 -0
- package/dist/core/setnotificationtimestamp.d.ts +1 -0
- package/dist/core/setpagelanguage.d.ts +1 -0
- package/dist/core/stashedit.d.ts +1 -0
- package/dist/core/tag.d.ts +35 -8
- package/dist/core/unblock.d.ts +35 -0
- package/dist/core/undelete.d.ts +23 -0
- package/dist/core/upload.d.ts +3 -0
- package/dist/core/userrights.d.ts +6 -7
- package/dist/core/validatepassword.d.ts +4 -3
- package/dist/core/watch.d.ts +17 -9
- package/dist/envelope/index.d.ts +74 -18
- package/dist/extensions/abusefilters.d.ts +12 -4
- package/dist/extensions/babel.d.ts +2 -1
- package/dist/extensions/categorytree.d.ts +5 -53
- package/dist/extensions/checkuser.d.ts +3 -2
- package/dist/extensions/description.d.ts +2 -0
- package/dist/extensions/discussiontools.d.ts +11 -3
- package/dist/extensions/echo.d.ts +27 -12
- package/dist/extensions/extracts.d.ts +1 -0
- package/dist/extensions/flaggedrevs.d.ts +24 -26
- package/dist/extensions/gadgets.d.ts +2 -0
- package/dist/extensions/globalblocks.d.ts +55 -12
- package/dist/extensions/globalpreferences.d.ts +6 -2
- package/dist/extensions/globalusage.d.ts +2 -4
- package/dist/extensions/globaluserinfo.d.ts +3 -2
- package/dist/extensions/linter.d.ts +8 -11
- package/dist/extensions/massmessage.d.ts +6 -2
- package/dist/extensions/oathauth.d.ts +9 -0
- package/dist/extensions/pageimages.d.ts +3 -0
- package/dist/extensions/scribunto.d.ts +2 -2
- package/dist/extensions/sitematrix.d.ts +2 -1
- package/dist/extensions/spamblacklist.d.ts +1 -0
- package/dist/extensions/templatedata.d.ts +8 -6
- package/dist/extensions/thanks.d.ts +4 -4
- package/dist/extensions/timedmediahandler.d.ts +29 -10
- package/dist/extensions/titleblacklist.d.ts +1 -0
- package/dist/extensions/urlshortener.d.ts +1 -0
- package/dist/extensions/visualeditor.d.ts +11 -3
- package/dist/extensions/wikibase.d.ts +2 -1
- package/dist/extensions/wikilove.d.ts +2 -1
- package/package.json +10 -5
package/dist/common/index.d.ts
CHANGED
|
@@ -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
|
package/dist/core/block.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `action=block`
|
|
3
|
-
*
|
|
2
|
+
* `action=block` response — blocking a user or IP range, returned under a
|
|
3
|
+
* top-level `block` object. Requires the `block` right.
|
|
4
4
|
*
|
|
5
|
-
* fv2 note: the block result uses **`userID`** (capital `D`)
|
|
6
|
-
* result
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* fv2 note: the block result uses **`userID`** (capital `D`), unlike the
|
|
6
|
+
* unblock result's `userid`. Block flags are real booleans (present as
|
|
7
|
+
* `false`); partial-block restrictions come back as `null` when the block is
|
|
8
|
+
* sitewide.
|
|
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:
|
|
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
|
|
64
|
-
*
|
|
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,28 +69,6 @@ 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
|
-
/** The `unblock` object of an `action=unblock` response. */
|
|
77
|
-
export interface ApiUnblockResult {
|
|
78
|
-
/** Removed block id. */
|
|
79
|
-
id: number;
|
|
80
|
-
/** Unblocked user name / IP; empty string when removing an autoblock. */
|
|
81
|
-
user: string;
|
|
82
|
-
/** Unblocked user id (`0` for IPs and autoblocks). Note lowercase, unlike the block result. */
|
|
83
|
-
userid: number;
|
|
84
|
-
/** Unblock reason (echoed back). */
|
|
85
|
-
reason: string;
|
|
86
|
-
/** Whether the unblock added the unblocked user to the unblocker's watchlist. */
|
|
87
|
-
watchuser: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Expiry applied to the watched user page, present only when the request
|
|
90
|
-
* passed `watchlistexpiry` with `watchuser`; `null` when the page is not
|
|
91
|
-
* actually watched.
|
|
92
|
-
*/
|
|
93
|
-
watchlistexpiry?: Timestamp | null;
|
|
94
|
-
}
|
|
95
|
-
/** Response of `action=unblock`. */
|
|
96
|
-
export interface ApiUnblockResponse extends ApiEnvelope {
|
|
97
|
-
unblock: ApiUnblockResult;
|
|
98
|
-
}
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
* token, the `editmyprivateinfo` right, and a fully-configured secondary-provider
|
|
5
5
|
* session. On success `ApiChangeAuthenticationData` emits a single field:
|
|
6
6
|
* `changeauthenticationdata.status` = `success`. Any refusal or incomplete flow
|
|
7
|
-
* is a top-level
|
|
7
|
+
* is a top-level `ApiErrorResponse` (dieStatus / badrequest).
|
|
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:
|
|
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:
|
|
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;
|
package/dist/core/compare.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `action=createaccount` response — AuthManager-driven account creation. The
|
|
3
|
-
* result keys under `createaccount
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
+
* `ApiErrorResponse`. `username` appears on `PASS`; `UI`/`RESTART`/
|
|
10
9
|
* `REDIRECT` outcomes add the `requests` descriptors; `canpreservestate` marks
|
|
11
10
|
* whether state can be kept.
|
|
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?:
|
|
39
|
+
requests?: ApiQueryAuthManagerInfoRequest[];
|
|
40
40
|
};
|
|
41
41
|
}
|
package/dist/core/delete.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `action=delete`
|
|
3
|
-
*
|
|
2
|
+
* `action=delete` response — page deletion, returned under a top-level `delete`
|
|
3
|
+
* object. Requires the `delete` right.
|
|
4
4
|
*
|
|
5
5
|
* Under `formatversion=2` a successful delete carries **no `result` key**
|
|
6
6
|
* (older clients branched on `result: "Success"`).
|
|
@@ -26,20 +26,6 @@ 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
|
-
/** The `undelete` object of an `action=undelete` response. */
|
|
32
|
-
export interface ApiUndeleteResult {
|
|
33
|
-
/** Restored page title. */
|
|
34
|
-
title: string;
|
|
35
|
-
/** Number of revisions restored. */
|
|
36
|
-
revisions: number;
|
|
37
|
-
/** Number of file versions restored. */
|
|
38
|
-
fileversions: number;
|
|
39
|
-
/** Undelete reason (echoed back). */
|
|
40
|
-
reason: string;
|
|
41
|
-
}
|
|
42
|
-
/** Response of `action=undelete`. */
|
|
43
|
-
export interface ApiUndeleteResponse extends ApiEnvelope {
|
|
44
|
-
undelete: ApiUndeleteResult;
|
|
45
|
-
}
|
package/dist/core/edit.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
+
* `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
|
}
|
package/dist/core/emailuser.d.ts
CHANGED
|
@@ -4,24 +4,25 @@
|
|
|
4
4
|
* under `emailuser`.
|
|
5
5
|
*
|
|
6
6
|
* `ApiEmailUser` reports the outcome **in-band** (not as a top-level
|
|
7
|
-
*
|
|
8
|
-
* and `warnings`/`errors` carry
|
|
9
|
-
*
|
|
10
|
-
* `errorformat`, which keeps them as
|
|
11
|
-
* a wiki without a mail transport.
|
|
7
|
+
* `ApiErrorResponse`): `result` is `Success`, `Warnings`, or `Failure`,
|
|
8
|
+
* and `warnings`/`errors` carry the messages, shaped per the request's
|
|
9
|
+
* `errorformat`. The keys are dropped when the status carries none of that
|
|
10
|
+
* kind — except under the default `bc` `errorformat`, which keeps them as
|
|
11
|
+
* empty arrays. A `Failure` also occurs on a wiki without a mail transport.
|
|
12
12
|
*
|
|
13
13
|
* @see https://www.mediawiki.org/wiki/API:Email
|
|
14
14
|
*/
|
|
15
15
|
import type { ApiSpecMessage } from "../common";
|
|
16
|
-
import type { ApiEnvelope } from "../envelope";
|
|
16
|
+
import type { ApiEnvelope, ApiMessage } 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 & {});
|
|
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[];
|
|
23
|
+
/** Non-fatal messages (e.g. subject/text transformations), shaped per the request's `errorformat`. */
|
|
24
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
25
|
+
/** In-band delivery errors (present when `result` is `Failure`), shaped per the request's `errorformat`. */
|
|
26
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
26
27
|
};
|
|
27
28
|
}
|
|
@@ -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
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
* needs CSRF, title-level `edit`/`upload` rights on the file, and `reupload`
|
|
4
4
|
* (or `reupload-own` when reverting one's own upload). The result keys under
|
|
5
5
|
* `filerevert`: `result` is `Success`, or `Failure` with an in-band `errors`
|
|
6
|
-
* array (a per-item outcome, not a top-level
|
|
6
|
+
* array (a per-item outcome, not a top-level `ApiErrorResponse`).
|
|
7
7
|
*
|
|
8
8
|
* @see https://www.mediawiki.org/wiki/API:Filerevert
|
|
9
9
|
*/
|
|
10
10
|
import type { ApiSpecMessage } from "../common";
|
|
11
|
-
import type { ApiEnvelope } from "../envelope";
|
|
11
|
+
import type { ApiEnvelope, ApiMessage } 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 & {});
|
|
17
|
-
/** In-band messages when the revert did not apply
|
|
18
|
-
errors?: ApiSpecMessage[];
|
|
18
|
+
/** In-band messages when the revert did not apply, shaped per the request's `errorformat`. */
|
|
19
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
19
20
|
};
|
|
20
21
|
}
|
|
@@ -14,38 +14,24 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://www.mediawiki.org/wiki/API:Imagerotate
|
|
16
16
|
*/
|
|
17
|
-
import type {
|
|
18
|
-
import type { ApiEnvelope } from "../envelope";
|
|
17
|
+
import type { ApiSpecMessage } from "../common";
|
|
18
|
+
import type { ApiEnvelope, ApiMessage } 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. */
|
|
44
29
|
result?: "Success" | "Failure" | (string & {});
|
|
45
|
-
/** In-band messages when the rotation failed
|
|
46
|
-
errors?: ApiSpecMessage[];
|
|
30
|
+
/** In-band messages when the rotation failed, shaped per the request's `errorformat`. */
|
|
31
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
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
|
}
|
package/dist/core/import.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export * from "./edit";
|
|
|
5
5
|
export * from "./move";
|
|
6
6
|
export * from "./purge";
|
|
7
7
|
export * from "./delete";
|
|
8
|
+
export * from "./undelete";
|
|
8
9
|
export * from "./block";
|
|
10
|
+
export * from "./unblock";
|
|
9
11
|
export * from "./watch";
|
|
10
12
|
export * from "./rollback";
|
|
11
13
|
export * from "./patrol";
|
package/dist/core/login.d.ts
CHANGED
|
@@ -12,14 +12,19 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://www.mediawiki.org/wiki/API:Login
|
|
14
14
|
*/
|
|
15
|
-
import type { ApiEnvelope } from "../envelope";
|
|
15
|
+
import type { ApiEnvelope, ApiMessage } 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 & {});
|
|
21
|
-
/**
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Why the login failed, emitted when `result` is `Failed` or `Aborted`:
|
|
24
|
+
* a plain string under the default (`bc`) `errorformat`, an
|
|
25
|
+
* {@link ApiMessage} under a modern one.
|
|
26
|
+
*/
|
|
27
|
+
reason?: string | ApiMessage;
|
|
23
28
|
/** Login token echoed back on a `NeedToken` round trip. */
|
|
24
29
|
token?: string;
|
|
25
30
|
/** User id of the logged-in account (legacy `lguserid` spelling). */
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
* @see https://www.mediawiki.org/wiki/API:Managetags
|
|
9
9
|
*/
|
|
10
10
|
import type { ApiSpecMessage } from "../common";
|
|
11
|
-
import type { ApiEnvelope } from "../envelope";
|
|
11
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
12
12
|
/** `action=managetags` operation. Open union for forward compatibility. */
|
|
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;
|
|
@@ -22,7 +23,7 @@ export interface ApiManageTagsResponse extends ApiEnvelope {
|
|
|
22
23
|
success: boolean;
|
|
23
24
|
/** Log entry id recorded for the operation. */
|
|
24
25
|
logid?: number;
|
|
25
|
-
/** Non-fatal messages (e.g. a deprecation notice)
|
|
26
|
-
warnings?: ApiSpecMessage[];
|
|
26
|
+
/** Non-fatal messages (e.g. a deprecation notice), shaped per the request's `errorformat`. */
|
|
27
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
27
28
|
};
|
|
28
29
|
}
|
|
@@ -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;
|
package/dist/core/move.d.ts
CHANGED
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Note under `formatversion=2`: `redirectcreated` / `moveoverredirect` /
|
|
6
6
|
* `talkmoveoverredirect` are real booleans (present as `false`), `reason` is
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
*
|
|
12
12
|
* @see https://www.mediawiki.org/wiki/API:Move
|
|
13
13
|
*/
|
|
14
14
|
import type { ApiSpecMessage } from "../common";
|
|
15
|
-
import type { ApiEnvelope } from "../envelope";
|
|
15
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
16
16
|
/** One subpage move outcome within `subpages`/`subpages-talk`. */
|
|
17
17
|
export interface ApiMoveSubpage {
|
|
18
18
|
/** Old subpage title. */
|
|
19
19
|
from?: string;
|
|
20
20
|
/** New subpage title, when the subpage moved. */
|
|
21
21
|
to?: string;
|
|
22
|
-
/** Why the subpage did not move, when it failed
|
|
23
|
-
errors?: ApiSpecMessage[];
|
|
22
|
+
/** Why the subpage did not move, when it failed, shaped per the request's `errorformat`. */
|
|
23
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
24
24
|
}
|
|
25
25
|
/** The object form of `subpages`, returned only when the whole move failed. */
|
|
26
26
|
export interface ApiMoveSubpageErrors {
|
|
27
|
-
/** Why no subpage could be moved
|
|
28
|
-
errors?: ApiSpecMessage[];
|
|
27
|
+
/** Why no subpage could be moved, shaped per the request's `errorformat`. */
|
|
28
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
29
29
|
}
|
|
30
30
|
/** The `move` object of a successful `action=move` response. */
|
|
31
31
|
export interface ApiMoveResult {
|
|
@@ -45,8 +45,8 @@ export interface ApiMoveResult {
|
|
|
45
45
|
talkto?: string;
|
|
46
46
|
/** Whether the talk-page destination already existed (redirect or not). A real `boolean`. */
|
|
47
47
|
talkmoveoverredirect?: boolean;
|
|
48
|
-
/** Why the talk-page move failed, instead of `talkfrom`/`talkto`. */
|
|
49
|
-
"talkmove-errors"?: ApiSpecMessage[];
|
|
48
|
+
/** Why the talk-page move failed, instead of `talkfrom`/`talkto`, shaped per the request's `errorformat`. */
|
|
49
|
+
"talkmove-errors"?: ApiSpecMessage[] | ApiMessage[];
|
|
50
50
|
/**
|
|
51
51
|
* Subpage move outcome (`movesubpages=1`). `formatversion=2` returns either
|
|
52
52
|
* an array of per-subpage outcomes or an object of errors, so both shapes are
|
|
@@ -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
|
}
|
package/dist/core/options.d.ts
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* CSRF token.
|
|
5
5
|
*
|
|
6
6
|
* On success `options` is the plain string `"success"`. Errors surface as a
|
|
7
|
-
* top-level
|
|
7
|
+
* top-level `ApiErrorResponse`.
|
|
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:
|
|
16
|
+
options: SuccessStatus;
|
|
16
17
|
}
|
package/dist/core/parse.d.ts
CHANGED
|
@@ -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.
|
|
46
|
-
*
|
|
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.
|
|
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 —
|
|
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;
|
package/dist/core/patrol.d.ts
CHANGED