types-mediawiki-response 1.1.0 → 1.2.0
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/README.md +4 -4
- package/README.zh.md +4 -4
- 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/readinglists.d.ts +210 -0
- package/dist/extensions/translate.d.ts +524 -0
- package/dist/extensions/uls.d.ts +52 -0
- package/package.json +4 -4
|
@@ -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,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in extension pack: **ReadingLists** (`meta=readinglists`,
|
|
3
|
+
* `list=readinglistentries`, `action=readinglists`).
|
|
4
|
+
*
|
|
5
|
+
* Not in the default export. Two shapes live here:
|
|
6
|
+
*
|
|
7
|
+
* - `meta=readinglists` / `list=readinglistentries` merge their result arrays
|
|
8
|
+
* into `ApiQueryResult` automatically — importing anything from this file
|
|
9
|
+
* activates the augmentation shipped at the bottom:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import type {} from 'types-mediawiki-response/ext/readinglists';
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* - `action=readinglists` writes a root-level key named after the `command`
|
|
16
|
+
* submodule (`create`, `update`, `setup`, …); import the matching response
|
|
17
|
+
* type directly:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import type { ApiReadingListsCreateResponse } from 'types-mediawiki-response/ext/readinglists';
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Both modules require a logged-in user: the reads check the
|
|
24
|
+
* `viewmyprivateinfo` right and the writes `editmyprivateinfo`, so an anonymous
|
|
25
|
+
* request gets a top-level `notloggedin` error and lists are always the current
|
|
26
|
+
* user's own. The extension marks its API internal (`isInternal()`), so the
|
|
27
|
+
* modules are omitted from public listings but still callable.
|
|
28
|
+
*
|
|
29
|
+
* fv2 notes: an id is a `number` inside a list/entry record but a *string* at
|
|
30
|
+
* the root of a write response (`id` / `ids`) — those carry the raw database
|
|
31
|
+
* value, uncoupled from the cast record. `duplicate` appears only while a
|
|
32
|
+
* write's repository row is merge-flagged (the create commands), never on a
|
|
33
|
+
* plain read. `deleted` (`true`) appears only in `changedsince` mode; a deleted
|
|
34
|
+
* list is reported under a `deleted-<hash>` name. The read continuation cursor
|
|
35
|
+
* (`rlcontinue`) is the extension's own and is not merged into
|
|
36
|
+
* `ApiQueryContinue`.
|
|
37
|
+
*
|
|
38
|
+
* @see https://www.mediawiki.org/wiki/Extension:ReadingLists
|
|
39
|
+
*/
|
|
40
|
+
import type { Timestamp } from "../common";
|
|
41
|
+
import type { ApiEnvelope } from "../envelope";
|
|
42
|
+
/**
|
|
43
|
+
* One reading list (`meta=readinglists`, and the `list`/`lists` payload of the
|
|
44
|
+
* `create` / `update` / `setup` commands).
|
|
45
|
+
*/
|
|
46
|
+
export interface ApiReadingListItem {
|
|
47
|
+
/** List id. */
|
|
48
|
+
id: number;
|
|
49
|
+
/** List title as set by the owner. */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Whether this is the user's catch-all default list. */
|
|
52
|
+
default: boolean;
|
|
53
|
+
/** Free-text description; `""` when none was set. */
|
|
54
|
+
description: string;
|
|
55
|
+
/** Creation time (ISO 8601). */
|
|
56
|
+
created: Timestamp;
|
|
57
|
+
/** Last update time (ISO 8601). */
|
|
58
|
+
updated: Timestamp;
|
|
59
|
+
/**
|
|
60
|
+
* Whether a list with the same name already existed, carried by the `create`
|
|
61
|
+
* command; absent on plain reads.
|
|
62
|
+
*/
|
|
63
|
+
duplicate?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* `true` for a list soft-deleted within the retention window; appears only in
|
|
66
|
+
* `changedsince` mode, where the list is reported under a `deleted-<hash>`
|
|
67
|
+
* `name`.
|
|
68
|
+
*/
|
|
69
|
+
deleted?: true;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One page saved in a reading list (`list=readinglistentries`, and the
|
|
73
|
+
* `entry`/`entries` payload of the `createentry` command).
|
|
74
|
+
*/
|
|
75
|
+
export interface ApiReadingListEntry {
|
|
76
|
+
/** Entry id. */
|
|
77
|
+
id: number;
|
|
78
|
+
/** Id of the list this entry belongs to. */
|
|
79
|
+
listId: number;
|
|
80
|
+
/**
|
|
81
|
+
* Canonical base URL of the wiki the entry points to (port omitted, e.g.
|
|
82
|
+
* `https://www.mediawiki.org`). Entries are cross-wiki; the `@local` project
|
|
83
|
+
* value resolves to the serving wiki's own URL here.
|
|
84
|
+
*/
|
|
85
|
+
project: string;
|
|
86
|
+
/** Page title on {@link project}. */
|
|
87
|
+
title: string;
|
|
88
|
+
/** Creation time (ISO 8601). */
|
|
89
|
+
created: Timestamp;
|
|
90
|
+
/** Last update time (ISO 8601). */
|
|
91
|
+
updated: Timestamp;
|
|
92
|
+
/** Merge-detection flag of the `createentry` command; absent on plain reads. */
|
|
93
|
+
duplicate?: boolean;
|
|
94
|
+
/** `true` for an entry soft-deleted within the retention window; changes mode only. */
|
|
95
|
+
deleted?: true;
|
|
96
|
+
}
|
|
97
|
+
/** Response of `action=readinglists&command=setup` (no arguments). */
|
|
98
|
+
export interface ApiReadingListsSetupResponse extends ApiEnvelope {
|
|
99
|
+
/** Result of the `setup` command. */
|
|
100
|
+
setup: {
|
|
101
|
+
/** The user's default list, created for them. */
|
|
102
|
+
list: ApiReadingListItem;
|
|
103
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
104
|
+
result: "Success";
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Response of `action=readinglists&command=create`. A single `name` returns
|
|
109
|
+
* `id` + `list`; a `batch` returns `ids` + `lists`.
|
|
110
|
+
*/
|
|
111
|
+
export interface ApiReadingListsCreateResponse extends ApiEnvelope {
|
|
112
|
+
/** Result of the `create` command. */
|
|
113
|
+
create: {
|
|
114
|
+
/** New list id (raw database value) for a single create. */
|
|
115
|
+
id?: string;
|
|
116
|
+
/** New list for a single create. */
|
|
117
|
+
list?: ApiReadingListItem;
|
|
118
|
+
/** New list ids for a batch create. */
|
|
119
|
+
ids?: string[];
|
|
120
|
+
/** New lists for a batch create. */
|
|
121
|
+
lists?: ApiReadingListItem[];
|
|
122
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
123
|
+
result: "Success";
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Response of `action=readinglists&command=update`. A single `list` returns
|
|
128
|
+
* `id` + `list`; a `batch` returns `ids` + `lists`.
|
|
129
|
+
*/
|
|
130
|
+
export interface ApiReadingListsUpdateResponse extends ApiEnvelope {
|
|
131
|
+
/** Result of the `update` command. */
|
|
132
|
+
update: {
|
|
133
|
+
/** Updated list id (raw database value) for a single update. */
|
|
134
|
+
id?: string;
|
|
135
|
+
/** Updated list for a single update. */
|
|
136
|
+
list?: ApiReadingListItem;
|
|
137
|
+
/** Updated list ids for a batch update. */
|
|
138
|
+
ids?: string[];
|
|
139
|
+
/** Updated lists for a batch update. */
|
|
140
|
+
lists?: ApiReadingListItem[];
|
|
141
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
142
|
+
result: "Success";
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** Response of `action=readinglists&command=delete` (single `list` or `batch`). */
|
|
146
|
+
export interface ApiReadingListsDeleteResponse extends ApiEnvelope {
|
|
147
|
+
/** Result of the `delete` command — a bare success sentinel. */
|
|
148
|
+
delete: {
|
|
149
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
150
|
+
result: "Success";
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Response of `action=readinglists&command=createentry`. A single `project` +
|
|
155
|
+
* `title` returns `id` + `entry`; a `batch` returns `ids` + `entries`.
|
|
156
|
+
*/
|
|
157
|
+
export interface ApiReadingListsCreateEntryResponse extends ApiEnvelope {
|
|
158
|
+
/** Result of the `createentry` command. */
|
|
159
|
+
createentry: {
|
|
160
|
+
/** New entry id (raw database value) for a single create. */
|
|
161
|
+
id?: string;
|
|
162
|
+
/** New entry for a single create. */
|
|
163
|
+
entry?: ApiReadingListEntry;
|
|
164
|
+
/** New entry ids for a batch create. */
|
|
165
|
+
ids?: string[];
|
|
166
|
+
/** New entries for a batch create. */
|
|
167
|
+
entries?: ApiReadingListEntry[];
|
|
168
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
169
|
+
result: "Success";
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Response of `action=readinglists&command=deleteentry` (single `entry` or
|
|
174
|
+
* `batch`).
|
|
175
|
+
*/
|
|
176
|
+
export interface ApiReadingListsDeleteEntryResponse extends ApiEnvelope {
|
|
177
|
+
/** Result of the `deleteentry` command — a bare success sentinel. */
|
|
178
|
+
deleteentry: {
|
|
179
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
180
|
+
result: "Success";
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** Response of `action=readinglists&command=teardown` (no arguments). */
|
|
184
|
+
export interface ApiReadingListsTeardownResponse extends ApiEnvelope {
|
|
185
|
+
/** Result of the `teardown` command — a bare success sentinel. */
|
|
186
|
+
teardown: {
|
|
187
|
+
/** Always `Success` on the success branch; failures are top-level errors. */
|
|
188
|
+
result: "Success";
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
declare module "types-mediawiki-response" {
|
|
192
|
+
interface ApiQueryResult {
|
|
193
|
+
/**
|
|
194
|
+
* The current user's reading lists. `meta=readinglists`.
|
|
195
|
+
*/
|
|
196
|
+
readinglists?: ApiReadingListItem[];
|
|
197
|
+
/**
|
|
198
|
+
* A sync watermark: querying with this timestamp as `changedsince`
|
|
199
|
+
* guarantees no intervening change is skipped. Sibling of {@link readinglists},
|
|
200
|
+
* `meta=readinglists`; omitted on continuation requests.
|
|
201
|
+
*/
|
|
202
|
+
"readinglists-synctimestamp"?: Timestamp;
|
|
203
|
+
/**
|
|
204
|
+
* Pages saved in the requested list(s). `list=readinglistentries` (or
|
|
205
|
+
* `generator=readinglistentries`, where the entries feed `pages` and this
|
|
206
|
+
* array comes back empty).
|
|
207
|
+
*/
|
|
208
|
+
readinglistentries?: ApiReadingListEntry[];
|
|
209
|
+
}
|
|
210
|
+
}
|