types-mediawiki-response 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/README.zh.md +57 -0
- package/dist/common/index.d.ts +87 -0
- package/dist/core/acquiretempusername.d.ts +17 -0
- package/dist/core/block.d.ts +98 -0
- package/dist/core/changeauthenticationdata.d.ts +18 -0
- package/dist/core/changecontentmodel.d.ts +27 -0
- package/dist/core/checktoken.d.ts +28 -0
- package/dist/core/clearhasmsg.d.ts +15 -0
- package/dist/core/clientlogin.d.ts +48 -0
- package/dist/core/compare.d.ts +92 -0
- package/dist/core/createaccount.d.ts +41 -0
- package/dist/core/delete.d.ts +45 -0
- package/dist/core/edit.d.ts +66 -0
- package/dist/core/emailuser.d.ts +27 -0
- package/dist/core/expandtemplates.d.ts +66 -0
- package/dist/core/filerevert.d.ts +20 -0
- package/dist/core/imagerotate.d.ts +51 -0
- package/dist/core/import.d.ts +29 -0
- package/dist/core/index.d.ts +40 -0
- package/dist/core/languagesearch.d.ts +24 -0
- package/dist/core/login.d.ts +30 -0
- package/dist/core/logout.d.ts +16 -0
- package/dist/core/managetags.d.ts +28 -0
- package/dist/core/mergehistory.d.ts +26 -0
- package/dist/core/move.d.ts +62 -0
- package/dist/core/options.d.ts +16 -0
- package/dist/core/parse.d.ts +324 -0
- package/dist/core/patrol.d.ts +21 -0
- package/dist/core/protect.d.ts +43 -0
- package/dist/core/purge.d.ts +61 -0
- package/dist/core/query/allcategories.d.ts +30 -0
- package/dist/core/query/alldeletedrevisions.d.ts +29 -0
- package/dist/core/query/allfileusages.d.ts +15 -0
- package/dist/core/query/allimages.d.ts +25 -0
- package/dist/core/query/alllinks.d.ts +34 -0
- package/dist/core/query/allmessages.d.ts +43 -0
- package/dist/core/query/allpages.d.ts +23 -0
- package/dist/core/query/allredirects.d.ts +23 -0
- package/dist/core/query/allrevisions.d.ts +30 -0
- package/dist/core/query/alltransclusions.d.ts +14 -0
- package/dist/core/query/allusers.d.ts +37 -0
- package/dist/core/query/authmanagerinfo.d.ts +96 -0
- package/dist/core/query/backlinks.d.ts +34 -0
- package/dist/core/query/blocks.d.ts +104 -0
- package/dist/core/query/categories.d.ts +28 -0
- package/dist/core/query/categoryinfo.d.ts +25 -0
- package/dist/core/query/categorymembers.d.ts +38 -0
- package/dist/core/query/codexicons.d.ts +40 -0
- package/dist/core/query/contributors.d.ts +23 -0
- package/dist/core/query/deletedrevisions.d.ts +21 -0
- package/dist/core/query/deletedrevs.d.ts +84 -0
- package/dist/core/query/duplicatefiles.d.ts +30 -0
- package/dist/core/query/embeddedin.d.ts +28 -0
- package/dist/core/query/extlinks.d.ts +17 -0
- package/dist/core/query/exturlusage.d.ts +30 -0
- package/dist/core/query/filearchive.d.ts +91 -0
- package/dist/core/query/filerepoinfo.d.ts +51 -0
- package/dist/core/query/fileusage.d.ts +26 -0
- package/dist/core/query/imageinfo.d.ts +214 -0
- package/dist/core/query/images.d.ts +20 -0
- package/dist/core/query/imageusage.d.ts +36 -0
- package/dist/core/query/index.d.ts +489 -0
- package/dist/core/query/info.d.ts +208 -0
- package/dist/core/query/iwbacklinks.d.ts +28 -0
- package/dist/core/query/iwlinks.d.ts +21 -0
- package/dist/core/query/langbacklinks.d.ts +28 -0
- package/dist/core/query/langlinks.d.ts +32 -0
- package/dist/core/query/languageinfo.d.ts +70 -0
- package/dist/core/query/links.d.ts +22 -0
- package/dist/core/query/linkshere.d.ts +25 -0
- package/dist/core/query/logevents.d.ts +77 -0
- package/dist/core/query/mystashedfiles.d.ts +39 -0
- package/dist/core/query/pagepropnames.d.ts +18 -0
- package/dist/core/query/pageprops.d.ts +19 -0
- package/dist/core/query/pageswithprop.d.ts +28 -0
- package/dist/core/query/prefixsearch.d.ts +27 -0
- package/dist/core/query/protectedtitles.d.ts +43 -0
- package/dist/core/query/querypage.d.ts +59 -0
- package/dist/core/query/random.d.ts +30 -0
- package/dist/core/query/recentchanges.d.ts +103 -0
- package/dist/core/query/redirects.d.ts +27 -0
- package/dist/core/query/revisions.d.ts +176 -0
- package/dist/core/query/search.d.ts +141 -0
- package/dist/core/query/siteinfo.d.ts +731 -0
- package/dist/core/query/stashimageinfo.d.ts +101 -0
- package/dist/core/query/tags.d.ts +34 -0
- package/dist/core/query/templates.d.ts +20 -0
- package/dist/core/query/tokens.d.ts +34 -0
- package/dist/core/query/trackingcategories.d.ts +25 -0
- package/dist/core/query/transcludedin.d.ts +25 -0
- package/dist/core/query/usercontribs.d.ts +72 -0
- package/dist/core/query/userinfo.d.ts +141 -0
- package/dist/core/query/users.d.ts +164 -0
- package/dist/core/query/watchlist.d.ts +109 -0
- package/dist/core/query/watchlistraw.d.ts +42 -0
- package/dist/core/removeauthenticationdata.d.ts +18 -0
- package/dist/core/resetpassword.d.ts +16 -0
- package/dist/core/revisiondelete.d.ts +83 -0
- package/dist/core/rollback.d.ts +27 -0
- package/dist/core/setnotificationtimestamp.d.ts +47 -0
- package/dist/core/setpagelanguage.d.ts +24 -0
- package/dist/core/stashedit.d.ts +25 -0
- package/dist/core/tag.d.ts +49 -0
- package/dist/core/upload.d.ts +106 -0
- package/dist/core/userrights.d.ts +41 -0
- package/dist/core/validatepassword.d.ts +28 -0
- package/dist/core/watch.d.ts +45 -0
- package/dist/envelope/index.d.ts +122 -0
- package/dist/extensions/abusefilters.d.ts +207 -0
- package/dist/extensions/babel.d.ts +32 -0
- package/dist/extensions/categorytree.d.ts +78 -0
- package/dist/extensions/checkuser.d.ts +148 -0
- package/dist/extensions/description.d.ts +22 -0
- package/dist/extensions/discussiontools.d.ts +273 -0
- package/dist/extensions/echo.d.ts +306 -0
- package/dist/extensions/extracts.d.ts +24 -0
- package/dist/extensions/flaggedrevs.d.ts +192 -0
- package/dist/extensions/gadgets.d.ts +148 -0
- package/dist/extensions/globalblocks.d.ts +115 -0
- package/dist/extensions/globalpreferences.d.ts +62 -0
- package/dist/extensions/globalusage.d.ts +41 -0
- package/dist/extensions/globaluserinfo.d.ts +95 -0
- package/dist/extensions/linter.d.ts +83 -0
- package/dist/extensions/massmessage.d.ts +108 -0
- package/dist/extensions/oathauth.d.ts +86 -0
- package/dist/extensions/pageimages.d.ts +33 -0
- package/dist/extensions/pageviews.d.ts +63 -0
- package/dist/extensions/scribunto.d.ts +61 -0
- package/dist/extensions/sitematrix.d.ts +109 -0
- package/dist/extensions/spamblacklist.d.ts +25 -0
- package/dist/extensions/templatedata.d.ts +130 -0
- package/dist/extensions/thanks.d.ts +29 -0
- package/dist/extensions/timedmediahandler.d.ts +121 -0
- package/dist/extensions/titleblacklist.d.ts +29 -0
- package/dist/extensions/urlshortener.d.ts +42 -0
- package/dist/extensions/visualeditor.d.ts +204 -0
- package/dist/extensions/wikibase.d.ts +100 -0
- package/dist/extensions/wikilove.d.ts +38 -0
- package/dist/index.d.ts +3 -0
- package/package.json +76 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prop=stashimageinfo` — metadata of files sitting in the current user's upload
|
|
3
|
+
* stash, selected by `siifilekey` rather than by title.
|
|
4
|
+
*
|
|
5
|
+
* Because the query is keyed by filekey, the rows come back as `query.stashimageinfo`
|
|
6
|
+
* instead of hanging off a `pages[]` entry, and the response does not echo the
|
|
7
|
+
* `filekey` — entries follow the order of the requested keys.
|
|
8
|
+
*
|
|
9
|
+
* `siiprop` is a subset of `prop=imageinfo`'s `iiprop` in 1.43: `user`, `userid`,
|
|
10
|
+
* `comment`, `parsedcomment`, `mediatype`, `archivename` and `uploadwarning` are
|
|
11
|
+
* not accepted values here. Unlike `list=filearchive`, the measurements here are
|
|
12
|
+
* numbers.
|
|
13
|
+
*
|
|
14
|
+
* @see https://www.mediawiki.org/wiki/API:Stashimageinfo
|
|
15
|
+
*/
|
|
16
|
+
import type { Timestamp } from "../../common";
|
|
17
|
+
import type { ApiExtMetadataField, ApiImageMetadataItem } from "./imageinfo";
|
|
18
|
+
/** Metadata of one stashed file. */
|
|
19
|
+
export interface ApiStashImageInfo {
|
|
20
|
+
/** When the file was stashed. `siiprop=timestamp`. */
|
|
21
|
+
timestamp?: Timestamp;
|
|
22
|
+
/** Canonical localized file title. `siiprop=canonicaltitle`. */
|
|
23
|
+
canonicaltitle?: string;
|
|
24
|
+
/** Size in bytes. `siiprop=size|dimensions`. */
|
|
25
|
+
size?: number;
|
|
26
|
+
/** Pixel height. `siiprop=size|dimensions`. */
|
|
27
|
+
height?: number;
|
|
28
|
+
/** Pixel width. `siiprop=size|dimensions`. */
|
|
29
|
+
width?: number;
|
|
30
|
+
/** Content checksum (hex). `siiprop=sha1`. */
|
|
31
|
+
sha1?: string;
|
|
32
|
+
/** MIME type, e.g. `image/png`. `siiprop=mime`. */
|
|
33
|
+
mime?: string;
|
|
34
|
+
/**
|
|
35
|
+
* MIME type the thumbnail will be rendered as. `siiprop=thumbmime`; requires
|
|
36
|
+
* `siiprop=url` and a transform via `siiurlwidth`/`siiurlheight`.
|
|
37
|
+
*/
|
|
38
|
+
thumbmime?: string;
|
|
39
|
+
/** Colour depth in bits. `siiprop=bitdepth`. */
|
|
40
|
+
bitdepth?: number;
|
|
41
|
+
/** Direct URL to the stashed file (an `Special:UploadStash/file/…` link). `siiprop=url`. */
|
|
42
|
+
url?: string;
|
|
43
|
+
/** URL of the file description page. `siiprop=url`; equals {@link url} for a stashed file. */
|
|
44
|
+
descriptionurl?: string;
|
|
45
|
+
/** Shortened description-page URL. `siiprop=url`; only when the repo returns one. */
|
|
46
|
+
descriptionshorturl?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Scaled thumbnail URL. Requires `siiprop=url`, plus a transform requested
|
|
49
|
+
* via `siiurlwidth`, `siiurlheight` or `siiurlparam`.
|
|
50
|
+
*/
|
|
51
|
+
thumburl?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Scaled thumbnail width (px). Falls back to the file's own width when no
|
|
54
|
+
* resize happened. Same requirements as {@link thumburl}.
|
|
55
|
+
*/
|
|
56
|
+
thumbwidth?: number;
|
|
57
|
+
/** Scaled thumbnail height (px). Falls back to the file's own height like {@link thumbwidth}. */
|
|
58
|
+
thumbheight?: number;
|
|
59
|
+
/**
|
|
60
|
+
* HiDPI (`2x`, …) source URLs keyed by pixel-density multiplier. Requires
|
|
61
|
+
* `siiprop=url`, plus a successful transform.
|
|
62
|
+
*/
|
|
63
|
+
responsiveUrls?: Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* Rendered text of the thumbnail error, when the requested thumbnail could
|
|
66
|
+
* not be made. Requires `siiprop=url`, plus a transform via
|
|
67
|
+
* `siiurlwidth`/`siiurlheight`/`siiurlparam`.
|
|
68
|
+
*/
|
|
69
|
+
thumberror?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Raw format metadata (EXIF / PNG chunks / …). `siiprop=metadata`;
|
|
72
|
+
* `null` when the file has none.
|
|
73
|
+
*/
|
|
74
|
+
metadata?: ApiImageMetadataItem[] | null;
|
|
75
|
+
/**
|
|
76
|
+
* Metadata keys common to all file types, same item shape as
|
|
77
|
+
* {@link metadata}. `siiprop=commonmetadata`; an empty PHP map, so `[]`
|
|
78
|
+
* when there is none.
|
|
79
|
+
*/
|
|
80
|
+
commonmetadata?: ApiImageMetadataItem[];
|
|
81
|
+
/** Structured/extended metadata keyed by field name. `siiprop=extmetadata`. */
|
|
82
|
+
extmetadata?: Record<string, ApiExtMetadataField>;
|
|
83
|
+
/**
|
|
84
|
+
* Media duration in seconds (audio/video), when the handler reports one.
|
|
85
|
+
* Emitted under `siiprop=size|dimensions`; there is no
|
|
86
|
+
* `siiprop=duration`.
|
|
87
|
+
*/
|
|
88
|
+
duration?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Page count (multi-page documents such as PDFs/TIFFs), when the handler
|
|
91
|
+
* supports one. Emitted under `siiprop=size|dimensions`; there
|
|
92
|
+
* is no `siiprop=pagecount`.
|
|
93
|
+
*/
|
|
94
|
+
pagecount?: number;
|
|
95
|
+
}
|
|
96
|
+
declare module "./index" {
|
|
97
|
+
interface ApiQueryResult {
|
|
98
|
+
/** Stashed files named by `siifilekey` (`prop=stashimageinfo`). */
|
|
99
|
+
stashimageinfo?: ApiStashImageInfo[];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=tags` — defined change tags, merged into {@link ApiQueryResult} via
|
|
3
|
+
* declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* The module's parameter prefix is `tg`, so the cursor is `tgcontinue`.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.mediawiki.org/wiki/API:Tags
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One change-tag definition. `tgprop` selects the optional fields; `name` is
|
|
11
|
+
* always present.
|
|
12
|
+
*/
|
|
13
|
+
export interface ApiTag {
|
|
14
|
+
/** Internal tag name (used by `rcprop=tags` / revision `tags`). */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Human-readable display name (may contain HTML). `tgprop=displayname`. */
|
|
17
|
+
displayname?: string;
|
|
18
|
+
/** Description (wikitext). `tgprop=description`. */
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Number of revisions/logs carrying this tag. `tgprop=hitcount`. */
|
|
21
|
+
hitcount?: number;
|
|
22
|
+
/** Whether the tag has a definition page. `tgprop=defined`; a real `boolean`. */
|
|
23
|
+
defined?: boolean;
|
|
24
|
+
/** Where the tag can come from. `tgprop=source`; open union members. */
|
|
25
|
+
source?: ("extension" | "manual" | "software" | (string & {}))[];
|
|
26
|
+
/** Whether the tag is still applicable. `tgprop=active`; a real `boolean`. */
|
|
27
|
+
active?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare module "./index" {
|
|
30
|
+
interface ApiQueryResult {
|
|
31
|
+
/** Change-tag definitions (`list=tags`). */
|
|
32
|
+
tags?: ApiTag[];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prop=templates` — templates (and other pages) transcluded by a page, merged
|
|
3
|
+
* into the shared {@link ApiPage} shape via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Templates
|
|
6
|
+
*/
|
|
7
|
+
import type { NamespaceIndex } from "../../common";
|
|
8
|
+
/** One page transcluded by the subject page. */
|
|
9
|
+
export interface ApiTemplate {
|
|
10
|
+
/** Namespace index of the transcluded page. */
|
|
11
|
+
ns: NamespaceIndex;
|
|
12
|
+
/** Title of the transcluded page. */
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
declare module "./index" {
|
|
16
|
+
interface ApiPage {
|
|
17
|
+
/** Pages transcluded by this page (`prop=templates`). */
|
|
18
|
+
templates?: ApiTemplate[];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `meta=tokens` — CSRF and action tokens, merged into {@link ApiQueryResult}
|
|
3
|
+
* via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Tokens
|
|
6
|
+
*/
|
|
7
|
+
/** Tokens returned by `meta=tokens`; which keys appear depends on `type`. */
|
|
8
|
+
export interface ApiQueryTokens {
|
|
9
|
+
/** Anti-CSRF token for most write actions. `type=csrf` (the default). */
|
|
10
|
+
csrftoken?: string;
|
|
11
|
+
/** `type=watch`. */
|
|
12
|
+
watchtoken?: string;
|
|
13
|
+
/** `type=patrol`. */
|
|
14
|
+
patroltoken?: string;
|
|
15
|
+
/** `type=rollback`. */
|
|
16
|
+
rollbacktoken?: string;
|
|
17
|
+
/** `type=userrights`. */
|
|
18
|
+
userrightstoken?: string;
|
|
19
|
+
/** `type=login`. */
|
|
20
|
+
logintoken?: string;
|
|
21
|
+
/** `type=createaccount`. */
|
|
22
|
+
createaccounttoken?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Extension-provided tokens follow the same `<type>token` shape, e.g.
|
|
25
|
+
* CentralAuth's `deleteglobalaccounttoken` / `setglobalaccountstatustoken`.
|
|
26
|
+
*/
|
|
27
|
+
[token: `${string}token`]: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
declare module "./index" {
|
|
30
|
+
interface ApiQueryResult {
|
|
31
|
+
/** Tokens requested via `meta=tokens`. */
|
|
32
|
+
tokens?: ApiQueryTokens;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=trackingcategories` — enumerate tracking categories that have members
|
|
3
|
+
* (or an existing category page), merged into {@link ApiQueryResult}.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Trackingcategories
|
|
6
|
+
* @since MediaWiki 1.45
|
|
7
|
+
*/
|
|
8
|
+
import type { ApiAllCategory } from "./allcategories";
|
|
9
|
+
/** One tracking-category entry. `tcprop=size|hidden` controls the size fields. */
|
|
10
|
+
export interface ApiTrackingCategory extends ApiAllCategory {
|
|
11
|
+
/** Message key of the tracking category (e.g. `broken-file-category`). */
|
|
12
|
+
catid: string;
|
|
13
|
+
}
|
|
14
|
+
declare module "./index" {
|
|
15
|
+
interface ApiQueryResult {
|
|
16
|
+
/**
|
|
17
|
+
* Tracking categories listed by `list=trackingcategories`. Entries share
|
|
18
|
+
* the `list=allcategories` shape plus {@link catid}; `size`/`hidden` only
|
|
19
|
+
* with the matching `tcprop` values.
|
|
20
|
+
*
|
|
21
|
+
* @since MediaWiki 1.45
|
|
22
|
+
*/
|
|
23
|
+
trackingcategories?: ApiTrackingCategory[];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prop=transcludedin` — pages that transclude (embed) the queried page,
|
|
3
|
+
* merged into {@link ApiPage} via declaration merging. Shape matches
|
|
4
|
+
* `prop=linkshere`.
|
|
5
|
+
*
|
|
6
|
+
* @see https://www.mediawiki.org/wiki/API:Transcludedin
|
|
7
|
+
*/
|
|
8
|
+
import type { NamespaceIndex } from "../../common";
|
|
9
|
+
/** One page in a `transcludedin` result. `tiprop` controls which fields appear. */
|
|
10
|
+
export interface ApiTranscludedIn {
|
|
11
|
+
/** Page id. `tiprop=pageid`. */
|
|
12
|
+
pageid?: number;
|
|
13
|
+
/** Namespace index. */
|
|
14
|
+
ns?: NamespaceIndex;
|
|
15
|
+
/** Full page title. */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Whether the transcluding page is a redirect. `tiprop=redirect`; a real `boolean`. */
|
|
18
|
+
redirect?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare module "./index" {
|
|
21
|
+
interface ApiPage {
|
|
22
|
+
/** Pages transcluding this page (`prop=transcludedin`). */
|
|
23
|
+
transcludedin?: ApiTranscludedIn[];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=usercontribs` — a user's edits, merged into {@link ApiQueryResult} via
|
|
3
|
+
* declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* Unlike `prop=revisions`, the `new` / `minor` / `top` flags are real booleans
|
|
6
|
+
* under `formatversion=2`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.mediawiki.org/wiki/API:Usercontribs
|
|
9
|
+
*/
|
|
10
|
+
import type { Flag, NamespaceIndex, Timestamp } from "../../common";
|
|
11
|
+
/** One contribution record. `ucprop` controls which fields appear. */
|
|
12
|
+
export interface ApiUserContrib {
|
|
13
|
+
/** Author user id; `0` for anonymous editors. Always emitted, regardless of `ucprop`. */
|
|
14
|
+
userid: number;
|
|
15
|
+
/** Author user name or IP. Always emitted, regardless of `ucprop`. */
|
|
16
|
+
user: string;
|
|
17
|
+
/** Id of the edited page. `ucprop=ids`. */
|
|
18
|
+
pageid?: number;
|
|
19
|
+
/** Revision id of this contribution. `ucprop=ids`. */
|
|
20
|
+
revid?: number;
|
|
21
|
+
/** Previous revision id; `0` for a new page. `ucprop=ids`. */
|
|
22
|
+
parentid?: number;
|
|
23
|
+
/** Namespace index. */
|
|
24
|
+
ns?: NamespaceIndex;
|
|
25
|
+
/** Title of the edited page. */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Contribution timestamp. `ucprop=timestamp`. */
|
|
28
|
+
timestamp?: Timestamp;
|
|
29
|
+
/** Whether this created a new page. `ucprop=flags`; a real `boolean`. */
|
|
30
|
+
new?: boolean;
|
|
31
|
+
/** Whether the edit was minor. `ucprop=flags`; a real `boolean`. */
|
|
32
|
+
minor?: boolean;
|
|
33
|
+
/** Whether this is the current revision. `ucprop=flags`; a real `boolean`. */
|
|
34
|
+
top?: boolean;
|
|
35
|
+
/** Raw edit summary. `ucprop=comment`. */
|
|
36
|
+
comment?: string;
|
|
37
|
+
/** HTML-rendered edit summary. `ucprop=parsedcomment`. */
|
|
38
|
+
parsedcomment?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the change has been patrolled. `ucprop=patrolled` (only for a caller
|
|
41
|
+
* that may see patrol state); a real `boolean`, present as `false` too.
|
|
42
|
+
*/
|
|
43
|
+
patrolled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the change was auto-patrolled via the user's rights.
|
|
46
|
+
* `ucprop=patrolled`; a real `boolean`.
|
|
47
|
+
*/
|
|
48
|
+
autopatrolled?: boolean;
|
|
49
|
+
/** Revision size in bytes. `ucprop=size`. */
|
|
50
|
+
size?: number;
|
|
51
|
+
/** Change in bytes vs. the parent. `ucprop=sizediff`. */
|
|
52
|
+
sizediff?: number;
|
|
53
|
+
/** Change tags. `ucprop=tags`. */
|
|
54
|
+
tags?: string[];
|
|
55
|
+
/** The revision content is hidden (revision-deleted). A {@link Flag}. */
|
|
56
|
+
texthidden?: Flag;
|
|
57
|
+
/** The author is hidden (revision-deleted). A {@link Flag}. */
|
|
58
|
+
userhidden?: Flag;
|
|
59
|
+
/** The summary is hidden. `ucprop=comment|parsedcomment`; a {@link Flag}. */
|
|
60
|
+
commenthidden?: Flag;
|
|
61
|
+
/**
|
|
62
|
+
* Oversight/suppression applies to this change (set together with the
|
|
63
|
+
* `*hidden` flags). A {@link Flag}.
|
|
64
|
+
*/
|
|
65
|
+
suppressed?: Flag;
|
|
66
|
+
}
|
|
67
|
+
declare module "./index" {
|
|
68
|
+
interface ApiQueryResult {
|
|
69
|
+
/** A user's contributions (`list=usercontribs`). */
|
|
70
|
+
usercontribs?: ApiUserContrib[];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `meta=userinfo` — information about the *current effective user* (the caller's
|
|
3
|
+
* session; an anonymous IP request returns the anon user), merged into
|
|
4
|
+
* {@link ApiQueryResult}. Distinct from `list=users` (which queries arbitrary
|
|
5
|
+
* named users). Widely used by gadgets/bots to branch on rights and prefs.
|
|
6
|
+
*
|
|
7
|
+
* `options` and `ratelimits` are intentionally open: `options` is a large,
|
|
8
|
+
* site- and user-specific map, and `ratelimits` is keyed by action then by user
|
|
9
|
+
* bucket.
|
|
10
|
+
*
|
|
11
|
+
* @see https://www.mediawiki.org/wiki/API:Userinfo
|
|
12
|
+
*/
|
|
13
|
+
import type { ApiSpecMessage, ApiWatchlistLabel, Flag, Timestamp } from "../../common";
|
|
14
|
+
import type { ApiMessage } from "../../envelope";
|
|
15
|
+
import type { ApiBlockInfo, ApiUserGroupMembership } from "./users";
|
|
16
|
+
/** One entry of the `acceptlang` list (a browser `Accept-Language` parse). */
|
|
17
|
+
export interface ApiAcceptLang {
|
|
18
|
+
/** Quality factor (0–1). */
|
|
19
|
+
q?: number;
|
|
20
|
+
/** Language code, or `*` for the fallback. `uiprop=acceptlang`. */
|
|
21
|
+
code?: string;
|
|
22
|
+
}
|
|
23
|
+
/** A single rate-limit window under `uiprop=ratelimits`. */
|
|
24
|
+
export interface ApiRateLimit {
|
|
25
|
+
/** Allowed hits in the window. */
|
|
26
|
+
hits?: number;
|
|
27
|
+
/** Window length in seconds. */
|
|
28
|
+
seconds?: number;
|
|
29
|
+
}
|
|
30
|
+
/** The `userinfo` object of a `meta=userinfo` response. */
|
|
31
|
+
export interface ApiUserInfo extends ApiBlockInfo {
|
|
32
|
+
/** User id; `0` for anonymous users. */
|
|
33
|
+
id?: number;
|
|
34
|
+
/** User name or IP address. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** `true` for an anonymous (IP) session. A {@link Flag}. */
|
|
37
|
+
anon?: Flag;
|
|
38
|
+
/**
|
|
39
|
+
* `true` for a temporary (auto-created) account. A {@link Flag}.
|
|
40
|
+
*
|
|
41
|
+
* @since MediaWiki 1.42
|
|
42
|
+
*/
|
|
43
|
+
temp?: Flag;
|
|
44
|
+
/** Whether the user has unread talk-page messages. `uiprop=hasmsg`; a real `boolean`. */
|
|
45
|
+
messages?: boolean;
|
|
46
|
+
/** Groups the user is a member of. `uiprop=groups`. */
|
|
47
|
+
groups?: string[];
|
|
48
|
+
/** Group memberships with grant/expiry metadata. `uiprop=groupmemberships`. */
|
|
49
|
+
groupmemberships?: ApiUserGroupMembership[];
|
|
50
|
+
/** Implicit groups (from inherent rights). `uiprop=implicitgroups`. */
|
|
51
|
+
implicitgroups?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Groups the (current) user may add/remove, and the self-service subsets.
|
|
54
|
+
* `uiprop=changeablegroups`. Hyphenated keys are literal.
|
|
55
|
+
*/
|
|
56
|
+
changeablegroups?: {
|
|
57
|
+
add?: string[];
|
|
58
|
+
remove?: string[];
|
|
59
|
+
"add-self"?: string[];
|
|
60
|
+
"remove-self"?: string[];
|
|
61
|
+
};
|
|
62
|
+
/** Effective rights. `uiprop=rights`. */
|
|
63
|
+
rights?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* Whether the user can create accounts. `uiprop=cancreateaccount`; a real
|
|
66
|
+
* `boolean` (`false` when a policy prevents it), not a {@link Flag}.
|
|
67
|
+
*
|
|
68
|
+
* @since MediaWiki 1.40
|
|
69
|
+
*/
|
|
70
|
+
cancreateaccount?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Why account creation is not allowed, as message objects. `uiprop=cancreateaccount`;
|
|
73
|
+
* present only when the `cancreateaccount` check does not pass.
|
|
74
|
+
*
|
|
75
|
+
* The shape follows the request's `errorformat`: under the default (`bc`)
|
|
76
|
+
* format these are `{ message, params, code, type }` specs, under a modern
|
|
77
|
+
* format they are full {@link ApiMessage}s.
|
|
78
|
+
*
|
|
79
|
+
* @since MediaWiki 1.40
|
|
80
|
+
*/
|
|
81
|
+
cancreateaccounterror?: ApiSpecMessage[] | ApiMessage[];
|
|
82
|
+
/** The user's preferences map (open; site/user specific). `uiprop=options`. */
|
|
83
|
+
options?: Record<string, string | number | boolean | null>;
|
|
84
|
+
/** Total edit count. `uiprop=editcount`. */
|
|
85
|
+
editcount?: number;
|
|
86
|
+
/** Registration timestamp. `uiprop=registrationdate`. */
|
|
87
|
+
registrationdate?: Timestamp;
|
|
88
|
+
/** Timestamp of the user's latest edit. `uiprop=latestcontrib`; absent with no edits. */
|
|
89
|
+
latestcontrib?: Timestamp;
|
|
90
|
+
/** Effective rate limits keyed by action then bucket. `uiprop=ratelimits`. */
|
|
91
|
+
ratelimits?: Record<string, Record<string, ApiRateLimit>>;
|
|
92
|
+
/**
|
|
93
|
+
* Rate limits that *would* apply to this user, ignoring the exemptions they
|
|
94
|
+
* actually hold (e.g. `noratelimit`). Same shape as {@link ratelimits};
|
|
95
|
+
* `uiprop=theoreticalratelimits`.
|
|
96
|
+
*/
|
|
97
|
+
theoreticalratelimits?: Record<string, Record<string, ApiRateLimit>>;
|
|
98
|
+
/** Parsed `Accept-Language`. `uiprop=acceptlang`. */
|
|
99
|
+
acceptlang?: ApiAcceptLang[];
|
|
100
|
+
/**
|
|
101
|
+
* Custom watchlist exclusion/inclusion labels. `uiprop=watchlistlabels`;
|
|
102
|
+
* requires `$wgEnableWatchlistLabels`, and `[]` when none are set.
|
|
103
|
+
*
|
|
104
|
+
* @since MediaWiki 1.46
|
|
105
|
+
*/
|
|
106
|
+
watchlistlabels?: ApiWatchlistLabel[];
|
|
107
|
+
/**
|
|
108
|
+
* Number of unread watchlist notifications; the string `1000+` once the
|
|
109
|
+
* count reaches the cap. `uiprop=unreadcount`.
|
|
110
|
+
*/
|
|
111
|
+
unreadcount?: number | string;
|
|
112
|
+
/**
|
|
113
|
+
* Real name. `uiprop=realname`; also absent when `$wgHiddenPrefs` includes
|
|
114
|
+
* `realname`.
|
|
115
|
+
*/
|
|
116
|
+
realname?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The user's email address. `uiprop=email`, and only for a caller with
|
|
119
|
+
* `viewmyprivateinfo`. An **empty string** when the address is unset or
|
|
120
|
+
* hidden, otherwise the address.
|
|
121
|
+
*/
|
|
122
|
+
email?: string;
|
|
123
|
+
/** When the email address was confirmed. `uiprop=email`; absent when never confirmed. */
|
|
124
|
+
emailauthenticated?: Timestamp;
|
|
125
|
+
/** Global (CentralAuth) ids keyed by provider. `uiprop=centralids`. */
|
|
126
|
+
centralids?: Record<string, number>;
|
|
127
|
+
/** Whether the account is attached per provider. `uiprop=centralids`. */
|
|
128
|
+
attachedlocal?: Record<string, boolean>;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the user is attached on the wiki named by the `attachedwiki`
|
|
131
|
+
* parameter, keyed by provider. Requires `uiprop=centralids` together with
|
|
132
|
+
* the `attachedwiki` parameter.
|
|
133
|
+
*/
|
|
134
|
+
attachedwiki?: Record<string, boolean>;
|
|
135
|
+
}
|
|
136
|
+
declare module "./index" {
|
|
137
|
+
interface ApiQueryResult {
|
|
138
|
+
/** The current effective user (`meta=userinfo`). */
|
|
139
|
+
userinfo?: ApiUserInfo;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=users` — information about one or more users, merged into
|
|
3
|
+
* {@link ApiQueryResult} via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Users
|
|
6
|
+
*/
|
|
7
|
+
import type { ApiSpecMessage, Flag, Timestamp } from "../../common";
|
|
8
|
+
/**
|
|
9
|
+
* Block details, as emitted for `usprop=blockinfo` (list=users) and
|
|
10
|
+
* `uiprop=blockinfo` (meta=userinfo). Only present when the user is blocked.
|
|
11
|
+
* The same shape is shared by {@link ApiUser.blockcomponents} entries.
|
|
12
|
+
*/
|
|
13
|
+
export interface ApiBlockInfo {
|
|
14
|
+
/** ID of the block. */
|
|
15
|
+
blockid?: number;
|
|
16
|
+
/** User name of the blocker; `''` when unknown (e.g. autoblocks). */
|
|
17
|
+
blockedby?: string;
|
|
18
|
+
/** User id of the blocker; `0` when unknown. */
|
|
19
|
+
blockedbyid?: number;
|
|
20
|
+
/** Block reason, in plain text. */
|
|
21
|
+
blockreason?: string;
|
|
22
|
+
/** When the block was placed or last modified. */
|
|
23
|
+
blockedtimestamp?: Timestamp;
|
|
24
|
+
/**
|
|
25
|
+
* `blockedtimestamp` localized for the requesting user.
|
|
26
|
+
*/
|
|
27
|
+
blockedtimestampformatted?: string;
|
|
28
|
+
/** Block expiry; the literal `infinite` when the block does not expire. */
|
|
29
|
+
blockexpiry?: Timestamp | "infinite";
|
|
30
|
+
/** `blockexpiry` localized for the requesting user; only when the block expires. */
|
|
31
|
+
blockexpiryformatted?: string;
|
|
32
|
+
/** Human-readable time to expiry (e.g. `in 5 days`); only when the block expires. */
|
|
33
|
+
blockexpiryrelative?: string;
|
|
34
|
+
/** Whether the block only applies to certain pages, namespaces and/or actions. A real `boolean`. */
|
|
35
|
+
blockpartial?: boolean;
|
|
36
|
+
/** Whether the block prevents account creation. A real `boolean`. */
|
|
37
|
+
blocknocreate?: boolean;
|
|
38
|
+
/** Whether the block only affects anonymous users (soft block). A real `boolean`. */
|
|
39
|
+
blockanononly?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the block prevents sending email. A real `boolean`.
|
|
42
|
+
*
|
|
43
|
+
* @since MediaWiki 1.41
|
|
44
|
+
*/
|
|
45
|
+
blockemail?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether editing one's own talk page is prevented. A real `boolean`.
|
|
48
|
+
*
|
|
49
|
+
* @since MediaWiki 1.41
|
|
50
|
+
*/
|
|
51
|
+
blockowntalk?: boolean;
|
|
52
|
+
/** Type of the automatically applied system block; only for system blocks. */
|
|
53
|
+
systemblocktype?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The individual blocks composing this one; only for composite blocks.
|
|
56
|
+
*
|
|
57
|
+
* @since MediaWiki 1.42
|
|
58
|
+
*/
|
|
59
|
+
blockcomponents?: ApiBlockInfo[];
|
|
60
|
+
/**
|
|
61
|
+
* Whether the block also enables the autoblock feature. A real `boolean`.
|
|
62
|
+
*
|
|
63
|
+
* @since MediaWiki 1.46
|
|
64
|
+
*/
|
|
65
|
+
blockautoblocking?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* The block itself is suppressed (hidden from users without the `hideuser`
|
|
68
|
+
* right). A {@link Flag}, present only when suppressed.
|
|
69
|
+
*
|
|
70
|
+
* @since MediaWiki 1.47
|
|
71
|
+
*/
|
|
72
|
+
blockhidden?: Flag;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A single group membership with grant metadata. `usprop=groupmemberships`
|
|
76
|
+
* (vs. the plain name list from `usprop=groups`).
|
|
77
|
+
*/
|
|
78
|
+
export interface ApiUserGroupMembership {
|
|
79
|
+
/** Group key, e.g. `sysop`. */
|
|
80
|
+
group?: string;
|
|
81
|
+
/** When the membership expires: a timestamp, or `infinity` when permanent. */
|
|
82
|
+
expiry?: Timestamp | "infinity";
|
|
83
|
+
}
|
|
84
|
+
/** A user record. `usprop` controls which fields appear. */
|
|
85
|
+
export interface ApiUser extends ApiBlockInfo {
|
|
86
|
+
/**
|
|
87
|
+
* User name (normalized). Present on found entries and on `missing` entries
|
|
88
|
+
* queried by name; absent from `missing` entries queried by `ususerids`.
|
|
89
|
+
*/
|
|
90
|
+
name?: string;
|
|
91
|
+
/**
|
|
92
|
+
* User id. Present on found entries, and on `missing` entries queried by
|
|
93
|
+
* `ususerids` (echoing the requested id); absent from name-queried `missing`
|
|
94
|
+
* entries.
|
|
95
|
+
*/
|
|
96
|
+
userid?: number;
|
|
97
|
+
/** `true` when no such user exists (`missing` is a {@link Flag}). */
|
|
98
|
+
missing?: Flag;
|
|
99
|
+
/** Total edit count. `usprop=editcount`. */
|
|
100
|
+
editcount?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Registration timestamp. `null` for accounts created before registration
|
|
103
|
+
* timestamps were tracked. `usprop=registration`.
|
|
104
|
+
*/
|
|
105
|
+
registration?: Timestamp | null;
|
|
106
|
+
/** Groups the user belongs to (including implicit). `usprop=groups`. */
|
|
107
|
+
groups?: string[];
|
|
108
|
+
/** Group memberships with grant/expiry metadata. `usprop=groupmemberships`. */
|
|
109
|
+
groupmemberships?: ApiUserGroupMembership[];
|
|
110
|
+
/** Groups that apply by virtue of an inherent right, not membership. `usprop=implicitgroups`. */
|
|
111
|
+
implicitgroups?: string[];
|
|
112
|
+
/** Effective rights. `usprop=rights`. */
|
|
113
|
+
rights?: string[];
|
|
114
|
+
/** User gender. `usprop=gender`. Open union for forward compatibility. */
|
|
115
|
+
gender?: "unknown" | "male" | "female" | (string & {});
|
|
116
|
+
/**
|
|
117
|
+
* Whether the user can be emailed. `usprop=emailable`; a real `boolean`
|
|
118
|
+
* (`false` when the address is hidden or unconfirmed), not a {@link Flag}.
|
|
119
|
+
*/
|
|
120
|
+
emailable?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether an account could be created for this name. `usprop=cancreate`; a
|
|
123
|
+
* real `boolean`, present only on `missing` entries queried by name.
|
|
124
|
+
*/
|
|
125
|
+
cancreate?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Why {@link cancreate} is `false`, as message specs (e.g. a reserved
|
|
128
|
+
* username). Emitted only when the creation check failed.
|
|
129
|
+
*/
|
|
130
|
+
cancreateerror?: ApiSpecMessage[];
|
|
131
|
+
/**
|
|
132
|
+
* The user is hidden (suppressed via a hidden block); a {@link Flag}.
|
|
133
|
+
* Emitted regardless of `usprop`.
|
|
134
|
+
*/
|
|
135
|
+
hidden?: Flag;
|
|
136
|
+
/** Global (CentralAuth) ids keyed by provider. `usprop=centralids`. */
|
|
137
|
+
centralids?: Record<string, number>;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the account is attached to each provider, keyed like
|
|
140
|
+
* {@link ApiUser.centralids}. `usprop=centralids`.
|
|
141
|
+
*/
|
|
142
|
+
attachedlocal?: Record<string, boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* `true` when this is a system user (e.g. `MediaWiki default`), absent
|
|
145
|
+
* otherwise; not gated by any `usprop`. A {@link Flag}.
|
|
146
|
+
*
|
|
147
|
+
* @since MediaWiki 1.43
|
|
148
|
+
*/
|
|
149
|
+
systemuser?: Flag;
|
|
150
|
+
/**
|
|
151
|
+
* Whether a temporary account has expired. `usprop=tempexpired`
|
|
152
|
+
* (`auprop=tempexpired` for `list=allusers`); a real `boolean` for a
|
|
153
|
+
* temporary account, and `null` for any other user.
|
|
154
|
+
*
|
|
155
|
+
* @since MediaWiki 1.46
|
|
156
|
+
*/
|
|
157
|
+
tempexpired?: boolean | null;
|
|
158
|
+
}
|
|
159
|
+
declare module "./index" {
|
|
160
|
+
interface ApiQueryResult {
|
|
161
|
+
/** User records (`list=users`). */
|
|
162
|
+
users?: ApiUser[];
|
|
163
|
+
}
|
|
164
|
+
}
|