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,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=recentchanges` — the recent-changes feed, merged into
|
|
3
|
+
* {@link ApiQueryResult} via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* `new` / `minor` / `bot` are real booleans (emitted under `rcprop=flags`,
|
|
6
|
+
* `false` included); `type` is always present; the `log*` fields appear only
|
|
7
|
+
* for `type=log` entries.
|
|
8
|
+
*
|
|
9
|
+
* @see https://www.mediawiki.org/wiki/API:RecentChanges
|
|
10
|
+
*/
|
|
11
|
+
import type { Flag, NamespaceIndex, Timestamp } from "../../common";
|
|
12
|
+
/** Change type (`rctype`). Open union for forward compatibility. */
|
|
13
|
+
export type RecentChangeType = "edit" | "new" | "log" | "categorize" | "external" | (string & {});
|
|
14
|
+
/** One recent-changes entry. `rcprop` controls which fields appear. */
|
|
15
|
+
export interface ApiRecentChange {
|
|
16
|
+
/** Change type. */
|
|
17
|
+
type: RecentChangeType;
|
|
18
|
+
/** Namespace index. */
|
|
19
|
+
ns?: NamespaceIndex;
|
|
20
|
+
/** Page title. */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Page id; `0` for log entries without a page. `rcprop=ids`. */
|
|
23
|
+
pageid?: number;
|
|
24
|
+
/** Revision id; `0` for log entries. `rcprop=ids`. */
|
|
25
|
+
revid?: number;
|
|
26
|
+
/** Previous revision id. `rcprop=ids`. */
|
|
27
|
+
old_revid?: number;
|
|
28
|
+
/** Recent-changes record id. `rcprop=ids`. */
|
|
29
|
+
rcid?: number;
|
|
30
|
+
/** Actor user name or IP. `rcprop=user`. */
|
|
31
|
+
user?: string;
|
|
32
|
+
/** Actor user id. `rcprop=userid`. */
|
|
33
|
+
userid?: number;
|
|
34
|
+
/** Whether the change was made by a bot. `rcprop=flags`; a real `boolean`. */
|
|
35
|
+
bot?: boolean;
|
|
36
|
+
/** Whether the change created a new page. `rcprop=flags`; a real `boolean`. */
|
|
37
|
+
new?: boolean;
|
|
38
|
+
/** Whether the edit was minor. `rcprop=flags`; a real `boolean`. */
|
|
39
|
+
minor?: boolean;
|
|
40
|
+
/** Whether the target is a redirect. `rcprop=redirect`; a real `boolean`. */
|
|
41
|
+
redirect?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the change has been patrolled (manually or automatically).
|
|
44
|
+
* `rcprop=patrolled` (requires rights).
|
|
45
|
+
*/
|
|
46
|
+
patrolled?: boolean;
|
|
47
|
+
/** Auto-patrolled flag. `rcprop=patrolled`. */
|
|
48
|
+
autopatrolled?: boolean;
|
|
49
|
+
/** Unpatrolled flag. `rcprop=patrolled`. */
|
|
50
|
+
unpatrolled?: boolean;
|
|
51
|
+
/** Old revision size in bytes. `rcprop=sizes`. */
|
|
52
|
+
oldlen?: number;
|
|
53
|
+
/** New revision size in bytes. `rcprop=sizes`. */
|
|
54
|
+
newlen?: number;
|
|
55
|
+
/** Change timestamp. `rcprop=timestamp`. */
|
|
56
|
+
timestamp?: Timestamp;
|
|
57
|
+
/** Raw summary. `rcprop=comment`. */
|
|
58
|
+
comment?: string;
|
|
59
|
+
/** HTML-rendered summary. `rcprop=parsedcomment`. */
|
|
60
|
+
parsedcomment?: string;
|
|
61
|
+
/** Change tags. `rcprop=tags`. */
|
|
62
|
+
tags?: string[];
|
|
63
|
+
/** Content checksum (hex). `rcprop=sha1`. */
|
|
64
|
+
sha1?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Made by an anonymous (IP) editor. `rcprop=user|userid`; a {@link Flag}
|
|
67
|
+
* (appears only when true, unlike this module's real-boolean `flags`).
|
|
68
|
+
*/
|
|
69
|
+
anon?: Flag;
|
|
70
|
+
/**
|
|
71
|
+
* The actor is a temporary account. `rcprop=user|userid`; a {@link Flag}.
|
|
72
|
+
*
|
|
73
|
+
* @since MediaWiki 1.42
|
|
74
|
+
*/
|
|
75
|
+
temp?: Flag;
|
|
76
|
+
/** The log action is hidden (log-deleted). `rcprop=ids|title|loginfo`; a {@link Flag}. */
|
|
77
|
+
actionhidden?: Flag;
|
|
78
|
+
/** The actor is hidden. Revision/log-deleted; a {@link Flag}. */
|
|
79
|
+
userhidden?: Flag;
|
|
80
|
+
/** The summary is hidden. Revision/log-deleted; a {@link Flag}. */
|
|
81
|
+
commenthidden?: Flag;
|
|
82
|
+
/** `sha1` is withheld because the content is hidden. A {@link Flag}. */
|
|
83
|
+
sha1hidden?: Flag;
|
|
84
|
+
/**
|
|
85
|
+
* Oversight/suppression applies to this change (set together with the
|
|
86
|
+
* `*hidden` flags). A {@link Flag}.
|
|
87
|
+
*/
|
|
88
|
+
suppressed?: Flag;
|
|
89
|
+
/** Log id. `rcprop=loginfo` (only for `type=log`). */
|
|
90
|
+
logid?: number;
|
|
91
|
+
/** Log type, e.g. `newusers`. `rcprop=loginfo`. */
|
|
92
|
+
logtype?: string;
|
|
93
|
+
/** Log action, e.g. `create`. `rcprop=loginfo`. */
|
|
94
|
+
logaction?: string;
|
|
95
|
+
/** Structured log parameters. `rcprop=loginfo`. */
|
|
96
|
+
logparams?: Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
declare module "./index" {
|
|
99
|
+
interface ApiQueryResult {
|
|
100
|
+
/** Recent changes (`list=recentchanges`). */
|
|
101
|
+
recentchanges?: ApiRecentChange[];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prop=redirects` — pages that redirect to the queried page, merged into
|
|
3
|
+
* {@link ApiPage} via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Redirects
|
|
6
|
+
*/
|
|
7
|
+
import type { NamespaceIndex } from "../../common";
|
|
8
|
+
/** One redirect entry. `rdprop` controls which fields appear. */
|
|
9
|
+
export interface ApiRedirect {
|
|
10
|
+
/** Page id of the redirect. `rdprop=pageid`. */
|
|
11
|
+
pageid?: number;
|
|
12
|
+
/** Namespace index. */
|
|
13
|
+
ns?: NamespaceIndex;
|
|
14
|
+
/** Full title of the redirect page. */
|
|
15
|
+
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Section/anchor fragment the redirect points to. `rdprop=fragment`.
|
|
18
|
+
* Omitted entirely when the redirect has no fragment.
|
|
19
|
+
*/
|
|
20
|
+
fragment?: string;
|
|
21
|
+
}
|
|
22
|
+
declare module "./index" {
|
|
23
|
+
interface ApiPage {
|
|
24
|
+
/** Redirects pointing at this page (`prop=redirects`). */
|
|
25
|
+
redirects?: ApiRedirect[];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `prop=revisions` — a page's revision history, merged into the shared
|
|
3
|
+
* {@link ApiPage} shape via declaration merging.
|
|
4
|
+
*
|
|
5
|
+
* Which fields appear depends on `rvprop`; content-related fields come back in
|
|
6
|
+
* the `slots` map when `rvslots=` is used (see {@link ApiRevision.slots}).
|
|
7
|
+
* Under `formatversion=2`, `minor` is a real `boolean`, while `anon` / `temp`
|
|
8
|
+
* are {@link Flag}s that appear only when true.
|
|
9
|
+
*
|
|
10
|
+
* @see https://www.mediawiki.org/wiki/API:Revisions
|
|
11
|
+
*/
|
|
12
|
+
import type { ContentFormat, ContentModel, Flag, Timestamp } from "../../common";
|
|
13
|
+
/** One content slot of a revision (a revision may have multiple named slots). */
|
|
14
|
+
export interface ApiRevisionSlot {
|
|
15
|
+
/** Content model of this slot, e.g. `wikitext`. `rvprop=contentmodel`. */
|
|
16
|
+
contentmodel?: ContentModel;
|
|
17
|
+
/** Serialization format of this slot, e.g. `text/x-wiki`. `rvprop=content`. */
|
|
18
|
+
contentformat?: ContentFormat;
|
|
19
|
+
/** Slot size in bytes. `rvprop=slotsize`. */
|
|
20
|
+
size?: number;
|
|
21
|
+
/** Slot content checksum (hex). `rvprop=slotsha1`. May be empty (`''`). */
|
|
22
|
+
sha1?: string;
|
|
23
|
+
/** The slot content is hidden (revision-deleted). `rvprop=content`; a {@link Flag}. */
|
|
24
|
+
texthidden?: Flag;
|
|
25
|
+
/** The slot checksum is hidden (revision-deleted). `rvprop=slotsha1`; a {@link Flag}. */
|
|
26
|
+
sha1hidden?: Flag;
|
|
27
|
+
/** The slot could not be read for this revision; a {@link Flag}. */
|
|
28
|
+
missing?: Flag;
|
|
29
|
+
/** The slot has no content to return (e.g. deleted text); a {@link Flag}. */
|
|
30
|
+
textmissing?: Flag;
|
|
31
|
+
/**
|
|
32
|
+
* The requested `rvsection` does not exist in this slot; a {@link Flag}.
|
|
33
|
+
* Without `rvslots=` the same condition surfaces as a `nosuchsection` API
|
|
34
|
+
* error instead.
|
|
35
|
+
*/
|
|
36
|
+
nosuchsection?: Flag;
|
|
37
|
+
/** The requested content format is not supported by this slot's model. `rvprop=content`; a {@link Flag}. */
|
|
38
|
+
badcontentformat?: Flag;
|
|
39
|
+
/**
|
|
40
|
+
* Slot body. `rvprop=content`. Absent when the text is suppressed
|
|
41
|
+
* (see {@link ApiRevisionSlot.texthidden}) or not requested.
|
|
42
|
+
*/
|
|
43
|
+
content?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The `slots` map, keyed by slot role. `main` is the default slot; extensions
|
|
47
|
+
* may add others (e.g. `top`, `bottom`). The index signature keeps it open.
|
|
48
|
+
*/
|
|
49
|
+
export interface ApiRevisionSlots {
|
|
50
|
+
/** The default slot. */
|
|
51
|
+
main?: ApiRevisionSlot;
|
|
52
|
+
[role: string]: ApiRevisionSlot | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Diff output attached to a revision (`rvdiffto`/`rvdifftotext`; both request
|
|
56
|
+
* parameters are deprecated — prefer `action=compare`).
|
|
57
|
+
*/
|
|
58
|
+
export interface ApiRevisionDiff {
|
|
59
|
+
/** Revision id the diff starts from. */
|
|
60
|
+
from?: number;
|
|
61
|
+
/** Revision id the diff ends at. */
|
|
62
|
+
to?: number;
|
|
63
|
+
/** Rendered HTML diff table. */
|
|
64
|
+
body?: string;
|
|
65
|
+
/** The diff was not cached and was computed at request time; a {@link Flag}. */
|
|
66
|
+
notcached?: Flag;
|
|
67
|
+
/** The content format is not supported, so no diff was built; a {@link Flag}. */
|
|
68
|
+
badcontentformat?: Flag;
|
|
69
|
+
}
|
|
70
|
+
/** A single revision entry in `pages[].revisions`. */
|
|
71
|
+
export interface ApiRevision {
|
|
72
|
+
/** Revision id. `rvprop=ids`. */
|
|
73
|
+
revid?: number;
|
|
74
|
+
/** Previous revision id; `0` for the first revision of a page. `rvprop=ids`. */
|
|
75
|
+
parentid?: number;
|
|
76
|
+
/** Whether the edit was marked minor. `rvprop=flags`; a real `boolean` (present as `false`). */
|
|
77
|
+
minor?: boolean;
|
|
78
|
+
/** Made by an anonymous (IP) editor. `rvprop=user|userid`; a {@link Flag}. */
|
|
79
|
+
anon?: Flag;
|
|
80
|
+
/** Editor user name. `rvprop=user`. */
|
|
81
|
+
user?: string;
|
|
82
|
+
/** Editor user id; `0` for anonymous editors. `rvprop=userid`. */
|
|
83
|
+
userid?: number;
|
|
84
|
+
/** Revision timestamp. `rvprop=timestamp`. */
|
|
85
|
+
timestamp?: Timestamp;
|
|
86
|
+
/** Revision size in bytes. `rvprop=size`. */
|
|
87
|
+
size?: number;
|
|
88
|
+
/** SHA-1 of the revision content (hex). `rvprop=sha1`. May be empty (`''`). */
|
|
89
|
+
sha1?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Content model of the main slot at this revision. `rvprop=contentmodel`,
|
|
92
|
+
* and also emitted alongside the legacy top-level {@link content} body
|
|
93
|
+
* (`rvprop=content`). Top level only when `rvslots=` is not used; with
|
|
94
|
+
* `rvslots=` the content model lives in each slot.
|
|
95
|
+
*/
|
|
96
|
+
contentmodel?: ContentModel;
|
|
97
|
+
/**
|
|
98
|
+
* Legacy top-level content body. Only when `rvslots=` is **not** used,
|
|
99
|
+
* together with `rvprop=content`; with `rvslots=` the body lives in each
|
|
100
|
+
* slot.
|
|
101
|
+
*/
|
|
102
|
+
content?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Serialization format of the legacy top-level {@link content}. Only when
|
|
105
|
+
* `rvslots=` is not used, with `rvprop=content`.
|
|
106
|
+
*/
|
|
107
|
+
contentformat?: ContentFormat;
|
|
108
|
+
/** Raw edit summary. `rvprop=comment`. */
|
|
109
|
+
comment?: string;
|
|
110
|
+
/** HTML-rendered edit summary. `rvprop=parsedcomment`. */
|
|
111
|
+
parsedcomment?: string;
|
|
112
|
+
/** Change tags applied to this revision. `rvprop=tags`. */
|
|
113
|
+
tags?: string[];
|
|
114
|
+
/** Slot roles present on this revision, e.g. `["main"]`. `rvprop=roles`. */
|
|
115
|
+
roles?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* Content slots. Requires `rvslots=` together with one of `rvprop=content`,
|
|
118
|
+
* `contentmodel`, `slotsize`, `slotsha1`; with none of those `rvprop` values
|
|
119
|
+
* no `slots` map is returned. Without `rvslots=` the content fields appear at
|
|
120
|
+
* the top level instead (legacy).
|
|
121
|
+
*/
|
|
122
|
+
slots?: ApiRevisionSlots;
|
|
123
|
+
/**
|
|
124
|
+
* The edit summary is hidden (revision-deleted). `rvprop=comment|parsedcomment`
|
|
125
|
+
* on a suppressed revision; a {@link Flag}. Reviewers with the delete right
|
|
126
|
+
* still see `comment` (often the empty string); other viewers see it withheld.
|
|
127
|
+
*/
|
|
128
|
+
commenthidden?: Flag;
|
|
129
|
+
/** The author is hidden. Revision-delete; a {@link Flag}. */
|
|
130
|
+
userhidden?: Flag;
|
|
131
|
+
/**
|
|
132
|
+
* The revision content is hidden (revision-deleted); a {@link Flag}.
|
|
133
|
+
* Top level only when `rvslots=` is not used; with `rvslots=` each slot
|
|
134
|
+
* carries its own `texthidden`.
|
|
135
|
+
*/
|
|
136
|
+
texthidden?: Flag;
|
|
137
|
+
/**
|
|
138
|
+
* The requested content format is not supported by this revision's model.
|
|
139
|
+
* Top level only when `rvslots=` is not used; with `rvslots=` each slot
|
|
140
|
+
* carries its own `badcontentformat`. A {@link Flag}.
|
|
141
|
+
*/
|
|
142
|
+
badcontentformat?: Flag;
|
|
143
|
+
/**
|
|
144
|
+
* The editor is a temporary account. `rvprop=user|userid` on a temp-account
|
|
145
|
+
* revision; a {@link Flag}.
|
|
146
|
+
*
|
|
147
|
+
* @since MediaWiki 1.42
|
|
148
|
+
*/
|
|
149
|
+
temp?: Flag;
|
|
150
|
+
/**
|
|
151
|
+
* The SHA-1 (`sha1`) is withheld because the content is revision-deleted.
|
|
152
|
+
* `rvprop=sha1`; a {@link Flag}.
|
|
153
|
+
*/
|
|
154
|
+
sha1hidden?: Flag;
|
|
155
|
+
/**
|
|
156
|
+
* Oversight/suppression is in effect on this revision (set when any visibility
|
|
157
|
+
* restriction applies, alongside the `*hidden` flags). A {@link Flag}.
|
|
158
|
+
*/
|
|
159
|
+
suppressed?: Flag;
|
|
160
|
+
/** Diff of this revision against `rvdiffto`/`rvdifftotext` (both deprecated; prefer `action=compare`). */
|
|
161
|
+
diff?: ApiRevisionDiff;
|
|
162
|
+
/** A slot could not be read for this revision (slot access failure); a {@link Flag}. */
|
|
163
|
+
slotsmissing?: Flag;
|
|
164
|
+
/**
|
|
165
|
+
* The revision has no content to return (e.g. deleted text). Top level only
|
|
166
|
+
* when `rvslots=` is not used; with `rvslots=` each slot carries its own
|
|
167
|
+
* `textmissing`. A {@link Flag}.
|
|
168
|
+
*/
|
|
169
|
+
textmissing?: Flag;
|
|
170
|
+
}
|
|
171
|
+
declare module "./index" {
|
|
172
|
+
interface ApiPage {
|
|
173
|
+
/** Revisions of the page (`prop=revisions`), newest first unless `rvdir=newer`. */
|
|
174
|
+
revisions?: ApiRevision[];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `list=search` — full-text search results, merged into {@link ApiQueryResult}
|
|
3
|
+
* via declaration merging, together with the `searchinfo` summary object.
|
|
4
|
+
*
|
|
5
|
+
* As `generator=search` the same hit fields are injected into `query.pages`
|
|
6
|
+
* entries — and into a `query.redirects` entry whose source is one of those
|
|
7
|
+
* pages — where the `g`-prefixed parameter forms apply (`gsrprop` / `gsrinfo`)
|
|
8
|
+
* and the framework adds `index`.
|
|
9
|
+
*
|
|
10
|
+
* Interwiki hits are reported outside `query.search`: `srinterwiki=1` collects
|
|
11
|
+
* them under `query.interwikisearch` keyed by interwiki prefix, and
|
|
12
|
+
* `enablerewrites=1` may surface backend-rewritten hits inline under
|
|
13
|
+
* `query.additionalsearch`. Each section carries its own totalhits counter
|
|
14
|
+
* under `<section>searchinfo`.
|
|
15
|
+
*
|
|
16
|
+
* @see https://www.mediawiki.org/wiki/API:Search
|
|
17
|
+
*/
|
|
18
|
+
import type { Flag, NamespaceIndex, Timestamp } from "../../common";
|
|
19
|
+
/**
|
|
20
|
+
* One search hit (`list=search`), and the page data `generator=search` injects
|
|
21
|
+
* into a `query.pages` entry.
|
|
22
|
+
*
|
|
23
|
+
* Which fields appear is controlled by `srprop` for `list=search` and by
|
|
24
|
+
* `gsrprop` for `generator=search`. The two differ in their default: `gsrprop`
|
|
25
|
+
* defaults to empty in generator mode, so only `ns`, `title`, `pageid` and the
|
|
26
|
+
* injected `index` appear unless `gsrprop` is passed explicitly.
|
|
27
|
+
*/
|
|
28
|
+
export interface ApiSearchResult {
|
|
29
|
+
/** Namespace index. */
|
|
30
|
+
ns?: NamespaceIndex;
|
|
31
|
+
/** Full page title. */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** Page id. */
|
|
34
|
+
pageid?: number;
|
|
35
|
+
/** Page size in bytes. `srprop=size`. */
|
|
36
|
+
size?: number;
|
|
37
|
+
/** Word count. `srprop=wordcount`. */
|
|
38
|
+
wordcount?: number;
|
|
39
|
+
/** Last-edit timestamp. `srprop=timestamp`. */
|
|
40
|
+
timestamp?: Timestamp;
|
|
41
|
+
/** HTML snippet of the match, with highlights. `srprop=snippet`. */
|
|
42
|
+
snippet?: string;
|
|
43
|
+
/** HTML snippet of the title. `srprop=titlesnippet`. */
|
|
44
|
+
titlesnippet?: string;
|
|
45
|
+
/** Snippet of the matching category. `srprop=categorysnippet`. */
|
|
46
|
+
categorysnippet?: string;
|
|
47
|
+
/** Title of the section the match is in. `srprop=sectiontitle`. */
|
|
48
|
+
sectiontitle?: string;
|
|
49
|
+
/** HTML snippet of the section heading. `srprop=sectionsnippet`. */
|
|
50
|
+
sectionsnippet?: string;
|
|
51
|
+
/** Title of the redirect target, if this hit redirects. `srprop=redirecttitle`. */
|
|
52
|
+
redirecttitle?: string;
|
|
53
|
+
/** HTML snippet of the redirect target title. `srprop=redirectsnippet`. */
|
|
54
|
+
redirectsnippet?: string;
|
|
55
|
+
/** Whether the hit matched a file. `srprop=isfilematch`; a real `boolean`. */
|
|
56
|
+
isfilematch?: boolean;
|
|
57
|
+
/** Search-backend extension data, keyed by augmentor name. `srprop=extensiondata`. */
|
|
58
|
+
extensiondata?: unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A `list=search` hit. The module writes `ns`, `title` and `pageid` for every
|
|
62
|
+
* hit, before any `srprop` value is considered, so they are required here —
|
|
63
|
+
* unlike {@link ApiSearchResult}, which stays all-optional because
|
|
64
|
+
* `generator=search` merges the same shape into {@link ApiPage} entries.
|
|
65
|
+
*/
|
|
66
|
+
export type ApiSearchHit = ApiSearchResult & {
|
|
67
|
+
/** Namespace index. */
|
|
68
|
+
ns: NamespaceIndex;
|
|
69
|
+
/** Full page title. */
|
|
70
|
+
title: string;
|
|
71
|
+
/** Page id. */
|
|
72
|
+
pageid: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* One interwiki search hit, an element of
|
|
76
|
+
* {@link ApiQueryResult.interwikisearch} / {@link ApiQueryResult.additionalsearch}.
|
|
77
|
+
* Fields follow `srprop` exactly like {@link ApiSearchResult}, except `title`
|
|
78
|
+
* is the bare page name without the namespace, `pageid` is always `0`, and the
|
|
79
|
+
* interwiki namespace/URL fields below are added.
|
|
80
|
+
*/
|
|
81
|
+
export interface ApiSearchInterwikiResult extends ApiSearchResult {
|
|
82
|
+
/** Namespace name on the foreign wiki, as text. */
|
|
83
|
+
namespace?: string;
|
|
84
|
+
/** Full URL of the hit on the foreign wiki. */
|
|
85
|
+
url?: string;
|
|
86
|
+
}
|
|
87
|
+
/** Total-hit counter of an interwiki search section. */
|
|
88
|
+
export interface ApiSearchInterwikiInfo {
|
|
89
|
+
/** Total number of interwiki hits across prefixes. */
|
|
90
|
+
totalhits?: number;
|
|
91
|
+
}
|
|
92
|
+
/** Per-search metadata (`list=search`'s `searchinfo` sibling). */
|
|
93
|
+
export interface ApiSearchInfo {
|
|
94
|
+
/** Total number of matches (may be capped by the search backend). */
|
|
95
|
+
totalhits?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Present (and `true`) when {@link totalhits} is only an approximation, i.e.
|
|
98
|
+
* the backend stopped counting early. A {@link Flag}: the key is omitted
|
|
99
|
+
* rather than set to `false`.
|
|
100
|
+
*
|
|
101
|
+
* @since MediaWiki 1.44
|
|
102
|
+
*/
|
|
103
|
+
approximate_totalhits?: Flag;
|
|
104
|
+
/** Suggested rewrite when the query had no/few results (`srinfo=suggestion`). */
|
|
105
|
+
suggestion?: string;
|
|
106
|
+
/** HTML snippet of the suggestion, with the changed terms highlighted (`srinfo=suggestion`). */
|
|
107
|
+
suggestionsnippet?: string;
|
|
108
|
+
/** The query after search-side rewriting (`srinfo=rewrittenquery`). */
|
|
109
|
+
rewrittenquery?: string;
|
|
110
|
+
/** HTML snippet of the rewritten query, with the changes highlighted (`srinfo=rewrittenquery`). */
|
|
111
|
+
rewrittenquerysnippet?: string;
|
|
112
|
+
}
|
|
113
|
+
declare module "./index" {
|
|
114
|
+
interface ApiQueryResult {
|
|
115
|
+
/** Search results (`list=search`). */
|
|
116
|
+
search?: ApiSearchHit[];
|
|
117
|
+
/**
|
|
118
|
+
* Search summary metadata. Emitted by `list=search`, or by
|
|
119
|
+
* `generator=search` when the request passes `gsrinfo` — the generator
|
|
120
|
+
* form defaults to no `searchinfo` at all.
|
|
121
|
+
*/
|
|
122
|
+
searchinfo?: ApiSearchInfo;
|
|
123
|
+
/**
|
|
124
|
+
* Interwiki search hits keyed by interwiki prefix (`srinterwiki=1`).
|
|
125
|
+
*/
|
|
126
|
+
interwikisearch?: Record<string, ApiSearchInterwikiResult[]>;
|
|
127
|
+
/** Total-hit counter for {@link interwikisearch}. */
|
|
128
|
+
interwikisearchinfo?: ApiSearchInterwikiInfo;
|
|
129
|
+
/**
|
|
130
|
+
* Interwiki hits the backend matched inline (`enablerewrites=1`), same
|
|
131
|
+
* shape as {@link interwikisearch}.
|
|
132
|
+
*/
|
|
133
|
+
additionalsearch?: Record<string, ApiSearchInterwikiResult[]>;
|
|
134
|
+
/** Total-hit counter for {@link additionalsearch}. */
|
|
135
|
+
additionalsearchinfo?: ApiSearchInterwikiInfo;
|
|
136
|
+
}
|
|
137
|
+
interface ApiPage extends ApiSearchResult {
|
|
138
|
+
}
|
|
139
|
+
interface ApiQueryResolvedRedirect extends ApiSearchResult {
|
|
140
|
+
}
|
|
141
|
+
}
|