types-mediawiki-response 1.0.0 → 1.1.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.
- package/dist/common/index.d.ts +7 -12
- package/dist/core/block.d.ts +15 -41
- package/dist/core/changeauthenticationdata.d.ts +2 -3
- package/dist/core/changecontentmodel.d.ts +2 -2
- package/dist/core/checktoken.d.ts +1 -2
- package/dist/core/createaccount.d.ts +1 -1
- package/dist/core/delete.d.ts +2 -18
- package/dist/core/edit.d.ts +1 -1
- package/dist/core/emailuser.d.ts +10 -10
- package/dist/core/filerevert.d.ts +4 -4
- package/dist/core/imagerotate.d.ts +3 -3
- package/dist/core/index.d.ts +2 -0
- package/dist/core/login.d.ts +7 -3
- package/dist/core/managetags.d.ts +5 -5
- package/dist/core/move.d.ts +7 -7
- package/dist/core/options.d.ts +2 -3
- package/dist/core/query/blocks.d.ts +1 -1
- package/dist/core/query/categorymembers.d.ts +2 -4
- package/dist/core/query/filerepoinfo.d.ts +1 -1
- package/dist/core/query/index.d.ts +6 -3
- package/dist/core/query/info.d.ts +16 -10
- package/dist/core/query/languageinfo.d.ts +2 -2
- package/dist/core/query/siteinfo.d.ts +45 -29
- package/dist/core/query/tags.d.ts +7 -2
- package/dist/core/query/userinfo.d.ts +2 -2
- package/dist/core/query/users.d.ts +4 -3
- package/dist/core/removeauthenticationdata.d.ts +2 -3
- package/dist/core/resetpassword.d.ts +1 -1
- package/dist/core/revisiondelete.d.ts +9 -9
- package/dist/core/tag.d.ts +34 -8
- package/dist/core/unblock.d.ts +34 -0
- package/dist/core/undelete.d.ts +23 -0
- package/dist/core/userrights.d.ts +4 -5
- package/dist/core/validatepassword.d.ts +3 -3
- package/dist/core/watch.d.ts +12 -5
- package/dist/envelope/index.d.ts +57 -20
- package/dist/extensions/babel.d.ts +1 -1
- package/dist/extensions/discussiontools.d.ts +7 -4
- package/dist/extensions/echo.d.ts +19 -16
- package/dist/extensions/flaggedrevs.d.ts +2 -2
- package/dist/extensions/globalblocks.d.ts +35 -1
- package/dist/extensions/globalpreferences.d.ts +2 -3
- package/dist/extensions/massmessage.d.ts +2 -3
- package/dist/extensions/scribunto.d.ts +1 -1
- package/dist/extensions/sitematrix.d.ts +2 -2
- package/dist/extensions/thanks.d.ts +1 -1
- package/dist/extensions/timedmediahandler.d.ts +7 -3
- package/dist/extensions/visualeditor.d.ts +20 -12
- package/dist/extensions/wikilove.d.ts +1 -1
- package/package.json +7 -5
package/dist/common/index.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export type Expiry = Timestamp | "infinity";
|
|
|
23
23
|
* literal `infinite` for an indefinite block.
|
|
24
24
|
*/
|
|
25
25
|
export type BlockExpiry = Timestamp | "infinite";
|
|
26
|
+
/**
|
|
27
|
+
* Expiry of a watch: a timestamp, or `null` when the page is not watched or
|
|
28
|
+
* the watch is permanent.
|
|
29
|
+
*/
|
|
30
|
+
export type WatchlistExpiry = Timestamp | null;
|
|
26
31
|
/**
|
|
27
32
|
* A block of plain text (as opposed to HTML), e.g. a TextExtracts excerpt
|
|
28
33
|
* requested with `explaintext`. Kept distinct from HTML-bearing string fields.
|
|
@@ -30,16 +35,6 @@ export type BlockExpiry = Timestamp | "infinite";
|
|
|
30
35
|
export type PlainText = string;
|
|
31
36
|
/** Namespace index. Negative indexes are pseudo-namespaces. */
|
|
32
37
|
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 & {});
|
|
43
38
|
/**
|
|
44
39
|
* A structured in-band message — a serialized MediaWiki `Message`/`FatalError`
|
|
45
40
|
* spec (`{ message, params, code, type }`) nested inside an action result
|
|
@@ -81,7 +76,7 @@ export interface ApiWatchlistLabel {
|
|
|
81
76
|
* promote their own models by augmenting {@link ContentModelExtension}
|
|
82
77
|
* (e.g. `MassMessageListContent` from the MassMessage pack); consumers may
|
|
83
78
|
* augment the same interface for site-specific models registered through
|
|
84
|
-
* `$
|
|
79
|
+
* `$wgContentHandlers`.
|
|
85
80
|
*/
|
|
86
81
|
export type ContentModel = "wikitext" | "javascript" | "css" | "json" | "text" | "Scribunto" | ContentModelExtension[keyof ContentModelExtension] | (string & {});
|
|
87
82
|
/**
|
|
@@ -91,7 +86,7 @@ export type ContentModel = "wikitext" | "javascript" | "css" | "json" | "text" |
|
|
|
91
86
|
* {@link ContentModel}.
|
|
92
87
|
*
|
|
93
88
|
* @example
|
|
94
|
-
* // A site-specific model registered through $
|
|
89
|
+
* // A site-specific model registered through $wgContentHandlers:
|
|
95
90
|
* declare module "types-mediawiki-response" {
|
|
96
91
|
* interface ContentModelExtension {
|
|
97
92
|
* MyModel: "my-model";
|
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 { BlockExpiry, Timestamp } from "../common";
|
|
12
|
+
import type { BlockExpiry, Timestamp, WatchlistExpiry } from "../common";
|
|
13
13
|
import type { ApiEnvelope } from "../envelope";
|
|
14
14
|
/** The `block` object of an `action=block` response. */
|
|
15
15
|
export interface ApiBlockResult {
|
|
@@ -40,19 +40,17 @@ export interface ApiBlockResult {
|
|
|
40
40
|
/** Restrict the block to specific pages or namespaces instead of sitewide. */
|
|
41
41
|
partial: boolean;
|
|
42
42
|
/** Page restrictions of a partial block; `null` when sitewide. */
|
|
43
|
-
pagerestrictions:
|
|
43
|
+
pagerestrictions: string[] | null;
|
|
44
44
|
/** Namespace restrictions of a partial block; `null` when sitewide. */
|
|
45
|
-
namespacerestrictions:
|
|
45
|
+
namespacerestrictions: number[] | null;
|
|
46
|
+
/** Expiry applied to the watched user page. */
|
|
47
|
+
watchlistexpiry?: WatchlistExpiry;
|
|
46
48
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
+
* Restricted actions of a partial action block; `null` when the block
|
|
50
|
+
* restricts no actions. Only emitted on MediaWiki 1.39–1.44 when
|
|
51
|
+
* `$wgEnablePartialActionBlocks` is on.
|
|
49
52
|
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Restricted actions of a partial action block; only emitted when
|
|
53
|
-
* `$wgEnablePartialActionBlocks` is enabled.
|
|
54
|
-
*/
|
|
55
|
-
actionrestrictions?: string[];
|
|
53
|
+
actionrestrictions?: string[] | null;
|
|
56
54
|
/**
|
|
57
55
|
* When the block was applied, in ISO 8601.
|
|
58
56
|
*
|
|
@@ -72,27 +70,3 @@ export interface ApiBlockResponse extends ApiEnvelope {
|
|
|
72
70
|
/** Result of `action=block`. */
|
|
73
71
|
block: ApiBlockResult;
|
|
74
72
|
}
|
|
75
|
-
/** The `unblock` object of an `action=unblock` response. */
|
|
76
|
-
export interface ApiUnblockResult {
|
|
77
|
-
/** Removed block id. */
|
|
78
|
-
id: number;
|
|
79
|
-
/** Unblocked user name / IP; empty string when removing an autoblock. */
|
|
80
|
-
user: string;
|
|
81
|
-
/** Unblocked user id (`0` for IPs and autoblocks). Note lowercase, unlike the block result. */
|
|
82
|
-
userid: number;
|
|
83
|
-
/** Unblock reason (echoed back). */
|
|
84
|
-
reason: string;
|
|
85
|
-
/** Whether the unblock added the unblocked user to the unblocker's watchlist. */
|
|
86
|
-
watchuser: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Expiry applied to the watched user page, present only when the request
|
|
89
|
-
* passed `watchlistexpiry` with `watchuser`; `null` when the page is not
|
|
90
|
-
* actually watched.
|
|
91
|
-
*/
|
|
92
|
-
watchlistexpiry?: Timestamp | null;
|
|
93
|
-
}
|
|
94
|
-
/** Response of `action=unblock`. */
|
|
95
|
-
export interface ApiUnblockResponse extends ApiEnvelope {
|
|
96
|
-
/** Result of `action=unblock`. */
|
|
97
|
-
unblock: ApiUnblockResult;
|
|
98
|
-
}
|
|
@@ -4,17 +4,16 @@
|
|
|
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";
|
|
12
11
|
import type { ApiEnvelope } from "../envelope";
|
|
13
12
|
/** Response of `action=changeauthenticationdata`. */
|
|
14
13
|
export interface ApiChangeAuthenticationDataResponse extends ApiEnvelope {
|
|
15
14
|
/** Result of `action=changeauthenticationdata`. */
|
|
16
15
|
changeauthenticationdata: {
|
|
17
16
|
/** Flow outcome; `success` when the change was applied. */
|
|
18
|
-
status:
|
|
17
|
+
status: "success";
|
|
19
18
|
};
|
|
20
19
|
}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @see https://www.mediawiki.org/wiki/API:Changecontentmodel
|
|
8
8
|
*/
|
|
9
|
-
import type { ContentModel
|
|
9
|
+
import type { ContentModel } from "../common";
|
|
10
10
|
import type { ApiEnvelope } from "../envelope";
|
|
11
11
|
/** Response of `action=changecontentmodel`. */
|
|
12
12
|
export interface ApiChangeContentModelResponse extends ApiEnvelope {
|
|
13
13
|
/** Result of `action=changecontentmodel`. */
|
|
14
14
|
changecontentmodel: {
|
|
15
15
|
/** `Success` when the model was changed. */
|
|
16
|
-
result:
|
|
16
|
+
result: "Success";
|
|
17
17
|
/** Page title. */
|
|
18
18
|
title: string;
|
|
19
19
|
/** Page id. */
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
* `maxtokenage`), or `invalid`. `generated` is decoded from the submitted
|
|
7
7
|
* token itself (MediaWiki tokens embed their generation time), so it appears
|
|
8
8
|
* whenever the token carries a timestamp — an old token reports its own age.
|
|
9
|
-
* Modeled as an open union for forward compatibility.
|
|
10
9
|
*
|
|
11
10
|
* @see https://www.mediawiki.org/wiki/API:Checktoken
|
|
12
11
|
*/
|
|
13
12
|
import type { Timestamp } from "../common";
|
|
14
13
|
import type { ApiEnvelope } from "../envelope";
|
|
15
14
|
/** Result values of {@link ApiCheckTokenResponse}. */
|
|
16
|
-
export type ApiCheckTokenResult = "valid" | "expired" | "invalid"
|
|
15
|
+
export type ApiCheckTokenResult = "valid" | "expired" | "invalid";
|
|
17
16
|
/** Response of `action=checktoken`. */
|
|
18
17
|
export interface ApiCheckTokenResponse extends ApiEnvelope {
|
|
19
18
|
/** Result of `action=checktoken`. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `message`/`messagecode`.
|
|
6
6
|
*
|
|
7
7
|
* These are **in-band** AuthManager outcomes, not a top-level
|
|
8
|
-
*
|
|
8
|
+
* `ApiErrorResponse`. `username` appears on `PASS`; `UI`/`RESTART`/
|
|
9
9
|
* `REDIRECT` outcomes add the `requests` descriptors; `canpreservestate` marks
|
|
10
10
|
* whether state can be kept.
|
|
11
11
|
*
|
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"`).
|
|
@@ -29,19 +29,3 @@ export interface ApiDeleteResponse extends ApiEnvelope {
|
|
|
29
29
|
/** Result of `action=delete`. */
|
|
30
30
|
delete: ApiDeleteResult;
|
|
31
31
|
}
|
|
32
|
-
/** The `undelete` object of an `action=undelete` response. */
|
|
33
|
-
export interface ApiUndeleteResult {
|
|
34
|
-
/** Restored page title. */
|
|
35
|
-
title: string;
|
|
36
|
-
/** Number of revisions restored. */
|
|
37
|
-
revisions: number;
|
|
38
|
-
/** Number of file versions restored. */
|
|
39
|
-
fileversions: number;
|
|
40
|
-
/** Undelete reason (echoed back). */
|
|
41
|
-
reason: string;
|
|
42
|
-
}
|
|
43
|
-
/** Response of `action=undelete`. */
|
|
44
|
-
export interface ApiUndeleteResponse extends ApiEnvelope {
|
|
45
|
-
/** Result of `action=undelete`. */
|
|
46
|
-
undelete: ApiUndeleteResult;
|
|
47
|
-
}
|
package/dist/core/edit.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* challenge) returns the in-band failure branch: `result: "Failure"` plus that
|
|
11
11
|
* data and no revision ids. Most hard failures (bad token, protected page,
|
|
12
12
|
* `createonly` on an existing page) surface as a top-level
|
|
13
|
-
*
|
|
13
|
+
* `ApiErrorResponse`, not `result: "Failure"`.
|
|
14
14
|
*
|
|
15
15
|
* @see https://www.mediawiki.org/wiki/API:Edit
|
|
16
16
|
*/
|
package/dist/core/emailuser.d.ts
CHANGED
|
@@ -4,25 +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
19
|
/** Result of `action=emailuser`. */
|
|
20
20
|
emailuser: {
|
|
21
21
|
/** Whether the message was accepted, or accepted with warnings, or failed. */
|
|
22
22
|
result: "Success" | "Warnings" | "Failure" | (string & {});
|
|
23
|
-
/** Non-fatal messages (e.g. subject/text transformations)
|
|
24
|
-
warnings?: ApiSpecMessage[];
|
|
25
|
-
/** In-band delivery errors (present when `result` is `Failure`)
|
|
26
|
-
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[];
|
|
27
27
|
};
|
|
28
28
|
}
|
|
@@ -3,19 +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
14
|
/** Result of `action=filerevert`. */
|
|
15
15
|
filerevert: {
|
|
16
16
|
/** Outcome of the revert. */
|
|
17
17
|
result: "Success" | "Failure" | (string & {});
|
|
18
|
-
/** In-band messages when the revert did not apply
|
|
19
|
-
errors?: ApiSpecMessage[];
|
|
18
|
+
/** In-band messages when the revert did not apply, shaped per the request's `errorformat`. */
|
|
19
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @see https://www.mediawiki.org/wiki/API:Imagerotate
|
|
16
16
|
*/
|
|
17
17
|
import type { ApiSpecMessage } from "../common";
|
|
18
|
-
import type { ApiEnvelope } from "../envelope";
|
|
18
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
19
19
|
import type { ApiPageIdentity } from "./query";
|
|
20
20
|
/** One file entry of an `action=imagerotate` response. */
|
|
21
21
|
export interface ApiImageRotateEntry extends ApiPageIdentity {
|
|
@@ -27,8 +27,8 @@ export interface ApiImageRotateEntry extends ApiPageIdentity {
|
|
|
27
27
|
iw?: string;
|
|
28
28
|
/** Per-file outcome. */
|
|
29
29
|
result?: "Success" | "Failure" | (string & {});
|
|
30
|
-
/** In-band messages when the rotation failed
|
|
31
|
-
errors?: ApiSpecMessage[];
|
|
30
|
+
/** In-band messages when the rotation failed, shaped per the request's `errorformat`. */
|
|
31
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
32
32
|
}
|
|
33
33
|
/** Response of `action=imagerotate`. */
|
|
34
34
|
export interface ApiImageRotateResponse extends ApiEnvelope {
|
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,15 +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
18
|
/** Result of `action=login`. */
|
|
19
19
|
login: {
|
|
20
20
|
/** Login outcome. */
|
|
21
21
|
result: "Success" | "Failed" | "NeedToken" | "WrongToken" | "Aborted" | (string & {});
|
|
22
|
-
/**
|
|
23
|
-
|
|
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;
|
|
24
28
|
/** Login token echoed back on a `NeedToken` round trip. */
|
|
25
29
|
token?: string;
|
|
26
30
|
/** User id of the logged-in account (legacy `lguserid` spelling). */
|
|
@@ -8,9 +8,9 @@
|
|
|
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";
|
|
12
|
-
/** `action=managetags` operation
|
|
13
|
-
export type ApiManageTagsOperation = "activate" | "create" | "deactivate" | "delete"
|
|
11
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
12
|
+
/** `action=managetags` operation, echoed from the request. */
|
|
13
|
+
export type ApiManageTagsOperation = "activate" | "create" | "deactivate" | "delete";
|
|
14
14
|
/** Response of `action=managetags`. */
|
|
15
15
|
export interface ApiManageTagsResponse extends ApiEnvelope {
|
|
16
16
|
/** Result of `action=managetags`. */
|
|
@@ -23,7 +23,7 @@ export interface ApiManageTagsResponse extends ApiEnvelope {
|
|
|
23
23
|
success: boolean;
|
|
24
24
|
/** Log entry id recorded for the operation. */
|
|
25
25
|
logid?: number;
|
|
26
|
-
/** Non-fatal messages (e.g. a deprecation notice)
|
|
27
|
-
warnings?: ApiSpecMessage[];
|
|
26
|
+
/** Non-fatal messages (e.g. a deprecation notice), shaped per the request's `errorformat`. */
|
|
27
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
28
28
|
};
|
|
29
29
|
}
|
package/dist/core/move.d.ts
CHANGED
|
@@ -12,20 +12,20 @@
|
|
|
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
|
package/dist/core/options.d.ts
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
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";
|
|
12
11
|
import type { ApiEnvelope } from "../envelope";
|
|
13
12
|
/** Response of `action=options`. */
|
|
14
13
|
export interface ApiOptionsResponse extends ApiEnvelope {
|
|
15
14
|
/** Success sentinel (`"success"`); failures come back as a top-level error. */
|
|
16
|
-
options:
|
|
15
|
+
options: "success";
|
|
17
16
|
}
|
|
@@ -19,7 +19,7 @@ export interface ApiBlockRestrictions {
|
|
|
19
19
|
}[];
|
|
20
20
|
/** Restricted namespace ids. */
|
|
21
21
|
namespaces?: number[];
|
|
22
|
-
/** Restricted actions; only on
|
|
22
|
+
/** Restricted actions; only on action-type entries. Before MediaWiki 1.45 these require `$wgEnablePartialActionBlocks`. */
|
|
23
23
|
actions?: string[];
|
|
24
24
|
}
|
|
25
25
|
/** One block record. `bkprop` controls which fields appear. */
|
|
@@ -9,10 +9,8 @@
|
|
|
9
9
|
* @see https://www.mediawiki.org/wiki/API:Categorymembers
|
|
10
10
|
*/
|
|
11
11
|
import type { NamespaceIndex, Timestamp } from "../../common";
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
export type CategoryMemberType = "page" | "subcat" | "file" | (string & {});
|
|
12
|
+
/** Member type (`cmtype` / `gcmtype`). */
|
|
13
|
+
export type CategoryMemberType = "page" | "subcat" | "file";
|
|
16
14
|
/** One category member. `cmprop` controls which fields appear. */
|
|
17
15
|
export interface ApiCategoryMember {
|
|
18
16
|
/** Page id. `cmprop=ids`. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* shapes that `prop=imageinfo` and `list=allimages` return.
|
|
5
5
|
*
|
|
6
6
|
* Config values, so the switches are real booleans (`false` is returned), not
|
|
7
|
-
*
|
|
7
|
+
* `Flag`s. Repos report only the optional settings they configure, so
|
|
8
8
|
* the key set varies by site; `apiurl` exists only for `ForeignAPIRepo`
|
|
9
9
|
* backends.
|
|
10
10
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* page shape grows as coverage expands without this file depending on them.
|
|
7
7
|
*/
|
|
8
8
|
import type { Flag, NamespaceIndex } from "../../common";
|
|
9
|
-
import type { ApiEnvelope } from "../../envelope";
|
|
9
|
+
import type { ApiEnvelope, ApiMessage } from "../../envelope";
|
|
10
10
|
/**
|
|
11
11
|
* Continuation tokens returned by `action=query`. @see https://www.mediawiki.org/wiki/API:Continue
|
|
12
12
|
*
|
|
@@ -275,8 +275,11 @@ export interface ApiPageIdentity {
|
|
|
275
275
|
known?: Flag;
|
|
276
276
|
/** `true` when the supplied title is not a valid title. */
|
|
277
277
|
invalid?: Flag;
|
|
278
|
-
/**
|
|
279
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Why the title is `invalid`: a plain string under the default (`bc`)
|
|
280
|
+
* `errorformat`, an {@link ApiMessage} under a modern one.
|
|
281
|
+
*/
|
|
282
|
+
invalidreason?: string | ApiMessage;
|
|
280
283
|
/** `true` for pages in a special namespace. */
|
|
281
284
|
special?: Flag;
|
|
282
285
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @see https://www.mediawiki.org/wiki/API:Info
|
|
7
7
|
*/
|
|
8
8
|
import type { ApiWatchlistLabel, ContentFormat, ContentModel, Flag, Timestamp } from "../../common";
|
|
9
|
+
import type { ApiMessageParam } from "../../envelope";
|
|
9
10
|
import type { QueryPage, QueryPageExisting } from "./index";
|
|
10
11
|
/** One entry of a page's `protection` array (`inprop=protection`). */
|
|
11
12
|
export interface ApiPageProtection {
|
|
@@ -29,17 +30,22 @@ export interface ApiPageProtection {
|
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* One permission-check failure reported under `intestactionsdetail=full|quick`.
|
|
32
|
-
* The
|
|
33
|
+
* The text-bearing keys depend on the request's `errorformat`: `text` for
|
|
34
|
+
* `plaintext`/`wikitext`, `html` for `html`, `key`/`params` for `raw`, and none
|
|
35
|
+
* of them for `none`. A request using the default (`bc`) format is rendered as
|
|
36
|
+
* `plaintext` here.
|
|
33
37
|
*/
|
|
34
38
|
export interface ApiActionPermission {
|
|
35
39
|
/** Machine-readable code, e.g. `sitejsprotected`. */
|
|
36
|
-
code
|
|
37
|
-
/** Rendered message text. */
|
|
40
|
+
code: string;
|
|
41
|
+
/** Rendered message text (`plaintext`/`wikitext`). */
|
|
38
42
|
text?: string;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
+
/** Parsed message HTML (`html`). */
|
|
44
|
+
html?: string;
|
|
45
|
+
/** i18n message key (`raw`). */
|
|
46
|
+
key?: string;
|
|
47
|
+
/** i18n message parameters (`raw`). */
|
|
48
|
+
params?: ApiMessageParam[];
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Fields `prop=info` contributes to {@link ApiPage}. {@link InfoPage} projects
|
|
@@ -52,8 +58,8 @@ export interface ApiPageInfo {
|
|
|
52
58
|
pagelanguage?: string;
|
|
53
59
|
/** HTML `lang` attribute value for the page language. */
|
|
54
60
|
pagelanguagehtmlcode?: string;
|
|
55
|
-
/** Writing direction of the page language.
|
|
56
|
-
pagelanguagedir?: "ltr" | "rtl"
|
|
61
|
+
/** Writing direction of the page language. */
|
|
62
|
+
pagelanguagedir?: "ltr" | "rtl";
|
|
57
63
|
/** When the page was last touched (cache/link invalidation), not last edited. Existing pages only. */
|
|
58
64
|
touched?: Timestamp;
|
|
59
65
|
/** Revision id of the latest revision. Existing pages only. */
|
|
@@ -211,7 +217,7 @@ declare module "./index" {
|
|
|
211
217
|
export type InfoPage = QueryPage<keyof ApiPageInfo>;
|
|
212
218
|
/**
|
|
213
219
|
* {@link InfoPage} for a page that exists: the identity fields and the
|
|
214
|
-
* unconditional `prop=info` fields (
|
|
220
|
+
* unconditional `prop=info` fields (`PropConstantKeys`) are required;
|
|
215
221
|
* `inprop`-gated fields stay optional.
|
|
216
222
|
*/
|
|
217
223
|
export type InfoPageExisting = QueryPageExisting<keyof ApiPageInfo>;
|
|
@@ -11,8 +11,8 @@ export interface ApiLanguageInfo {
|
|
|
11
11
|
code?: string;
|
|
12
12
|
/** BCP 47 language tag. `liprop=bcp47`. */
|
|
13
13
|
bcp47?: string;
|
|
14
|
-
/** Writing direction. `liprop=dir`.
|
|
15
|
-
dir?: "ltr" | "rtl"
|
|
14
|
+
/** Writing direction. `liprop=dir`. */
|
|
15
|
+
dir?: "ltr" | "rtl";
|
|
16
16
|
/** Name in the language itself. `liprop=autonym`. */
|
|
17
17
|
autonym?: string;
|
|
18
18
|
/** Name in the content/`uselang` language. `liprop=name`. */
|