types-mediawiki-response 1.1.0 → 1.1.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/dist/core/query/index.d.ts +1 -0
- package/dist/core/query/logevents.d.ts +6 -2
- package/dist/core/query/logparams.d.ts +283 -0
- package/dist/core/query/recentchanges.d.ts +6 -2
- package/dist/core/query/watchlist.d.ts +6 -2
- package/dist/extensions/betafeatures.d.ts +40 -0
- package/dist/extensions/centralauth.d.ts +328 -0
- package/dist/extensions/checkuser.d.ts +19 -1
- package/dist/extensions/translate.d.ts +524 -0
- package/dist/extensions/uls.d.ts +52 -0
- package/package.json +1 -1
|
@@ -448,6 +448,7 @@ export interface ApiQueryResponse extends ApiEnvelope {
|
|
|
448
448
|
"query-noncontinue"?: Record<string, Record<string, string | number>>;
|
|
449
449
|
}
|
|
450
450
|
export * from "./shared";
|
|
451
|
+
export * from "./logparams";
|
|
451
452
|
export * from "./info";
|
|
452
453
|
export * from "./categories";
|
|
453
454
|
export * from "./revisions";
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Flag, NamespaceIndex, Timestamp } from "../../common";
|
|
11
11
|
import type { ApiHiddenFlags } from "./shared";
|
|
12
|
+
import type { ApiLogEventParams } from "./logparams";
|
|
12
13
|
/** One log event. `leprop` controls which fields appear. */
|
|
13
14
|
export interface ApiLogEvent extends ApiHiddenFlags {
|
|
14
15
|
/** Log record id. `leprop=ids`. */
|
|
@@ -31,8 +32,11 @@ export interface ApiLogEvent extends ApiHiddenFlags {
|
|
|
31
32
|
type?: string;
|
|
32
33
|
/** Log action, e.g. `create`, `delete`. `leprop=type`. */
|
|
33
34
|
action?: string;
|
|
34
|
-
/**
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Structured log details; shape varies by `type`/`action` — see
|
|
37
|
+
* {@link ApiLogEventParams}. `leprop=details`.
|
|
38
|
+
*/
|
|
39
|
+
params?: ApiLogEventParams;
|
|
36
40
|
/** Performing user name (or IP). `leprop=user`. */
|
|
37
41
|
user?: string;
|
|
38
42
|
/** Performing user id. `leprop=userid`. */
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured details of log events, shared by `logevents.params`,
|
|
3
|
+
* `recentchanges.logparams` and `watchlist.logparams`.
|
|
4
|
+
*/
|
|
5
|
+
import type { ContentModel, Expiry, Timestamp } from "../../common";
|
|
6
|
+
/**
|
|
7
|
+
* Structured log details — the `params` object of a log event (`leprop=details`
|
|
8
|
+
* on `list=logevents`, `logparams` under the log-info fields of
|
|
9
|
+
* `list=recentchanges` / `list=watchlist`).
|
|
10
|
+
*
|
|
11
|
+
* Each log action writes its own key set, which the server normalizes for the
|
|
12
|
+
* API. The keys below are the ones MediaWiki core itself writes; which of
|
|
13
|
+
* them a row carries depends on its `type`/`action`.
|
|
14
|
+
*
|
|
15
|
+
* The key space is open: extensions and site configuration can register
|
|
16
|
+
* further log actions, and rows written by older MediaWiki versions keep
|
|
17
|
+
* their historical key forms. Unknown keys therefore fall back to `unknown`
|
|
18
|
+
* instead of erroring. Consumers targeting one specific log action — or a
|
|
19
|
+
* site-custom one — can add its keys through interface merging:
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* declare module "types-mediawiki-response" {
|
|
23
|
+
* interface ApiLogEventParams {
|
|
24
|
+
* // a site-custom log action, or a legacy key form still in the data
|
|
25
|
+
* "4::target"?: string;
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export interface ApiLogEventParams {
|
|
30
|
+
/**
|
|
31
|
+
* Block duration as configured: `'infinity'` or the raw specifier
|
|
32
|
+
* (`'2 weeks'`, …), on `block/block`, `block/reblock`, `suppress/block` and
|
|
33
|
+
* `suppress/reblock` rows. Older rows without one are normalized to
|
|
34
|
+
* `'infinity'`.
|
|
35
|
+
*/
|
|
36
|
+
duration?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Options in force on the block. Rows written by very old MediaWiki
|
|
39
|
+
* versions may carry the legacy values `autoblock` or `angry-autoblock`
|
|
40
|
+
* instead of the current flag set. An array (`[]` when none).
|
|
41
|
+
*/
|
|
42
|
+
flags?: Array<"anononly" | "nocreate" | "noautoblock" | "noemail" | "nousertalk" | "hiddenname" | "autoblock" | "angry-autoblock">;
|
|
43
|
+
/**
|
|
44
|
+
* Absolute expiry of the block (ISO 8601), on rows with a finite duration.
|
|
45
|
+
*/
|
|
46
|
+
expiry?: Timestamp;
|
|
47
|
+
/** Whether the block covers the whole site (`false` for a partial block). */
|
|
48
|
+
sitewide?: boolean;
|
|
49
|
+
/** Scope of a partial block; absent for sitewide blocks. */
|
|
50
|
+
restrictions?: ApiLogBlockRestrictions;
|
|
51
|
+
/**
|
|
52
|
+
* Id of the block the row created or changed.
|
|
53
|
+
*
|
|
54
|
+
* @since MediaWiki 1.44
|
|
55
|
+
*/
|
|
56
|
+
blockId?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Localized duration text (e.g. `'14 days'`, `'infinite'`), in the
|
|
59
|
+
* requesting user's language.
|
|
60
|
+
*
|
|
61
|
+
* @since MediaWiki 1.44
|
|
62
|
+
*/
|
|
63
|
+
"duration-l10n"?: string;
|
|
64
|
+
/** Namespace of the move destination (on `move/move` and `move/move_redir` rows). */
|
|
65
|
+
target_ns?: number;
|
|
66
|
+
/** Title of the move destination. */
|
|
67
|
+
target_title?: string;
|
|
68
|
+
/** Whether the move left no redirect behind. */
|
|
69
|
+
suppressredirect?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Content-language protection summary (e.g. `'[edit=autoconfirmed]
|
|
72
|
+
* (indefinite)'`), aimed at machine feeds; the structured data lives in
|
|
73
|
+
* {@link details}.
|
|
74
|
+
*/
|
|
75
|
+
description?: string;
|
|
76
|
+
/** Whether cascading protection was requested. */
|
|
77
|
+
cascade?: boolean;
|
|
78
|
+
/** Protection restrictions in force. */
|
|
79
|
+
details?: ApiLogProtectDetail[];
|
|
80
|
+
/** Namespace of the title the protection moved away from. */
|
|
81
|
+
oldtitle_ns?: number;
|
|
82
|
+
/** Title the protection moved away from. */
|
|
83
|
+
oldtitle_title?: string;
|
|
84
|
+
/**
|
|
85
|
+
* How many revisions and archived file versions the undeletion restored
|
|
86
|
+
* (`delete/restore`), how many revisions an import created
|
|
87
|
+
* (`import/upload`, `import/interwiki`), or how many uses a managed tag
|
|
88
|
+
* had (`managetags/activate|deactivate|delete`).
|
|
89
|
+
*/
|
|
90
|
+
count?: {
|
|
91
|
+
revisions: number;
|
|
92
|
+
files: number;
|
|
93
|
+
} | number;
|
|
94
|
+
/**
|
|
95
|
+
* What the visibility change targeted: `'revision'`, `'archive'`,
|
|
96
|
+
* `'oldimage'` or `'filearchive'` on `…/revision` rows; `'logging'` on
|
|
97
|
+
* `…/event` rows.
|
|
98
|
+
*/
|
|
99
|
+
type?: "revision" | "archive" | "oldimage" | "filearchive" | "logging";
|
|
100
|
+
/**
|
|
101
|
+
* Ids of the targeted revisions, file versions or log entries — numbers on
|
|
102
|
+
* current rows, strings on legacy ones.
|
|
103
|
+
*/
|
|
104
|
+
ids?: Array<number | string>;
|
|
105
|
+
/** Visibility state before the change. */
|
|
106
|
+
old?: ApiLogRevDelVisibility;
|
|
107
|
+
/** Visibility state after the change. */
|
|
108
|
+
new?: ApiLogRevDelVisibility;
|
|
109
|
+
/**
|
|
110
|
+
* Id of the account the row reports (on `newusers/create`, `newusers/create2`
|
|
111
|
+
* and `newusers/autocreate` rows).
|
|
112
|
+
*/
|
|
113
|
+
userid?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Groups the target user belonged to before the change (on `rights/rights`
|
|
116
|
+
* and `rights/autopromote` rows).
|
|
117
|
+
*/
|
|
118
|
+
oldgroups?: string[];
|
|
119
|
+
/** Groups after the change. */
|
|
120
|
+
newgroups?: string[];
|
|
121
|
+
/**
|
|
122
|
+
* Per-group membership expiry, parallel to {@link oldgroups}; `[]` when the
|
|
123
|
+
* memberships were all permanent. Absent on `rights/autopromote` rows.
|
|
124
|
+
*/
|
|
125
|
+
oldmetadata?: ApiLogGroupMetadata[];
|
|
126
|
+
/**
|
|
127
|
+
* Per-group membership expiry, parallel to {@link newgroups}; `[]` when
|
|
128
|
+
* permanent. Absent on `rights/autopromote` rows.
|
|
129
|
+
*/
|
|
130
|
+
newmetadata?: ApiLogGroupMetadata[];
|
|
131
|
+
/**
|
|
132
|
+
* Content model before the change (on `contentmodel/change` and
|
|
133
|
+
* `contentmodel/new` rows).
|
|
134
|
+
*/
|
|
135
|
+
oldmodel?: ContentModel;
|
|
136
|
+
/** Content model after the change. */
|
|
137
|
+
newmodel?: ContentModel;
|
|
138
|
+
/** Namespace of the page the history was merged into. */
|
|
139
|
+
dest_ns?: number;
|
|
140
|
+
/** Title of the page the history was merged into. */
|
|
141
|
+
dest_title?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Namespace of the page whose history was merged in (`merge/merge-into` row
|
|
144
|
+
* filed on the destination page).
|
|
145
|
+
*
|
|
146
|
+
* @since MediaWiki 1.45
|
|
147
|
+
*/
|
|
148
|
+
src_ns?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Title of the page whose history was merged in (`merge/merge-into`).
|
|
151
|
+
*
|
|
152
|
+
* @since MediaWiki 1.45
|
|
153
|
+
*/
|
|
154
|
+
src_title?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Revision the histories were interleaved at (ISO 8601), on `merge/merge`
|
|
157
|
+
* and `merge/merge-into` rows.
|
|
158
|
+
*/
|
|
159
|
+
mergepoint?: Timestamp;
|
|
160
|
+
/**
|
|
161
|
+
* Boundary revision id the merge stopped at; stored raw, so it appears as
|
|
162
|
+
* a number or its decimal string.
|
|
163
|
+
*
|
|
164
|
+
* @since MediaWiki 1.42
|
|
165
|
+
*/
|
|
166
|
+
mergerevid?: number | string;
|
|
167
|
+
/**
|
|
168
|
+
* Timestamp of the first revision kept out of the merge, when a start
|
|
169
|
+
* boundary was used (ISO 8601); the id of that revision is
|
|
170
|
+
* {@link mergestartid}. Only `merge/merge` rows carry it — `merge/merge-into`
|
|
171
|
+
* rows do not report the start boundary at all.
|
|
172
|
+
*
|
|
173
|
+
* @since MediaWiki 1.45
|
|
174
|
+
*/
|
|
175
|
+
mergestart?: Timestamp;
|
|
176
|
+
/**
|
|
177
|
+
* First revision id kept out of the merge; stored raw like
|
|
178
|
+
* {@link mergerevid}.
|
|
179
|
+
*
|
|
180
|
+
* @since MediaWiki 1.45
|
|
181
|
+
*/
|
|
182
|
+
mergestartid?: number | string;
|
|
183
|
+
/** Namespace of the source page on the foreign wiki (`import/interwiki`). */
|
|
184
|
+
interwiki_ns?: number;
|
|
185
|
+
/** Source page on the foreign wiki, with its interwiki prefix (`import/interwiki`). */
|
|
186
|
+
interwiki_title?: string;
|
|
187
|
+
/**
|
|
188
|
+
* SHA-1 of the uploaded file (base36), on `upload/upload`, `upload/overwrite`
|
|
189
|
+
* and `upload/revert` rows.
|
|
190
|
+
*/
|
|
191
|
+
img_sha1?: string;
|
|
192
|
+
/** File timestamp (ISO 8601), which can differ from the row's timestamp. */
|
|
193
|
+
img_timestamp?: Timestamp;
|
|
194
|
+
/** Revision id that was marked patrolled, on `patrol/patrol` rows. */
|
|
195
|
+
curid?: number;
|
|
196
|
+
/** Revision id the patrolled one followed. */
|
|
197
|
+
previd?: number;
|
|
198
|
+
/** Always `false`: automatic patrols are not logged. */
|
|
199
|
+
auto?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Revision the tags were applied to (`tag/update` rows); a raw value from
|
|
202
|
+
* the tagging caller, so forms vary (a number, its decimal string, or
|
|
203
|
+
* `false` when the update targeted a log entry).
|
|
204
|
+
*/
|
|
205
|
+
revid?: number | string | false;
|
|
206
|
+
/**
|
|
207
|
+
* Log entry the tags were applied to, on rows that targeted one; a raw
|
|
208
|
+
* value like {@link revid} — `false` when the update targeted a revision.
|
|
209
|
+
*/
|
|
210
|
+
logid?: number | string | false;
|
|
211
|
+
/** Tags the update added. */
|
|
212
|
+
tagsAdded?: string[];
|
|
213
|
+
/** How many tags {@link tagsAdded} holds. */
|
|
214
|
+
tagsAddedCount?: number;
|
|
215
|
+
/** Tags the update removed. */
|
|
216
|
+
tagsRemoved?: string[];
|
|
217
|
+
/** How many tags {@link tagsRemoved} holds. */
|
|
218
|
+
tagsRemovedCount?: number;
|
|
219
|
+
/** Tags the target carried before the update. */
|
|
220
|
+
initialTags?: string[];
|
|
221
|
+
/** Name of the managed tag (`managetags/create|activate|deactivate|delete`). */
|
|
222
|
+
tag?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Page language before the change, on `pagelang/pagelang` rows; the wiki's
|
|
225
|
+
* default language carries a `[def]` suffix (e.g. `'en[def]'`).
|
|
226
|
+
*/
|
|
227
|
+
oldlanguage?: string;
|
|
228
|
+
/** Page language after the change; also `[def]`-suffixed when set to default. */
|
|
229
|
+
newlanguage?: string;
|
|
230
|
+
/**
|
|
231
|
+
* Any other parameter a log action attaches — a log action registered by an
|
|
232
|
+
* extension or site configuration, or a legacy key form on rows written by
|
|
233
|
+
* an older MediaWiki version.
|
|
234
|
+
*/
|
|
235
|
+
[key: string]: unknown;
|
|
236
|
+
}
|
|
237
|
+
/** One page a partial block is restricted to (`restrictions.pages` entry). */
|
|
238
|
+
export interface ApiLogPageRef {
|
|
239
|
+
/** Namespace index. */
|
|
240
|
+
page_ns: number;
|
|
241
|
+
/** Full page title. */
|
|
242
|
+
page_title: string;
|
|
243
|
+
}
|
|
244
|
+
/** Scope of a partial block (`restrictions`). */
|
|
245
|
+
export interface ApiLogBlockRestrictions {
|
|
246
|
+
/** Pages the block is restricted to. */
|
|
247
|
+
pages?: ApiLogPageRef[];
|
|
248
|
+
/** Namespace indexes the block is restricted to. */
|
|
249
|
+
namespaces?: number[];
|
|
250
|
+
/** Action names the block is restricted to (e.g. `'edit'`). */
|
|
251
|
+
actions?: string[];
|
|
252
|
+
}
|
|
253
|
+
/** One protection restriction (`details` entry on `protect/protect`, `protect/modify`). */
|
|
254
|
+
export interface ApiLogProtectDetail {
|
|
255
|
+
/** Action being restricted (e.g. `'edit'`); `'create'` for title protection. */
|
|
256
|
+
type: string;
|
|
257
|
+
/** Protection level (e.g. `'autoconfirmed'`, `'sysop'`). */
|
|
258
|
+
level: string;
|
|
259
|
+
/** When the protection lapses (ISO 8601), or `'infinite'`. */
|
|
260
|
+
expiry: Timestamp | "infinite";
|
|
261
|
+
/** Whether this restriction cascades; absent on `'create'` entries. */
|
|
262
|
+
cascade?: boolean;
|
|
263
|
+
}
|
|
264
|
+
/** One visibility state (`old`/`new` on a RevisionDelete row). */
|
|
265
|
+
export interface ApiLogRevDelVisibility {
|
|
266
|
+
/** Raw visibility bitfield. */
|
|
267
|
+
bitmask: number;
|
|
268
|
+
/** Whether the content is hidden. */
|
|
269
|
+
content: boolean;
|
|
270
|
+
/** Whether the edit summary is hidden. */
|
|
271
|
+
comment: boolean;
|
|
272
|
+
/** Whether the performer is hidden. */
|
|
273
|
+
user: boolean;
|
|
274
|
+
/** Whether only suppressors can unhide. */
|
|
275
|
+
restricted: boolean;
|
|
276
|
+
}
|
|
277
|
+
/** One group-membership change with its expiry (`oldmetadata`/`newmetadata` entry). */
|
|
278
|
+
export interface ApiLogGroupMetadata {
|
|
279
|
+
/** Group name. */
|
|
280
|
+
group: string;
|
|
281
|
+
/** When the membership lapses. */
|
|
282
|
+
expiry: Expiry;
|
|
283
|
+
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Flag, NamespaceIndex, Timestamp } from "../../common";
|
|
11
11
|
import type { ApiHiddenFlags } from "./shared";
|
|
12
|
+
import type { ApiLogEventParams } from "./logparams";
|
|
12
13
|
/** Change type (`rctype`). Open union for forward compatibility. */
|
|
13
14
|
export type RecentChangeType = "edit" | "new" | "log" | "categorize" | "external" | (string & {});
|
|
14
15
|
/** One recent-changes entry. `rcprop` controls which fields appear. */
|
|
@@ -83,8 +84,11 @@ export interface ApiRecentChange extends ApiHiddenFlags {
|
|
|
83
84
|
logtype?: string;
|
|
84
85
|
/** Log action, e.g. `create`. `rcprop=loginfo`. */
|
|
85
86
|
logaction?: string;
|
|
86
|
-
/**
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Structured log details — see {@link ApiLogEventParams}. `rcprop=loginfo`
|
|
89
|
+
* (only for `type=log`).
|
|
90
|
+
*/
|
|
91
|
+
logparams?: ApiLogEventParams;
|
|
88
92
|
}
|
|
89
93
|
declare module "./index" {
|
|
90
94
|
interface ApiQueryResult {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import type { ApiWatchlistLabel, Flag, NamespaceIndex, Timestamp } from "../../common";
|
|
14
14
|
import type { ApiHiddenFlags } from "./shared";
|
|
15
15
|
import type { RecentChangeType } from "./recentchanges";
|
|
16
|
+
import type { ApiLogEventParams } from "./logparams";
|
|
16
17
|
/** One watchlist entry. `wlprop` controls which fields appear. */
|
|
17
18
|
export interface ApiWatchlistEntry extends ApiHiddenFlags {
|
|
18
19
|
/** Change type. */
|
|
@@ -33,8 +34,11 @@ export interface ApiWatchlistEntry extends ApiHiddenFlags {
|
|
|
33
34
|
logtype?: string;
|
|
34
35
|
/** Log action. `wlprop=loginfo` (only for `type=log`). */
|
|
35
36
|
logaction?: string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Structured log details — see {@link ApiLogEventParams}. `wlprop=loginfo`
|
|
39
|
+
* (only for `type=log`).
|
|
40
|
+
*/
|
|
41
|
+
logparams?: ApiLogEventParams;
|
|
38
42
|
/**
|
|
39
43
|
* Localized log action text, e.g. `changed protection settings`.
|
|
40
44
|
* `wlprop=loginfo` (only for `type=log`).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in extension pack: **BetaFeatures** (`list=betafeatures`).
|
|
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/betafeatures';
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The result is a flat map keyed by feature id — one entry per feature
|
|
14
|
+
* registered through `$wgBetaFeatures` or the
|
|
15
|
+
* `GetBetaFeaturePreferences` hook, so the key set is site-configured and open.
|
|
16
|
+
* A wiki with no beta features omits the whole `betafeatures` bucket.
|
|
17
|
+
*
|
|
18
|
+
* @see https://www.mediawiki.org/wiki/Extension:BetaFeatures
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* One `list=betafeatures` entry: a feature id with its user count.
|
|
22
|
+
*/
|
|
23
|
+
export interface ApiBetaFeature {
|
|
24
|
+
/** The feature id, e.g. `mw-vector-2022-default-title`. */
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* Number of users who enabled the feature; `0` unless `bfcounts` was
|
|
28
|
+
* requested.
|
|
29
|
+
*/
|
|
30
|
+
count: number;
|
|
31
|
+
}
|
|
32
|
+
declare module "types-mediawiki-response" {
|
|
33
|
+
interface ApiQueryResult {
|
|
34
|
+
/**
|
|
35
|
+
* Beta features registered on this wiki, keyed by feature id
|
|
36
|
+
* (`list=betafeatures`). Absent when no features are registered.
|
|
37
|
+
*/
|
|
38
|
+
betafeatures?: Record<string, ApiBetaFeature>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in extension pack: **CentralAuth** (`list=globalallusers`,
|
|
3
|
+
* `list=globalgroups`, `list=globalusers`, `list=wikisets`,
|
|
4
|
+
* `action=centralauthtoken`, `action=globaluserrights`,
|
|
5
|
+
* `action=setglobalaccountstatus`, `action=deleteglobalaccount`,
|
|
6
|
+
* `action=createlocalaccount`).
|
|
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/centralauth';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* fv2 notes: `list=globalallusers` ids are real numbers, while `list=wikisets`
|
|
18
|
+
* carries the database id **as a string up to MediaWiki 1.45 and as a number
|
|
19
|
+
* from 1.46** (its `WikiSet::newFromRow` picked up an `intval()` cast). When a
|
|
20
|
+
* write action's operation fails — `createlocalaccount`, or the unmerge /
|
|
21
|
+
* lock-hide step of `deleteglobalaccount` / `setglobalaccountstatus` — the
|
|
22
|
+
* messages are reported **in band** under the root `error` key as a nested list
|
|
23
|
+
* of {@link ApiSpecMessage} rows rather than as a standard `ApiErrorResponse`;
|
|
24
|
+
* `setglobalaccountstatus` still returns its (unchanged) result object alongside
|
|
25
|
+
* that `error` key. Input validation failures (e.g. an unknown global account)
|
|
26
|
+
* are ordinary top-level errors.
|
|
27
|
+
*
|
|
28
|
+
* @see https://www.mediawiki.org/wiki/Extension:CentralAuth
|
|
29
|
+
*/
|
|
30
|
+
import type { ApiSpecMessage } from "../common";
|
|
31
|
+
import type { Expiry, Timestamp } from "../common";
|
|
32
|
+
import type { ApiEnvelope } from "../envelope";
|
|
33
|
+
/**
|
|
34
|
+
* One `list=globalallusers` entry. `aguprop` controls which fields beyond
|
|
35
|
+
* {@link ApiGlobalCentralUser.id} / {@link ApiGlobalCentralUser.name} appear.
|
|
36
|
+
* Hidden accounts (suppressed from public lists) never appear here at all.
|
|
37
|
+
*/
|
|
38
|
+
export interface ApiGlobalCentralUser {
|
|
39
|
+
/** Global account id. */
|
|
40
|
+
id: number;
|
|
41
|
+
/** Global account name. */
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* Global groups of the account, `[]` when it is in none. `aguprop=groups`.
|
|
45
|
+
* Expired group memberships are not included.
|
|
46
|
+
*/
|
|
47
|
+
groups?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* The account is attached to (has a local account on) the requesting wiki;
|
|
50
|
+
* an empty-string marker (stays `""` under fv2 rather than becoming `true`).
|
|
51
|
+
* `aguprop=existslocally`.
|
|
52
|
+
*/
|
|
53
|
+
existslocally?: "";
|
|
54
|
+
/**
|
|
55
|
+
* The account is locked globally; an empty-string marker (see
|
|
56
|
+
* {@link ApiGlobalCentralUser.existslocally}). `aguprop=lockinfo`.
|
|
57
|
+
*/
|
|
58
|
+
locked?: "";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One `list=globalgroups` entry: a global group defined on the wiki farm. The
|
|
62
|
+
* rows derive from the `global_group_permissions` table, so groups are only
|
|
63
|
+
* listed once they have at least one permission granted.
|
|
64
|
+
*/
|
|
65
|
+
export interface ApiGlobalGroup {
|
|
66
|
+
/** Global group name, e.g. `global-sysop` (site-configured, not fixed). */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Permissions granted to the group. `ggpprop=rights`. */
|
|
69
|
+
rights?: string[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One `list=wikisets` entry: a named wiki set (a list of wikis used for global
|
|
73
|
+
* group restrictions). The key set is farm-configured.
|
|
74
|
+
*/
|
|
75
|
+
export interface ApiWikiSet {
|
|
76
|
+
/**
|
|
77
|
+
* Wiki set id. A string up to MediaWiki 1.45 (fv2 passes the raw `ws_id`
|
|
78
|
+
* column through), a number from 1.46 once the value is cast to int.
|
|
79
|
+
*/
|
|
80
|
+
id: string | number;
|
|
81
|
+
/** Wiki set name. */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Whether the set lists included (`optin`) or excluded (`optout`) wikis. */
|
|
84
|
+
type?: "optin" | "optout";
|
|
85
|
+
/**
|
|
86
|
+
* Wikis the set covers (for `optin`) or does not cover (for `optout`), `[]`
|
|
87
|
+
* when none. Present whenever `wsprop` includes it.
|
|
88
|
+
*/
|
|
89
|
+
wikisincluded?: string[];
|
|
90
|
+
/**
|
|
91
|
+
* The complement of {@link ApiWikiSet.wikisincluded} against all known wikis,
|
|
92
|
+
* `[]` when none. Present whenever `wsprop` includes it.
|
|
93
|
+
*/
|
|
94
|
+
wikisnotincluded?: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Result of `action=globaluserrights` (userrights-token POST): global group
|
|
98
|
+
* memberships changed for one global account. Mirrors the core
|
|
99
|
+
* `action=userrights` result shape.
|
|
100
|
+
*/
|
|
101
|
+
export interface ApiGlobalUserRightsResult {
|
|
102
|
+
/** The affected global account name. */
|
|
103
|
+
user: string;
|
|
104
|
+
/** Global account id. */
|
|
105
|
+
userid: number;
|
|
106
|
+
/** Groups added by this call (empty when only removing). */
|
|
107
|
+
added: string[];
|
|
108
|
+
/** Groups removed by this call (empty when only adding). */
|
|
109
|
+
removed: string[];
|
|
110
|
+
}
|
|
111
|
+
/** Response of `action=globaluserrights`. Failures are standard top-level errors. */
|
|
112
|
+
export interface ApiGlobalUserRightsResponse extends ApiEnvelope {
|
|
113
|
+
/** Result of `action=globaluserrights`. */
|
|
114
|
+
globaluserrights: ApiGlobalUserRightsResult;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The lock / hide state of a global account, written by
|
|
118
|
+
* `action=setglobalaccountstatus` on every outcome. The success response
|
|
119
|
+
* extends it with {@link ApiSetGlobalAccountStatusResult.reason}; a failed call
|
|
120
|
+
* reports only this state, alongside the in-band root `error` list.
|
|
121
|
+
*/
|
|
122
|
+
export interface ApiSetGlobalAccountStatusState {
|
|
123
|
+
/** The affected global account name. */
|
|
124
|
+
user: string;
|
|
125
|
+
/** Whether the account is locked after the call. */
|
|
126
|
+
locked: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Suppression level after the call: visible (`""`), hidden from lists, or
|
|
129
|
+
* fully suppressed.
|
|
130
|
+
*/
|
|
131
|
+
hidden: "" | "lists" | "suppressed";
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Result object of `action=setglobalaccountstatus` (its own token type POST):
|
|
135
|
+
* the new lock / hide state of a global account plus the reason echoed back.
|
|
136
|
+
*/
|
|
137
|
+
export interface ApiSetGlobalAccountStatusResult extends ApiSetGlobalAccountStatusState {
|
|
138
|
+
/** The reason passed to the call; `null` when none was given. */
|
|
139
|
+
reason: string | null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Successful response of `action=setglobalaccountstatus`. A failed lock/hide
|
|
143
|
+
* returns the unchanged state (without `reason`) plus an in-band root `error`
|
|
144
|
+
* — see {@link ApiSetGlobalAccountStatusFailedResponse}.
|
|
145
|
+
*/
|
|
146
|
+
export interface ApiSetGlobalAccountStatusResponse extends ApiEnvelope {
|
|
147
|
+
/** Result of `action=setglobalaccountstatus`. */
|
|
148
|
+
setglobalaccountstatus: ApiSetGlobalAccountStatusResult;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* In-band failure of `action=setglobalaccountstatus`: the unchanged state object
|
|
152
|
+
* is returned without `reason`, alongside the root `error` list as a nested
|
|
153
|
+
* {@link ApiSpecMessage} list rather than a standard `ApiErrorResponse`. Use
|
|
154
|
+
* `ApiResponseWith` to model either outcome.
|
|
155
|
+
*/
|
|
156
|
+
export interface ApiSetGlobalAccountStatusFailedResponse extends ApiEnvelope {
|
|
157
|
+
/** The unchanged lock / hide state after the failed call. */
|
|
158
|
+
setglobalaccountstatus: ApiSetGlobalAccountStatusState;
|
|
159
|
+
/** In-band failure messages. */
|
|
160
|
+
error: ApiSpecMessage[][];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Result of `action=deleteglobalaccount` (its own token type POST): the global
|
|
164
|
+
* account was unmerged (deleted).
|
|
165
|
+
*/
|
|
166
|
+
export interface ApiDeleteGlobalAccountResult {
|
|
167
|
+
/** The deleted global account name. */
|
|
168
|
+
user: string;
|
|
169
|
+
/** The reason passed to the call; `null` when none was given. */
|
|
170
|
+
reason: string | null;
|
|
171
|
+
}
|
|
172
|
+
/** Response of `action=deleteglobalaccount`. */
|
|
173
|
+
export interface ApiDeleteGlobalAccountResponse extends ApiEnvelope {
|
|
174
|
+
/** Result of `action=deleteglobalaccount`. */
|
|
175
|
+
deleteglobalaccount: ApiDeleteGlobalAccountResult;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Result of `action=createlocalaccount` (CSRF-token POST, `centralauth-createlocal`
|
|
179
|
+
* right): a local account was force-created on this wiki for the global account.
|
|
180
|
+
*
|
|
181
|
+
* @since MediaWiki 1.36
|
|
182
|
+
*/
|
|
183
|
+
export interface ApiCreateLocalAccountResult {
|
|
184
|
+
/** The user name a local account was created for. */
|
|
185
|
+
username: string;
|
|
186
|
+
/** The reason passed to the call; `null` when none was given. */
|
|
187
|
+
reason: string | null;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Response of `action=createlocalaccount`. Unlike `setglobalaccountstatus`, a
|
|
191
|
+
* failure returns only the root `error` list and no result object.
|
|
192
|
+
*
|
|
193
|
+
* @since MediaWiki 1.36
|
|
194
|
+
*/
|
|
195
|
+
export interface ApiCreateLocalAccountResponse extends ApiEnvelope {
|
|
196
|
+
/** Result of `action=createlocalaccount`. */
|
|
197
|
+
createlocalaccount: ApiCreateLocalAccountResult;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Response of `action=centralauthtoken`: a token that authenticates the
|
|
201
|
+
* current CentralAuth session on another wiki of the farm (sent as the
|
|
202
|
+
* `centralauthtoken` parameter there). Requires a logged-in user attached to
|
|
203
|
+
* a global account whose session comes from the CentralAuth session provider;
|
|
204
|
+
* every other case is a standard top-level error (`notloggedin`, `badsession`,
|
|
205
|
+
* `notattached`).
|
|
206
|
+
*/
|
|
207
|
+
export interface ApiCentralAuthTokenResponse extends ApiEnvelope {
|
|
208
|
+
centralauthtoken: {
|
|
209
|
+
/** The cross-wiki authentication token. */
|
|
210
|
+
centralauthtoken: string;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* In-band failure of `action=deleteglobalaccount` / `action=createlocalaccount`:
|
|
215
|
+
* the messages appear under the root `error` key as a list of per-status
|
|
216
|
+
* lists — not as a standard {@link ApiErrorResponse} — so `error` carries no
|
|
217
|
+
* `code`/`info` of its own.
|
|
218
|
+
*/
|
|
219
|
+
export interface ApiCentralAuthInBandErrorResponse extends ApiEnvelope {
|
|
220
|
+
error: ApiSpecMessage[][];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* One `list=globalusers` entry for an existing global account. `gusprop`
|
|
224
|
+
* controls which fields beyond {@link ApiGlobalUserFound.centralid} /
|
|
225
|
+
* {@link ApiGlobalUserFound.name} appear. Results come back in request order;
|
|
226
|
+
* unknown names/ids get marker rows (see {@link ApiGlobalUserRow}).
|
|
227
|
+
*/
|
|
228
|
+
export interface ApiGlobalUserFound {
|
|
229
|
+
/** Global account id. */
|
|
230
|
+
centralid: number;
|
|
231
|
+
/** Global account name. */
|
|
232
|
+
name: string;
|
|
233
|
+
/**
|
|
234
|
+
* The account is hidden from public lists; a real `true`. Only observable to
|
|
235
|
+
* requesters with the `centralauth-suppress` right — for everyone else the
|
|
236
|
+
* row is replaced by a `missing` marker.
|
|
237
|
+
*/
|
|
238
|
+
hidden?: true;
|
|
239
|
+
/**
|
|
240
|
+
* The account is fully suppressed; a real `true`. Same visibility rule as
|
|
241
|
+
* {@link ApiGlobalUserFound.hidden}.
|
|
242
|
+
*/
|
|
243
|
+
suppressed?: true;
|
|
244
|
+
/** Whether the account is locked globally. `gusprop=locked`. */
|
|
245
|
+
locked?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Log id of the most recent lock on the account (for a follow-up
|
|
248
|
+
* `list=logevents` on the central wiki); present only when locked.
|
|
249
|
+
*/
|
|
250
|
+
locklogid?: number;
|
|
251
|
+
/** Global edit count. `gusprop=editcount`. */
|
|
252
|
+
editcount?: number;
|
|
253
|
+
/** When the global account was created. `gusprop=registration`. */
|
|
254
|
+
registration?: Timestamp;
|
|
255
|
+
/**
|
|
256
|
+
* Attachment status on the requesting wiki. `gusprop=localinfo`;
|
|
257
|
+
* {@link ApiGlobalUserLocalInfo.localid} /
|
|
258
|
+
* {@link ApiGlobalUserLocalInfo.timestamp} are only present when attached.
|
|
259
|
+
*/
|
|
260
|
+
localinfo?: ApiGlobalUserLocalInfo;
|
|
261
|
+
/** Global groups of the account (active ones only). `gusprop=groups`. */
|
|
262
|
+
groups?: string[];
|
|
263
|
+
/**
|
|
264
|
+
* Global group memberships with expiry. `gusprop=groupmemberships`.
|
|
265
|
+
*/
|
|
266
|
+
groupmemberships?: ApiGlobalGroupMembership[];
|
|
267
|
+
/** Permissions derived from the account's global groups. `gusprop=rights`. */
|
|
268
|
+
rights?: string[];
|
|
269
|
+
}
|
|
270
|
+
/** The `localinfo` object of a `list=globalusers` row. */
|
|
271
|
+
export interface ApiGlobalUserLocalInfo {
|
|
272
|
+
/** The account has a local account on the requesting wiki. */
|
|
273
|
+
attached: boolean;
|
|
274
|
+
/** Local user id; `null` when recorded without one. Only when attached. */
|
|
275
|
+
localid?: number | null;
|
|
276
|
+
/** When the local account was attached. Only when attached. */
|
|
277
|
+
timestamp?: Timestamp | null;
|
|
278
|
+
}
|
|
279
|
+
/** One global group membership of a `list=globalusers` row. */
|
|
280
|
+
export interface ApiGlobalGroupMembership {
|
|
281
|
+
/** Global group name. */
|
|
282
|
+
group: string;
|
|
283
|
+
/** Membership expiry, or `infinity`. */
|
|
284
|
+
expiry: Expiry;
|
|
285
|
+
}
|
|
286
|
+
/** A `list=globalusers` row for a requested name with no global account. */
|
|
287
|
+
export interface ApiGlobalUserMissingName {
|
|
288
|
+
/** The requested name, echoed back. */
|
|
289
|
+
name: string;
|
|
290
|
+
/** Marker: no global account under this name. */
|
|
291
|
+
missing: true;
|
|
292
|
+
}
|
|
293
|
+
/** A `list=globalusers` row for a requested name that is not a valid username. */
|
|
294
|
+
export interface ApiGlobalUserInvalidName {
|
|
295
|
+
/** The requested name, echoed back as given. */
|
|
296
|
+
name: string;
|
|
297
|
+
/** Marker: not a valid username. */
|
|
298
|
+
invalid: true;
|
|
299
|
+
}
|
|
300
|
+
/** A `list=globalusers` row for a requested global id with no global account. */
|
|
301
|
+
export interface ApiGlobalUserMissingId {
|
|
302
|
+
/** The requested global id, echoed back. */
|
|
303
|
+
centralid: number;
|
|
304
|
+
/** Marker: no global account with this id. */
|
|
305
|
+
missing: true;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* One `list=globalusers` row: either a found account
|
|
309
|
+
* ({@link ApiGlobalUserFound}) or a marker for a name/id that is unknown
|
|
310
|
+
* (`missing`), syntactically invalid (`invalid`), or hidden from the requester
|
|
311
|
+
* (`missing` again — hidden accounts are reported as absent).
|
|
312
|
+
*/
|
|
313
|
+
export type ApiGlobalUserRow = ApiGlobalUserFound | ApiGlobalUserMissingName | ApiGlobalUserInvalidName | ApiGlobalUserMissingId;
|
|
314
|
+
declare module "types-mediawiki-response" {
|
|
315
|
+
interface ApiQueryResult {
|
|
316
|
+
/** All global accounts of the farm, name-ordered (`list=globalallusers`). */
|
|
317
|
+
globalallusers?: ApiGlobalCentralUser[];
|
|
318
|
+
/** Global groups defined on the farm (`list=globalgroups`). */
|
|
319
|
+
globalgroups?: ApiGlobalGroup[];
|
|
320
|
+
/** Per-name/per-id global account lookup (`list=globalusers`).
|
|
321
|
+
*
|
|
322
|
+
* @since MediaWiki 1.47
|
|
323
|
+
*/
|
|
324
|
+
globalusers?: ApiGlobalUserRow[];
|
|
325
|
+
/** Wiki sets defined on the farm (`list=wikisets`). */
|
|
326
|
+
wikisets?: ApiWikiSet[];
|
|
327
|
+
}
|
|
328
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Opt-in extension pack: **CheckUser** (`list=checkuser`, `list=checkuserlog
|
|
2
|
+
* Opt-in extension pack: **CheckUser** (`list=checkuser`, `list=checkuserlog`,
|
|
3
|
+
* `meta=checkuserformattedblockinfo`).
|
|
3
4
|
*
|
|
4
5
|
* Not in the default export: importing anything from this file — even just the
|
|
5
6
|
* field-group type you are about to use — activates the augmentation shipped at
|
|
@@ -139,11 +140,28 @@ export interface ApiQueryCheckUserLogResult {
|
|
|
139
140
|
/** Log entries, ordered per `culdir` (default newest first). */
|
|
140
141
|
entries?: ApiCheckUserLogEntry[];
|
|
141
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* The `checkuserformattedblockinfo` object: the sitewide-block status of the
|
|
145
|
+
* requesting user, for clients that need to explain API failures caused by
|
|
146
|
+
* their own block.
|
|
147
|
+
*
|
|
148
|
+
* @since MediaWiki 1.44
|
|
149
|
+
*/
|
|
150
|
+
export interface ApiQueryCheckUserFormattedBlockInfoResult {
|
|
151
|
+
/**
|
|
152
|
+
* Rendered (HTML) block message explaining the sitewide block; `null` when
|
|
153
|
+
* the requesting user is not sitewide-blocked. Partial blocks and blocks on
|
|
154
|
+
* other users do not appear here.
|
|
155
|
+
*/
|
|
156
|
+
details: string | null;
|
|
157
|
+
}
|
|
142
158
|
declare module "types-mediawiki-response" {
|
|
143
159
|
interface ApiQueryResult {
|
|
144
160
|
/** Result of the requested `curequest` mode (`list=checkuser`). */
|
|
145
161
|
checkuser?: ApiQueryCheckUserResult;
|
|
146
162
|
/** Entries from the CheckUser log (`list=checkuserlog`). */
|
|
147
163
|
checkuserlog?: ApiQueryCheckUserLogResult;
|
|
164
|
+
/** Block status of the requesting user (`meta=checkuserformattedblockinfo`). */
|
|
165
|
+
checkuserformattedblockinfo?: ApiQueryCheckUserFormattedBlockInfoResult;
|
|
148
166
|
}
|
|
149
167
|
}
|
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in extension pack: **Translate** (`meta=messagegroups`,
|
|
3
|
+
* `meta=messagegroupstats`, `meta=languagestats`, `meta=messagetranslations`,
|
|
4
|
+
* `list=messagecollection`, `action=translationstats`,
|
|
5
|
+
* `action=translationaids`, `action=ttmserver`, `action=markfortranslation`,
|
|
6
|
+
* `action=translationreview`, `action=groupreview`, `action=aggregategroups`,
|
|
7
|
+
* `action=translationentitysearch`, `action=translatesandbox`,
|
|
8
|
+
* `action=translationstash`, `action=messagegroupsubscription`,
|
|
9
|
+
* `action=searchtranslations`).
|
|
10
|
+
*
|
|
11
|
+
* Not in the default export: importing anything from this file — even just the
|
|
12
|
+
* field-group type you are about to use — activates the augmentation shipped at
|
|
13
|
+
* the bottom, which merges the field groups into the root package automatically
|
|
14
|
+
* (no manual `declare module`):
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import type {} from 'types-mediawiki-response/ext/translate';
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* fv2 notes: `messagegroupstats` / `languagestats` continue with an
|
|
21
|
+
* `mgsoffset` / `lsoffset` cursor (a group/language id, not a number), and
|
|
22
|
+
* `messagetranslations` / `messagecollection` paginate with a numeric `mtoffset`
|
|
23
|
+
* / string `mcoffset`; all are covered by the core `ApiQueryContinue` index
|
|
24
|
+
* signature. The `workflowstates` / `prioritylangs` payloads use `false` (not
|
|
25
|
+
* `null`) as their "not configured" marker.
|
|
26
|
+
* Out of scope here: `action=managemessagegroups` and
|
|
27
|
+
* `action=managegroupsynchronizationcache`, whose success shapes only occur
|
|
28
|
+
* within the group-synchronization (changeset) workflow of file-based groups.
|
|
29
|
+
*
|
|
30
|
+
* @see https://www.mediawiki.org/wiki/Extension:Translate
|
|
31
|
+
*/
|
|
32
|
+
import type { ApiEnvelope } from "../envelope";
|
|
33
|
+
/**
|
|
34
|
+
* One `meta=messagegroups` entry. `mgprop` controls which fields appear. The
|
|
35
|
+
* groups themselves are site-defined (wiki pages, YAML files, aggregate
|
|
36
|
+
* definitions), so ids beyond the dynamic `!recent` / `!additions` ones are
|
|
37
|
+
* open-ended.
|
|
38
|
+
*/ export interface ApiTranslateMessageGroup {
|
|
39
|
+
/** Group id, e.g. `page-Example`, `!recent`. `mgprop=id`. */
|
|
40
|
+
id?: string;
|
|
41
|
+
/** Localized group label. `mgprop=label`. */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Localized group description. `mgprop=description`. */
|
|
44
|
+
description?: string;
|
|
45
|
+
/** PHP class backing the group, e.g. `WikiPageMessageGroup`. `mgprop=class`. */
|
|
46
|
+
class?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Namespace the group's messages live in, e.g. `1198` (the Translations
|
|
49
|
+
* namespace) for page groups; `false` for groups without a namespace (the
|
|
50
|
+
* dynamic `!recent` / `!additions` ones). `mgprop=namespace`.
|
|
51
|
+
*/
|
|
52
|
+
namespace?: number | false;
|
|
53
|
+
/** Whether the group currently exists (real `boolean`). `mgprop=exists`. */
|
|
54
|
+
exists?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Icon URLs keyed by size. `mgprop=icon`; absent for groups without an icon.
|
|
57
|
+
*/
|
|
58
|
+
icon?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Translation priority. Beyond the core `default`, values are site-defined
|
|
61
|
+
* (set through the group's priority metadata).
|
|
62
|
+
*/
|
|
63
|
+
priority?: "default" | (string & {});
|
|
64
|
+
/**
|
|
65
|
+
* Priority languages of the group, or `false` when unset.
|
|
66
|
+
* `mgprop=prioritylangs`.
|
|
67
|
+
*/
|
|
68
|
+
prioritylangs?: string[] | false;
|
|
69
|
+
/**
|
|
70
|
+
* Whether translation to non-priority languages is prevented.
|
|
71
|
+
* `mgprop=priorityforce`.
|
|
72
|
+
*/
|
|
73
|
+
priorityforce?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Workflow states of the group keyed by state id, or `false` when the group
|
|
76
|
+
* has none. `mgprop=workflowstates`.
|
|
77
|
+
*/
|
|
78
|
+
workflowstates?: Record<string, ApiTranslateWorkflowState> | false;
|
|
79
|
+
/** Source language of the group's messages. `mgprop=sourcelanguage`. */
|
|
80
|
+
sourcelanguage?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the current user is subscribed to group updates. `mgprop=subscription`;
|
|
83
|
+
* absent when group subscription is disabled or unavailable to the user.
|
|
84
|
+
*/
|
|
85
|
+
subscription?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Number of nested groups folded into this entry (`mgformat=tree` with
|
|
88
|
+
* `mgdepth` reached).
|
|
89
|
+
*/
|
|
90
|
+
groupcount?: number;
|
|
91
|
+
/** Child groups (`mgformat=tree` above the depth cutoff). */
|
|
92
|
+
groups?: ApiTranslateMessageGroup[];
|
|
93
|
+
}
|
|
94
|
+
/** One workflow state of a message group (`meta=messagegroups` + `mgprop=workflowstates`). */
|
|
95
|
+
export interface ApiTranslateWorkflowState {
|
|
96
|
+
/** Localized state name. */
|
|
97
|
+
name: string;
|
|
98
|
+
/** The requesting user may set this state. */
|
|
99
|
+
canchange?: 1;
|
|
100
|
+
/** Site-defined state configuration, passed through. */
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The four completeness counters shared by `meta=languagestats` and
|
|
105
|
+
* `meta=messagegroupstats` rows. A row appears only once its statistics are
|
|
106
|
+
* available; while they are still being computed the result is a continue
|
|
107
|
+
* instead.
|
|
108
|
+
*/
|
|
109
|
+
export interface ApiTranslateStatsRow {
|
|
110
|
+
/** Total number of messages. */
|
|
111
|
+
total: number;
|
|
112
|
+
/** Number of translated (non-fuzzy) messages. */
|
|
113
|
+
translated: number;
|
|
114
|
+
/** Number of out-of-date (fuzzy) translations. */
|
|
115
|
+
fuzzy: number;
|
|
116
|
+
/** Number of proofread translations. */
|
|
117
|
+
proofread: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* One `meta=languagestats` row: completeness of one message group in the
|
|
121
|
+
* requested language.
|
|
122
|
+
*/
|
|
123
|
+
export interface ApiLanguageStatsRow extends ApiTranslateStatsRow {
|
|
124
|
+
/** Message group id the row counts. */
|
|
125
|
+
group: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* One `meta=messagegroupstats` row: completeness of one language in the
|
|
129
|
+
* requested group.
|
|
130
|
+
*/
|
|
131
|
+
export interface ApiMessageGroupStatsRow extends ApiTranslateStatsRow {
|
|
132
|
+
/**
|
|
133
|
+
* Language code of the row. Kept for backwards compatibility; newer clients
|
|
134
|
+
* should read {@link ApiMessageGroupStatsRow.language}.
|
|
135
|
+
*
|
|
136
|
+
* @deprecated Superseded by `language`.
|
|
137
|
+
*/
|
|
138
|
+
code: string;
|
|
139
|
+
/** Language code of the row. */
|
|
140
|
+
language: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One `meta=messagetranslations` row: one existing translation of a message
|
|
144
|
+
* (the title named in `mttitle`).
|
|
145
|
+
*/
|
|
146
|
+
export interface ApiMessageTranslation {
|
|
147
|
+
/** Title of the translation subpage, e.g. `Translations:Example/1/de`. */
|
|
148
|
+
title: string;
|
|
149
|
+
/** Language code of the translation. */
|
|
150
|
+
language: string;
|
|
151
|
+
/** Name of the last translator. */
|
|
152
|
+
lasttranslator: string;
|
|
153
|
+
/** The translation text (fuzzy marker stripped). */
|
|
154
|
+
translation: string;
|
|
155
|
+
/** The translation is marked out-of-date (fuzzy); a literal marker. */
|
|
156
|
+
fuzzy?: "fuzzy";
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* One `list=messagecollection` row: a message of the group named in `mcgroup`
|
|
160
|
+
* for the language named in `mclanguage`. `mcprop` controls which fields
|
|
161
|
+
* beyond the mandatory ones appear.
|
|
162
|
+
*/
|
|
163
|
+
export interface ApiMessageCollectionRow {
|
|
164
|
+
/** Message key, e.g. `Example/1`. */
|
|
165
|
+
key: string;
|
|
166
|
+
/** Title of the translation subpage for this message and language. */
|
|
167
|
+
title: string;
|
|
168
|
+
/** Language the collection was requested for (`mclanguage`). */
|
|
169
|
+
targetLanguage: string;
|
|
170
|
+
/** Id of the group the message belongs to. */
|
|
171
|
+
primaryGroup?: string;
|
|
172
|
+
/** Source-language definition. `mcprop=definition`. */
|
|
173
|
+
definition?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Translation in the requested language; `null` when the message is
|
|
176
|
+
* untranslated. `mcprop=translation`.
|
|
177
|
+
*/
|
|
178
|
+
translation?: string | null;
|
|
179
|
+
/** Change tags of the translation, `[]` when untagged. `mcprop=tags`. */
|
|
180
|
+
tags?: string[];
|
|
181
|
+
/**
|
|
182
|
+
* Per-message metadata (e.g. `status`, `last-translator-text`,
|
|
183
|
+
* `last-translator-id`, `revision`) keyed by property name; values may be
|
|
184
|
+
* `null` for untranslated messages. `mcprop=properties`.
|
|
185
|
+
*/
|
|
186
|
+
properties?: Record<string, string | null>;
|
|
187
|
+
/** Revision of the translated unit. `mcprop=revision`.
|
|
188
|
+
*
|
|
189
|
+
* @deprecated Superseded by `properties.revision`; removed in MediaWiki 1.44.
|
|
190
|
+
*/
|
|
191
|
+
revision?: number | string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The `query.metadata` block `list=messagecollection` writes alongside its
|
|
195
|
+
* rows, describing the requested slice of the collection.
|
|
196
|
+
*/
|
|
197
|
+
export interface ApiMessageCollectionMetadata {
|
|
198
|
+
/**
|
|
199
|
+
* Review workflow state of the group for the requested language; `null` when
|
|
200
|
+
* the group has no workflow states configured.
|
|
201
|
+
*/
|
|
202
|
+
state: string | null;
|
|
203
|
+
/** Number of messages matching the requested filters. */
|
|
204
|
+
resultsize: number;
|
|
205
|
+
/** Rows after this slice, i.e. `resultsize` minus the rows returned. */
|
|
206
|
+
remaining: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Payload of one translation aid of `action=translationaids`, keyed by aid
|
|
210
|
+
* type (the registry is hook-extensible, so the set is open). An aid that
|
|
211
|
+
* cannot run reports {@link ApiTranslationAid.error} instead of its data.
|
|
212
|
+
*/
|
|
213
|
+
export interface ApiTranslationAid {
|
|
214
|
+
/** Language of {@link ApiTranslationAid.value}, when language-bound. */
|
|
215
|
+
language?: string;
|
|
216
|
+
/** The aid's payload, when it is a text value. */
|
|
217
|
+
value?: string | null;
|
|
218
|
+
/** Whether the translation is marked out-of-date (fuzzy). */
|
|
219
|
+
fuzzy?: boolean;
|
|
220
|
+
/** Rendered reason why this aid is unavailable. */
|
|
221
|
+
error?: string;
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The `helpers` map of `action=translationaids`. Members are the aid types of
|
|
226
|
+
* the {@link https://www.mediawiki.org/wiki/Manual:Hooks/TranslationAids |
|
|
227
|
+
* TranslationAids registry} — the built-in ones are declared here for
|
|
228
|
+
* autocomplete, the index signature keeps hook-registered aids usable.
|
|
229
|
+
*/
|
|
230
|
+
export interface ApiTranslationAidsPayload {
|
|
231
|
+
/** Source-language definition of the message. */
|
|
232
|
+
definition?: ApiTranslationAid;
|
|
233
|
+
/** The current translation in the target language. */
|
|
234
|
+
translation?: ApiTranslationAid;
|
|
235
|
+
/** `{{Documentation}}` subpage content; `error` when docs are disabled. */
|
|
236
|
+
documentation?: ApiTranslationAid;
|
|
237
|
+
/** Existing translations in other languages; a list. */
|
|
238
|
+
inotherlanguages?: unknown[];
|
|
239
|
+
/** Diff of the definition since the translation was made. */
|
|
240
|
+
definitiondiff?: ApiTranslationAid;
|
|
241
|
+
/** Edit summaries of the definition page. */
|
|
242
|
+
editsummaries?: ApiTranslationAid;
|
|
243
|
+
/** Gettext metadata for gettext-defined messages. */
|
|
244
|
+
gettext?: ApiTranslationAid;
|
|
245
|
+
/** Insertable wikitext snippets (customizable via hooks). */
|
|
246
|
+
insertables?: ApiTranslationAid;
|
|
247
|
+
/** Machine-translation suggestions, when a service is configured. */
|
|
248
|
+
mt?: ApiTranslationAid;
|
|
249
|
+
/** Human translation support (e.g. TTMServer suggestions). */
|
|
250
|
+
support?: ApiTranslationAid;
|
|
251
|
+
[key: string]: ApiTranslationAid | unknown[] | undefined;
|
|
252
|
+
}
|
|
253
|
+
/** Response of `action=translationaids` (root-level `helpers` and `times`). */
|
|
254
|
+
export interface ApiTranslationAidsResponse extends ApiEnvelope {
|
|
255
|
+
/** Requested aids keyed by aid type. */
|
|
256
|
+
helpers?: ApiTranslationAidsPayload;
|
|
257
|
+
/** Wall-clock seconds spent per aid (plus `query_aggregator`). */
|
|
258
|
+
times?: Record<string, number>;
|
|
259
|
+
}
|
|
260
|
+
/** Response of `action=translationstats`: graph data for the requested series. */
|
|
261
|
+
export interface ApiTranslationStatsResponse extends ApiEnvelope {
|
|
262
|
+
translationstats: {
|
|
263
|
+
/** One label per series, e.g. `Example @ Deutsch (de)`. */
|
|
264
|
+
labels: string[];
|
|
265
|
+
/** Per-day (per scale unit) values, one entry per series. */
|
|
266
|
+
data: Record<string, number[]>;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* One suggestion of `action=ttmserver`: a translation-memory hit for the
|
|
271
|
+
* requested text. The fields are supplied by the configured translation-memory
|
|
272
|
+
* service; a unit from the local memory carries the fields below.
|
|
273
|
+
*/
|
|
274
|
+
export interface ApiTtmServerSuggestion {
|
|
275
|
+
/** Source text of the stored translation unit. */
|
|
276
|
+
source: string;
|
|
277
|
+
/** Translation text of the stored unit. */
|
|
278
|
+
target: string;
|
|
279
|
+
/** Message key of the stored unit, e.g. `Translations:Example/1`. */
|
|
280
|
+
context: string;
|
|
281
|
+
/** Canonical URL of the translation page the unit came from. */
|
|
282
|
+
location: string;
|
|
283
|
+
/** Match quality as a ratio between 0 and 1 (1 is a perfect match). */
|
|
284
|
+
quality: number;
|
|
285
|
+
}
|
|
286
|
+
/** Response of `action=ttmserver`. */
|
|
287
|
+
export interface ApiTtmServerResponse extends ApiEnvelope {
|
|
288
|
+
/** Suggestions, best match first; `[]` when the memory has no hit. */
|
|
289
|
+
ttmserver: ApiTtmServerSuggestion[];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Result of `action=markfortranslation` (pagetranslation-token POST,
|
|
293
|
+
* `pagetranslation` right): a wiki page was marked for translation, creating
|
|
294
|
+
* its translation units and the `page-<title>` message group.
|
|
295
|
+
*/
|
|
296
|
+
export interface ApiMarkForTranslationResult {
|
|
297
|
+
/** Fixed `Success` marker; failures are standard top-level errors. */
|
|
298
|
+
result: "Success";
|
|
299
|
+
/** Whether this was the first time the page was marked. */
|
|
300
|
+
firstmark: boolean;
|
|
301
|
+
/** Number of translation units created (including the page title). */
|
|
302
|
+
unitcount: number;
|
|
303
|
+
}
|
|
304
|
+
/** Response of `action=markfortranslation`. */
|
|
305
|
+
export interface ApiMarkForTranslationResponse extends ApiEnvelope {
|
|
306
|
+
/** Result of `action=markfortranslation`. */
|
|
307
|
+
markfortranslation: ApiMarkForTranslationResult;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Result of `action=translationreview` (CSRF-token POST,
|
|
311
|
+
* `translate-messagereview` right): one translation revision was marked as
|
|
312
|
+
* reviewed. Reviewing one's own translation, fuzzy translations and already
|
|
313
|
+
* reviewed revisions are errors / warnings.
|
|
314
|
+
*/
|
|
315
|
+
export interface ApiTranslationReviewResponse extends ApiEnvelope {
|
|
316
|
+
translationreview: {
|
|
317
|
+
/** Result of `action=translationreview`. */
|
|
318
|
+
review: {
|
|
319
|
+
/** Title of the reviewed translation, e.g. `Translations:Page/1/de`. */
|
|
320
|
+
title: string;
|
|
321
|
+
/** Page id of the translation subpage. */
|
|
322
|
+
pageid: number;
|
|
323
|
+
/** Reviewed revision id. */
|
|
324
|
+
revision: number;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Response of `action=groupreview` (CSRF-token POST, `translate-groupreview`
|
|
330
|
+
* right): the workflow state of one message group for one language was set.
|
|
331
|
+
* Requires `$wgTranslateWorkflowStates` on the wiki; the state names are
|
|
332
|
+
* site-configured.
|
|
333
|
+
*/
|
|
334
|
+
export interface ApiGroupReviewResponse extends ApiEnvelope {
|
|
335
|
+
groupreview: {
|
|
336
|
+
/** Result of `action=groupreview`. */
|
|
337
|
+
review: {
|
|
338
|
+
/** Message group id the state was set for. */
|
|
339
|
+
group: string;
|
|
340
|
+
/** Language code the state was set for. */
|
|
341
|
+
language: string;
|
|
342
|
+
/** The new workflow state, as configured on the wiki. */
|
|
343
|
+
state: string;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Result of `action=aggregategroups` (CSRF-token POST, `translate-manage`
|
|
349
|
+
* right). The fields depend on the requested `do`: creating returns the new
|
|
350
|
+
* group id and the aggregate-able groups, associating returns the target page
|
|
351
|
+
* URL, dissociating and removing return only the marker.
|
|
352
|
+
*/
|
|
353
|
+
export interface ApiAggregateGroupsResult {
|
|
354
|
+
/** Fixed `ok` marker; failures are standard top-level errors. */
|
|
355
|
+
result: "ok";
|
|
356
|
+
/**
|
|
357
|
+
* Groups that can be added to the new aggregate group, keyed by group id
|
|
358
|
+
* with their labels as values. Returned by `do=add`.
|
|
359
|
+
*/
|
|
360
|
+
groups?: Record<string, string>;
|
|
361
|
+
/** Id of the created aggregate group. Returned by `do=add`. */
|
|
362
|
+
aggregategroupId?: string;
|
|
363
|
+
/** Full URL of the associated group's translation page. `do=associate`. */
|
|
364
|
+
groupUrl?: string;
|
|
365
|
+
}
|
|
366
|
+
/** Response of `action=aggregategroups`. */
|
|
367
|
+
export interface ApiAggregateGroupsResponse extends ApiEnvelope {
|
|
368
|
+
/** Result of `action=aggregategroups`. */
|
|
369
|
+
aggregategroups: ApiAggregateGroupsResult;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Result of `action=translationentitysearch`: message group and message key
|
|
373
|
+
* prefixes matching the query. Keys are absent when the entity type was not
|
|
374
|
+
* requested or nothing matched.
|
|
375
|
+
*/
|
|
376
|
+
export interface ApiTranslationEntitySearchResult {
|
|
377
|
+
/** Matching message groups, best match first. */
|
|
378
|
+
groups?: ApiTranslationEntitySearchGroup[];
|
|
379
|
+
/**
|
|
380
|
+
* Matching message key prefixes; several messages under one prefix are
|
|
381
|
+
* collapsed into a `*` wildcard pattern with a match count.
|
|
382
|
+
*/
|
|
383
|
+
messages?: ApiTranslationEntitySearchMessage[];
|
|
384
|
+
}
|
|
385
|
+
/** One message group match of `action=translationentitysearch`. */
|
|
386
|
+
export interface ApiTranslationEntitySearchGroup {
|
|
387
|
+
/** Localized group label. */
|
|
388
|
+
label: string;
|
|
389
|
+
/** Message group id. */
|
|
390
|
+
group: string;
|
|
391
|
+
}
|
|
392
|
+
/** One message prefix match of `action=translationentitysearch`. */
|
|
393
|
+
export interface ApiTranslationEntitySearchMessage {
|
|
394
|
+
/** Message key prefix; `*` marks a wildcard. */
|
|
395
|
+
pattern: string;
|
|
396
|
+
/** Number of messages matching the pattern. */
|
|
397
|
+
count: number;
|
|
398
|
+
}
|
|
399
|
+
/** Response of `action=translationentitysearch`. */
|
|
400
|
+
export interface ApiTranslationEntitySearchResponse extends ApiEnvelope {
|
|
401
|
+
/** Result of `action=translationentitysearch`. */
|
|
402
|
+
translationentitysearch: ApiTranslationEntitySearchResult;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Response of `action=translatesandbox` with `do=create` (registers a sandboxed
|
|
406
|
+
* translator; requires `$wgTranslateUseSandbox`). The `delete` / `promote` /
|
|
407
|
+
* `remind` variants return no payload — an empty {@link ApiEnvelope}.
|
|
408
|
+
*/
|
|
409
|
+
export interface ApiTranslateSandboxCreateResponse extends ApiEnvelope {
|
|
410
|
+
translatesandbox: {
|
|
411
|
+
/** The registered sandbox user. */
|
|
412
|
+
user: {
|
|
413
|
+
/** User name of the sandbox user. */
|
|
414
|
+
name: string;
|
|
415
|
+
/** User id of the sandbox user. */
|
|
416
|
+
id: number;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Response of `action=translatesandbox` with `do=delete` / `do=promote` /
|
|
422
|
+
* `do=remind`: the users were processed, no payload keys are returned.
|
|
423
|
+
*/
|
|
424
|
+
export interface ApiTranslateSandboxActionResponse extends ApiEnvelope {
|
|
425
|
+
}
|
|
426
|
+
/** One stashed translation of `action=translationstash` `subaction=query`. */
|
|
427
|
+
export interface ApiStashedTranslation {
|
|
428
|
+
/** Title the stashed translation belongs to, e.g. `Translations:Page/2/nl`. */
|
|
429
|
+
title: string;
|
|
430
|
+
/** Source-language definition; `""` when the message handle is unknown. */
|
|
431
|
+
definition: string;
|
|
432
|
+
/** The stashed translation text. */
|
|
433
|
+
translation: string;
|
|
434
|
+
/** Current translation in the target language, `null` when untranslated. */
|
|
435
|
+
comparison: string | null;
|
|
436
|
+
/** Arbitrary metadata passed when stashing (an empty map decodes to `[]`). */
|
|
437
|
+
metadata: unknown;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Response of `action=translationstash` (CSRF-token POST): `subaction=add`
|
|
441
|
+
* returns only the marker, `subaction=query` additionally lists the stashed
|
|
442
|
+
* translations of the requesting (sandbox) user.
|
|
443
|
+
*/
|
|
444
|
+
export interface ApiTranslationStashResponse extends ApiEnvelope {
|
|
445
|
+
translationstash: {
|
|
446
|
+
/** Stashed translations, oldest first. Only with `subaction=query`. */
|
|
447
|
+
translations?: ApiStashedTranslation[];
|
|
448
|
+
/** Fixed `ok` marker; failures are standard top-level errors. */
|
|
449
|
+
result: "ok";
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Response of `action=messagegroupsubscription` (CSRF-token POST): the
|
|
454
|
+
* requesting user's subscription to the group was changed. Requires
|
|
455
|
+
* `$wgTranslateEnableMessageGroupSubscription`.
|
|
456
|
+
*/
|
|
457
|
+
export interface ApiMessageGroupSubscriptionResponse extends ApiEnvelope {
|
|
458
|
+
messagegroupsubscription: {
|
|
459
|
+
/** Fixed `1` success marker; failures are standard top-level errors. */
|
|
460
|
+
success: 1;
|
|
461
|
+
/** The group whose subscription changed. */
|
|
462
|
+
group: {
|
|
463
|
+
/** Message group id. */
|
|
464
|
+
id: string;
|
|
465
|
+
/** Localized group label. */
|
|
466
|
+
label: string;
|
|
467
|
+
};
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* One `action=searchtranslations` match: a document of the translation memory.
|
|
472
|
+
* The fields are fixed by the search index; the result may replace `content`
|
|
473
|
+
* with a highlighted snippet.
|
|
474
|
+
*/
|
|
475
|
+
export interface ApiSearchTranslationsDocument {
|
|
476
|
+
/** Wiki id the indexed translation belongs to. */
|
|
477
|
+
wiki: string;
|
|
478
|
+
/** Canonical URL of the translation page. */
|
|
479
|
+
uri: string;
|
|
480
|
+
/** Base title of the translation unit, e.g. `Example`. */
|
|
481
|
+
localid: string;
|
|
482
|
+
/** Language code of the indexed translation. */
|
|
483
|
+
language: string;
|
|
484
|
+
/** Message group ids the unit belongs to. */
|
|
485
|
+
group: string[];
|
|
486
|
+
/** The indexed text (translation or definition), possibly highlighted. */
|
|
487
|
+
content: string;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Response of `action=searchtranslations`: full-text search over the
|
|
491
|
+
* translation memories. Only wikis backed by a searchable translation-memory
|
|
492
|
+
* service return hits; the response carries them with a metadata block under
|
|
493
|
+
* the root `search` key.
|
|
494
|
+
*/
|
|
495
|
+
export interface ApiSearchTranslationsResponse extends ApiEnvelope {
|
|
496
|
+
search: {
|
|
497
|
+
/** Hit metadata. */
|
|
498
|
+
metadata: {
|
|
499
|
+
/** Total number of hits. */
|
|
500
|
+
total: number;
|
|
501
|
+
};
|
|
502
|
+
/** Hits, best match first; `[]` when nothing matched. */
|
|
503
|
+
translations: ApiSearchTranslationsDocument[];
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
declare module "types-mediawiki-response" {
|
|
507
|
+
interface ApiQueryResult {
|
|
508
|
+
/** Message groups of this wiki (`meta=messagegroups`). */
|
|
509
|
+
messagegroups?: ApiTranslateMessageGroup[];
|
|
510
|
+
/** Per-language completeness of one group (`meta=messagegroupstats`). */
|
|
511
|
+
messagegroupstats?: ApiMessageGroupStatsRow[];
|
|
512
|
+
/** Per-group completeness of one language (`meta=languagestats`). */
|
|
513
|
+
languagestats?: ApiLanguageStatsRow[];
|
|
514
|
+
/** Existing translations of one message (`meta=messagetranslations`). */
|
|
515
|
+
messagetranslations?: ApiMessageTranslation[];
|
|
516
|
+
/**
|
|
517
|
+
* Workflow/report metadata of the message collection slice
|
|
518
|
+
* (`list=messagecollection`).
|
|
519
|
+
*/
|
|
520
|
+
metadata?: ApiMessageCollectionMetadata;
|
|
521
|
+
/** Messages of one group and language (`list=messagecollection`). */
|
|
522
|
+
messagecollection?: ApiMessageCollectionRow[];
|
|
523
|
+
}
|
|
524
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in extension pack: **Universal Language Selector** (`ulssetlang`,
|
|
3
|
+
* `ulslocalization`).
|
|
4
|
+
*
|
|
5
|
+
* Not in the default export: importing anything from this file — even just a
|
|
6
|
+
* response type — is all that is needed; both modules return standalone action
|
|
7
|
+
* payloads, so no declaration merging is involved:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type {
|
|
11
|
+
* ApiUlsLocalizationResponse,
|
|
12
|
+
* ApiUlsSetLanguageResponse,
|
|
13
|
+
* } from 'types-mediawiki-response/ext/uls';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* `action=languagesearch` used to be the third ULS module; it now ships with
|
|
17
|
+
* core as `ApiLanguageSearchResponse` in the core package.
|
|
18
|
+
*
|
|
19
|
+
* @see https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector
|
|
20
|
+
*/
|
|
21
|
+
import type { ApiEnvelope } from "../envelope";
|
|
22
|
+
/**
|
|
23
|
+
* Response of `action=ulssetlang` (CSRF-token POST): stores the interface
|
|
24
|
+
* language in the named user's preferences. A success response carries no
|
|
25
|
+
* payload keys. Anonymous callers only succeed when `$wgULSAnonCanChangeLanguage`
|
|
26
|
+
* is enabled (then only a cookie is set, likewise with no payload).
|
|
27
|
+
*/
|
|
28
|
+
export interface ApiUlsSetLanguageResponse extends ApiEnvelope {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Metadata block of a ULS localization bundle, carried over from the source
|
|
32
|
+
* i18n files. Only the keys the wiki's ULS files actually use appear.
|
|
33
|
+
*/
|
|
34
|
+
export interface ApiUlsLocalizationMetadata {
|
|
35
|
+
/** translators: credited in the source file. */
|
|
36
|
+
authors?: string[];
|
|
37
|
+
/** Message documentation language code, typically `qqq`. */
|
|
38
|
+
"message-documentation"?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Response of `action=ulslocalization`: the ULS message bundle for one language
|
|
42
|
+
* (its fallback chain merged in), returned raw as JSON — there is no envelope and
|
|
43
|
+
* no `ulslocalization` wrapper. Keys are ULS message ids (e.g.
|
|
44
|
+
* `uls-region-WW`) mapped to their translation; `@metadata` holds the source
|
|
45
|
+
* file credits. The module is internal to ULS; responses are cached publicly
|
|
46
|
+
* for 28 days.
|
|
47
|
+
*/
|
|
48
|
+
export interface ApiUlsLocalizationResponse {
|
|
49
|
+
/** Credits and provenance of the merged source files. */
|
|
50
|
+
"@metadata"?: ApiUlsLocalizationMetadata;
|
|
51
|
+
[key: string]: string | ApiUlsLocalizationMetadata | undefined;
|
|
52
|
+
}
|