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,273 @@
1
+ /**
2
+ * Opt-in extension pack: **DiscussionTools**
3
+ * (`action=discussiontoolspageinfo`, `action=discussiontoolsfindcomment`,
4
+ * `action=discussiontoolsgetsubscriptions`, `action=discussiontoolssubscribe`,
5
+ * `action=discussiontoolsthank`, `action=discussiontoolscompare`,
6
+ * `action=discussiontoolspreview`, `action=discussiontoolsedit`).
7
+ *
8
+ * Not in the default export. These are standalone action responses — import what
9
+ * you need directly:
10
+ *
11
+ * ```ts
12
+ * import type { ApiDiscussionToolsPageInfoResponse } from 'types-mediawiki-response/ext/discussiontools';
13
+ * ```
14
+ *
15
+ * Nothing here merges into `ApiPage`/`ApiQueryResult`: most modules write a
16
+ * root-level key named after themselves (`discussiontoolspageinfo`,
17
+ * `discussiontoolsedit`, …). Two exceptions: `discussiontoolsgetsubscriptions`
18
+ * writes a root-level `subscriptions` map, and `discussiontoolsthank` writes a
19
+ * root-level `result` — the same shape as `action=thank` from the Thanks
20
+ * extension.
21
+ *
22
+ * Comments are addressed by a generated `id` (`h-<slug>-<timestamp>` for a topic
23
+ * heading, `c-<user>-<timestamp>` for a comment) and a `name` (`h-<user>-<timestamp>`
24
+ * for a topic, where `<user>` is the thread starter; `c-<user>-<timestamp>` for a
25
+ * comment); `findcomment` resolves either into both fields, which is the reliable
26
+ * way to obtain them. Replies nest arbitrarily deep under `replies`.
27
+ *
28
+ * @see https://www.mediawiki.org/wiki/Extension:DiscussionTools
29
+ */
30
+ import type { Flag, Timestamp } from "../common";
31
+ import type { ApiEnvelope } from "../envelope";
32
+ import type { ApiParse } from "../core/parse";
33
+ import type { ApiThankResult } from "./thanks";
34
+ import type { ApiLastModified } from "./visualeditor";
35
+ /** One node of a reply/indent tree (`prop=threaditemshtml`). */
36
+ export interface ApiDiscussionToolsComment {
37
+ /** Comment id, e.g. `h-Example_topic-20240115083000`. */
38
+ id: string;
39
+ /**
40
+ * Comment name — headings only (`h-<user>-<timestamp>`, where `<user>` is
41
+ * the thread starter, or bare `h-` for an empty section); comment items do
42
+ * not serialize a name.
43
+ */
44
+ name?: string;
45
+ /** Rendering level of the heading (`0` for the topic itself). */
46
+ level?: number;
47
+ /** Heading level as written in wikitext (`==` → 2), headings only; `null` for placeholder headings. */
48
+ headingLevel?: number | null;
49
+ /**
50
+ * The heading opens a section that cannot be edited here (no edit-section
51
+ * link was rendered); headings only.
52
+ */
53
+ uneditableSection?: Flag;
54
+ /** Who wrote the comment. */
55
+ author?: string;
56
+ /** Display name shown in the signature, when it differs from {@link author}. */
57
+ displayName?: string;
58
+ /** When it was signed. */
59
+ timestamp?: Timestamp;
60
+ /** Comment type, e.g. `comment`, `heading`. Open union. */
61
+ type: string;
62
+ /** Rendered HTML of this comment. */
63
+ html?: string;
64
+ /** HTML of the content between an empty section's heading and the next one; headings only. */
65
+ othercontent?: string;
66
+ /** Nested replies (same shape, recursively). */
67
+ replies?: ApiDiscussionToolsComment[];
68
+ /**
69
+ * Number of comments below this heading. Headings only
70
+ * (`prop=threaditemshtml`).
71
+ *
72
+ * @since MediaWiki 1.45
73
+ */
74
+ commentCount?: number;
75
+ /**
76
+ * Distinct authors below this heading. Headings only.
77
+ *
78
+ * @since MediaWiki 1.45
79
+ */
80
+ authorCount?: number;
81
+ /**
82
+ * Timestamp of the latest reply under this heading, or `null` when there is
83
+ * none. Headings only.
84
+ *
85
+ * @since MediaWiki 1.45
86
+ */
87
+ latestReplyTimestamp?: Timestamp | null;
88
+ /**
89
+ * The most recent reply, serialized as a comment item without its `replies`;
90
+ * `null` when there is none. Headings only, and only with
91
+ * `threaditemsflags=activity` (alongside `prop=threaditemshtml`).
92
+ *
93
+ * @since MediaWiki 1.46
94
+ */
95
+ latestReply?: ApiDiscussionToolsComment | null;
96
+ /**
97
+ * The earliest reply, same serialization as {@link latestReply}; `null` when
98
+ * there is none. Headings only, and only with `threaditemsflags=activity`
99
+ * (alongside `prop=threaditemshtml`).
100
+ *
101
+ * @since MediaWiki 1.46
102
+ */
103
+ oldestReply?: ApiDiscussionToolsComment | null;
104
+ }
105
+ /**
106
+ * `prop=transcludedfrom`: whether each comment is a transclusion target here.
107
+ * Keyed by comment id **and** name; `false` when the content is local, `true`
108
+ * when transcluded but the source could not be determined, otherwise the
109
+ * source page title.
110
+ */
111
+ export interface ApiDiscussionToolsTranscludedFrom {
112
+ [commentIdOrName: string]: boolean | string | undefined;
113
+ }
114
+ /** Response of `action=discussiontoolspageinfo`. */
115
+ export interface ApiDiscussionToolsPageInfoResponse extends ApiEnvelope {
116
+ discussiontoolspageinfo: {
117
+ /** Parsed reply tree. `prop=threaditemshtml`. */
118
+ threaditemshtml?: ApiDiscussionToolsComment[];
119
+ /** Per-comment transclusion map (local vs transcluded, with source title). `prop=transcludedfrom`. */
120
+ transcludedfrom?: ApiDiscussionToolsTranscludedFrom;
121
+ };
122
+ }
123
+ /** One candidate returned by `action=discussiontoolsfindcomment`. */
124
+ export interface ApiDiscussionToolsFoundComment {
125
+ /** Canonical comment id. */
126
+ id: string;
127
+ /** Canonical comment name. */
128
+ name: string;
129
+ /** Page the comment lives on. */
130
+ title: string;
131
+ /** Revision id of the permalink; `null` when the revision is the current one. */
132
+ oldid: number | null;
133
+ /** How the lookup matched: `id`, `name` or `heading`. */
134
+ matchedby: "id" | "name" | "heading" | (string & {});
135
+ /**
136
+ * Whether the request could be redirected to a permalink. Absent in the 1.41
137
+ * `findcomment` release, which unset it; emitted from 1.42.
138
+ *
139
+ * @since MediaWiki 1.42
140
+ */
141
+ couldredirect?: boolean;
142
+ /**
143
+ * Whether it should be (the target differs from what was asked).
144
+ *
145
+ * @since MediaWiki 1.41
146
+ */
147
+ shouldredirect?: boolean;
148
+ }
149
+ /** Response of `action=discussiontoolsfindcomment` (a list of candidates). */
150
+ export interface ApiDiscussionToolsFindCommentResponse extends ApiEnvelope {
151
+ discussiontoolsfindcomment: ApiDiscussionToolsFoundComment[];
152
+ }
153
+ /**
154
+ * Response of `action=discussiontoolsgetsubscriptions`. The map is keyed by
155
+ * comment **name** (the same strings as the `commentname` request parameter);
156
+ * each value is `0` (unsubscribed), `1` (subscribed) or `2` (auto-subscribed)
157
+ * — numeric, not boolean, because the underlying column is.
158
+ */
159
+ export interface ApiDiscussionToolsGetSubscriptionsResponse extends ApiEnvelope {
160
+ subscriptions: Record<string, number>;
161
+ }
162
+ /** Response of `action=discussiontoolssubscribe`. */
163
+ export interface ApiDiscussionToolsSubscribeResponse extends ApiEnvelope {
164
+ discussiontoolssubscribe: {
165
+ /** Page the comment is on. */
166
+ page: string;
167
+ /** Canonical comment name the subscription applies to. */
168
+ commentname: string;
169
+ /** Requested state, echoed back. */
170
+ subscribe: boolean;
171
+ };
172
+ }
173
+ /**
174
+ * Response of `action=discussiontoolsthank`. The module inherits the Thanks
175
+ * extension's result: a root-level `result` key, not one named after the
176
+ * module.
177
+ */
178
+ export interface ApiDiscussionToolsThankResponse extends ApiEnvelope {
179
+ /** The thanks result, the same shape as `action=thank` ({@link ApiThankResult}). */
180
+ result?: ApiThankResult;
181
+ }
182
+ /**
183
+ * One comment item in a `discussiontoolscompare` diff: the thread-item shape
184
+ * (see `ApiDiscussionToolsComment`) with `replies` flattened to comment ids
185
+ * and the heading references appended.
186
+ */
187
+ export interface ApiDiscussionToolsCommentForDiff {
188
+ /** Comment id. */
189
+ id?: string;
190
+ /** Comment type, e.g. `comment`. */
191
+ type?: string;
192
+ /** Rendering level. */
193
+ level?: number;
194
+ /** Ids of nested replies (shallow serialization). */
195
+ replies?: string[];
196
+ /** When it was signed — the compact id/name timestamp form (`YYYYMMDDHHMMSS`); comments predating 2022-07 are ISO 8601 instead. */
197
+ timestamp?: Timestamp;
198
+ /** Who wrote the comment. */
199
+ author?: string;
200
+ /** Id of the heading the comment sits under. */
201
+ headingId?: string;
202
+ /** Id of the nearest subscribable heading; `null` when there is none. */
203
+ subscribableHeadingId?: string | null;
204
+ }
205
+ /** Response of `action=discussiontoolscompare` (comment-level diff of two revisions). */
206
+ export interface ApiDiscussionToolsCompareResponse extends ApiEnvelope {
207
+ discussiontoolscompare: {
208
+ /** Left revision id. */
209
+ fromrevid?: number;
210
+ /** Page title of the left revision. */
211
+ fromtitle?: string;
212
+ /** Right revision id. */
213
+ torevid?: number;
214
+ /** Page title of the right revision. */
215
+ totitle?: string;
216
+ /** Comments present only in the left revision. */
217
+ removedcomments?: ApiDiscussionToolsCommentForDiff[];
218
+ /** Comments present only in the right revision. */
219
+ addedcomments?: ApiDiscussionToolsCommentForDiff[];
220
+ };
221
+ }
222
+ /** Response of `action=discussiontoolspreview`. */
223
+ export interface ApiDiscussionToolsPreviewResponse extends ApiEnvelope {
224
+ discussiontoolspreview: {
225
+ /** The parsed preview, same shape as an `action=parse` payload. */
226
+ parse?: ApiParse;
227
+ };
228
+ }
229
+ /** Response of `action=discussiontoolsedit`. */
230
+ export interface ApiDiscussionToolsEditResponse extends ApiEnvelope {
231
+ discussiontoolsedit: {
232
+ /** `success` when the comment was saved. */
233
+ result?: "success" | (string & {});
234
+ /** Rendered HTML of the saved comment area. */
235
+ content?: string;
236
+ /**
237
+ * `true` when the content above was withheld (the `nocontent` request
238
+ * parameter) but had to be fetched internally anyway.
239
+ *
240
+ * @since MediaWiki 1.42
241
+ */
242
+ nocontent?: Flag;
243
+ /** Page subtitle (parsed HTML), copied from the underlying `action=parse` output. */
244
+ contentSub?: string;
245
+ /** Category HTML added by the saved comment. */
246
+ categorieshtml?: string;
247
+ /** Section list after the edit. */
248
+ sections?: unknown[];
249
+ /** Display title, HTML form. */
250
+ displayTitleHtml?: string;
251
+ /** ResourceLoader module names to load. */
252
+ modules?: string[];
253
+ /** ResourceLoader config variables (includes the thread model). */
254
+ jsconfigvars?: Record<string, unknown>;
255
+ /**
256
+ * Empty string for a normal page. The module copies `action=parse`'s field,
257
+ * which is a `Flag`-like empty string under fv2 rather than a boolean.
258
+ */
259
+ isRedirect?: string;
260
+ /** When the page last changed, in display parts. */
261
+ lastModified?: ApiLastModified;
262
+ /** New revision id; absent when nothing was saved. */
263
+ newrevid?: number;
264
+ /** `true` when a temporary account was created by this edit. */
265
+ tempusercreated?: Flag;
266
+ /** Redirect URL for a just-created temporary account, when one applies. */
267
+ tempusercreatedredirect?: string;
268
+ /** Whether the user now watches the page. */
269
+ watched?: boolean;
270
+ /** When that watch expires; `null` for a permanent watch. */
271
+ watchlistexpiry?: Timestamp | null;
272
+ };
273
+ }
@@ -0,0 +1,306 @@
1
+ /**
2
+ * Opt-in extension pack: **Echo / Notifications** (`meta=notifications`,
3
+ * `meta=unreadnotificationpages`, `action=echomute`, `action=echocreateevent`,
4
+ * `action=echoarticlereminder`, `action=echopushsubscriptions`).
5
+ * `echomarkread`/`echomarkseen` are top-level actions (not `meta=` modules)
6
+ * that report their result under `query`.
7
+ *
8
+ * Not in the default export: importing anything from this file — even just the
9
+ * field-group type you are about to use — activates the augmentation shipped at
10
+ * the bottom, which merges the field groups into the root package automatically
11
+ * (no manual `declare module`):
12
+ *
13
+ * ```ts
14
+ * import type {} from 'types-mediawiki-response/ext/echo';
15
+ * ```
16
+ *
17
+ * The `action=` responses (`echomute`, `echocreateevent`) are standalone — import them by name.
18
+ *
19
+ * `ApiEchoNotification` is one notification row; the unread counts (localized
20
+ * `count` string next to numeric `rawcount`) live on the result objects and on
21
+ * the `echomarkread` response.
22
+ * `ApiEchoMarkSeen` returns the server "all seen" timestamp. Pass
23
+ * `timestampformat=ISO_8601` to avoid the deprecated MW-timestamp format.
24
+ *
25
+ * fv2 notes worth knowing: `count` is a **localized string** while `rawcount` is a
26
+ * number; `notifications.continue` is explicitly `null` when there is nothing left
27
+ * to page through (not an omitted key); with `notgroupbysection=1` the result is
28
+ * keyed by `alert`/`message` instead of carrying a flat `list`; and
29
+ * `notformat=model` replaces the rendered strings with a structured
30
+ * {@link ApiEchoNotificationModel} body.
31
+ *
32
+ * @see https://www.mediawiki.org/wiki/Extension:Echo
33
+ */
34
+ import type { NamespaceIndex, Timestamp } from "../common";
35
+ import type { ApiEnvelope } from "../envelope";
36
+ /** A notification count: numeric `rawcount` plus a localized `count` string. */
37
+ export interface ApiEchoNotificationCount {
38
+ /** Raw numeric count. */
39
+ rawcount: number;
40
+ /** Count formatted for display (a string; e.g. `"0"`, `"1,234"`). */
41
+ count: string;
42
+ }
43
+ /** The `echomarkread` object (returned under `query` by `action=echomarkread`). */
44
+ export interface ApiQueryEchoMarkRead {
45
+ /** Echo status string; `success` on completion. */
46
+ result: "success" | (string & {});
47
+ /** Per-wiki error from a failed foreign (cross-wiki) subrequest. */
48
+ errors?: {
49
+ [wiki: string]: {
50
+ code?: string;
51
+ info?: string;
52
+ [key: string]: unknown;
53
+ };
54
+ };
55
+ /** Remaining unread `alert`-section count. */
56
+ alert: ApiEchoNotificationCount;
57
+ /** Remaining unread `message`-section count. */
58
+ message: ApiEchoNotificationCount;
59
+ /** Overall remaining unread count. */
60
+ rawcount: number;
61
+ /** Overall remaining unread count, formatted. */
62
+ count: string;
63
+ }
64
+ /** The `echomarkseen` object (returned under `query` by `action=echomarkseen`). */
65
+ export interface ApiQueryEchoMarkSeen {
66
+ /** Echo status string; `success` on completion. */
67
+ result?: "success" | (string & {});
68
+ /** The "all notifications seen" timestamp just recorded. */
69
+ timestamp?: Timestamp;
70
+ }
71
+ /** Every timestamp form Echo attaches to a notification (`timestamp=` object). */
72
+ export interface ApiEchoTimestamp {
73
+ /** ISO 8601 (UTC), e.g. `2024-01-15T08:30:00Z`. */
74
+ utciso8601?: Timestamp;
75
+ /** Unix epoch seconds as a number. */
76
+ utcunix?: number;
77
+ /** Unix epoch seconds as a **string**, in the receiving user's local timezone ({@link utcunix} is UTC). */
78
+ unix?: string;
79
+ /** MediaWiki 14-digit timestamp. */
80
+ utcmw?: string;
81
+ /** MediaWiki 14-digit timestamp in the user's local timezone (`utcmw` is the UTC one). */
82
+ mw?: string;
83
+ /**
84
+ * Localized date-group header: `Today`/`Yesterday`, or a pretty date such as
85
+ * `May 10` for notifications older than 48 hours.
86
+ */
87
+ date?: string;
88
+ }
89
+ /** The title of the page a notification points at. */
90
+ export interface ApiEchoTitle {
91
+ /** Full title with namespace prefix. */
92
+ full?: string;
93
+ /** Localized namespace prefix (`""` in the main namespace). */
94
+ namespace?: string;
95
+ /** Namespace index; hyphenated key, spelled literally. */
96
+ "namespace-key"?: number;
97
+ /** Title without the namespace prefix. */
98
+ text?: string;
99
+ }
100
+ /** The user whose action triggered a notification. */
101
+ export interface ApiEchoAgent {
102
+ /** User id. */
103
+ id?: number;
104
+ /** User name. */
105
+ name?: string;
106
+ /**
107
+ * Suppression marker: when the agent's identity is hidden, the agent object
108
+ * collapses to `{ userhidden: "" }` and carries no other keys.
109
+ */
110
+ userhidden?: "";
111
+ }
112
+ /** One link attached to a model-format notification. */
113
+ export interface ApiEchoNotificationLink {
114
+ /** Link text. */
115
+ label?: string;
116
+ /** Target URL. */
117
+ url?: string;
118
+ }
119
+ /** Structured payload a notification's presenter exposes (`notformat=model`). */
120
+ export interface ApiEchoNotificationModel {
121
+ /** Rendered body HTML. */
122
+ body?: string;
123
+ /** Short header line. */
124
+ header?: string;
125
+ /** Condensed header for the flyout. */
126
+ compactHeader?: string;
127
+ /** Icon name from the Echo icon registry. */
128
+ icon?: string;
129
+ /** Icon URL. */
130
+ iconUrl: string;
131
+ /** Primary/secondary action links. Open: extensions add their own keys. */
132
+ links?: {
133
+ primary?: ApiEchoNotificationLink;
134
+ secondary?: ApiEchoNotificationLink[];
135
+ [key: string]: unknown;
136
+ };
137
+ /** Presenter-specific extras (bundled notifications, watch titles, …). */
138
+ [key: string]: unknown;
139
+ }
140
+ /** One notification row (`meta=notifications`, `notprop=list`). */
141
+ export interface ApiEchoNotification {
142
+ /** Wiki the notification came from — cross-wiki notifications carry other sites. */
143
+ wiki?: string;
144
+ /** Notification id; feed it back to `action=echomarkread` or `action=echomute`. */
145
+ id?: number;
146
+ /** Event type, e.g. `mention`, `thank-you-edit`, `page-linked`. Open union. */
147
+ type?: string;
148
+ /** Event category, usually mirrors {@link type}. */
149
+ category?: string;
150
+ /** Section the notification lives in. */
151
+ section?: "alert" | "message" | (string & {});
152
+ /** Timestamp in every form Echo publishes. */
153
+ timestamp?: ApiEchoTimestamp;
154
+ /** Ids of the notifications bundled into this one (bundled notifications present). */
155
+ bundledIds?: number[];
156
+ /** Presentation variant of the event, when the event carries one. */
157
+ variant?: string;
158
+ /** Target page of the notification. */
159
+ title?: ApiEchoTitle;
160
+ /** Actor that triggered it. */
161
+ agent?: ApiEchoAgent;
162
+ /** Revision id associated with the event. */
163
+ revid?: number;
164
+ /** When the notification was marked read (MediaWiki 14-digit timestamp). */
165
+ read?: string;
166
+ /** Page ids the notification targets (empty array when there are none). */
167
+ targetpages?: number[];
168
+ /**
169
+ * Rendered notification body, present whenever `notformat` is given. The
170
+ * shape depends on the format: `model` returns a structured
171
+ * {@link ApiEchoNotificationModel} object, the other formats (`special`,
172
+ * plus the deprecated `flyout`/`html`) return an HTML string.
173
+ */
174
+ "*"?: ApiEchoNotificationModel | string;
175
+ /**
176
+ * The notifications bundled into this one, formatted like the parent row
177
+ * (expandable bundles; requires `notformat`).
178
+ */
179
+ bundledNotifications?: ApiEchoNotification[];
180
+ }
181
+ /** A `count` / `list` slice, either flat or grouped per section. */
182
+ export interface ApiEchoNotificationSection {
183
+ /** Notification rows. */
184
+ list?: ApiEchoNotification[];
185
+ /** Continue cursor for this section, or `null` when the list is complete. */
186
+ continue?: string | null;
187
+ /** Raw numeric unread count. */
188
+ rawcount?: number;
189
+ /** Unread count formatted for display. */
190
+ count?: string;
191
+ /**
192
+ * Last-seen timestamp. At the top level of `notifications` (flat mode) this
193
+ * is a map keyed by section name; inside a per-section object (grouped mode,
194
+ * `notgroupbysection=1`) it is a single ISO timestamp.
195
+ */
196
+ seenTime?: Timestamp | Record<string, Timestamp>;
197
+ }
198
+ /** The `notifications` object (returned under `query` by `meta=notifications`). */
199
+ export interface ApiQueryEchoNotifications extends ApiEchoNotificationSection {
200
+ /**
201
+ * Per-section results, present only with `notgroupbysection=1` — then
202
+ * {@link ApiEchoNotificationSection.list} sits inside each section instead.
203
+ */
204
+ alert?: ApiEchoNotificationSection;
205
+ /** Message-section grouping; see {@link alert}. */
206
+ message?: ApiEchoNotificationSection;
207
+ }
208
+ /** One wiki's unread-notification summary inside `unreadnotificationpages`. */
209
+ export interface ApiEchoUnreadSource {
210
+ /** Article-path base of the source wiki. */
211
+ base?: string;
212
+ /** URL of the source wiki's `api.php` endpoint. */
213
+ url?: string;
214
+ /** Display name of the source wiki (localized project name, sitename fallback). */
215
+ title?: string;
216
+ }
217
+ /** Per-wiki unread summary keyed by page title. */
218
+ export interface ApiEchoUnreadPage {
219
+ /**
220
+ * Page title; `null` for the pseudo-row aggregating notifications not tied
221
+ * to any page (only appears with `unpgrouppages` off).
222
+ */
223
+ title?: string | null;
224
+ /** Namespace index (only with `unpgrouppages`). */
225
+ ns?: NamespaceIndex;
226
+ /** Title without the namespace prefix (only with `unpgrouppages`). */
227
+ unprefixed?: string;
228
+ /**
229
+ * Subject- and talk-page titles this count covers (only with
230
+ * `unpgrouppages`); contains `null` for the requesting user's own page.
231
+ */
232
+ pages?: (string | null)[];
233
+ /** Unread notifications for this page. */
234
+ count?: number;
235
+ }
236
+ /** One wiki's entry in `meta=unreadnotificationpages` (keyed by wiki id). */
237
+ export interface ApiEchoUnreadWiki {
238
+ /** Where the notifications came from. */
239
+ source?: ApiEchoUnreadSource;
240
+ /** Per-page unread counts. */
241
+ pages?: ApiEchoUnreadPage[];
242
+ /**
243
+ * Total unread notifications on the wiki (badge-count semantics, capped at
244
+ * the notifications-badge limit); not the sum of {@link ApiEchoUnreadPage.count}.
245
+ */
246
+ totalCount?: number;
247
+ }
248
+ /**
249
+ * The `unreadnotificationpages` object: a map from wiki id (e.g.
250
+ * `mediawikiwiki`) to that wiki's unread summary. A PHP map, so an empty result
251
+ * serializes as `[]`.
252
+ */
253
+ export interface ApiQueryEchoUnreadPages {
254
+ [wikiId: string]: ApiEchoUnreadWiki | unknown[] | undefined;
255
+ }
256
+ /**
257
+ * Response of `action=echomute`. The module writes a plain status **string**
258
+ * (no wrapper object): `success` after muting or unmuting.
259
+ */
260
+ export interface ApiEchoMuteResponse extends ApiEnvelope {
261
+ echomute: "success" | (string & {});
262
+ }
263
+ /**
264
+ * Response of `action=echocreateevent`. Shape of the `ApiEchoCreateEvent`
265
+ * module (off by default — `$wgEchoEnableApiEvents`).
266
+ *
267
+ * @since MediaWiki 1.43
268
+ */
269
+ export interface ApiEchoCreateEventResponse extends ApiEnvelope {
270
+ echocreateevent: {
271
+ /** `success` when the event was stored. */
272
+ result?: "success" | (string & {});
273
+ };
274
+ }
275
+ /**
276
+ * The `echoarticlereminder` object (returned under `query`). The module is
277
+ * only registered when `$wgAllowArticleReminderNotification` is on.
278
+ */
279
+ export interface ApiQueryEchoArticleReminder {
280
+ /** `success` when the reminder was scheduled. */
281
+ result?: "success" | (string & {});
282
+ }
283
+ /**
284
+ * Responses of `action=echopushsubscriptions`: the `command` value is the
285
+ * response key (`create` or `delete`). The module is experimental and only
286
+ * registered when `$wgEchoEnablePush` is on.
287
+ */
288
+ export interface ApiEchoPushSubscriptionsResponse extends ApiEnvelope {
289
+ /** `command=create` — the subscription was stored. */
290
+ create?: {
291
+ result?: "Success" | (string & {});
292
+ };
293
+ /** `command=delete` — the subscription was removed. */
294
+ delete?: {
295
+ result?: "Success" | (string & {});
296
+ };
297
+ }
298
+ declare module "types-mediawiki-response" {
299
+ interface ApiQueryResult {
300
+ notifications?: ApiQueryEchoNotifications;
301
+ unreadnotificationpages?: ApiQueryEchoUnreadPages;
302
+ echomarkread?: ApiQueryEchoMarkRead;
303
+ echomarkseen?: ApiQueryEchoMarkSeen;
304
+ echoarticlereminder?: ApiQueryEchoArticleReminder;
305
+ }
306
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Opt-in extension pack: **TextExtracts** (`prop=extracts`).
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/extracts';
11
+ * ```
12
+ *
13
+ * `exintro` limits to the intro, `explaintext` returns plain text (else HTML).
14
+ *
15
+ * @see https://www.mediawiki.org/wiki/Extension:TextExtracts
16
+ */
17
+ import type { PlainText } from "../common";
18
+ /** A page content extract ({@link PlainText} with `explaintext`, else HTML). */
19
+ export type ApiExtract = PlainText;
20
+ declare module "types-mediawiki-response" {
21
+ interface ApiPage {
22
+ extract?: ApiExtract;
23
+ }
24
+ }