types-mediawiki-response 1.0.1 → 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 +9 -11
- package/dist/core/changeauthenticationdata.d.ts +1 -2
- package/dist/core/changecontentmodel.d.ts +2 -2
- package/dist/core/checktoken.d.ts +1 -2
- package/dist/core/managetags.d.ts +2 -2
- package/dist/core/options.d.ts +1 -2
- package/dist/core/query/blocks.d.ts +1 -1
- package/dist/core/query/categorymembers.d.ts +2 -4
- package/dist/core/query/info.d.ts +2 -2
- 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/removeauthenticationdata.d.ts +1 -2
- package/dist/core/unblock.d.ts +4 -5
- package/dist/core/userrights.d.ts +4 -5
- 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/globalpreferences.d.ts +2 -3
- package/dist/extensions/massmessage.d.ts +2 -3
- package/dist/extensions/sitematrix.d.ts +2 -2
- package/dist/extensions/timedmediahandler.d.ts +7 -3
- package/dist/extensions/visualeditor.d.ts +20 -12
- package/package.json +2 -1
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
|
@@ -9,7 +9,7 @@
|
|
|
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
|
*
|
|
@@ -8,13 +8,12 @@
|
|
|
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`. */
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { ApiSpecMessage } from "../common";
|
|
11
11
|
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
12
|
-
/** `action=managetags` operation
|
|
13
|
-
export type ApiManageTagsOperation = "activate" | "create" | "deactivate" | "delete"
|
|
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`. */
|
package/dist/core/options.d.ts
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
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`. */
|
|
@@ -58,8 +58,8 @@ export interface ApiPageInfo {
|
|
|
58
58
|
pagelanguage?: string;
|
|
59
59
|
/** HTML `lang` attribute value for the page language. */
|
|
60
60
|
pagelanguagehtmlcode?: string;
|
|
61
|
-
/** Writing direction of the page language.
|
|
62
|
-
pagelanguagedir?: "ltr" | "rtl"
|
|
61
|
+
/** Writing direction of the page language. */
|
|
62
|
+
pagelanguagedir?: "ltr" | "rtl";
|
|
63
63
|
/** When the page was last touched (cache/link invalidation), not last edited. Existing pages only. */
|
|
64
64
|
touched?: Timestamp;
|
|
65
65
|
/** Revision id of the latest revision. Existing pages only. */
|
|
@@ -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`. */
|
|
@@ -188,11 +188,11 @@ export interface ApiSiteGeneral {
|
|
|
188
188
|
/** Site favicon URL; absent when the site sets no `$wgFavicon`. */
|
|
189
189
|
favicon?: string;
|
|
190
190
|
/**
|
|
191
|
-
* Host prefixes external images may be loaded from;
|
|
192
|
-
*
|
|
191
|
+
* Host prefixes external images may be loaded from; `[""]` when external
|
|
192
|
+
* images are allowed at large (`$wgAllowExternalImages`).
|
|
193
193
|
*/
|
|
194
194
|
externalimages?: string[];
|
|
195
|
-
/** Gallery rendering defaults
|
|
195
|
+
/** Gallery rendering defaults. */
|
|
196
196
|
galleryoptions: ApiGalleryOptions;
|
|
197
197
|
/**
|
|
198
198
|
* Selectable thumbnail widths, in pixels, keyed by position. Always an object
|
|
@@ -214,8 +214,11 @@ export interface ApiSiteGeneral {
|
|
|
214
214
|
externallinktarget: string | boolean;
|
|
215
215
|
/** Whether interwiki prefixes may be used as magic links. A real `boolean`. */
|
|
216
216
|
interwikimagic: boolean;
|
|
217
|
-
/**
|
|
218
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Magic-link keywords and whether each is enabled; mirrors
|
|
219
|
+
* `$wgEnableMagicLinks` verbatim, so an empty set serializes as `[]`.
|
|
220
|
+
*/
|
|
221
|
+
magiclinks: Record<string, boolean> | unknown[];
|
|
219
222
|
/** Method used to look up a user's central account id. */
|
|
220
223
|
centralidlookupprovider: string;
|
|
221
224
|
/** All available central-id lookup providers. */
|
|
@@ -234,22 +237,25 @@ export interface ApiSiteGeneral {
|
|
|
234
237
|
/** Git commit hash of the deployment; only present on git checkouts. */
|
|
235
238
|
"git-hash"?: string;
|
|
236
239
|
}
|
|
237
|
-
/**
|
|
240
|
+
/**
|
|
241
|
+
* `general.galleryoptions`: the site's `$wgGalleryOptions`, with core's defaults
|
|
242
|
+
* filled in for any key the site omits.
|
|
243
|
+
*/
|
|
238
244
|
export interface ApiGalleryOptions {
|
|
239
245
|
/** Images per row; `0` lets the skin decide. */
|
|
240
|
-
imagesPerRow
|
|
246
|
+
imagesPerRow: number;
|
|
241
247
|
/** Thumbnail width in pixels. */
|
|
242
|
-
imageWidth
|
|
248
|
+
imageWidth: number;
|
|
243
249
|
/** Thumbnail height in pixels. */
|
|
244
|
-
imageHeight
|
|
250
|
+
imageHeight: number;
|
|
245
251
|
/** Whether captions are length-limited. A real `boolean`. */
|
|
246
|
-
captionLength
|
|
252
|
+
captionLength: boolean;
|
|
247
253
|
/** Whether file sizes are shown. A real `boolean`. */
|
|
248
|
-
showBytes
|
|
254
|
+
showBytes: boolean;
|
|
249
255
|
/** Whether dimensions are shown. A real `boolean`. */
|
|
250
|
-
showDimensions
|
|
256
|
+
showDimensions: boolean;
|
|
251
257
|
/** Gallery layout, e.g. `traditional`, `nolines`, `packed`, `modified-packed`. */
|
|
252
|
-
mode
|
|
258
|
+
mode: string;
|
|
253
259
|
}
|
|
254
260
|
/** One entry of `general.imagelimits`: a selectable display size. */
|
|
255
261
|
export interface ApiImageLimit {
|
|
@@ -304,20 +310,20 @@ export interface ApiUserGroup {
|
|
|
304
310
|
*/
|
|
305
311
|
export interface ApiSiteRestrictions {
|
|
306
312
|
/** Restriction kinds, e.g. `create`, `edit`, `move`, `upload`. */
|
|
307
|
-
types
|
|
313
|
+
types: string[];
|
|
308
314
|
/** Selectable protection levels; `""` means unrestricted. */
|
|
309
|
-
levels
|
|
315
|
+
levels: (string | string[])[];
|
|
310
316
|
/** Levels that may cascade. */
|
|
311
|
-
cascadinglevels
|
|
317
|
+
cascadinglevels: string[];
|
|
312
318
|
/** Levels treated as semi-protection. */
|
|
313
|
-
semiprotectedlevels
|
|
319
|
+
semiprotectedlevels: string[];
|
|
314
320
|
}
|
|
315
321
|
/** `siprop=rightsinfo`: where to read the site's content-rights statement. */
|
|
316
322
|
export interface ApiRightsInfo {
|
|
317
323
|
/** Rights-page/account URL; empty string when unset (not absent). */
|
|
318
|
-
url
|
|
324
|
+
url: string;
|
|
319
325
|
/** Link text override; empty string when unset. */
|
|
320
|
-
text
|
|
326
|
+
text: string;
|
|
321
327
|
}
|
|
322
328
|
/** One localized namespace alias (`siprop=namespacealiases`). */
|
|
323
329
|
export interface ApiNamespaceAlias {
|
|
@@ -343,8 +349,15 @@ export interface ApiFileExtension {
|
|
|
343
349
|
* {@link type} appear only when the component's `extension.json` declares them.
|
|
344
350
|
*/
|
|
345
351
|
export interface ApiSiteExtension {
|
|
346
|
-
/**
|
|
347
|
-
|
|
352
|
+
/**
|
|
353
|
+
* Component class. The names MediaWiki has display labels for are
|
|
354
|
+
* `specialpage`, `editor`, `wikifamily`, `parserhook`, `variable`, `media`,
|
|
355
|
+
* `antispam`, `skin`, `api` and `other`, but the value is never validated
|
|
356
|
+
* against them: a component declares its own `type` in `extension.json`,
|
|
357
|
+
* `$wgExtensionCredits` entries pass through as written, and the
|
|
358
|
+
* `ExtensionTypes` hook can add further names — **open union**.
|
|
359
|
+
*/
|
|
360
|
+
type: "specialpage" | "editor" | "wikifamily" | "parserhook" | "variable" | "media" | "antispam" | "skin" | "api" | "other" | (string & {});
|
|
348
361
|
/** Display name. */
|
|
349
362
|
name?: string;
|
|
350
363
|
/** Message key holding the name. */
|
|
@@ -402,9 +415,9 @@ export interface ApiMagicWord {
|
|
|
402
415
|
/** One hook and its subscribers (`siprop=showhooks`). */
|
|
403
416
|
export interface ApiShowHook {
|
|
404
417
|
/** Hook name. */
|
|
405
|
-
name
|
|
418
|
+
name: string;
|
|
406
419
|
/** `Class::method` handlers registered for it. */
|
|
407
|
-
subscribers
|
|
420
|
+
subscribers: string[];
|
|
408
421
|
}
|
|
409
422
|
/** One database host (`siprop=dbrepllag`). */
|
|
410
423
|
export interface ApiDbReplLag {
|
|
@@ -453,11 +466,11 @@ export interface ApiInterwikiMapEntry {
|
|
|
453
466
|
/** One language entry (`siprop=languages`). */
|
|
454
467
|
export interface ApiSiteLanguage {
|
|
455
468
|
/** Language code. */
|
|
456
|
-
code
|
|
469
|
+
code: string;
|
|
457
470
|
/** BCP 47 form of {@link code}. */
|
|
458
|
-
bcp47
|
|
471
|
+
bcp47: string;
|
|
459
472
|
/** Localized language name. */
|
|
460
|
-
name
|
|
473
|
+
name: string;
|
|
461
474
|
}
|
|
462
475
|
/** One language variant and its fallbacks (`siprop=languagevariants`). */
|
|
463
476
|
export interface ApiLanguageVariant {
|
|
@@ -512,7 +525,7 @@ export interface ApiAutoCreateTempUser {
|
|
|
512
525
|
*
|
|
513
526
|
* @since MediaWiki 1.41
|
|
514
527
|
*/
|
|
515
|
-
enabled
|
|
528
|
+
enabled: boolean;
|
|
516
529
|
/**
|
|
517
530
|
* Name patterns reserved for temporary accounts; only when configured.
|
|
518
531
|
*
|
|
@@ -653,8 +666,11 @@ declare module "./index" {
|
|
|
653
666
|
interface ApiQueryResult {
|
|
654
667
|
/** General site configuration (`meta=siteinfo`, `siprop=general`). */
|
|
655
668
|
general?: ApiSiteGeneral;
|
|
656
|
-
/**
|
|
657
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Upload-dialog config (`siprop=uploaddialog`), mirroring `$wgUploadDialog`
|
|
671
|
+
* verbatim; an empty configuration serializes as `[]`.
|
|
672
|
+
*/
|
|
673
|
+
uploaddialog?: ApiUploadDialog | unknown[];
|
|
658
674
|
/**
|
|
659
675
|
* Domains allowed to send authenticated CORS requests, from
|
|
660
676
|
* `$wgCrossSiteAJAXdomains`; always a JSON array (empty when unconfigured).
|
|
@@ -18,8 +18,13 @@ export interface ApiTag {
|
|
|
18
18
|
hitcount?: number;
|
|
19
19
|
/** Whether the tag has a definition page. `tgprop=defined`; a real `boolean`. */
|
|
20
20
|
defined?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Where the tag can come from. `tgprop=source`: `software` for a tag defined
|
|
23
|
+
* in code, `manual` for one with a definition page, and `extension` as a
|
|
24
|
+
* backwards-compatibility entry emitted alongside `software`. Emitted as a
|
|
25
|
+
* list — a tag with no source serializes as `[]`.
|
|
26
|
+
*/
|
|
27
|
+
source?: ("extension" | "manual" | "software")[];
|
|
23
28
|
/** Whether the tag is still applicable. `tgprop=active`; a real `boolean`. */
|
|
24
29
|
active?: boolean;
|
|
25
30
|
}
|
|
@@ -29,9 +29,9 @@ export interface ApiRateLimit {
|
|
|
29
29
|
/** The `userinfo` object of a `meta=userinfo` response. */
|
|
30
30
|
export interface ApiUserInfo extends ApiUserCore {
|
|
31
31
|
/** User id; `0` for anonymous users. */
|
|
32
|
-
id
|
|
32
|
+
id: number;
|
|
33
33
|
/** User name or IP address. */
|
|
34
|
-
name
|
|
34
|
+
name: string;
|
|
35
35
|
/** `true` for an anonymous (IP) session. A {@link Flag}. */
|
|
36
36
|
anon?: Flag;
|
|
37
37
|
/**
|
|
@@ -8,13 +8,12 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @see https://www.mediawiki.org/wiki/API:Removeauthenticationdata
|
|
10
10
|
*/
|
|
11
|
-
import type { SuccessStatus } from "../common";
|
|
12
11
|
import type { ApiEnvelope } from "../envelope";
|
|
13
12
|
/** Response of `action=removeauthenticationdata`. */
|
|
14
13
|
export interface ApiRemoveAuthenticationDataResponse extends ApiEnvelope {
|
|
15
14
|
/** Result of `action=removeauthenticationdata`. */
|
|
16
15
|
removeauthenticationdata: {
|
|
17
16
|
/** Flow outcome; `success` when the data was removed. */
|
|
18
|
-
status:
|
|
17
|
+
status: "success";
|
|
19
18
|
};
|
|
20
19
|
}
|
package/dist/core/unblock.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @see https://www.mediawiki.org/wiki/API:Block
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { WatchlistExpiry } from "../common";
|
|
11
11
|
import type { ApiEnvelope } from "../envelope";
|
|
12
12
|
/** The `unblock` object of an `action=unblock` response. */
|
|
13
13
|
export interface ApiUnblockResult {
|
|
@@ -22,11 +22,10 @@ export interface ApiUnblockResult {
|
|
|
22
22
|
/** Whether the unblock added the unblocked user to the unblocker's watchlist. */
|
|
23
23
|
watchuser: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Expiry applied to the watched user page, present only when
|
|
26
|
-
*
|
|
27
|
-
* actually watched.
|
|
25
|
+
* Expiry applied to the watched user page, present only when `watchuser=1`
|
|
26
|
+
* took effect.
|
|
28
27
|
*/
|
|
29
|
-
watchlistexpiry?:
|
|
28
|
+
watchlistexpiry?: WatchlistExpiry;
|
|
30
29
|
}
|
|
31
30
|
/** Response of `action=unblock`. */
|
|
32
31
|
export interface ApiUnblockResponse extends ApiEnvelope {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @see https://www.mediawiki.org/wiki/API:User_group_membership
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { WatchlistExpiry } from "../common";
|
|
13
13
|
import type { ApiEnvelope } from "../envelope";
|
|
14
14
|
/** Response of `action=userrights`. */
|
|
15
15
|
export interface ApiUserrightsResponse extends ApiEnvelope {
|
|
@@ -31,10 +31,9 @@ export interface ApiUserrightsResponse extends ApiEnvelope {
|
|
|
31
31
|
*/
|
|
32
32
|
watchuser?: boolean;
|
|
33
33
|
/**
|
|
34
|
-
* Expiry of the watch on the user's user page
|
|
35
|
-
*
|
|
36
|
-
* `watchlistexpiry` was supplied; the value is read back from the watchlist.
|
|
34
|
+
* Expiry of the watch on the user's user page, present only when
|
|
35
|
+
* `watchuser=1` took effect.
|
|
37
36
|
*/
|
|
38
|
-
watchlistexpiry?:
|
|
37
|
+
watchlistexpiry?: WatchlistExpiry;
|
|
39
38
|
};
|
|
40
39
|
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @see https://www.mediawiki.org/wiki/Extension:DiscussionTools
|
|
29
29
|
*/
|
|
30
|
-
import type { Flag,
|
|
30
|
+
import type { Flag, Timestamp, WatchlistExpiry } from "../common";
|
|
31
31
|
import type { ApiEnvelope } from "../envelope";
|
|
32
32
|
import type { ApiParse } from "../core/parse";
|
|
33
33
|
import type { ApiThankResult } from "./thanks";
|
|
@@ -237,8 +237,11 @@ export interface ApiDiscussionToolsPreviewResponse extends ApiEnvelope {
|
|
|
237
237
|
export interface ApiDiscussionToolsEditResponse extends ApiEnvelope {
|
|
238
238
|
/** Result of `action=discussiontoolsedit`. */
|
|
239
239
|
discussiontoolsedit: {
|
|
240
|
-
/**
|
|
241
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Outcome of the delegated `action=visualeditoredit` call: `success` when
|
|
242
|
+
* the comment was saved, `error` when the save was rejected.
|
|
243
|
+
*/
|
|
244
|
+
result?: "success" | "error";
|
|
242
245
|
/** Rendered HTML of the saved comment area. */
|
|
243
246
|
content?: string;
|
|
244
247
|
/**
|
|
@@ -276,6 +279,6 @@ export interface ApiDiscussionToolsEditResponse extends ApiEnvelope {
|
|
|
276
279
|
/** Whether the user now watches the page. */
|
|
277
280
|
watched?: boolean;
|
|
278
281
|
/** When that watch expires; `null` for a permanent watch. */
|
|
279
|
-
watchlistexpiry?:
|
|
282
|
+
watchlistexpiry?: WatchlistExpiry;
|
|
280
283
|
};
|
|
281
284
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
*
|
|
32
32
|
* @see https://www.mediawiki.org/wiki/Extension:Echo
|
|
33
33
|
*/
|
|
34
|
-
import type { NamespaceIndex,
|
|
34
|
+
import type { NamespaceIndex, Timestamp } from "../common";
|
|
35
35
|
import type { ApiEnvelope } from "../envelope";
|
|
36
36
|
/** A notification count: numeric `rawcount` plus a localized `count` string. */
|
|
37
37
|
export interface ApiEchoNotificationCount {
|
|
@@ -42,8 +42,11 @@ export interface ApiEchoNotificationCount {
|
|
|
42
42
|
}
|
|
43
43
|
/** The `echomarkread` object (returned under `query` by `action=echomarkread`). */
|
|
44
44
|
export interface ApiQueryEchoMarkRead {
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Success sentinel; a foreign wiki that fails is reported per wiki in
|
|
47
|
+
* {@link errors} instead of changing this value.
|
|
48
|
+
*/
|
|
49
|
+
result: "success";
|
|
47
50
|
/** Per-wiki error from a failed foreign (cross-wiki) subrequest. */
|
|
48
51
|
errors?: {
|
|
49
52
|
/** Error reported for the foreign wiki the key names. */
|
|
@@ -67,8 +70,8 @@ export interface ApiQueryEchoMarkRead {
|
|
|
67
70
|
}
|
|
68
71
|
/** The `echomarkseen` object (returned under `query` by `action=echomarkseen`). */
|
|
69
72
|
export interface ApiQueryEchoMarkSeen {
|
|
70
|
-
/**
|
|
71
|
-
result?:
|
|
73
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
74
|
+
result?: "success";
|
|
72
75
|
/** The "all notifications seen" timestamp just recorded. */
|
|
73
76
|
timestamp?: Timestamp;
|
|
74
77
|
}
|
|
@@ -261,11 +264,11 @@ export interface ApiQueryEchoUnreadPages {
|
|
|
261
264
|
}
|
|
262
265
|
/**
|
|
263
266
|
* Response of `action=echomute`. The module writes a plain status **string**
|
|
264
|
-
*
|
|
267
|
+
* rather than a wrapper object.
|
|
265
268
|
*/
|
|
266
269
|
export interface ApiEchoMuteResponse extends ApiEnvelope {
|
|
267
|
-
/**
|
|
268
|
-
echomute:
|
|
270
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
271
|
+
echomute: "success";
|
|
269
272
|
}
|
|
270
273
|
/**
|
|
271
274
|
* Response of `action=echocreateevent`. Shape of the `ApiEchoCreateEvent`
|
|
@@ -276,8 +279,8 @@ export interface ApiEchoMuteResponse extends ApiEnvelope {
|
|
|
276
279
|
export interface ApiEchoCreateEventResponse extends ApiEnvelope {
|
|
277
280
|
/** Result of `action=echocreateevent`. */
|
|
278
281
|
echocreateevent: {
|
|
279
|
-
/**
|
|
280
|
-
result?:
|
|
282
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
283
|
+
result?: "success";
|
|
281
284
|
};
|
|
282
285
|
}
|
|
283
286
|
/**
|
|
@@ -285,8 +288,8 @@ export interface ApiEchoCreateEventResponse extends ApiEnvelope {
|
|
|
285
288
|
* only registered when `$wgAllowArticleReminderNotification` is on.
|
|
286
289
|
*/
|
|
287
290
|
export interface ApiQueryEchoArticleReminder {
|
|
288
|
-
/**
|
|
289
|
-
result?:
|
|
291
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
292
|
+
result?: "success";
|
|
290
293
|
}
|
|
291
294
|
/**
|
|
292
295
|
* Responses of `action=echopushsubscriptions`: the `command` value is the
|
|
@@ -296,13 +299,13 @@ export interface ApiQueryEchoArticleReminder {
|
|
|
296
299
|
export interface ApiEchoPushSubscriptionsResponse extends ApiEnvelope {
|
|
297
300
|
/** `command=create` — the subscription was stored. */
|
|
298
301
|
create?: {
|
|
299
|
-
/**
|
|
300
|
-
result?:
|
|
302
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
303
|
+
result?: "Success";
|
|
301
304
|
};
|
|
302
305
|
/** `command=delete` — the subscription was removed. */
|
|
303
306
|
delete?: {
|
|
304
|
-
/**
|
|
305
|
-
result?:
|
|
307
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
308
|
+
result?: "Success";
|
|
306
309
|
};
|
|
307
310
|
}
|
|
308
311
|
declare module "types-mediawiki-response" {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
*
|
|
32
32
|
* @see https://www.mediawiki.org/wiki/Extension:FlaggedRevs
|
|
33
33
|
*/
|
|
34
|
-
import type { Expiry,
|
|
34
|
+
import type { Expiry, Timestamp } from "../common";
|
|
35
35
|
import type { ApiPageRef } from "../core/query/shared";
|
|
36
36
|
import type { ApiEnvelope } from "../envelope";
|
|
37
37
|
/** A page's FlaggedRevs state (`prop=flagged`). */
|
|
@@ -121,7 +121,7 @@ export interface ApiReviewResponse extends ApiEnvelope {
|
|
|
121
121
|
/** Result of `action=review`. */
|
|
122
122
|
review: {
|
|
123
123
|
/** `Success` when the review was recorded; failures surface as API errors. */
|
|
124
|
-
result:
|
|
124
|
+
result: "Success";
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @see https://www.mediawiki.org/wiki/Extension:GlobalPreferences
|
|
21
21
|
*/
|
|
22
|
-
import type { SuccessStatus } from "../common";
|
|
23
22
|
import type { ApiEnvelope } from "../envelope";
|
|
24
23
|
/**
|
|
25
24
|
* Value of a global preference: the stored value, returned verbatim (always a
|
|
@@ -48,7 +47,7 @@ export interface ApiGlobalPreferencesResult {
|
|
|
48
47
|
*/
|
|
49
48
|
export interface ApiGlobalPreferencesResponse extends ApiEnvelope {
|
|
50
49
|
/** Plain status string rather than a wrapper object; `success` on success. */
|
|
51
|
-
globalpreferences:
|
|
50
|
+
globalpreferences: "success";
|
|
52
51
|
}
|
|
53
52
|
/**
|
|
54
53
|
* Response of `action=globalpreferenceoverrides` — same reply style as
|
|
@@ -56,7 +55,7 @@ export interface ApiGlobalPreferencesResponse extends ApiEnvelope {
|
|
|
56
55
|
*/
|
|
57
56
|
export interface ApiGlobalPreferenceOverridesResponse extends ApiEnvelope {
|
|
58
57
|
/** Plain status string rather than a wrapper object; `success` on success. */
|
|
59
|
-
globalpreferenceoverrides:
|
|
58
|
+
globalpreferenceoverrides: "success";
|
|
60
59
|
}
|
|
61
60
|
declare module "types-mediawiki-response" {
|
|
62
61
|
interface ApiQueryResult {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://www.mediawiki.org/wiki/Extension:MassMessage
|
|
25
25
|
*/
|
|
26
|
-
import type { SuccessStatus } from "../common";
|
|
27
26
|
import type { ApiEnvelope } from "../envelope";
|
|
28
27
|
/** The `mmcontent` object of a `prop=mmcontent` response. */
|
|
29
28
|
export interface ApiMmContent {
|
|
@@ -65,7 +64,7 @@ export interface ApiEditMassMessageListResult {
|
|
|
65
64
|
* `Success` when everything applied; `Done` when any submitted target was
|
|
66
65
|
* invalid (see {@link invalidadd} / {@link invalidremove}).
|
|
67
66
|
*/
|
|
68
|
-
result: "Success" | "Done"
|
|
67
|
+
result: "Success" | "Done";
|
|
69
68
|
/** Targets actually added (deduplicated, canonicalized). */
|
|
70
69
|
added?: ApiMassMessageTarget[];
|
|
71
70
|
/** Targets removed. */
|
|
@@ -87,7 +86,7 @@ export interface ApiEditMassMessageListResponse extends ApiEnvelope {
|
|
|
87
86
|
/** The `massmessage` object of an `action=massmessage` response. */
|
|
88
87
|
export interface ApiMassMessageResult {
|
|
89
88
|
/** `success` (lowercase) when delivery was queued. */
|
|
90
|
-
result:
|
|
89
|
+
result: "success";
|
|
91
90
|
/** Number of targets the message was queued for. */
|
|
92
91
|
count: number;
|
|
93
92
|
}
|
|
@@ -44,8 +44,8 @@ export interface ApiSiteMatrixLanguage {
|
|
|
44
44
|
name?: string | null;
|
|
45
45
|
/** Localized language name (in the interface language); `smlangprop=localname`. */
|
|
46
46
|
localname?: string;
|
|
47
|
-
/** Text direction of the language
|
|
48
|
-
dir?: "ltr" | "rtl"
|
|
47
|
+
/** Text direction of the language. */
|
|
48
|
+
dir?: "ltr" | "rtl";
|
|
49
49
|
/** Wikis of this language in each project family. */
|
|
50
50
|
site?: ApiSiteMatrixSite[];
|
|
51
51
|
}
|
|
@@ -56,14 +56,18 @@ export interface ApiVideoTimedTextTrack {
|
|
|
56
56
|
* `origin=*` for cross-origin playback).
|
|
57
57
|
*/
|
|
58
58
|
src?: string;
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Track kind; `subtitles` for the text tracks TMH generates. **Open union**:
|
|
61
|
+
* a track mirrored from a foreign file repository keeps the kind that
|
|
62
|
+
* repository reports.
|
|
63
|
+
*/
|
|
60
64
|
kind?: "subtitles" | (string & {});
|
|
61
65
|
/** MIME type of the track, e.g. `text/x-srt` or `text/vtt`. */
|
|
62
66
|
type?: string;
|
|
63
67
|
/** Track language (BCP 47). */
|
|
64
68
|
srclang?: string;
|
|
65
|
-
/** Text direction of the track language
|
|
66
|
-
dir?: "ltr" | "rtl"
|
|
69
|
+
/** Text direction of the track language. */
|
|
70
|
+
dir?: "ltr" | "rtl";
|
|
67
71
|
/** Human-readable track label including the language name. */
|
|
68
72
|
label?: string;
|
|
69
73
|
}
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
* * `templatesused` → `visualeditor` is a bare HTML **string** (a
|
|
17
17
|
* `<div class="templatesUsed">` block), not the usual object.
|
|
18
18
|
*
|
|
19
|
-
* `notices` and `blockinfo` show the
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* `notices`, `checkboxesDef`/`checkboxesMessages` and `blockinfo` show the
|
|
20
|
+
* classic PHP-to-JSON traps: each map is keyed once populated but an empty
|
|
21
|
+
* **array** when there is nothing to show (an anonymous request has no
|
|
22
|
+
* applicable save-form fields), and `blockinfo` is `null` rather than absent
|
|
23
|
+
* for an unblocked user.
|
|
22
24
|
*
|
|
23
25
|
* `action=visualeditoredit` requires a `paction` parameter selecting the
|
|
24
26
|
* operation (`save`, `diff`, `serialize`, `serializeforcache`). `save` returns
|
|
@@ -32,7 +34,7 @@
|
|
|
32
34
|
*
|
|
33
35
|
* @see https://www.mediawiki.org/wiki/Extension:VisualEditor
|
|
34
36
|
*/
|
|
35
|
-
import type { Flag,
|
|
37
|
+
import type { Flag, Timestamp, WatchlistExpiry } from "../common";
|
|
36
38
|
import type { ApiEditResult } from "../core/edit";
|
|
37
39
|
import type { ApiBlockInfo } from "../core/query/users";
|
|
38
40
|
import type { ApiEnvelope } from "../envelope";
|
|
@@ -85,7 +87,7 @@ export interface ApiLastModified {
|
|
|
85
87
|
/** The page frame both `visualeditor` and `visualeditoredit` return. */
|
|
86
88
|
export interface ApiVisualEditorPageFrame {
|
|
87
89
|
/** Outcome of the request; `error` on the save-failure branch. */
|
|
88
|
-
result?: "success" | "error"
|
|
90
|
+
result?: "success" | "error";
|
|
89
91
|
/** Rendered page body (HTML for `parse`, wikitext for `wikitext`). */
|
|
90
92
|
content?: string;
|
|
91
93
|
/** Whether {@link content} came from a preload rather than the page. */
|
|
@@ -114,7 +116,7 @@ export interface ApiVisualEditorPageFrame {
|
|
|
114
116
|
/** Whether the editor watches the page now. */
|
|
115
117
|
watched?: boolean;
|
|
116
118
|
/** When that watch expires; `null` when permanent. */
|
|
117
|
-
watchlistexpiry?:
|
|
119
|
+
watchlistexpiry?: WatchlistExpiry;
|
|
118
120
|
/** HTML diff, from `visualeditoredit` `paction=diff`. */
|
|
119
121
|
diff?: string;
|
|
120
122
|
/** Key into the serialisation cache, from `visualeditoredit` `paction=serializeforcache`. */
|
|
@@ -145,10 +147,16 @@ export interface ApiVisualEditorResponse extends ApiEnvelope {
|
|
|
145
147
|
notices: Record<string, string> | unknown[];
|
|
146
148
|
/** Copyright warning HTML; `""` when none applies. */
|
|
147
149
|
copyrightWarning: string;
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Definitions of the save-form fields, keyed by element id. An empty PHP
|
|
152
|
+
* map, so `[]` when no field applies to the requesting user.
|
|
153
|
+
*/
|
|
154
|
+
checkboxesDef: Record<string, ApiVisualEditorCheckboxDef> | unknown[];
|
|
155
|
+
/**
|
|
156
|
+
* Plain text of the messages referenced by `checkboxesDef`. An empty PHP
|
|
157
|
+
* map, so `[]` when there are no messages.
|
|
158
|
+
*/
|
|
159
|
+
checkboxesMessages: Record<string, string> | unknown[];
|
|
152
160
|
/** CSS classes for protection state, joined into one string (`""` when none). */
|
|
153
161
|
protectedClasses: string;
|
|
154
162
|
/** Base timestamp for edit-conflict detection. */
|
|
@@ -186,8 +194,8 @@ export interface ApiVisualEditorTemplatesUsedResponse extends ApiEnvelope {
|
|
|
186
194
|
export interface ApiVisualEditorParseFragmentResponse extends ApiEnvelope {
|
|
187
195
|
/** Result of `action=visualeditor&paction=parsefragment`. */
|
|
188
196
|
visualeditor: {
|
|
189
|
-
/**
|
|
190
|
-
result:
|
|
197
|
+
/** Success sentinel; a rejected call comes back as a top-level error. */
|
|
198
|
+
result: "success";
|
|
191
199
|
/** Transformed wikitext fragment. */
|
|
192
200
|
content: string;
|
|
193
201
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "types-mediawiki-response",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "TypeScript type definitions for MediaWiki Action API responses",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"action-api",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"check:examples": "pnpm run build && pnpm --filter ./examples/* run typecheck",
|
|
56
56
|
"check:pack": "pnpm run build && attw --pack .",
|
|
57
57
|
"release": "pnpm run check && bumpp",
|
|
58
|
+
"release-notes": "tsx scripts/generate-release-notes.ts",
|
|
58
59
|
"docs:dev": "pnpm --filter types-mediawiki-response-docs dev",
|
|
59
60
|
"docs:build": "pnpm --filter types-mediawiki-response-docs build",
|
|
60
61
|
"docs:preview": "pnpm --filter types-mediawiki-response-docs preview"
|