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.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/README.zh.md +57 -0
  4. package/dist/common/index.d.ts +87 -0
  5. package/dist/core/acquiretempusername.d.ts +17 -0
  6. package/dist/core/block.d.ts +98 -0
  7. package/dist/core/changeauthenticationdata.d.ts +18 -0
  8. package/dist/core/changecontentmodel.d.ts +27 -0
  9. package/dist/core/checktoken.d.ts +28 -0
  10. package/dist/core/clearhasmsg.d.ts +15 -0
  11. package/dist/core/clientlogin.d.ts +48 -0
  12. package/dist/core/compare.d.ts +92 -0
  13. package/dist/core/createaccount.d.ts +41 -0
  14. package/dist/core/delete.d.ts +45 -0
  15. package/dist/core/edit.d.ts +66 -0
  16. package/dist/core/emailuser.d.ts +27 -0
  17. package/dist/core/expandtemplates.d.ts +66 -0
  18. package/dist/core/filerevert.d.ts +20 -0
  19. package/dist/core/imagerotate.d.ts +51 -0
  20. package/dist/core/import.d.ts +29 -0
  21. package/dist/core/index.d.ts +40 -0
  22. package/dist/core/languagesearch.d.ts +24 -0
  23. package/dist/core/login.d.ts +30 -0
  24. package/dist/core/logout.d.ts +16 -0
  25. package/dist/core/managetags.d.ts +28 -0
  26. package/dist/core/mergehistory.d.ts +26 -0
  27. package/dist/core/move.d.ts +62 -0
  28. package/dist/core/options.d.ts +16 -0
  29. package/dist/core/parse.d.ts +324 -0
  30. package/dist/core/patrol.d.ts +21 -0
  31. package/dist/core/protect.d.ts +43 -0
  32. package/dist/core/purge.d.ts +61 -0
  33. package/dist/core/query/allcategories.d.ts +30 -0
  34. package/dist/core/query/alldeletedrevisions.d.ts +29 -0
  35. package/dist/core/query/allfileusages.d.ts +15 -0
  36. package/dist/core/query/allimages.d.ts +25 -0
  37. package/dist/core/query/alllinks.d.ts +34 -0
  38. package/dist/core/query/allmessages.d.ts +43 -0
  39. package/dist/core/query/allpages.d.ts +23 -0
  40. package/dist/core/query/allredirects.d.ts +23 -0
  41. package/dist/core/query/allrevisions.d.ts +30 -0
  42. package/dist/core/query/alltransclusions.d.ts +14 -0
  43. package/dist/core/query/allusers.d.ts +37 -0
  44. package/dist/core/query/authmanagerinfo.d.ts +96 -0
  45. package/dist/core/query/backlinks.d.ts +34 -0
  46. package/dist/core/query/blocks.d.ts +104 -0
  47. package/dist/core/query/categories.d.ts +28 -0
  48. package/dist/core/query/categoryinfo.d.ts +25 -0
  49. package/dist/core/query/categorymembers.d.ts +38 -0
  50. package/dist/core/query/codexicons.d.ts +40 -0
  51. package/dist/core/query/contributors.d.ts +23 -0
  52. package/dist/core/query/deletedrevisions.d.ts +21 -0
  53. package/dist/core/query/deletedrevs.d.ts +84 -0
  54. package/dist/core/query/duplicatefiles.d.ts +30 -0
  55. package/dist/core/query/embeddedin.d.ts +28 -0
  56. package/dist/core/query/extlinks.d.ts +17 -0
  57. package/dist/core/query/exturlusage.d.ts +30 -0
  58. package/dist/core/query/filearchive.d.ts +91 -0
  59. package/dist/core/query/filerepoinfo.d.ts +51 -0
  60. package/dist/core/query/fileusage.d.ts +26 -0
  61. package/dist/core/query/imageinfo.d.ts +214 -0
  62. package/dist/core/query/images.d.ts +20 -0
  63. package/dist/core/query/imageusage.d.ts +36 -0
  64. package/dist/core/query/index.d.ts +489 -0
  65. package/dist/core/query/info.d.ts +208 -0
  66. package/dist/core/query/iwbacklinks.d.ts +28 -0
  67. package/dist/core/query/iwlinks.d.ts +21 -0
  68. package/dist/core/query/langbacklinks.d.ts +28 -0
  69. package/dist/core/query/langlinks.d.ts +32 -0
  70. package/dist/core/query/languageinfo.d.ts +70 -0
  71. package/dist/core/query/links.d.ts +22 -0
  72. package/dist/core/query/linkshere.d.ts +25 -0
  73. package/dist/core/query/logevents.d.ts +77 -0
  74. package/dist/core/query/mystashedfiles.d.ts +39 -0
  75. package/dist/core/query/pagepropnames.d.ts +18 -0
  76. package/dist/core/query/pageprops.d.ts +19 -0
  77. package/dist/core/query/pageswithprop.d.ts +28 -0
  78. package/dist/core/query/prefixsearch.d.ts +27 -0
  79. package/dist/core/query/protectedtitles.d.ts +43 -0
  80. package/dist/core/query/querypage.d.ts +59 -0
  81. package/dist/core/query/random.d.ts +30 -0
  82. package/dist/core/query/recentchanges.d.ts +103 -0
  83. package/dist/core/query/redirects.d.ts +27 -0
  84. package/dist/core/query/revisions.d.ts +176 -0
  85. package/dist/core/query/search.d.ts +141 -0
  86. package/dist/core/query/siteinfo.d.ts +731 -0
  87. package/dist/core/query/stashimageinfo.d.ts +101 -0
  88. package/dist/core/query/tags.d.ts +34 -0
  89. package/dist/core/query/templates.d.ts +20 -0
  90. package/dist/core/query/tokens.d.ts +34 -0
  91. package/dist/core/query/trackingcategories.d.ts +25 -0
  92. package/dist/core/query/transcludedin.d.ts +25 -0
  93. package/dist/core/query/usercontribs.d.ts +72 -0
  94. package/dist/core/query/userinfo.d.ts +141 -0
  95. package/dist/core/query/users.d.ts +164 -0
  96. package/dist/core/query/watchlist.d.ts +109 -0
  97. package/dist/core/query/watchlistraw.d.ts +42 -0
  98. package/dist/core/removeauthenticationdata.d.ts +18 -0
  99. package/dist/core/resetpassword.d.ts +16 -0
  100. package/dist/core/revisiondelete.d.ts +83 -0
  101. package/dist/core/rollback.d.ts +27 -0
  102. package/dist/core/setnotificationtimestamp.d.ts +47 -0
  103. package/dist/core/setpagelanguage.d.ts +24 -0
  104. package/dist/core/stashedit.d.ts +25 -0
  105. package/dist/core/tag.d.ts +49 -0
  106. package/dist/core/upload.d.ts +106 -0
  107. package/dist/core/userrights.d.ts +41 -0
  108. package/dist/core/validatepassword.d.ts +28 -0
  109. package/dist/core/watch.d.ts +45 -0
  110. package/dist/envelope/index.d.ts +122 -0
  111. package/dist/extensions/abusefilters.d.ts +207 -0
  112. package/dist/extensions/babel.d.ts +32 -0
  113. package/dist/extensions/categorytree.d.ts +78 -0
  114. package/dist/extensions/checkuser.d.ts +148 -0
  115. package/dist/extensions/description.d.ts +22 -0
  116. package/dist/extensions/discussiontools.d.ts +273 -0
  117. package/dist/extensions/echo.d.ts +306 -0
  118. package/dist/extensions/extracts.d.ts +24 -0
  119. package/dist/extensions/flaggedrevs.d.ts +192 -0
  120. package/dist/extensions/gadgets.d.ts +148 -0
  121. package/dist/extensions/globalblocks.d.ts +115 -0
  122. package/dist/extensions/globalpreferences.d.ts +62 -0
  123. package/dist/extensions/globalusage.d.ts +41 -0
  124. package/dist/extensions/globaluserinfo.d.ts +95 -0
  125. package/dist/extensions/linter.d.ts +83 -0
  126. package/dist/extensions/massmessage.d.ts +108 -0
  127. package/dist/extensions/oathauth.d.ts +86 -0
  128. package/dist/extensions/pageimages.d.ts +33 -0
  129. package/dist/extensions/pageviews.d.ts +63 -0
  130. package/dist/extensions/scribunto.d.ts +61 -0
  131. package/dist/extensions/sitematrix.d.ts +109 -0
  132. package/dist/extensions/spamblacklist.d.ts +25 -0
  133. package/dist/extensions/templatedata.d.ts +130 -0
  134. package/dist/extensions/thanks.d.ts +29 -0
  135. package/dist/extensions/timedmediahandler.d.ts +121 -0
  136. package/dist/extensions/titleblacklist.d.ts +29 -0
  137. package/dist/extensions/urlshortener.d.ts +42 -0
  138. package/dist/extensions/visualeditor.d.ts +204 -0
  139. package/dist/extensions/wikibase.d.ts +100 -0
  140. package/dist/extensions/wikilove.d.ts +38 -0
  141. package/dist/index.d.ts +3 -0
  142. package/package.json +76 -0
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `action=watch` response — adds/removes pages from the watchlist; needs CSRF.
3
+ * The result is a top-level `watch` **array** (one entry per title) in pageset
4
+ * mode (`titles`/`pageids`/`revids`), a **single object** with the legacy
5
+ * `title` parameter. Requires the `watch` token (`meta=tokens&type=watch`).
6
+ *
7
+ * @see https://www.mediawiki.org/wiki/API:Watch
8
+ */
9
+ import type { ApiWatchlistLabel, NamespaceIndex, Timestamp, ApiSpecMessage } from "../common";
10
+ import type { ApiEnvelope } from "../envelope";
11
+ /** One watched/unwatched page. */
12
+ export interface ApiWatchEntry {
13
+ /** Page title. */
14
+ title: string;
15
+ /** Namespace index. */
16
+ ns: NamespaceIndex;
17
+ /** The page was added to the watchlist. A real `boolean`. */
18
+ watched?: boolean;
19
+ /** The page was removed from the watchlist. A real `boolean`. */
20
+ unwatched?: boolean;
21
+ /**
22
+ * The page is not watchable — always `0`; `watched`/`unwatched` are absent.
23
+ */
24
+ watchable?: 0;
25
+ /**
26
+ * Expiry applied to the watch (`expiry` parameter echo, formatted by
27
+ * `ApiResult::formatExpiry`). Watch direction only.
28
+ */
29
+ expiry?: Timestamp | "infinity";
30
+ /** In-band messages when the watch/unwatch operation failed (pageset mode; the legacy `title` mode dies with a top-level error instead). */
31
+ errors?: ApiSpecMessage[];
32
+ /** In-band warnings for a failed operation (present when non-empty). */
33
+ warnings?: ApiSpecMessage[];
34
+ /**
35
+ * Watchlist labels just saved for this page, echoed back when the request
36
+ * passed `labels` and `$wgEnableWatchlistLabels` is on.
37
+ *
38
+ * @since MediaWiki 1.46
39
+ */
40
+ labels?: ApiWatchlistLabel[];
41
+ }
42
+ /** Response of `action=watch`. */
43
+ export interface ApiWatchResponse extends ApiEnvelope {
44
+ watch: ApiWatchEntry | ApiWatchEntry[];
45
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Core response envelope types shared by all MediaWiki Action API responses.
3
+ *
4
+ * Note: this package models responses requested with `formatversion=2`
5
+ * unless explicitly documented otherwise.
6
+ *
7
+ * The error/warning shape depends on the request's `errorformat`:
8
+ * - default (`bc`): a single `error` object and a module-keyed `warnings` object;
9
+ * - modern (`plaintext`/`wikitext`/`html`/`raw`/`none`): an `errors` array and a
10
+ * `warnings` array of message objects, plus a top-level `docref`.
11
+ *
12
+ * @see https://www.mediawiki.org/wiki/API:Errors_and_warnings
13
+ */
14
+ /**
15
+ * A single message under a modern `errorformat` (an entry of the `errors` or
16
+ * `warnings` array). Which text-bearing field is present depends on the
17
+ * format: `text` for `plaintext`/`wikitext`, `html` for `html`, `key`/`params`
18
+ * for `raw`.
19
+ */
20
+ export interface ApiMessage {
21
+ /** Machine-readable code, e.g. `badvalue`, `unrecognizedparams`. */
22
+ code?: string;
23
+ /** Rendered message (`errorformat=plaintext`/`wikitext`). */
24
+ text?: string;
25
+ /** Parsed message HTML (`errorformat=html`). */
26
+ html?: string;
27
+ /** i18n message key (`errorformat=raw`). */
28
+ key?: string;
29
+ /**
30
+ * i18n message parameters (`errorformat=raw`). Numeric params occur too,
31
+ * and a parameter may itself be a message, serialized as
32
+ * `{ message: ApiRawMessage }`.
33
+ */
34
+ params?: (string | number | {
35
+ message?: ApiRawMessage;
36
+ })[];
37
+ /** Module the message originated from, e.g. `main`, `query+info`. */
38
+ module?: string;
39
+ /** Extra structured data some messages attach. */
40
+ data?: unknown;
41
+ }
42
+ /**
43
+ * An i18n message spec nested inside another message's `params`
44
+ * (`errorformat=raw`) when a parameter is itself a message, serialized as
45
+ * `{ message: ApiRawMessage }`. The nested `params` may recursively contain
46
+ * further messages.
47
+ */
48
+ export interface ApiRawMessage {
49
+ /** i18n message key of the nested message. */
50
+ key?: string;
51
+ /** Parameters of the nested message, which may themselves be messages. */
52
+ params?: (string | number | {
53
+ message?: ApiRawMessage;
54
+ })[];
55
+ }
56
+ /** The `error` object under the default (`bc`) `errorformat`. */
57
+ export interface ApiError {
58
+ /** Machine-readable error code, e.g. `badtoken`. */
59
+ code?: string;
60
+ /** Human-readable description provided by the server. */
61
+ info?: string;
62
+ /** Docs link plus deprecation notices; nested in `error` under the `bc` format. */
63
+ docref?: string;
64
+ /** PHP backtrace, when `$wgShowExceptionDetails` is on (non-usage exceptions). */
65
+ trace?: string;
66
+ /**
67
+ * Structured `apiData` attached to the message by the emitting code, merged
68
+ * into this object as top-level keys.
69
+ */
70
+ [key: string]: unknown;
71
+ }
72
+ /** One `bc`-format warning entry (the value of a module key in `warnings`). */
73
+ export interface ApiWarningDetail {
74
+ /** Warning text (`bc` errorformat). */
75
+ warnings?: string;
76
+ }
77
+ /**
78
+ * Warnings shape, polymorphic on `errorformat`:
79
+ * `bc` → object keyed by module name; modern → array of {@link ApiMessage}.
80
+ */
81
+ export type ApiWarnings = Record<string, ApiWarningDetail> | ApiMessage[];
82
+ /** Fields that may appear on every API response, successful or not. */
83
+ export interface ApiEnvelope {
84
+ /**
85
+ * Present and `true` when all data for the current batch of pages has been
86
+ * returned. Continuation may still be ongoing: the generator runs again for
87
+ * the next batch of pages, and list/meta modules may continue independently.
88
+ * Serialized as a real boolean under `formatversion=2`.
89
+ */
90
+ batchcomplete?: true;
91
+ /**
92
+ * Identifier of the server that handled the request. Present by default on
93
+ * error responses; on successful responses only when explicitly requested.
94
+ */
95
+ servedby?: string;
96
+ /** Current server time (ISO 8601), present when the request set `curtimestamp`. */
97
+ curtimestamp?: string;
98
+ /** Opaque value echoed back from the request's `requestid` parameter. */
99
+ requestid?: string;
100
+ /** Non-fatal warnings; shape depends on `errorformat` (see {@link ApiWarnings}). */
101
+ warnings?: ApiWarnings;
102
+ /** Language of the interface strings in the response (`responselanginfo=1`). */
103
+ uselang?: string;
104
+ /** Language error messages are rendered in (`responselanginfo=1`). */
105
+ errorlang?: string;
106
+ }
107
+ /** Error response under the default (`bc`) `errorformat`: a single `error` object. */
108
+ export interface ApiBcErrorResponse extends ApiEnvelope {
109
+ error: ApiError;
110
+ }
111
+ /** Error response under a modern `errorformat`: an `errors` array plus top-level `docref`. */
112
+ export interface ApiModernErrorResponse extends ApiEnvelope {
113
+ errors: ApiMessage[];
114
+ /** Docs link plus deprecation notices (top-level under modern `errorformat`). */
115
+ docref?: string;
116
+ /** PHP backtrace, when `$wgShowExceptionDetails` is on (non-usage exceptions). */
117
+ trace?: string;
118
+ }
119
+ /** An API response describing a failed request (either `errorformat` family). */
120
+ export type ApiErrorResponse = ApiBcErrorResponse | ApiModernErrorResponse;
121
+ /** Discriminated union helper: a response is either successful or an error. */
122
+ export type ApiResponseWith<TSuccess> = ApiErrorResponse | (TSuccess & ApiEnvelope);
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Opt-in extension pack: **AbuseFilter** (`list=abusefilters`, `list=abuselog`,
3
+ * `action=abusefilterchecksyntax`, `action=abusefilterevalexpression`,
4
+ * `action=abusefiltercheckmatch`, `action=abusefilterunblockautopromote`,
5
+ * `action=abuselogprivatedetails`).
6
+ *
7
+ * Not in the default export: importing anything from this file — even just the
8
+ * field-group type you are about to use — activates the augmentation shipped at
9
+ * the bottom, which merges the field groups into the root package automatically
10
+ * (no manual `declare module`):
11
+ *
12
+ * ```ts
13
+ * import type {} from 'types-mediawiki-response/ext/abusefilters';
14
+ * ```
15
+ *
16
+ * The `action=` responses are standalone — import them by name.
17
+ *
18
+ * fv2 notes: `hits` is withheld (surfaced as `hitsredacted: true` on newer
19
+ * builds) for viewers without `abusefilter-log-detail`; `abfprop=flags` expands
20
+ * the booleans. Continuation uses `abfstartid`/`aflstart` (covered by the core
21
+ * `ApiQueryContinue` index signature). `abuselog` visibility is permission
22
+ * sensitive: `filter_id`/`revid` come back as `""` rather than being omitted when
23
+ * the viewer may not see the details, and `details`/`filter`/`wiki` appear only
24
+ * with the matching `aflprop`.
25
+ *
26
+ * @see https://www.mediawiki.org/wiki/Extension:AbuseFilter/Raw_format_of_filters
27
+ * @see https://www.mediawiki.org/wiki/Extension:AbuseFilter/API
28
+ */
29
+ import type { Flag, NamespaceIndex, Timestamp } from "../common";
30
+ import type { ApiEnvelope } from "../envelope";
31
+ /** One abuse filter definition. */
32
+ export interface ApiAbuseFilter {
33
+ /** Filter id. */
34
+ id?: number;
35
+ /** Human-readable filter description. `abfprop=description`. */
36
+ description?: string;
37
+ /** The filter's regex/rule string. `abfprop=pattern` (withheld for private/protected filters). */
38
+ pattern?: string;
39
+ /**
40
+ * The actions the filter performs. `abfprop=actions`.
41
+ * * Up to MediaWiki 1.46: the raw `af_actions` column, a comma-joined
42
+ * string such as `"disallow,tag"`.
43
+ * * 1.47 onward: the same value split into a `string[]`.
44
+ */
45
+ actions?: string | string[];
46
+ /** The filter's comments. `abfprop=comments` (withheld for private/protected filters). */
47
+ comments?: string;
48
+ /** Number of matches (only when the viewer may see it). `abfprop=hits`. */
49
+ hits?: number;
50
+ /**
51
+ * `true` when `hits` was withheld from this viewer. A {@link Flag}. Before
52
+ * 1.47, a withheld {@link hits} was simply omitted.
53
+ *
54
+ * @since MediaWiki 1.47
55
+ */
56
+ hitsredacted?: Flag;
57
+ /**
58
+ * `true` when `pattern` was withheld from this viewer. A {@link Flag}.
59
+ * Before 1.47, a withheld {@link pattern} was simply omitted.
60
+ *
61
+ * @since MediaWiki 1.47
62
+ */
63
+ patternredacted?: Flag;
64
+ /**
65
+ * `true` when `comments` was withheld from this viewer. A {@link Flag}.
66
+ * Before 1.47, a withheld {@link comments} was simply omitted.
67
+ *
68
+ * @since MediaWiki 1.47
69
+ */
70
+ commentsredacted?: Flag;
71
+ /** Last editor of the filter. `abfprop=lasteditor`. */
72
+ lasteditor?: string;
73
+ /** Last edit timestamp. `abfprop=lastedittime`. */
74
+ lastedittime?: Timestamp;
75
+ /**
76
+ * Whether the filter is enabled. `abfprop=status`.
77
+ * * 1.43: present as an **empty string** when the flag applies, and absent otherwise.
78
+ * * Newer builds (`abfprop=flags`): real booleans, always present.
79
+ */
80
+ enabled?: "" | boolean;
81
+ /** Whether the filter is soft-deleted. `abfprop=status`; same `""` (1.43) vs real boolean (newer `abfprop=flags`) behaviour as {@link enabled}. */
82
+ deleted?: "" | boolean;
83
+ /** Whether the filter is private (hidden from the viewer). `abfprop=private`; same `""` (1.43) vs real boolean (newer `abfprop=flags`) behaviour as {@link enabled}. */
84
+ private?: "" | boolean;
85
+ /**
86
+ * Whether the filter's protected variables are hidden. Same `""` (1.43) vs
87
+ * real boolean (newer `abfprop=flags`) behaviour as {@link enabled}.
88
+ *
89
+ * @since MediaWiki 1.43
90
+ */
91
+ protected?: "" | boolean;
92
+ /**
93
+ * Whether the filter is suppressed (oversight). A real `boolean` under
94
+ * `abfprop=flags`; the per-flag `abfprop=suppressed` alias is itself
95
+ * deprecated since 1.47.
96
+ *
97
+ * @since MediaWiki 1.47
98
+ */
99
+ suppressed?: boolean;
100
+ }
101
+ /** One abuse-log entry (`list=abuselog`). */
102
+ export interface ApiAbuseLogEntry {
103
+ /** Log record id (`afl_id`). `aflprop=ids`. */
104
+ id?: number;
105
+ /**
106
+ * Filter that matched: the filter id as a string, prefixed `global-` for
107
+ * central filters (e.g. `global-42`). `aflprop=ids`; an **empty string**
108
+ * when the viewer may not see the details.
109
+ */
110
+ filter_id?: string;
111
+ /** Public description of the filter. `aflprop=filter`. */
112
+ filter?: string;
113
+ /** Actor name. `aflprop=user`. */
114
+ user?: string;
115
+ /** Namespace of the affected page. `aflprop=title`. */
116
+ ns?: NamespaceIndex;
117
+ /** Title of the affected page. `aflprop=title`. */
118
+ title?: string;
119
+ /** Action that was filtered, e.g. `edit`, `create`. `aflprop=action`. */
120
+ action?: string;
121
+ /**
122
+ * Consequences applied, e.g. `disallow`. `aflprop=result`; a comma-joined
123
+ * string on 1.43, as stored in `afl_actions`.
124
+ */
125
+ result?: string;
126
+ /** Revision the log entry points at. `aflprop=revid`; `""` when withheld. */
127
+ revid?: number | "";
128
+ /** When the entry was recorded. `aflprop=timestamp`. */
129
+ timestamp?: Timestamp;
130
+ /** Whether the entry is revdel'd. `aflprop=hidden`; a real `boolean`. */
131
+ hidden?: boolean;
132
+ /**
133
+ * Filter variables in effect. `aflprop=details`; a map keyed by variable name.
134
+ * Values are strings, numbers or booleans, but may also be arrays or `null`
135
+ * (the raw `AFPData::toNative()` dump); withheld variables arrive as empty
136
+ * strings. An empty map arrives as `[]`.
137
+ */
138
+ details?: Record<string, unknown> | unknown[];
139
+ /** Source wiki id. `aflprop=wiki`, and only on a central filter wiki. */
140
+ wiki?: string;
141
+ }
142
+ /** Status of a syntax check (`action=abusefilterchecksyntax`). */
143
+ export type AbuseFilterSyntaxStatus = "ok" | "error" | (string & {});
144
+ /** Response of `action=abusefilterchecksyntax`. */
145
+ export interface ApiAbuseFilterCheckSyntaxResponse extends ApiEnvelope {
146
+ abusefilterchecksyntax: {
147
+ /** Check outcome; `ok` when the pattern parses. */
148
+ status?: AbuseFilterSyntaxStatus;
149
+ /** Localized message text describing the problem. */
150
+ message?: string;
151
+ /** Character offset of the problem within the pattern. */
152
+ character?: number;
153
+ /**
154
+ * Parser warnings (e.g. an empty-match regex); present only when there is
155
+ * at least one, each with its own message and character offset.
156
+ */
157
+ warnings?: {
158
+ message?: string;
159
+ character?: number;
160
+ }[];
161
+ };
162
+ }
163
+ /** Response of `action=abusefilterevalexpression`. */
164
+ export interface ApiAbuseFilterEvalExpressionResponse extends ApiEnvelope {
165
+ abusefilterevalexpression: {
166
+ /**
167
+ * Evaluated value. A boolean, number, string or (with `prettyprint`) a
168
+ * formatted representation, and a structured value for some expressions.
169
+ */
170
+ result?: unknown;
171
+ };
172
+ }
173
+ /** Response of `action=abusefiltercheckmatch`. */
174
+ export interface ApiAbuseFilterCheckMatchResponse extends ApiEnvelope {
175
+ abusefiltercheckmatch: {
176
+ /** Whether the pattern matches the supplied variables. A real `boolean`. */
177
+ result?: boolean;
178
+ };
179
+ }
180
+ /** Response of `action=abusefilterunblockautopromote`. */
181
+ export interface ApiAbuseFilterUnblockAutopromoteResponse extends ApiEnvelope {
182
+ abusefilterunblockautopromote: {
183
+ /** Canonical name of the user whose autopromote block was lifted. */
184
+ user?: string;
185
+ };
186
+ }
187
+ /** Response of `action=abuselogprivatedetails` (needs `abusefilter-privatedetails`). */
188
+ export interface ApiAbuseLogPrivateDetailsResponse extends ApiEnvelope {
189
+ abuselogprivatedetails: {
190
+ /** Log record the details belong to. */
191
+ "log-id"?: number;
192
+ /** Actor of that log entry. */
193
+ user?: string;
194
+ /** Filter that matched. */
195
+ "filter-id"?: number;
196
+ /** Public filter description. */
197
+ "filter-description"?: string;
198
+ /** Real IP behind the entry; `null` when the log stored none. */
199
+ "ip-address"?: string | null;
200
+ };
201
+ }
202
+ declare module "types-mediawiki-response" {
203
+ interface ApiQueryResult {
204
+ abusefilters?: ApiAbuseFilter[];
205
+ abuselog?: ApiAbuseLogEntry[];
206
+ }
207
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Opt-in extension pack: **Babel** (`meta=babel`).
3
+ *
4
+ * Not in the default export: importing anything from this file — even just the
5
+ * field-group type you are about to use — activates the augmentation shipped at
6
+ * the bottom, which merges the field groups into the root package automatically
7
+ * (no manual `declare module`):
8
+ *
9
+ * ```ts
10
+ * import type {} from 'types-mediawiki-response/ext/babel';
11
+ * ```
12
+ *
13
+ * `ApiQueryBabel` (prefix `bab`, requiring `babuser`) returns a **flat map** of
14
+ * language code to Babel level (`"babel": { "en": "1", "de": "2", … }`) — one
15
+ * entry per language, no further grouping. The keys are site-configured Babel
16
+ * codes, so the object is open-ended; a user with no Babel entry yields an
17
+ * empty object (the module forces an associative type, so an empty result
18
+ * stays `{}` rather than `[]`).
19
+ *
20
+ * @see https://www.mediawiki.org/wiki/Extension:Babel
21
+ */
22
+ /**
23
+ * A `meta=babel` result: language code → Babel level string (e.g. `"N"`, `"1"`…
24
+ * `"5"`). Site-configured, so the key set is open. An unknown user is an
25
+ * {@link ApiErrorResponse}, not this type.
26
+ */
27
+ export type ApiBabelResult = Record<string, string>;
28
+ declare module "types-mediawiki-response" {
29
+ interface ApiQueryResult {
30
+ babel?: ApiBabelResult;
31
+ }
32
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Opt-in extension pack: **CategoryTree** (`action=categorytree`).
3
+ *
4
+ * Not in the default export. Standalone action response — import it directly:
5
+ *
6
+ * ```ts
7
+ * import type { ApiCategoryTreeResponse } from 'types-mediawiki-response/ext/categorytree';
8
+ * ```
9
+ *
10
+ * The module returns **pre-rendered HTML**, not structured rows: `category` is
11
+ * the root category, `html` the tree markup. Everything you would expect as
12
+ * data (page list, subcategories, sort keys) has to be parsed out of `html`, so
13
+ * prefer `list=allpages`/`prop=categories` when you need structure.
14
+ *
15
+ * The knobs are packed into a single JSON-encoded `options` string — there is
16
+ * **no `flavor` request parameter**; the tree shape comes from `mode`, and an
17
+ * unrecognized request parameter is what a `flavor=…` attempt earns you. The
18
+ * keys honored by the API are those in `$wgCategoryTreeDefaultOptions`
19
+ * (`mode`, `hideprefix`, `showcount`, `namespaces`, `notranslations`) plus
20
+ * `depth`; `hideroot` and `onlyroot` are read by the `<categorytree>` tag
21
+ * only, not by this module. Other scalar keys are tolerated but ignored, so
22
+ * the bag stays open.
23
+ * `html` is `""` when the category is empty or does not exist.
24
+ *
25
+ * @see https://www.mediawiki.org/wiki/Extension:CategoryTree
26
+ * @see https://www.mediawiki.org/wiki/Extension:CategoryTree/API
27
+ */
28
+ import type { ApiEnvelope } from "../envelope";
29
+ /**
30
+ * Options accepted inside the JSON-encoded `options` parameter. Which keys are
31
+ * honored comes from `$wgCategoryTreeDefaultOptions` (plus `depth`);
32
+ * `hideroot` and `onlyroot` apply to the `<categorytree>` tag only.
33
+ */
34
+ export interface ApiCategoryTreeOptions {
35
+ /**
36
+ * What to list: `0` subcategories, `10` pages, `20` both, `100` parents
37
+ * (inverse listing). Also accepts the names `categories`/`sub`, `pages`,
38
+ * `all` and `parents`/`super`/`inverse`.
39
+ */
40
+ mode?: number | "categories" | "pages" | "all" | "parents" | (string & {});
41
+ /** How many levels deep to expand from the root category. Defaults to 1. */
42
+ depth?: number;
43
+ /** Restrict listed pages to these namespace indexes; `false` means all. */
44
+ namespaces?: number[] | false;
45
+ /** Append per-category member counts. */
46
+ showcount?: boolean;
47
+ /**
48
+ * Strip the namespace prefix from displayed titles: `always`, `never`,
49
+ * `auto`, or `categories` (aliases `category`, `smart` — strip it only on
50
+ * subcategories). Boolean and yes/no spellings are accepted too.
51
+ */
52
+ hideprefix?: "always" | "never" | "auto" | "categories" | (string & {});
53
+ /** Exclude translated versions of pages from the listing. */
54
+ notranslations?: boolean;
55
+ /**
56
+ * Omit the root category itself from the output. Read by the
57
+ * `<categorytree>` tag only; the API ignores it.
58
+ */
59
+ hideroot?: boolean;
60
+ /**
61
+ * Emit only the root node, without its children. Read by the
62
+ * `<categorytree>` tag only; the API ignores it.
63
+ */
64
+ onlyroot?: boolean;
65
+ /** Additional scalar keys are tolerated (but ignored) by the API. */
66
+ [key: string]: unknown;
67
+ }
68
+ /** Response of `action=categorytree`. */
69
+ export interface ApiCategoryTreeResponse extends ApiEnvelope {
70
+ /**
71
+ * The module's only output is a content value: `html` holds the rendered tree.
72
+ * The requested category is **not** echoed back.
73
+ */
74
+ categorytree: {
75
+ /** Rendered tree markup; `""` for an empty or non-existent category. */
76
+ html?: string;
77
+ };
78
+ }
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Opt-in extension pack: **CheckUser** (`list=checkuser`, `list=checkuserlog`).
3
+ *
4
+ * Not in the default export: importing anything from this file — even just the
5
+ * field-group type you are about to use — activates the augmentation shipped at
6
+ * the bottom, which merges the field groups into the root package automatically
7
+ * (no manual `declare module`):
8
+ *
9
+ * ```ts
10
+ * import type {} from 'types-mediawiki-response/ext/checkuser';
11
+ * ```
12
+ *
13
+ * `list=checkuser` requires `mustBePosted()` and a csrf token (`cutoken`) plus
14
+ * the `checkuser` right; `list=checkuserlog` is a plain GET needing only the
15
+ * `checkuser-log` right. Every successful `list=checkuser` lookup is itself
16
+ * logged to cu_log (reason prefixed `API: ` for API requests), which is what
17
+ * populates `list=checkuserlog`.
18
+ *
19
+ * From MediaWiki 1.45 `list=checkuser` is switched off by default: unless the
20
+ * wiki sets `$wgCheckUserDisableCheckUserAPI = false`, every request fails with
21
+ * `disabled`. `list=checkuserlog` is unaffected.
22
+ *
23
+ * fv2 notes: values that were never recorded come back as `null` rather than
24
+ * being omitted — `agent`, and `ip` / `user` on rows that carry neither an actor
25
+ * nor an IP address.
26
+ * Continuation for `checkuserlog` uses `culcontinue` (covered by the core
27
+ * `ApiQueryContinue` index signature); `list=checkuser` does not paginate.
28
+ *
29
+ * @see https://www.mediawiki.org/wiki/Extension:CheckUser
30
+ */
31
+ import type { NamespaceIndex, Timestamp } from "../common";
32
+ /** One IP row of `curequest=userips`: an IP the target user edited from. */
33
+ export interface ApiCheckUserIpRow {
34
+ /** Last edit from this IP. */
35
+ end: Timestamp;
36
+ /** Number of edits made from this IP within the requested time frame. */
37
+ editcount: number;
38
+ /**
39
+ * First edit from this IP; only present once the IP has more than one edit.
40
+ */
41
+ start?: Timestamp;
42
+ /**
43
+ * The IP address; `""` for a row recorded without one, as this mode
44
+ * stringifies the column.
45
+ */
46
+ address: string;
47
+ }
48
+ /** One action row of `curequest=actions` (deprecated alias `edits`). */
49
+ export interface ApiCheckUserActionRow {
50
+ /** When the action happened. */
51
+ timestamp: Timestamp;
52
+ /** Namespace of the affected page. */
53
+ ns: NamespaceIndex;
54
+ /**
55
+ * Title (DB key form with underscores) of the affected page; a user page
56
+ * whose name is hidden comes back as a `rev-deleted-user` placeholder.
57
+ */
58
+ title: string;
59
+ /**
60
+ * Performing user name; IP for anonymous actions, or a `rev-deleted-user`
61
+ * placeholder. `null` on rows recorded with neither an actor nor an IP.
62
+ */
63
+ user: string | null;
64
+ /** IP address the action was made from; `null` when none was recorded. */
65
+ ip: string | null;
66
+ /**
67
+ * User-Agent string of the request, or `null` (not omitted under fv2) when
68
+ * none was recorded.
69
+ */
70
+ agent: string | null;
71
+ /** Edit summary / log action text, when there is one. */
72
+ summary?: string;
73
+ /** `m` for minor edits; the key is absent otherwise. */
74
+ minor?: "m";
75
+ /**
76
+ * X-Forwarded-For chain of the request, when one was recorded. Reported
77
+ * independently of `cuxff`, which only decides what the lookup matches on.
78
+ */
79
+ xff?: string;
80
+ }
81
+ /** One user row of `curequest=ipusers`: an account that edited from the target IP. */
82
+ export interface ApiCheckUserIpUserRow {
83
+ /** Last edit by this user from the target IP. */
84
+ end: Timestamp;
85
+ /** Number of edits by this user from the target IP within the time frame. */
86
+ editcount: number;
87
+ /**
88
+ * Distinct IPs the user edited from — one for a single-IP target, but several
89
+ * when the target is a CIDR range or `cuxff` was passed (rows are then
90
+ * matched on XFF while the reported address stays the recorded IP). An entry
91
+ * is `null` when its row was recorded without an IP.
92
+ */
93
+ ips: (string | null)[];
94
+ /** Distinct User-Agent strings seen, entries may be `null` when unrecorded. */
95
+ agents: (string | null)[];
96
+ /**
97
+ * First edit by this user from the target IP; only present once the user has
98
+ * more than one edit.
99
+ */
100
+ start?: Timestamp;
101
+ /**
102
+ * User name, or a `rev-deleted-user` placeholder when suppressed; `""` for
103
+ * rows recorded with neither an actor nor an IP.
104
+ */
105
+ name: string;
106
+ }
107
+ /** The `checkuser` object: shaped by `curequest`, one key per request mode. */
108
+ export interface ApiQueryCheckUserResult {
109
+ /** `curequest=userips`: IPs a user edited from. */
110
+ userips?: ApiCheckUserIpRow[];
111
+ /**
112
+ * `curequest=actions`, and its deprecated alias `curequest=edits` (which
113
+ * only draws a deprecation warning): individual actions by a user / IP.
114
+ *
115
+ * @since MediaWiki 1.42 for the `actions` spelling; earlier releases accept
116
+ * only `edits`.
117
+ */
118
+ edits?: ApiCheckUserActionRow[];
119
+ /** `curequest=ipusers`: users who edited from an IP or range. */
120
+ ipusers?: ApiCheckUserIpUserRow[];
121
+ }
122
+ /** One entry of `list=checkuserlog`. */
123
+ export interface ApiCheckUserLogEntry {
124
+ /** When the check was performed. */
125
+ timestamp: Timestamp;
126
+ /** The checkuser who ran the lookup. */
127
+ checkuser: string;
128
+ /**
129
+ * Lookup type, e.g. `userips`, `useredits`, `ipusers`, `ipedits`,
130
+ * `ipedits-xff`, `ipusers-xff`, `investigate`.
131
+ */
132
+ type: string;
133
+ /** Check reason, prefixed `API: ` for lookups made through the API. */
134
+ reason: string;
135
+ /** Looked-up target (user name or IP). */
136
+ target: string;
137
+ }
138
+ /** The `checkuserlog` object of a `list=checkuserlog` response. */
139
+ export interface ApiQueryCheckUserLogResult {
140
+ /** Log entries, ordered per `culdir` (default newest first). */
141
+ entries?: ApiCheckUserLogEntry[];
142
+ }
143
+ declare module "types-mediawiki-response" {
144
+ interface ApiQueryResult {
145
+ checkuser?: ApiQueryCheckUserResult;
146
+ checkuserlog?: ApiQueryCheckUserLogResult;
147
+ }
148
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Opt-in extension pack: **Wikibase Client** (`prop=description`).
3
+ *
4
+ * Not in the default export: importing anything from this file — even just the
5
+ * field-group type you are about to use — activates the augmentation shipped at
6
+ * the bottom, which merges the field groups into the root package automatically
7
+ * (no manual `declare module`):
8
+ *
9
+ * ```ts
10
+ * import type {} from 'types-mediawiki-response/ext/description';
11
+ * ```
12
+ *
13
+ * @see https://www.mediawiki.org/wiki/Extension:Wikibase_Client
14
+ */
15
+ /** Where the description came from. Open union for forward compatibility. */
16
+ export type DescriptionSource = "local" | "central" | (string & {});
17
+ declare module "types-mediawiki-response" {
18
+ interface ApiPage {
19
+ description?: string;
20
+ descriptionsource?: DescriptionSource;
21
+ }
22
+ }