@ukwhatn/wikidot 4.0.5 → 4.0.6
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 +83 -83
- package/dist/errors.cjs +1 -1
- package/dist/errors.d.cts +34 -34
- package/dist/errors.d.ts +34 -34
- package/dist/errors.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +644 -644
- package/dist/index.d.ts +644 -644
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Wikidot
|
|
3
|
-
*
|
|
2
|
+
* Base error class for the Wikidot library
|
|
3
|
+
* All custom errors inherit from this class
|
|
4
4
|
*/
|
|
5
5
|
declare abstract class WikidotError extends Error {
|
|
6
|
-
/**
|
|
6
|
+
/** Error name */
|
|
7
7
|
readonly name: string;
|
|
8
8
|
/**
|
|
9
|
-
* @param message -
|
|
9
|
+
* @param message - Error message
|
|
10
10
|
*/
|
|
11
11
|
constructor(message: string);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Unexpected error
|
|
15
|
+
* Represents internal inconsistencies or bugs
|
|
16
16
|
*/
|
|
17
17
|
declare class UnexpectedError extends WikidotError {}
|
|
18
18
|
/**
|
|
19
|
-
* Ajax Module Connector
|
|
19
|
+
* Base error for Ajax Module Connector related issues
|
|
20
20
|
*/
|
|
21
21
|
declare class AMCError extends WikidotError {}
|
|
22
22
|
/**
|
|
23
|
-
* HTTP
|
|
24
|
-
* AMC
|
|
23
|
+
* HTTP status code error
|
|
24
|
+
* Thrown when an AMC request fails with an HTTP error
|
|
25
25
|
*/
|
|
26
26
|
declare class AMCHttpError extends AMCError {
|
|
27
|
-
/** HTTP
|
|
27
|
+
/** HTTP status code */
|
|
28
28
|
readonly statusCode: number;
|
|
29
29
|
/**
|
|
30
|
-
* @param message -
|
|
31
|
-
* @param statusCode - HTTP
|
|
30
|
+
* @param message - Error message
|
|
31
|
+
* @param statusCode - HTTP status code
|
|
32
32
|
*/
|
|
33
33
|
constructor(message: string, statusCode: number);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Wikidot
|
|
37
|
-
* AMC
|
|
36
|
+
* Wikidot status code error
|
|
37
|
+
* Thrown when AMC response status is not ok
|
|
38
38
|
*/
|
|
39
39
|
declare class WikidotStatusError extends AMCError {
|
|
40
|
-
/** Wikidot
|
|
40
|
+
/** Wikidot status code string */
|
|
41
41
|
readonly statusCode: string;
|
|
42
42
|
/**
|
|
43
|
-
* @param message -
|
|
44
|
-
* @param statusCode -
|
|
43
|
+
* @param message - Error message
|
|
44
|
+
* @param statusCode - Status code (e.g., 'not_ok', 'try_again')
|
|
45
45
|
*/
|
|
46
46
|
constructor(message: string, statusCode: string);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
49
|
+
* Response data error
|
|
50
|
+
* Thrown when response parsing fails
|
|
51
51
|
*/
|
|
52
52
|
declare class ResponseDataError extends AMCError {}
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Base error for session related issues
|
|
55
55
|
*/
|
|
56
56
|
declare class SessionError extends WikidotError {}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* Session creation failure error
|
|
59
|
+
* Thrown when a login attempt fails
|
|
60
60
|
*/
|
|
61
61
|
declare class SessionCreateError extends SessionError {}
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* Login required error
|
|
64
|
+
* Thrown when an authenticated operation is attempted without login
|
|
65
65
|
*/
|
|
66
66
|
declare class LoginRequiredError extends SessionError {
|
|
67
67
|
constructor(message?: string);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
70
|
+
* Resource not found error
|
|
71
|
+
* Thrown when the requested resource does not exist
|
|
72
72
|
*/
|
|
73
73
|
declare class NotFoundException extends WikidotError {}
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* Resource already exists error
|
|
76
|
+
* Thrown when attempting to create a resource that already exists
|
|
77
77
|
*/
|
|
78
78
|
declare class TargetExistsError extends WikidotError {}
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Target state error
|
|
81
|
+
* Thrown when a resource is in an inoperable state (e.g., locked)
|
|
82
82
|
*/
|
|
83
83
|
declare class TargetError extends WikidotError {}
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* Access denied error
|
|
86
|
+
* Thrown when an operation is denied due to insufficient permissions
|
|
87
87
|
*/
|
|
88
88
|
declare class ForbiddenError extends WikidotError {}
|
|
89
89
|
/**
|
|
90
|
-
* HTML
|
|
91
|
-
*
|
|
90
|
+
* HTML element not found error
|
|
91
|
+
* Thrown when a required element is not found during parsing
|
|
92
92
|
*/
|
|
93
93
|
declare class NoElementError extends WikidotError {}
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
95
|
+
* Module providing logging functionality
|
|
96
96
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* This module configures and provides loggers used throughout the library.
|
|
98
|
+
* By default, it does not output anything, allowing application-side log control.
|
|
99
99
|
*/
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* Log level
|
|
102
102
|
*/
|
|
103
103
|
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Logger handler
|
|
106
106
|
*/
|
|
107
107
|
type LogHandler = (level: LogLevel, name: string, message: string, ...args: unknown[]) => void;
|
|
108
108
|
/**
|
|
109
|
-
* NullHandler:
|
|
109
|
+
* NullHandler: Outputs nothing (default)
|
|
110
110
|
*/
|
|
111
111
|
declare const nullHandler: LogHandler;
|
|
112
112
|
/**
|
|
113
|
-
* ConsoleHandler:
|
|
113
|
+
* ConsoleHandler: Outputs to console
|
|
114
114
|
*/
|
|
115
115
|
declare const consoleHandler: LogHandler;
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* Logger class
|
|
118
118
|
*/
|
|
119
119
|
declare class Logger {
|
|
120
120
|
private readonly name;
|
|
@@ -122,19 +122,19 @@ declare class Logger {
|
|
|
122
122
|
private level;
|
|
123
123
|
constructor(name: string, handler?: LogHandler, level?: LogLevel);
|
|
124
124
|
/**
|
|
125
|
-
*
|
|
125
|
+
* Set handler
|
|
126
126
|
*/
|
|
127
127
|
setHandler(handler: LogHandler): void;
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
129
|
+
* Set log level
|
|
130
130
|
*/
|
|
131
131
|
setLevel(level: LogLevel): void;
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
133
|
+
* Check if the specified level should be logged
|
|
134
134
|
*/
|
|
135
135
|
private shouldLog;
|
|
136
136
|
/**
|
|
137
|
-
*
|
|
137
|
+
* Output log
|
|
138
138
|
*/
|
|
139
139
|
private log;
|
|
140
140
|
debug(message: string, ...args: unknown[]): void;
|
|
@@ -143,67 +143,67 @@ declare class Logger {
|
|
|
143
143
|
error(message: string, ...args: unknown[]): void;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
*
|
|
147
|
-
* @param name -
|
|
148
|
-
* @returns
|
|
146
|
+
* Get logger
|
|
147
|
+
* @param name - Logger name (default: "wikidot")
|
|
148
|
+
* @returns Logger instance
|
|
149
149
|
*/
|
|
150
150
|
declare function getLogger(name?: string): Logger;
|
|
151
151
|
/**
|
|
152
|
-
*
|
|
153
|
-
* @param logger -
|
|
154
|
-
* @param level -
|
|
152
|
+
* Setup console output handler
|
|
153
|
+
* @param logger - Logger to configure
|
|
154
|
+
* @param level - Log level (default: "warn")
|
|
155
155
|
*/
|
|
156
156
|
declare function setupConsoleHandler(logger: Logger, level?: LogLevel): void;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
158
|
+
* Default logger used throughout the package
|
|
159
159
|
*/
|
|
160
160
|
declare const logger: Logger;
|
|
161
|
-
/**
|
|
161
|
+
/** DateTime type (ISO 8601 format) */
|
|
162
162
|
type DateTimeString = string;
|
|
163
|
-
/**
|
|
163
|
+
/** User ID or username */
|
|
164
164
|
type UserIdentifier = number | string;
|
|
165
|
-
/**
|
|
165
|
+
/** Site UNIX name */
|
|
166
166
|
type SiteUnixName = string;
|
|
167
|
-
/**
|
|
167
|
+
/** Page fullname (category:name) */
|
|
168
168
|
type PageFullname = string;
|
|
169
169
|
import { Result, ResultAsync } from "neverthrow";
|
|
170
|
-
/**
|
|
170
|
+
/** Synchronous Result type alias */
|
|
171
171
|
type WikidotResult<T> = Result<T, WikidotError>;
|
|
172
|
-
/**
|
|
172
|
+
/** Asynchronous Result type alias */
|
|
173
173
|
type WikidotResultAsync<T> = ResultAsync<T, WikidotError>;
|
|
174
|
-
/**
|
|
174
|
+
/** Create success Result */
|
|
175
175
|
declare const wdOk: <T>(value: T) => WikidotResult<T>;
|
|
176
|
-
/**
|
|
176
|
+
/** Create error Result */
|
|
177
177
|
declare const wdErr: <E extends WikidotError>(error: E) => WikidotResult<never>;
|
|
178
|
-
/**
|
|
178
|
+
/** Create success ResultAsync */
|
|
179
179
|
declare const wdOkAsync: <T>(value: T) => WikidotResultAsync<T>;
|
|
180
|
-
/**
|
|
180
|
+
/** Create error ResultAsync */
|
|
181
181
|
declare const wdErrAsync: <E extends WikidotError>(error: E) => WikidotResultAsync<never>;
|
|
182
|
-
/** Promise
|
|
182
|
+
/** Convert from Promise */
|
|
183
183
|
declare const fromPromise: <T>(promise: Promise<T>, errorMapper: (error: unknown) => WikidotError) => WikidotResultAsync<T>;
|
|
184
|
-
/**
|
|
184
|
+
/** Combine multiple ResultAsync */
|
|
185
185
|
declare const combineResults: <T>(results: WikidotResultAsync<T>[]) => WikidotResultAsync<T[]>;
|
|
186
186
|
/**
|
|
187
|
-
* Ajax Module Connector
|
|
187
|
+
* Ajax Module Connector configuration
|
|
188
188
|
*/
|
|
189
189
|
interface AMCConfig {
|
|
190
|
-
/**
|
|
190
|
+
/** Request timeout (milliseconds) */
|
|
191
191
|
timeout: number;
|
|
192
|
-
/**
|
|
192
|
+
/** Maximum retry count */
|
|
193
193
|
retryLimit: number;
|
|
194
|
-
/**
|
|
194
|
+
/** Base retry interval (milliseconds) */
|
|
195
195
|
retryInterval: number;
|
|
196
|
-
/**
|
|
196
|
+
/** Maximum backoff (milliseconds) */
|
|
197
197
|
maxBackoff: number;
|
|
198
|
-
/**
|
|
198
|
+
/** Backoff factor */
|
|
199
199
|
backoffFactor: number;
|
|
200
|
-
/**
|
|
200
|
+
/** Maximum concurrent requests */
|
|
201
201
|
semaphoreLimit: number;
|
|
202
202
|
}
|
|
203
|
-
/**
|
|
203
|
+
/** Default AMC configuration */
|
|
204
204
|
declare const DEFAULT_AMC_CONFIG: AMCConfig;
|
|
205
205
|
/**
|
|
206
|
-
* AMC
|
|
206
|
+
* Class for managing AMC request headers
|
|
207
207
|
*/
|
|
208
208
|
declare class AMCHeader {
|
|
209
209
|
private cookies;
|
|
@@ -211,7 +211,7 @@ declare class AMCHeader {
|
|
|
211
211
|
private userAgent;
|
|
212
212
|
private referer;
|
|
213
213
|
/**
|
|
214
|
-
* @param options -
|
|
214
|
+
* @param options - Header initialization options
|
|
215
215
|
*/
|
|
216
216
|
constructor(options?: {
|
|
217
217
|
contentType?: string;
|
|
@@ -219,35 +219,35 @@ declare class AMCHeader {
|
|
|
219
219
|
referer?: string;
|
|
220
220
|
});
|
|
221
221
|
/**
|
|
222
|
-
*
|
|
223
|
-
* @param name - Cookie
|
|
224
|
-
* @param value - Cookie
|
|
222
|
+
* Set a cookie
|
|
223
|
+
* @param name - Cookie name
|
|
224
|
+
* @param value - Cookie value
|
|
225
225
|
*/
|
|
226
226
|
setCookie(name: string, value: string): void;
|
|
227
227
|
/**
|
|
228
|
-
*
|
|
229
|
-
* @param name - Cookie
|
|
228
|
+
* Delete a cookie
|
|
229
|
+
* @param name - Cookie name
|
|
230
230
|
*/
|
|
231
231
|
deleteCookie(name: string): void;
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
234
|
-
* @param name - Cookie
|
|
235
|
-
* @returns Cookie
|
|
233
|
+
* Get a cookie
|
|
234
|
+
* @param name - Cookie name
|
|
235
|
+
* @returns Cookie value, undefined if not exists
|
|
236
236
|
*/
|
|
237
237
|
getCookie(name: string): string | undefined;
|
|
238
238
|
/**
|
|
239
|
-
* HTTP
|
|
240
|
-
* @returns
|
|
239
|
+
* Get HTTP headers object
|
|
240
|
+
* @returns Headers dictionary
|
|
241
241
|
*/
|
|
242
242
|
getHeaders(): Record<string, string>;
|
|
243
243
|
}
|
|
244
244
|
import { z } from "zod";
|
|
245
245
|
/**
|
|
246
|
-
* AMC
|
|
246
|
+
* AMC request body value type
|
|
247
247
|
*/
|
|
248
248
|
type AMCRequestBodyValue = string | number | boolean | null | undefined | Record<string, unknown> | AMCRequestBodyValue[];
|
|
249
249
|
/**
|
|
250
|
-
* AMC
|
|
250
|
+
* AMC request body type definition
|
|
251
251
|
*/
|
|
252
252
|
interface AMCRequestBody {
|
|
253
253
|
moduleName?: string;
|
|
@@ -256,7 +256,7 @@ interface AMCRequestBody {
|
|
|
256
256
|
[key: string]: AMCRequestBodyValue;
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
|
-
* AMC
|
|
259
|
+
* AMC response base schema
|
|
260
260
|
*/
|
|
261
261
|
declare const baseSchema: z.ZodObject<{
|
|
262
262
|
status: z.ZodString;
|
|
@@ -264,15 +264,15 @@ declare const baseSchema: z.ZodObject<{
|
|
|
264
264
|
message: z.ZodOptional<z.ZodString>;
|
|
265
265
|
}>;
|
|
266
266
|
/**
|
|
267
|
-
* AMC
|
|
267
|
+
* AMC response schema
|
|
268
268
|
*/
|
|
269
269
|
declare const amcResponseSchema: z.ZodType<z.infer<typeof baseSchema> & Record<string, unknown>>;
|
|
270
270
|
/**
|
|
271
|
-
* AMC
|
|
271
|
+
* AMC response type
|
|
272
272
|
*/
|
|
273
273
|
type AMCResponse = z.infer<typeof amcResponseSchema>;
|
|
274
274
|
/**
|
|
275
|
-
*
|
|
275
|
+
* Successful AMC response
|
|
276
276
|
*/
|
|
277
277
|
interface AMCSuccessResponse {
|
|
278
278
|
status: "ok";
|
|
@@ -280,99 +280,99 @@ interface AMCSuccessResponse {
|
|
|
280
280
|
[key: string]: unknown;
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
|
-
* AMC
|
|
284
|
-
* @param response - AMC
|
|
285
|
-
* @returns
|
|
283
|
+
* Type guard to check if AMC response is successful
|
|
284
|
+
* @param response - AMC response
|
|
285
|
+
* @returns true if response is successful
|
|
286
286
|
*/
|
|
287
287
|
declare function isSuccessResponse(response: AMCResponse): response is AMCSuccessResponse;
|
|
288
288
|
/**
|
|
289
|
-
*
|
|
290
|
-
* @param body -
|
|
291
|
-
* @returns
|
|
289
|
+
* Mask sensitive information (for logging)
|
|
290
|
+
* @param body - Request body to mask
|
|
291
|
+
* @returns Masked body
|
|
292
292
|
*/
|
|
293
293
|
declare function maskSensitiveData(body: AMCRequestBody): Record<string, unknown>;
|
|
294
294
|
/**
|
|
295
|
-
* AMC
|
|
295
|
+
* AMC request options
|
|
296
296
|
*/
|
|
297
297
|
interface AMCRequestOptions {
|
|
298
|
-
/**
|
|
298
|
+
/** Site name (default: www) */
|
|
299
299
|
siteName?: string;
|
|
300
|
-
/** SSL
|
|
300
|
+
/** SSL support (auto-detected if omitted) */
|
|
301
301
|
sslSupported?: boolean;
|
|
302
|
-
/**
|
|
302
|
+
/** Include errors in results instead of throwing (default: false) */
|
|
303
303
|
returnExceptions?: boolean;
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
|
-
* Ajax Module Connector
|
|
307
|
-
* Wikidot AMC
|
|
306
|
+
* Ajax Module Connector client
|
|
307
|
+
* Manages requests to Wikidot AMC endpoint
|
|
308
308
|
*/
|
|
309
309
|
declare class AMCClient {
|
|
310
|
-
/** ky
|
|
310
|
+
/** ky instance */
|
|
311
311
|
private readonly ky;
|
|
312
|
-
/**
|
|
312
|
+
/** Concurrent request limiter */
|
|
313
313
|
private readonly limit;
|
|
314
|
-
/**
|
|
314
|
+
/** Header manager */
|
|
315
315
|
readonly header: AMCHeader;
|
|
316
|
-
/**
|
|
316
|
+
/** Configuration */
|
|
317
317
|
readonly config: AMCConfig;
|
|
318
|
-
/**
|
|
318
|
+
/** Base domain */
|
|
319
319
|
readonly domain: string;
|
|
320
|
-
/** SSL
|
|
320
|
+
/** SSL support status cache */
|
|
321
321
|
private sslCache;
|
|
322
322
|
/**
|
|
323
|
-
* @param config - AMC
|
|
324
|
-
* @param domain -
|
|
323
|
+
* @param config - AMC configuration (uses defaults if omitted)
|
|
324
|
+
* @param domain - Base domain (default: wikidot.com)
|
|
325
325
|
*/
|
|
326
326
|
constructor(config?: Partial<AMCConfig>, domain?: string);
|
|
327
327
|
/**
|
|
328
|
-
*
|
|
329
|
-
* @param siteName -
|
|
330
|
-
* @returns SSL
|
|
328
|
+
* Check site existence and SSL support status
|
|
329
|
+
* @param siteName - Site name
|
|
330
|
+
* @returns SSL support status (true: HTTPS, false: HTTP)
|
|
331
331
|
*/
|
|
332
332
|
checkSiteSSL(siteName: string): WikidotResultAsync<boolean>;
|
|
333
333
|
/**
|
|
334
|
-
* AMC
|
|
335
|
-
* @param bodies -
|
|
336
|
-
* @param siteName -
|
|
337
|
-
* @param sslSupported - SSL
|
|
338
|
-
* @returns
|
|
334
|
+
* Execute AMC request
|
|
335
|
+
* @param bodies - Request body array
|
|
336
|
+
* @param siteName - Site name (default: www)
|
|
337
|
+
* @param sslSupported - SSL support (auto-detected if omitted)
|
|
338
|
+
* @returns Response array
|
|
339
339
|
*/
|
|
340
340
|
request(bodies: AMCRequestBody[], siteName?: string, sslSupported?: boolean): WikidotResultAsync<AMCResponse[]>;
|
|
341
341
|
/**
|
|
342
|
-
* AMC
|
|
343
|
-
* @param bodies -
|
|
344
|
-
* @param options -
|
|
345
|
-
* @returns
|
|
342
|
+
* Execute AMC request (with options)
|
|
343
|
+
* @param bodies - Request body array
|
|
344
|
+
* @param options - Request options
|
|
345
|
+
* @returns Response array (includes errors if returnExceptions is true)
|
|
346
346
|
*/
|
|
347
347
|
requestWithOptions(bodies: AMCRequestBody[], options?: AMCRequestOptions): WikidotResultAsync<(AMCResponse | WikidotError)[]>;
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
350
|
-
* @param body -
|
|
351
|
-
* @param url -
|
|
352
|
-
* @returns
|
|
349
|
+
* Internal method to execute a single request
|
|
350
|
+
* @param body - Request body
|
|
351
|
+
* @param url - Request URL
|
|
352
|
+
* @returns Response
|
|
353
353
|
*/
|
|
354
354
|
private singleRequest;
|
|
355
355
|
}
|
|
356
356
|
/**
|
|
357
|
-
*
|
|
358
|
-
* Client
|
|
357
|
+
* Client reference interface
|
|
358
|
+
* Used to avoid direct dependency on Client type
|
|
359
359
|
*/
|
|
360
360
|
interface ClientRef {
|
|
361
361
|
/**
|
|
362
|
-
*
|
|
363
|
-
* @returns
|
|
362
|
+
* Call before operations that require login
|
|
363
|
+
* @returns Error if not logged in
|
|
364
364
|
*/
|
|
365
365
|
requireLogin(): {
|
|
366
366
|
isErr(): boolean;
|
|
367
367
|
error?: Error;
|
|
368
368
|
};
|
|
369
369
|
/**
|
|
370
|
-
*
|
|
370
|
+
* Whether logged in
|
|
371
371
|
*/
|
|
372
372
|
isLoggedIn(): boolean;
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
|
-
* AMCHeader
|
|
375
|
+
* Minimal AMCHeader interface
|
|
376
376
|
*/
|
|
377
377
|
interface AMCHeaderRef {
|
|
378
378
|
getHeaders(): Record<string, string>;
|
|
@@ -380,155 +380,155 @@ interface AMCHeaderRef {
|
|
|
380
380
|
deleteCookie(name: string): void;
|
|
381
381
|
}
|
|
382
382
|
/**
|
|
383
|
-
* AMCClient
|
|
383
|
+
* Minimal AMCClient interface
|
|
384
384
|
*/
|
|
385
385
|
interface AMCClientRef {
|
|
386
386
|
header: AMCHeaderRef;
|
|
387
387
|
request(bodies: AMCRequestBody[]): WikidotResultAsync<AMCResponse[]>;
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
390
|
-
*
|
|
391
|
-
* auth.ts
|
|
390
|
+
* Client context required for authentication
|
|
391
|
+
* Used to avoid auth.ts directly depending on client.ts
|
|
392
392
|
*/
|
|
393
393
|
interface AuthClientContext {
|
|
394
394
|
amcClient: AMCClientRef;
|
|
395
395
|
}
|
|
396
396
|
/**
|
|
397
|
-
*
|
|
398
|
-
* Site
|
|
397
|
+
* Site reference interface
|
|
398
|
+
* Used to avoid direct dependency on Site type
|
|
399
399
|
*/
|
|
400
400
|
interface SiteRef {
|
|
401
401
|
/**
|
|
402
|
-
*
|
|
402
|
+
* Site ID
|
|
403
403
|
*/
|
|
404
404
|
readonly id: number;
|
|
405
405
|
/**
|
|
406
|
-
* UNIX
|
|
406
|
+
* UNIX name (e.g., scp-jp)
|
|
407
407
|
*/
|
|
408
408
|
readonly unixName: string;
|
|
409
409
|
/**
|
|
410
|
-
*
|
|
410
|
+
* Domain
|
|
411
411
|
*/
|
|
412
412
|
readonly domain: string;
|
|
413
413
|
/**
|
|
414
|
-
* SSL
|
|
414
|
+
* SSL support flag
|
|
415
415
|
*/
|
|
416
416
|
readonly sslSupported: boolean;
|
|
417
417
|
/**
|
|
418
|
-
*
|
|
418
|
+
* Client reference
|
|
419
419
|
*/
|
|
420
420
|
readonly client: ClientRef;
|
|
421
421
|
/**
|
|
422
|
-
* AMC
|
|
422
|
+
* Execute AMC request
|
|
423
423
|
*/
|
|
424
424
|
amcRequest(bodies: AMCRequestBody[]): WikidotResultAsync<AMCResponse[]>;
|
|
425
425
|
/**
|
|
426
|
-
*
|
|
426
|
+
* Execute single AMC request
|
|
427
427
|
*/
|
|
428
428
|
amcRequestSingle(body: AMCRequestBody): WikidotResultAsync<AMCResponse>;
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
431
|
-
*
|
|
431
|
+
* Forum category reference interface
|
|
432
432
|
*/
|
|
433
433
|
interface ForumCategoryRef {
|
|
434
434
|
/**
|
|
435
|
-
*
|
|
435
|
+
* Category ID
|
|
436
436
|
*/
|
|
437
437
|
readonly id: number;
|
|
438
438
|
/**
|
|
439
|
-
*
|
|
439
|
+
* Category title
|
|
440
440
|
*/
|
|
441
441
|
readonly title: string;
|
|
442
442
|
/**
|
|
443
|
-
*
|
|
443
|
+
* Site reference
|
|
444
444
|
*/
|
|
445
445
|
readonly site: SiteRef;
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
|
-
*
|
|
449
|
-
* ForumThread
|
|
448
|
+
* Forum thread reference interface
|
|
449
|
+
* Used to avoid direct dependency on ForumThread type
|
|
450
450
|
*/
|
|
451
451
|
interface ForumThreadRef {
|
|
452
452
|
/**
|
|
453
|
-
*
|
|
453
|
+
* Thread ID
|
|
454
454
|
*/
|
|
455
455
|
readonly id: number;
|
|
456
456
|
/**
|
|
457
|
-
*
|
|
457
|
+
* Thread title
|
|
458
458
|
*/
|
|
459
459
|
readonly title: string;
|
|
460
460
|
/**
|
|
461
|
-
*
|
|
461
|
+
* Site reference
|
|
462
462
|
*/
|
|
463
463
|
readonly site: SiteRef;
|
|
464
464
|
/**
|
|
465
|
-
*
|
|
465
|
+
* Category reference (if exists)
|
|
466
466
|
*/
|
|
467
467
|
readonly category?: ForumCategoryRef | null;
|
|
468
468
|
}
|
|
469
469
|
/**
|
|
470
|
-
*
|
|
471
|
-
* Page
|
|
470
|
+
* Page reference interface
|
|
471
|
+
* Used to avoid direct dependency on Page type
|
|
472
472
|
*/
|
|
473
473
|
interface PageRef {
|
|
474
474
|
/**
|
|
475
|
-
*
|
|
475
|
+
* Page ID (set after retrieval)
|
|
476
476
|
*/
|
|
477
477
|
readonly id: number | null;
|
|
478
478
|
/**
|
|
479
|
-
*
|
|
479
|
+
* Fullname (category:name format)
|
|
480
480
|
*/
|
|
481
481
|
readonly fullname: string;
|
|
482
482
|
/**
|
|
483
|
-
*
|
|
483
|
+
* Page name
|
|
484
484
|
*/
|
|
485
485
|
readonly name: string;
|
|
486
486
|
/**
|
|
487
|
-
*
|
|
487
|
+
* Category
|
|
488
488
|
*/
|
|
489
489
|
readonly category: string;
|
|
490
490
|
/**
|
|
491
|
-
*
|
|
491
|
+
* Site reference
|
|
492
492
|
*/
|
|
493
493
|
readonly site: SiteRef;
|
|
494
494
|
}
|
|
495
495
|
/**
|
|
496
|
-
*
|
|
497
|
-
* @param client -
|
|
498
|
-
* @param username -
|
|
499
|
-
* @param password -
|
|
500
|
-
* @returns
|
|
496
|
+
* Login to Wikidot with username and password
|
|
497
|
+
* @param client - Client context (object with AMCClient)
|
|
498
|
+
* @param username - Username
|
|
499
|
+
* @param password - Password
|
|
500
|
+
* @returns void on success, SessionCreateError on failure
|
|
501
501
|
*/
|
|
502
502
|
declare function login(client: AuthClientContext, username: string, password: string): WikidotResultAsync<void>;
|
|
503
503
|
/**
|
|
504
|
-
*
|
|
505
|
-
* @param client -
|
|
506
|
-
* @returns
|
|
504
|
+
* Logout from Wikidot
|
|
505
|
+
* @param client - Client context (object with AMCClient)
|
|
506
|
+
* @returns void on success
|
|
507
507
|
*/
|
|
508
508
|
declare function logout(client: AuthClientContext): WikidotResultAsync<void>;
|
|
509
509
|
/**
|
|
510
|
-
*
|
|
510
|
+
* User type
|
|
511
511
|
*/
|
|
512
512
|
type UserType = "user" | "deleted" | "anonymous" | "guest" | "wikidot";
|
|
513
513
|
/**
|
|
514
|
-
*
|
|
514
|
+
* User base interface
|
|
515
515
|
*/
|
|
516
516
|
interface AbstractUser {
|
|
517
|
-
/**
|
|
517
|
+
/** Client */
|
|
518
518
|
readonly client: ClientRef;
|
|
519
|
-
/**
|
|
519
|
+
/** User ID */
|
|
520
520
|
readonly id: number;
|
|
521
|
-
/**
|
|
521
|
+
/** Username */
|
|
522
522
|
readonly name: string;
|
|
523
|
-
/** UNIX
|
|
523
|
+
/** UNIX format username */
|
|
524
524
|
readonly unixName: string | null;
|
|
525
|
-
/**
|
|
525
|
+
/** Avatar URL */
|
|
526
526
|
readonly avatarUrl: string | null;
|
|
527
|
-
/** IP
|
|
527
|
+
/** IP address (only for anonymous users) */
|
|
528
528
|
readonly ip: string | null;
|
|
529
|
-
/**
|
|
529
|
+
/** User type */
|
|
530
530
|
readonly userType: UserType;
|
|
531
|
-
/**
|
|
531
|
+
/** Check user type */
|
|
532
532
|
isUser(): boolean;
|
|
533
533
|
isDeletedUser(): boolean;
|
|
534
534
|
isAnonymousUser(): boolean;
|
|
@@ -536,21 +536,21 @@ interface AbstractUser {
|
|
|
536
536
|
isWikidotUser(): boolean;
|
|
537
537
|
}
|
|
538
538
|
/**
|
|
539
|
-
*
|
|
539
|
+
* Anonymous user
|
|
540
540
|
*/
|
|
541
541
|
declare class AnonymousUser implements AbstractUser {
|
|
542
542
|
readonly client: ClientRef;
|
|
543
|
-
/**
|
|
543
|
+
/** User ID (0 for anonymous) */
|
|
544
544
|
readonly id: number;
|
|
545
|
-
/**
|
|
545
|
+
/** Username ("Anonymous" for anonymous users) */
|
|
546
546
|
readonly name: string;
|
|
547
|
-
/** UNIX
|
|
547
|
+
/** UNIX format username */
|
|
548
548
|
readonly unixName: string;
|
|
549
|
-
/**
|
|
549
|
+
/** Avatar URL (null for anonymous) */
|
|
550
550
|
readonly avatarUrl: string | null;
|
|
551
|
-
/** IP
|
|
551
|
+
/** IP address */
|
|
552
552
|
readonly ip: string;
|
|
553
|
-
/**
|
|
553
|
+
/** User type */
|
|
554
554
|
readonly userType: UserType;
|
|
555
555
|
constructor(client: ClientRef, ip: string);
|
|
556
556
|
isUser(): boolean;
|
|
@@ -561,21 +561,21 @@ declare class AnonymousUser implements AbstractUser {
|
|
|
561
561
|
toString(): string;
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
564
|
-
*
|
|
564
|
+
* Deleted user
|
|
565
565
|
*/
|
|
566
566
|
declare class DeletedUser implements AbstractUser {
|
|
567
567
|
readonly client: ClientRef;
|
|
568
|
-
/**
|
|
568
|
+
/** Deleted user ID */
|
|
569
569
|
readonly id: number;
|
|
570
|
-
/**
|
|
570
|
+
/** Username ("account deleted" for deleted users) */
|
|
571
571
|
readonly name: string;
|
|
572
|
-
/** UNIX
|
|
572
|
+
/** UNIX format username */
|
|
573
573
|
readonly unixName: string;
|
|
574
|
-
/**
|
|
574
|
+
/** Avatar URL (null for deleted) */
|
|
575
575
|
readonly avatarUrl: string | null;
|
|
576
|
-
/** IP
|
|
576
|
+
/** IP address (null for deleted) */
|
|
577
577
|
readonly ip: string | null;
|
|
578
|
-
/**
|
|
578
|
+
/** User type */
|
|
579
579
|
readonly userType: UserType;
|
|
580
580
|
constructor(client: ClientRef, id: number);
|
|
581
581
|
isUser(): boolean;
|
|
@@ -586,21 +586,21 @@ declare class DeletedUser implements AbstractUser {
|
|
|
586
586
|
toString(): string;
|
|
587
587
|
}
|
|
588
588
|
/**
|
|
589
|
-
*
|
|
589
|
+
* Guest user
|
|
590
590
|
*/
|
|
591
591
|
declare class GuestUser implements AbstractUser {
|
|
592
592
|
readonly client: ClientRef;
|
|
593
|
-
/**
|
|
593
|
+
/** User ID (0 for guest) */
|
|
594
594
|
readonly id: number;
|
|
595
|
-
/**
|
|
595
|
+
/** Guest name */
|
|
596
596
|
readonly name: string;
|
|
597
|
-
/** UNIX
|
|
597
|
+
/** UNIX format username (null for guest) */
|
|
598
598
|
readonly unixName: string | null;
|
|
599
|
-
/**
|
|
599
|
+
/** Avatar URL (may be Gravatar) */
|
|
600
600
|
readonly avatarUrl: string | null;
|
|
601
|
-
/** IP
|
|
601
|
+
/** IP address (null for guest) */
|
|
602
602
|
readonly ip: string | null;
|
|
603
|
-
/**
|
|
603
|
+
/** User type */
|
|
604
604
|
readonly userType: UserType;
|
|
605
605
|
constructor(client: ClientRef, name: string, avatarUrl?: string | null);
|
|
606
606
|
isUser(): boolean;
|
|
@@ -611,30 +611,30 @@ declare class GuestUser implements AbstractUser {
|
|
|
611
611
|
toString(): string;
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
|
-
*
|
|
614
|
+
* User collection
|
|
615
615
|
*/
|
|
616
616
|
declare class UserCollection extends Array<User | null> {
|
|
617
617
|
constructor(users?: (User | null)[]);
|
|
618
618
|
/**
|
|
619
|
-
*
|
|
620
|
-
* @param name -
|
|
621
|
-
* @returns
|
|
619
|
+
* Find by username
|
|
620
|
+
* @param name - Username
|
|
621
|
+
* @returns User or undefined
|
|
622
622
|
*/
|
|
623
623
|
findByName(name: string): User | undefined;
|
|
624
624
|
/**
|
|
625
|
-
*
|
|
626
|
-
* @param id -
|
|
627
|
-
* @returns
|
|
625
|
+
* Find by user ID
|
|
626
|
+
* @param id - User ID
|
|
627
|
+
* @returns User or undefined
|
|
628
628
|
*/
|
|
629
629
|
findById(id: number): User | undefined;
|
|
630
630
|
/**
|
|
631
|
-
* null
|
|
632
|
-
* @returns null
|
|
631
|
+
* Return only non-null users
|
|
632
|
+
* @returns Array of non-null users
|
|
633
633
|
*/
|
|
634
634
|
filterNonNull(): User[];
|
|
635
635
|
}
|
|
636
636
|
/**
|
|
637
|
-
*
|
|
637
|
+
* User data
|
|
638
638
|
*/
|
|
639
639
|
interface UserData {
|
|
640
640
|
id: number;
|
|
@@ -644,37 +644,37 @@ interface UserData {
|
|
|
644
644
|
unixName?: string;
|
|
645
645
|
}
|
|
646
646
|
/**
|
|
647
|
-
*
|
|
647
|
+
* Regular user
|
|
648
648
|
*/
|
|
649
649
|
declare class User implements AbstractUser {
|
|
650
650
|
readonly client: ClientRef;
|
|
651
|
-
/**
|
|
651
|
+
/** User ID */
|
|
652
652
|
readonly id: number;
|
|
653
|
-
/**
|
|
653
|
+
/** Username */
|
|
654
654
|
readonly name: string;
|
|
655
|
-
/**
|
|
655
|
+
/** Display name */
|
|
656
656
|
readonly displayName: string | null;
|
|
657
|
-
/**
|
|
657
|
+
/** Avatar URL */
|
|
658
658
|
readonly avatarUrl: string | null;
|
|
659
|
-
/** UNIX
|
|
659
|
+
/** UNIX format username */
|
|
660
660
|
readonly unixName: string;
|
|
661
|
-
/** IP
|
|
661
|
+
/** IP address (null for regular users) */
|
|
662
662
|
readonly ip: string | null;
|
|
663
|
-
/**
|
|
663
|
+
/** User type */
|
|
664
664
|
readonly userType: UserType;
|
|
665
665
|
constructor(client: ClientRef, data: UserData);
|
|
666
666
|
/**
|
|
667
|
-
*
|
|
668
|
-
* @param client -
|
|
669
|
-
* @param name -
|
|
670
|
-
* @returns
|
|
667
|
+
* Get user from username
|
|
668
|
+
* @param client - Client
|
|
669
|
+
* @param name - Username
|
|
670
|
+
* @returns User (null if not found)
|
|
671
671
|
*/
|
|
672
672
|
static fromName(client: ClientRef, name: string): WikidotResultAsync<User | null>;
|
|
673
673
|
/**
|
|
674
|
-
*
|
|
675
|
-
* @param client -
|
|
676
|
-
* @param names -
|
|
677
|
-
* @returns
|
|
674
|
+
* Get users from multiple usernames
|
|
675
|
+
* @param client - Client
|
|
676
|
+
* @param names - Array of usernames
|
|
677
|
+
* @returns User collection
|
|
678
678
|
*/
|
|
679
679
|
static fromNames(client: ClientRef, names: string[]): WikidotResultAsync<UserCollection>;
|
|
680
680
|
isUser(): boolean;
|
|
@@ -685,21 +685,21 @@ declare class User implements AbstractUser {
|
|
|
685
685
|
toString(): string;
|
|
686
686
|
}
|
|
687
687
|
/**
|
|
688
|
-
* Wikidot
|
|
688
|
+
* Wikidot system user
|
|
689
689
|
*/
|
|
690
690
|
declare class WikidotUser implements AbstractUser {
|
|
691
691
|
readonly client: ClientRef;
|
|
692
|
-
/**
|
|
692
|
+
/** User ID (0 for Wikidot system) */
|
|
693
693
|
readonly id: number;
|
|
694
|
-
/**
|
|
694
|
+
/** Username */
|
|
695
695
|
readonly name: string;
|
|
696
|
-
/** UNIX
|
|
696
|
+
/** UNIX format username */
|
|
697
697
|
readonly unixName: string;
|
|
698
|
-
/**
|
|
698
|
+
/** Avatar URL (null for system user) */
|
|
699
699
|
readonly avatarUrl: string | null;
|
|
700
|
-
/** IP
|
|
700
|
+
/** IP address (null for system user) */
|
|
701
701
|
readonly ip: string | null;
|
|
702
|
-
/**
|
|
702
|
+
/** User type */
|
|
703
703
|
readonly userType: UserType;
|
|
704
704
|
constructor(client: ClientRef);
|
|
705
705
|
isUser(): boolean;
|
|
@@ -710,7 +710,7 @@ declare class WikidotUser implements AbstractUser {
|
|
|
710
710
|
toString(): string;
|
|
711
711
|
}
|
|
712
712
|
/**
|
|
713
|
-
*
|
|
713
|
+
* Private message data
|
|
714
714
|
*/
|
|
715
715
|
interface PrivateMessageData {
|
|
716
716
|
client: Client;
|
|
@@ -722,7 +722,7 @@ interface PrivateMessageData {
|
|
|
722
722
|
createdAt: Date;
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
725
|
-
*
|
|
725
|
+
* Private message
|
|
726
726
|
*/
|
|
727
727
|
declare class PrivateMessage {
|
|
728
728
|
readonly client: Client;
|
|
@@ -734,62 +734,62 @@ declare class PrivateMessage {
|
|
|
734
734
|
readonly createdAt: Date;
|
|
735
735
|
constructor(data: PrivateMessageData);
|
|
736
736
|
/**
|
|
737
|
-
*
|
|
738
|
-
* @param client -
|
|
739
|
-
* @param messageId -
|
|
740
|
-
* @returns
|
|
737
|
+
* Get message by message ID
|
|
738
|
+
* @param client - Client instance
|
|
739
|
+
* @param messageId - Message ID
|
|
740
|
+
* @returns Private message
|
|
741
741
|
*/
|
|
742
742
|
static fromId(client: Client, messageId: number): WikidotResultAsync<PrivateMessage>;
|
|
743
743
|
/**
|
|
744
|
-
*
|
|
745
|
-
* @param client -
|
|
746
|
-
* @param recipient -
|
|
747
|
-
* @param subject -
|
|
748
|
-
* @param body -
|
|
744
|
+
* Send private message
|
|
745
|
+
* @param client - Client instance
|
|
746
|
+
* @param recipient - Recipient
|
|
747
|
+
* @param subject - Subject
|
|
748
|
+
* @param body - Body
|
|
749
749
|
*/
|
|
750
750
|
static send(client: Client, recipient: User, subject: string, body: string): WikidotResultAsync<void>;
|
|
751
751
|
toString(): string;
|
|
752
752
|
}
|
|
753
753
|
/**
|
|
754
|
-
*
|
|
754
|
+
* Private message collection
|
|
755
755
|
*/
|
|
756
756
|
declare class PrivateMessageCollection extends Array<PrivateMessage> {
|
|
757
757
|
readonly client: Client;
|
|
758
758
|
constructor(client: Client, messages?: PrivateMessage[]);
|
|
759
759
|
/**
|
|
760
|
-
* ID
|
|
760
|
+
* Find by ID
|
|
761
761
|
*/
|
|
762
762
|
findById(id: number): PrivateMessage | undefined;
|
|
763
763
|
/**
|
|
764
|
-
*
|
|
764
|
+
* Get messages from list of message IDs
|
|
765
765
|
*/
|
|
766
766
|
static fromIds(client: Client, messageIds: number[]): WikidotResultAsync<PrivateMessageCollection>;
|
|
767
767
|
/**
|
|
768
|
-
*
|
|
768
|
+
* Internal method to get messages from module
|
|
769
769
|
*/
|
|
770
770
|
protected static acquireFromModule(client: Client, moduleName: string): WikidotResultAsync<PrivateMessageCollection>;
|
|
771
771
|
}
|
|
772
772
|
/**
|
|
773
|
-
*
|
|
773
|
+
* Inbox
|
|
774
774
|
*/
|
|
775
775
|
declare class PrivateMessageInbox extends PrivateMessageCollection {
|
|
776
776
|
/**
|
|
777
|
-
*
|
|
777
|
+
* Get all messages in inbox
|
|
778
778
|
*/
|
|
779
779
|
static acquire(client: Client): WikidotResultAsync<PrivateMessageInbox>;
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
782
|
-
*
|
|
782
|
+
* Sent box
|
|
783
783
|
*/
|
|
784
784
|
declare class PrivateMessageSentBox extends PrivateMessageCollection {
|
|
785
785
|
/**
|
|
786
|
-
*
|
|
786
|
+
* Get all messages in sent box
|
|
787
787
|
*/
|
|
788
788
|
static acquire(client: Client): WikidotResultAsync<PrivateMessageSentBox>;
|
|
789
789
|
}
|
|
790
790
|
import { Element } from "domhandler";
|
|
791
791
|
/**
|
|
792
|
-
*
|
|
792
|
+
* Forum post data
|
|
793
793
|
*/
|
|
794
794
|
interface ForumPostData {
|
|
795
795
|
thread: ForumThreadRef;
|
|
@@ -804,7 +804,7 @@ interface ForumPostData {
|
|
|
804
804
|
parentId?: number | null;
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
807
|
-
*
|
|
807
|
+
* Forum post
|
|
808
808
|
*/
|
|
809
809
|
declare class ForumPost {
|
|
810
810
|
readonly thread: ForumThreadRef;
|
|
@@ -820,44 +820,44 @@ declare class ForumPost {
|
|
|
820
820
|
private _source;
|
|
821
821
|
constructor(data: ForumPostData);
|
|
822
822
|
/**
|
|
823
|
-
*
|
|
823
|
+
* Parent post ID
|
|
824
824
|
*/
|
|
825
825
|
get parentId(): number | null;
|
|
826
826
|
/**
|
|
827
|
-
*
|
|
827
|
+
* Get source code (Wikidot syntax)
|
|
828
828
|
*/
|
|
829
829
|
getSource(): WikidotResultAsync<string>;
|
|
830
830
|
/**
|
|
831
|
-
*
|
|
832
|
-
* @param source -
|
|
833
|
-
* @param title -
|
|
831
|
+
* Edit post
|
|
832
|
+
* @param source - New source (Wikidot syntax)
|
|
833
|
+
* @param title - New title (keeps current title if omitted)
|
|
834
834
|
*/
|
|
835
835
|
edit(source: string, title?: string): WikidotResultAsync<void>;
|
|
836
836
|
toString(): string;
|
|
837
837
|
}
|
|
838
838
|
/**
|
|
839
|
-
*
|
|
839
|
+
* Forum post collection
|
|
840
840
|
*/
|
|
841
841
|
declare class ForumPostCollection extends Array<ForumPost> {
|
|
842
842
|
readonly thread: ForumThreadRef;
|
|
843
843
|
constructor(thread: ForumThreadRef, posts?: ForumPost[]);
|
|
844
844
|
/**
|
|
845
|
-
* ID
|
|
846
|
-
* @param id -
|
|
847
|
-
* @returns
|
|
845
|
+
* Find by ID
|
|
846
|
+
* @param id - Post ID
|
|
847
|
+
* @returns Post (undefined if not found)
|
|
848
848
|
*/
|
|
849
849
|
findById(id: number): ForumPost | undefined;
|
|
850
850
|
/**
|
|
851
|
-
* HTML
|
|
851
|
+
* Parse posts from HTML (internal method)
|
|
852
852
|
*/
|
|
853
853
|
private static _parse;
|
|
854
854
|
/**
|
|
855
|
-
*
|
|
855
|
+
* Get all posts in a thread
|
|
856
856
|
*/
|
|
857
857
|
static acquireAllInThread(thread: ForumThreadRef): WikidotResultAsync<ForumPostCollection>;
|
|
858
858
|
}
|
|
859
859
|
/**
|
|
860
|
-
*
|
|
860
|
+
* Forum thread data
|
|
861
861
|
*/
|
|
862
862
|
interface ForumThreadData {
|
|
863
863
|
site: Site;
|
|
@@ -870,7 +870,7 @@ interface ForumThreadData {
|
|
|
870
870
|
category?: ForumCategory | null;
|
|
871
871
|
}
|
|
872
872
|
/**
|
|
873
|
-
*
|
|
873
|
+
* Forum thread
|
|
874
874
|
*/
|
|
875
875
|
declare class ForumThread2 {
|
|
876
876
|
readonly site: Site;
|
|
@@ -884,50 +884,50 @@ declare class ForumThread2 {
|
|
|
884
884
|
private _posts;
|
|
885
885
|
constructor(data: ForumThreadData);
|
|
886
886
|
/**
|
|
887
|
-
*
|
|
887
|
+
* Get thread URL
|
|
888
888
|
*/
|
|
889
889
|
getUrl(): string;
|
|
890
890
|
/**
|
|
891
|
-
*
|
|
891
|
+
* Get post list
|
|
892
892
|
*/
|
|
893
893
|
getPosts(): WikidotResultAsync<ForumPostCollection>;
|
|
894
894
|
/**
|
|
895
|
-
*
|
|
895
|
+
* Reply to thread
|
|
896
896
|
*/
|
|
897
897
|
reply(source: string, title?: string, parentPostId?: number | null): WikidotResultAsync<ForumThread2>;
|
|
898
898
|
toString(): string;
|
|
899
899
|
/**
|
|
900
|
-
* ID
|
|
900
|
+
* Get thread by ID
|
|
901
901
|
*/
|
|
902
902
|
static getFromId(site: Site, threadId: number, category?: ForumCategory | null): WikidotResultAsync<ForumThread2>;
|
|
903
903
|
}
|
|
904
904
|
/**
|
|
905
|
-
*
|
|
905
|
+
* Forum thread collection
|
|
906
906
|
*/
|
|
907
907
|
declare class ForumThreadCollection extends Array<ForumThread2> {
|
|
908
908
|
readonly site: Site;
|
|
909
909
|
constructor(site: Site, threads?: ForumThread2[]);
|
|
910
910
|
/**
|
|
911
|
-
* ID
|
|
911
|
+
* Find by ID
|
|
912
912
|
*/
|
|
913
913
|
findById(id: number): ForumThread2 | undefined;
|
|
914
914
|
/**
|
|
915
|
-
*
|
|
915
|
+
* Get all threads in category
|
|
916
916
|
*/
|
|
917
917
|
static acquireAllInCategory(category: ForumCategory): WikidotResultAsync<ForumThreadCollection>;
|
|
918
918
|
/**
|
|
919
|
-
*
|
|
920
|
-
* @param site -
|
|
921
|
-
* @param threadId -
|
|
919
|
+
* Get a single thread by thread ID
|
|
920
|
+
* @param site - Site instance
|
|
921
|
+
* @param threadId - Thread ID
|
|
922
922
|
*/
|
|
923
923
|
static fromId(site: Site, threadId: number): WikidotResultAsync<ForumThread2>;
|
|
924
924
|
/**
|
|
925
|
-
*
|
|
925
|
+
* Get threads by thread IDs
|
|
926
926
|
*/
|
|
927
927
|
static acquireFromThreadIds(site: Site, threadIds: number[], category?: ForumCategory | null): WikidotResultAsync<ForumThreadCollection>;
|
|
928
928
|
}
|
|
929
929
|
/**
|
|
930
|
-
*
|
|
930
|
+
* Forum category data
|
|
931
931
|
*/
|
|
932
932
|
interface ForumCategoryData {
|
|
933
933
|
site: Site;
|
|
@@ -938,7 +938,7 @@ interface ForumCategoryData {
|
|
|
938
938
|
postsCount: number;
|
|
939
939
|
}
|
|
940
940
|
/**
|
|
941
|
-
*
|
|
941
|
+
* Forum category
|
|
942
942
|
*/
|
|
943
943
|
declare class ForumCategory {
|
|
944
944
|
readonly site: Site;
|
|
@@ -950,76 +950,76 @@ declare class ForumCategory {
|
|
|
950
950
|
private _threads;
|
|
951
951
|
constructor(data: ForumCategoryData);
|
|
952
952
|
/**
|
|
953
|
-
*
|
|
953
|
+
* Get thread list
|
|
954
954
|
*/
|
|
955
955
|
getThreads(): WikidotResultAsync<ForumThreadCollection>;
|
|
956
956
|
/**
|
|
957
|
-
*
|
|
957
|
+
* Reload thread list
|
|
958
958
|
*/
|
|
959
959
|
reloadThreads(): WikidotResultAsync<ForumThreadCollection>;
|
|
960
960
|
/**
|
|
961
|
-
*
|
|
961
|
+
* Create thread
|
|
962
962
|
*/
|
|
963
963
|
createThread(title: string, description: string, source: string): WikidotResultAsync<ForumThread2>;
|
|
964
964
|
toString(): string;
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
|
-
*
|
|
967
|
+
* Forum category collection
|
|
968
968
|
*/
|
|
969
969
|
declare class ForumCategoryCollection extends Array<ForumCategory> {
|
|
970
970
|
readonly site: Site;
|
|
971
971
|
constructor(site: Site, categories?: ForumCategory[]);
|
|
972
972
|
/**
|
|
973
|
-
* ID
|
|
973
|
+
* Find by ID
|
|
974
974
|
*/
|
|
975
975
|
findById(id: number): ForumCategory | undefined;
|
|
976
976
|
/**
|
|
977
|
-
*
|
|
977
|
+
* Get all categories for a site
|
|
978
978
|
*/
|
|
979
979
|
static acquireAll(site: Site): WikidotResultAsync<ForumCategoryCollection>;
|
|
980
980
|
}
|
|
981
981
|
/**
|
|
982
|
-
* QuickModule
|
|
982
|
+
* QuickModule module name
|
|
983
983
|
*/
|
|
984
984
|
type QuickModuleName = "MemberLookupQModule" | "UserLookupQModule" | "PageLookupQModule";
|
|
985
985
|
/**
|
|
986
|
-
* QuickModule
|
|
986
|
+
* QuickModule user information
|
|
987
987
|
*/
|
|
988
988
|
interface QMCUser {
|
|
989
989
|
id: number;
|
|
990
990
|
name: string;
|
|
991
991
|
}
|
|
992
992
|
/**
|
|
993
|
-
* QuickModule
|
|
993
|
+
* QuickModule page information
|
|
994
994
|
*/
|
|
995
995
|
interface QMCPage {
|
|
996
996
|
title: string;
|
|
997
997
|
unixName: string;
|
|
998
998
|
}
|
|
999
999
|
/**
|
|
1000
|
-
*
|
|
1001
|
-
* @param siteId -
|
|
1002
|
-
* @param query -
|
|
1003
|
-
* @returns
|
|
1000
|
+
* Search site members
|
|
1001
|
+
* @param siteId - Site ID
|
|
1002
|
+
* @param query - Search query (partial username)
|
|
1003
|
+
* @returns List of matching users
|
|
1004
1004
|
*/
|
|
1005
1005
|
declare function memberLookup(siteId: number, query: string): WikidotResultAsync<QMCUser[]>;
|
|
1006
1006
|
/**
|
|
1007
|
-
* Wikidot
|
|
1008
|
-
* @param siteId -
|
|
1009
|
-
* @param query -
|
|
1010
|
-
* @returns
|
|
1007
|
+
* Search users across all Wikidot
|
|
1008
|
+
* @param siteId - Site ID (any site ID works)
|
|
1009
|
+
* @param query - Search query (partial username)
|
|
1010
|
+
* @returns List of matching users
|
|
1011
1011
|
*/
|
|
1012
1012
|
declare function userLookup(siteId: number, query: string): WikidotResultAsync<QMCUser[]>;
|
|
1013
1013
|
/**
|
|
1014
|
-
*
|
|
1015
|
-
* @param siteId -
|
|
1016
|
-
* @param query -
|
|
1017
|
-
* @returns
|
|
1014
|
+
* Search pages within site
|
|
1015
|
+
* @param siteId - Site ID
|
|
1016
|
+
* @param query - Search query (partial page name)
|
|
1017
|
+
* @returns List of matching pages
|
|
1018
1018
|
*/
|
|
1019
1019
|
declare function pageLookup(siteId: number, query: string): WikidotResultAsync<QMCPage[]>;
|
|
1020
1020
|
/**
|
|
1021
|
-
* QuickModule API
|
|
1022
|
-
* @deprecated
|
|
1021
|
+
* QuickModule API (maintained for backwards compatibility)
|
|
1022
|
+
* @deprecated Use individual functions (memberLookup, userLookup, pageLookup) instead
|
|
1023
1023
|
*/
|
|
1024
1024
|
declare const QuickModule: {
|
|
1025
1025
|
memberLookup: typeof memberLookup;
|
|
@@ -1027,7 +1027,7 @@ declare const QuickModule: {
|
|
|
1027
1027
|
pageLookup: typeof pageLookup;
|
|
1028
1028
|
};
|
|
1029
1029
|
/**
|
|
1030
|
-
*
|
|
1030
|
+
* Site membership application data
|
|
1031
1031
|
*/
|
|
1032
1032
|
interface SiteApplicationData {
|
|
1033
1033
|
site: Site;
|
|
@@ -1035,7 +1035,7 @@ interface SiteApplicationData {
|
|
|
1035
1035
|
text: string;
|
|
1036
1036
|
}
|
|
1037
1037
|
/**
|
|
1038
|
-
*
|
|
1038
|
+
* Site membership application
|
|
1039
1039
|
*/
|
|
1040
1040
|
declare class SiteApplication {
|
|
1041
1041
|
readonly site: Site;
|
|
@@ -1043,26 +1043,26 @@ declare class SiteApplication {
|
|
|
1043
1043
|
readonly text: string;
|
|
1044
1044
|
constructor(data: SiteApplicationData);
|
|
1045
1045
|
/**
|
|
1046
|
-
*
|
|
1047
|
-
* @param site -
|
|
1046
|
+
* Get all pending membership applications
|
|
1047
|
+
* @param site - Target site
|
|
1048
1048
|
*/
|
|
1049
1049
|
static acquireAll(site: Site): WikidotResultAsync<SiteApplication[]>;
|
|
1050
1050
|
/**
|
|
1051
|
-
*
|
|
1051
|
+
* Internal method to process application
|
|
1052
1052
|
*/
|
|
1053
1053
|
private process;
|
|
1054
1054
|
/**
|
|
1055
|
-
*
|
|
1055
|
+
* Accept membership application
|
|
1056
1056
|
*/
|
|
1057
1057
|
accept(): WikidotResultAsync<void>;
|
|
1058
1058
|
/**
|
|
1059
|
-
*
|
|
1059
|
+
* Decline membership application
|
|
1060
1060
|
*/
|
|
1061
1061
|
decline(): WikidotResultAsync<void>;
|
|
1062
1062
|
toString(): string;
|
|
1063
1063
|
}
|
|
1064
1064
|
/**
|
|
1065
|
-
*
|
|
1065
|
+
* Site member data
|
|
1066
1066
|
*/
|
|
1067
1067
|
interface SiteMemberData {
|
|
1068
1068
|
site: Site;
|
|
@@ -1070,7 +1070,7 @@ interface SiteMemberData {
|
|
|
1070
1070
|
joinedAt: Date | null;
|
|
1071
1071
|
}
|
|
1072
1072
|
/**
|
|
1073
|
-
*
|
|
1073
|
+
* Site member
|
|
1074
1074
|
*/
|
|
1075
1075
|
declare class SiteMember {
|
|
1076
1076
|
readonly site: Site;
|
|
@@ -1078,80 +1078,80 @@ declare class SiteMember {
|
|
|
1078
1078
|
readonly joinedAt: Date | null;
|
|
1079
1079
|
constructor(data: SiteMemberData);
|
|
1080
1080
|
/**
|
|
1081
|
-
* HTML
|
|
1081
|
+
* Parse member information from HTML
|
|
1082
1082
|
*/
|
|
1083
1083
|
private static parse;
|
|
1084
1084
|
/**
|
|
1085
|
-
*
|
|
1086
|
-
* @param site -
|
|
1087
|
-
* @param group -
|
|
1085
|
+
* Get site member list
|
|
1086
|
+
* @param site - Target site
|
|
1087
|
+
* @param group - Group ("admins", "moderators", or empty string for all members)
|
|
1088
1088
|
*/
|
|
1089
1089
|
static getMembers(site: Site, group?: "admins" | "moderators" | ""): WikidotResultAsync<SiteMember[]>;
|
|
1090
1090
|
/**
|
|
1091
|
-
*
|
|
1091
|
+
* Internal method to change group
|
|
1092
1092
|
*/
|
|
1093
1093
|
private changeGroup;
|
|
1094
1094
|
/**
|
|
1095
|
-
*
|
|
1095
|
+
* Promote to moderator
|
|
1096
1096
|
*/
|
|
1097
1097
|
toModerator(): WikidotResultAsync<void>;
|
|
1098
1098
|
/**
|
|
1099
|
-
*
|
|
1099
|
+
* Remove moderator privileges
|
|
1100
1100
|
*/
|
|
1101
1101
|
removeModerator(): WikidotResultAsync<void>;
|
|
1102
1102
|
/**
|
|
1103
|
-
*
|
|
1103
|
+
* Promote to admin
|
|
1104
1104
|
*/
|
|
1105
1105
|
toAdmin(): WikidotResultAsync<void>;
|
|
1106
1106
|
/**
|
|
1107
|
-
*
|
|
1107
|
+
* Remove admin privileges
|
|
1108
1108
|
*/
|
|
1109
1109
|
removeAdmin(): WikidotResultAsync<void>;
|
|
1110
1110
|
toString(): string;
|
|
1111
1111
|
}
|
|
1112
1112
|
/**
|
|
1113
|
-
*
|
|
1113
|
+
* Site member operations accessor
|
|
1114
1114
|
*/
|
|
1115
1115
|
declare class MemberAccessor {
|
|
1116
1116
|
readonly site: Site;
|
|
1117
1117
|
constructor(site: Site);
|
|
1118
1118
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
* @returns
|
|
1119
|
+
* Get all members
|
|
1120
|
+
* @returns Member list
|
|
1121
1121
|
*/
|
|
1122
1122
|
getAll(): WikidotResultAsync<SiteMember[]>;
|
|
1123
1123
|
/**
|
|
1124
|
-
*
|
|
1125
|
-
* @returns
|
|
1124
|
+
* Get moderator list
|
|
1125
|
+
* @returns Moderator list
|
|
1126
1126
|
*/
|
|
1127
1127
|
getModerators(): WikidotResultAsync<SiteMember[]>;
|
|
1128
1128
|
/**
|
|
1129
|
-
*
|
|
1130
|
-
* @returns
|
|
1129
|
+
* Get admin list
|
|
1130
|
+
* @returns Admin list
|
|
1131
1131
|
*/
|
|
1132
1132
|
getAdmins(): WikidotResultAsync<SiteMember[]>;
|
|
1133
1133
|
/**
|
|
1134
|
-
*
|
|
1135
|
-
* @returns
|
|
1134
|
+
* Get pending membership applications
|
|
1135
|
+
* @returns Application list
|
|
1136
1136
|
*/
|
|
1137
1137
|
getApplications(): WikidotResultAsync<SiteApplication[]>;
|
|
1138
1138
|
/**
|
|
1139
|
-
*
|
|
1140
|
-
* @param query -
|
|
1141
|
-
* @returns
|
|
1139
|
+
* Search members
|
|
1140
|
+
* @param query - Search query (part of username)
|
|
1141
|
+
* @returns Matched user list (QMCUser format)
|
|
1142
1142
|
*/
|
|
1143
1143
|
lookup(query: string): WikidotResultAsync<QMCUser[]>;
|
|
1144
1144
|
/**
|
|
1145
|
-
*
|
|
1146
|
-
* @param user -
|
|
1147
|
-
* @param text -
|
|
1145
|
+
* Invite user to site
|
|
1146
|
+
* @param user - User to invite
|
|
1147
|
+
* @param text - Invitation message
|
|
1148
1148
|
*/
|
|
1149
1149
|
invite(user: User, text: string): WikidotResultAsync<void>;
|
|
1150
1150
|
}
|
|
1151
1151
|
import * as cheerio from "cheerio";
|
|
1152
1152
|
import { AnyNode } from "domhandler";
|
|
1153
1153
|
/**
|
|
1154
|
-
*
|
|
1154
|
+
* Page file data
|
|
1155
1155
|
*/
|
|
1156
1156
|
interface PageFileData {
|
|
1157
1157
|
page: Page;
|
|
@@ -1162,7 +1162,7 @@ interface PageFileData {
|
|
|
1162
1162
|
size: number;
|
|
1163
1163
|
}
|
|
1164
1164
|
/**
|
|
1165
|
-
*
|
|
1165
|
+
* Page attachment file
|
|
1166
1166
|
*/
|
|
1167
1167
|
declare class PageFile {
|
|
1168
1168
|
readonly page: Page;
|
|
@@ -1175,30 +1175,30 @@ declare class PageFile {
|
|
|
1175
1175
|
toString(): string;
|
|
1176
1176
|
}
|
|
1177
1177
|
/**
|
|
1178
|
-
*
|
|
1178
|
+
* Page file collection
|
|
1179
1179
|
*/
|
|
1180
1180
|
declare class PageFileCollection extends Array<PageFile> {
|
|
1181
1181
|
readonly page: Page;
|
|
1182
1182
|
constructor(page: Page, files?: PageFile[]);
|
|
1183
1183
|
/**
|
|
1184
|
-
* ID
|
|
1184
|
+
* Find by ID
|
|
1185
1185
|
*/
|
|
1186
1186
|
findById(id: number): PageFile | undefined;
|
|
1187
1187
|
/**
|
|
1188
|
-
*
|
|
1188
|
+
* Find by name
|
|
1189
1189
|
*/
|
|
1190
1190
|
findByName(name: string): PageFile | undefined;
|
|
1191
1191
|
/**
|
|
1192
|
-
*
|
|
1192
|
+
* Convert size string to bytes
|
|
1193
1193
|
*/
|
|
1194
1194
|
private static parseSize;
|
|
1195
1195
|
/**
|
|
1196
|
-
*
|
|
1196
|
+
* Get list of files attached to page
|
|
1197
1197
|
*/
|
|
1198
1198
|
static acquire(page: Page): WikidotResultAsync<PageFileCollection>;
|
|
1199
1199
|
}
|
|
1200
1200
|
/**
|
|
1201
|
-
*
|
|
1201
|
+
* Page meta tag data
|
|
1202
1202
|
*/
|
|
1203
1203
|
interface PageMetaData {
|
|
1204
1204
|
page: PageRef;
|
|
@@ -1206,7 +1206,7 @@ interface PageMetaData {
|
|
|
1206
1206
|
content: string;
|
|
1207
1207
|
}
|
|
1208
1208
|
/**
|
|
1209
|
-
*
|
|
1209
|
+
* Page meta tag
|
|
1210
1210
|
*/
|
|
1211
1211
|
declare class PageMeta {
|
|
1212
1212
|
readonly page: PageRef;
|
|
@@ -1214,68 +1214,68 @@ declare class PageMeta {
|
|
|
1214
1214
|
content: string;
|
|
1215
1215
|
constructor(data: PageMetaData);
|
|
1216
1216
|
/**
|
|
1217
|
-
*
|
|
1218
|
-
* @param content -
|
|
1217
|
+
* Update meta tag value
|
|
1218
|
+
* @param content - New value
|
|
1219
1219
|
*/
|
|
1220
1220
|
update(content: string): WikidotResultAsync<void>;
|
|
1221
1221
|
/**
|
|
1222
|
-
*
|
|
1222
|
+
* Delete meta tag
|
|
1223
1223
|
*/
|
|
1224
1224
|
delete(): WikidotResultAsync<void>;
|
|
1225
1225
|
toString(): string;
|
|
1226
1226
|
}
|
|
1227
1227
|
/**
|
|
1228
|
-
*
|
|
1228
|
+
* Page meta tag collection
|
|
1229
1229
|
*/
|
|
1230
1230
|
declare class PageMetaCollection extends Array<PageMeta> {
|
|
1231
1231
|
readonly page: PageRef;
|
|
1232
1232
|
constructor(page: PageRef, metas?: PageMeta[]);
|
|
1233
1233
|
/**
|
|
1234
|
-
*
|
|
1235
|
-
* @param name -
|
|
1236
|
-
* @returns
|
|
1234
|
+
* Find by name
|
|
1235
|
+
* @param name - Meta tag name
|
|
1236
|
+
* @returns Meta tag (undefined if not found)
|
|
1237
1237
|
*/
|
|
1238
1238
|
findByName(name: string): PageMeta | undefined;
|
|
1239
1239
|
/**
|
|
1240
|
-
*
|
|
1241
|
-
* @param page -
|
|
1242
|
-
* @returns
|
|
1240
|
+
* Get page meta tags
|
|
1241
|
+
* @param page - Page reference
|
|
1242
|
+
* @returns Meta tag collection
|
|
1243
1243
|
*/
|
|
1244
1244
|
static acquire(page: PageRef): WikidotResultAsync<PageMetaCollection>;
|
|
1245
1245
|
/**
|
|
1246
|
-
*
|
|
1247
|
-
* @param page -
|
|
1248
|
-
* @param name -
|
|
1249
|
-
* @param content -
|
|
1246
|
+
* Set meta tag
|
|
1247
|
+
* @param page - Page reference
|
|
1248
|
+
* @param name - Meta tag name
|
|
1249
|
+
* @param content - Meta tag value
|
|
1250
1250
|
*/
|
|
1251
1251
|
static setMeta(page: PageRef, name: string, content: string): WikidotResultAsync<void>;
|
|
1252
1252
|
/**
|
|
1253
|
-
*
|
|
1254
|
-
* @param page -
|
|
1255
|
-
* @param name -
|
|
1253
|
+
* Delete meta tag
|
|
1254
|
+
* @param page - Page reference
|
|
1255
|
+
* @param name - Meta tag name
|
|
1256
1256
|
*/
|
|
1257
1257
|
static deleteMeta(page: PageRef, name: string): WikidotResultAsync<void>;
|
|
1258
1258
|
}
|
|
1259
1259
|
/**
|
|
1260
|
-
*
|
|
1260
|
+
* Page source data
|
|
1261
1261
|
*/
|
|
1262
1262
|
interface PageSourceData {
|
|
1263
1263
|
page: Page;
|
|
1264
1264
|
wikiText: string;
|
|
1265
1265
|
}
|
|
1266
1266
|
/**
|
|
1267
|
-
*
|
|
1267
|
+
* Page source code (Wikidot syntax)
|
|
1268
1268
|
*/
|
|
1269
1269
|
declare class PageSource {
|
|
1270
|
-
/**
|
|
1270
|
+
/** Page this source belongs to */
|
|
1271
1271
|
readonly page: Page;
|
|
1272
|
-
/**
|
|
1272
|
+
/** Source code (Wikidot syntax) */
|
|
1273
1273
|
readonly wikiText: string;
|
|
1274
1274
|
constructor(data: PageSourceData);
|
|
1275
1275
|
toString(): string;
|
|
1276
1276
|
}
|
|
1277
1277
|
/**
|
|
1278
|
-
*
|
|
1278
|
+
* Page revision data
|
|
1279
1279
|
*/
|
|
1280
1280
|
interface PageRevisionData {
|
|
1281
1281
|
page: Page;
|
|
@@ -1286,87 +1286,87 @@ interface PageRevisionData {
|
|
|
1286
1286
|
comment: string;
|
|
1287
1287
|
}
|
|
1288
1288
|
/**
|
|
1289
|
-
*
|
|
1289
|
+
* Page revision (version in edit history)
|
|
1290
1290
|
*/
|
|
1291
1291
|
declare class PageRevision {
|
|
1292
|
-
/**
|
|
1292
|
+
/** Page this revision belongs to */
|
|
1293
1293
|
readonly page: Page;
|
|
1294
|
-
/**
|
|
1294
|
+
/** Revision ID */
|
|
1295
1295
|
readonly id: number;
|
|
1296
|
-
/**
|
|
1296
|
+
/** Revision number */
|
|
1297
1297
|
readonly revNo: number;
|
|
1298
|
-
/**
|
|
1298
|
+
/** Revision creator */
|
|
1299
1299
|
readonly createdBy: AbstractUser;
|
|
1300
|
-
/**
|
|
1300
|
+
/** Revision creation date */
|
|
1301
1301
|
readonly createdAt: Date;
|
|
1302
|
-
/**
|
|
1302
|
+
/** Edit comment */
|
|
1303
1303
|
readonly comment: string;
|
|
1304
|
-
/**
|
|
1304
|
+
/** Source code (internal cache) */
|
|
1305
1305
|
private _source;
|
|
1306
|
-
/** HTML
|
|
1306
|
+
/** HTML display (internal cache) */
|
|
1307
1307
|
private _html;
|
|
1308
1308
|
constructor(data: PageRevisionData);
|
|
1309
1309
|
/**
|
|
1310
|
-
*
|
|
1310
|
+
* Whether source code has been acquired
|
|
1311
1311
|
*/
|
|
1312
1312
|
isSourceAcquired(): boolean;
|
|
1313
1313
|
/**
|
|
1314
|
-
* HTML
|
|
1314
|
+
* Whether HTML display has been acquired
|
|
1315
1315
|
*/
|
|
1316
1316
|
isHtmlAcquired(): boolean;
|
|
1317
1317
|
/**
|
|
1318
|
-
*
|
|
1318
|
+
* Get source code (cached)
|
|
1319
1319
|
*/
|
|
1320
1320
|
get source(): PageSource | null;
|
|
1321
1321
|
/**
|
|
1322
|
-
*
|
|
1322
|
+
* Set source code
|
|
1323
1323
|
*/
|
|
1324
1324
|
set source(value: PageSource | null);
|
|
1325
1325
|
/**
|
|
1326
|
-
* HTML
|
|
1326
|
+
* Get HTML display (cached)
|
|
1327
1327
|
*/
|
|
1328
1328
|
get html(): string | null;
|
|
1329
1329
|
/**
|
|
1330
|
-
* HTML
|
|
1330
|
+
* Set HTML display
|
|
1331
1331
|
*/
|
|
1332
1332
|
set html(value: string | null);
|
|
1333
1333
|
/**
|
|
1334
|
-
*
|
|
1335
|
-
* @returns
|
|
1334
|
+
* Get revision source (REV-001)
|
|
1335
|
+
* @returns Source string
|
|
1336
1336
|
*/
|
|
1337
1337
|
getSource(): WikidotResultAsync<string>;
|
|
1338
1338
|
/**
|
|
1339
|
-
*
|
|
1340
|
-
* @returns HTML
|
|
1339
|
+
* Get revision HTML (REV-002)
|
|
1340
|
+
* @returns HTML string
|
|
1341
1341
|
*/
|
|
1342
1342
|
getHtml(): WikidotResultAsync<string>;
|
|
1343
1343
|
toString(): string;
|
|
1344
1344
|
}
|
|
1345
1345
|
/**
|
|
1346
|
-
*
|
|
1346
|
+
* Page revision collection
|
|
1347
1347
|
*/
|
|
1348
1348
|
declare class PageRevisionCollection extends Array<PageRevision> {
|
|
1349
1349
|
readonly page: Page | null;
|
|
1350
1350
|
constructor(page: Page | null, revisions?: PageRevision[]);
|
|
1351
1351
|
/**
|
|
1352
|
-
* ID
|
|
1353
|
-
* @param id -
|
|
1354
|
-
* @returns
|
|
1352
|
+
* Find by ID
|
|
1353
|
+
* @param id - Revision ID
|
|
1354
|
+
* @returns Revision (undefined if not found)
|
|
1355
1355
|
*/
|
|
1356
1356
|
findById(id: number): PageRevision | undefined;
|
|
1357
1357
|
/**
|
|
1358
|
-
*
|
|
1359
|
-
* @returns
|
|
1358
|
+
* Get sources for all revisions
|
|
1359
|
+
* @returns Array of source strings
|
|
1360
1360
|
*/
|
|
1361
1361
|
getSources(): WikidotResultAsync<string[]>;
|
|
1362
1362
|
/**
|
|
1363
|
-
*
|
|
1364
|
-
* @returns HTML
|
|
1363
|
+
* Get HTML for all revisions
|
|
1364
|
+
* @returns Array of HTML strings
|
|
1365
1365
|
*/
|
|
1366
1366
|
getHtmls(): WikidotResultAsync<string[]>;
|
|
1367
1367
|
}
|
|
1368
1368
|
/**
|
|
1369
|
-
*
|
|
1369
|
+
* Page vote data
|
|
1370
1370
|
*/
|
|
1371
1371
|
interface PageVoteData {
|
|
1372
1372
|
page: Page;
|
|
@@ -1374,132 +1374,132 @@ interface PageVoteData {
|
|
|
1374
1374
|
value: number;
|
|
1375
1375
|
}
|
|
1376
1376
|
/**
|
|
1377
|
-
*
|
|
1377
|
+
* Page vote (rating)
|
|
1378
1378
|
*/
|
|
1379
1379
|
declare class PageVote {
|
|
1380
|
-
/**
|
|
1380
|
+
/** Page this vote belongs to */
|
|
1381
1381
|
readonly page: Page;
|
|
1382
|
-
/**
|
|
1382
|
+
/** User who voted */
|
|
1383
1383
|
readonly user: AbstractUser;
|
|
1384
|
-
/**
|
|
1384
|
+
/** Vote value (+1/-1 or numeric) */
|
|
1385
1385
|
readonly value: number;
|
|
1386
1386
|
constructor(data: PageVoteData);
|
|
1387
1387
|
toString(): string;
|
|
1388
1388
|
}
|
|
1389
1389
|
/**
|
|
1390
|
-
*
|
|
1390
|
+
* Page vote collection
|
|
1391
1391
|
*/
|
|
1392
1392
|
declare class PageVoteCollection extends Array<PageVote> {
|
|
1393
1393
|
readonly page: Page;
|
|
1394
1394
|
constructor(page: Page, votes?: PageVote[]);
|
|
1395
1395
|
/**
|
|
1396
|
-
*
|
|
1397
|
-
* @param user -
|
|
1398
|
-
* @returns
|
|
1396
|
+
* Find by user
|
|
1397
|
+
* @param user - User to search for
|
|
1398
|
+
* @returns Vote (undefined if not found)
|
|
1399
1399
|
*/
|
|
1400
1400
|
findByUser(user: AbstractUser): PageVote | undefined;
|
|
1401
1401
|
}
|
|
1402
1402
|
/**
|
|
1403
|
-
*
|
|
1403
|
+
* Page search query parameters
|
|
1404
1404
|
*/
|
|
1405
1405
|
interface SearchPagesQueryParams {
|
|
1406
|
-
/**
|
|
1406
|
+
/** Page type (e.g., 'normal', 'admin') */
|
|
1407
1407
|
pagetype?: string;
|
|
1408
|
-
/**
|
|
1408
|
+
/** Category name */
|
|
1409
1409
|
category?: string;
|
|
1410
|
-
/**
|
|
1410
|
+
/** Tags to search (AND condition) */
|
|
1411
1411
|
tags?: string | string[];
|
|
1412
|
-
/**
|
|
1412
|
+
/** Parent page name */
|
|
1413
1413
|
parent?: string;
|
|
1414
|
-
/**
|
|
1414
|
+
/** Linked page name */
|
|
1415
1415
|
linkTo?: string;
|
|
1416
|
-
/**
|
|
1416
|
+
/** Created date condition */
|
|
1417
1417
|
createdAt?: string;
|
|
1418
|
-
/**
|
|
1418
|
+
/** Updated date condition */
|
|
1419
1419
|
updatedAt?: string;
|
|
1420
|
-
/**
|
|
1420
|
+
/** Creator */
|
|
1421
1421
|
createdBy?: AbstractUser | string;
|
|
1422
|
-
/**
|
|
1422
|
+
/** Rating condition */
|
|
1423
1423
|
rating?: string;
|
|
1424
|
-
/**
|
|
1424
|
+
/** Vote count condition */
|
|
1425
1425
|
votes?: string;
|
|
1426
|
-
/**
|
|
1426
|
+
/** Page name condition */
|
|
1427
1427
|
name?: string;
|
|
1428
|
-
/**
|
|
1428
|
+
/** Fullname (exact match) */
|
|
1429
1429
|
fullname?: string;
|
|
1430
|
-
/**
|
|
1430
|
+
/** Range specification */
|
|
1431
1431
|
range?: string;
|
|
1432
|
-
/**
|
|
1432
|
+
/** Sort order (e.g., 'created_at desc') */
|
|
1433
1433
|
order?: string;
|
|
1434
|
-
/**
|
|
1434
|
+
/** Start offset */
|
|
1435
1435
|
offset?: number;
|
|
1436
|
-
/**
|
|
1436
|
+
/** Result limit */
|
|
1437
1437
|
limit?: number;
|
|
1438
|
-
/**
|
|
1438
|
+
/** Items per page */
|
|
1439
1439
|
perPage?: number;
|
|
1440
|
-
/**
|
|
1440
|
+
/** Separate display */
|
|
1441
1441
|
separate?: string;
|
|
1442
|
-
/**
|
|
1442
|
+
/** Wrapper display */
|
|
1443
1443
|
wrapper?: string;
|
|
1444
1444
|
}
|
|
1445
1445
|
/**
|
|
1446
|
-
*
|
|
1446
|
+
* Default items per page
|
|
1447
1447
|
*/
|
|
1448
1448
|
declare const DEFAULT_PER_PAGE = 250;
|
|
1449
1449
|
/**
|
|
1450
|
-
*
|
|
1450
|
+
* Default module body fields
|
|
1451
1451
|
*/
|
|
1452
1452
|
declare const DEFAULT_MODULE_BODY: readonly ["fullname", "category", "name", "title", "created_at", "created_by_linked", "updated_at", "updated_by_linked", "commented_at", "commented_by_linked", "parent_fullname", "comments", "size", "children", "rating_votes", "rating", "rating_percent", "revisions", "tags", "_tags"];
|
|
1453
1453
|
/**
|
|
1454
|
-
*
|
|
1454
|
+
* Page search query
|
|
1455
1455
|
*/
|
|
1456
1456
|
declare class SearchPagesQuery {
|
|
1457
|
-
/**
|
|
1457
|
+
/** Page type */
|
|
1458
1458
|
pagetype: string;
|
|
1459
|
-
/**
|
|
1459
|
+
/** Category */
|
|
1460
1460
|
category: string;
|
|
1461
|
-
/**
|
|
1461
|
+
/** Tags */
|
|
1462
1462
|
tags: string | string[] | null;
|
|
1463
|
-
/**
|
|
1463
|
+
/** Parent page */
|
|
1464
1464
|
parent: string | null;
|
|
1465
|
-
/**
|
|
1465
|
+
/** Link target */
|
|
1466
1466
|
linkTo: string | null;
|
|
1467
|
-
/**
|
|
1467
|
+
/** Created date condition */
|
|
1468
1468
|
createdAt: string | null;
|
|
1469
|
-
/**
|
|
1469
|
+
/** Updated date condition */
|
|
1470
1470
|
updatedAt: string | null;
|
|
1471
|
-
/**
|
|
1471
|
+
/** Creator */
|
|
1472
1472
|
createdBy: AbstractUser | string | null;
|
|
1473
|
-
/**
|
|
1473
|
+
/** Rating condition */
|
|
1474
1474
|
rating: string | null;
|
|
1475
|
-
/**
|
|
1475
|
+
/** Vote count condition */
|
|
1476
1476
|
votes: string | null;
|
|
1477
|
-
/**
|
|
1477
|
+
/** Page name condition */
|
|
1478
1478
|
name: string | null;
|
|
1479
|
-
/**
|
|
1479
|
+
/** Fullname condition */
|
|
1480
1480
|
fullname: string | null;
|
|
1481
|
-
/**
|
|
1481
|
+
/** Range */
|
|
1482
1482
|
range: string | null;
|
|
1483
|
-
/**
|
|
1483
|
+
/** Sort order */
|
|
1484
1484
|
order: string;
|
|
1485
|
-
/**
|
|
1485
|
+
/** Offset */
|
|
1486
1486
|
offset: number;
|
|
1487
|
-
/**
|
|
1487
|
+
/** Result limit */
|
|
1488
1488
|
limit: number | null;
|
|
1489
|
-
/**
|
|
1489
|
+
/** Items per page */
|
|
1490
1490
|
perPage: number;
|
|
1491
|
-
/**
|
|
1491
|
+
/** Separate display */
|
|
1492
1492
|
separate: string;
|
|
1493
|
-
/**
|
|
1493
|
+
/** Wrapper display */
|
|
1494
1494
|
wrapper: string;
|
|
1495
1495
|
constructor(params?: SearchPagesQueryParams);
|
|
1496
1496
|
/**
|
|
1497
|
-
*
|
|
1497
|
+
* Convert to dictionary format
|
|
1498
1498
|
*/
|
|
1499
1499
|
asDict(): Record<string, unknown>;
|
|
1500
1500
|
}
|
|
1501
1501
|
/**
|
|
1502
|
-
*
|
|
1502
|
+
* Page data
|
|
1503
1503
|
*/
|
|
1504
1504
|
interface PageData {
|
|
1505
1505
|
site: Site;
|
|
@@ -1524,7 +1524,7 @@ interface PageData {
|
|
|
1524
1524
|
commentedAt: Date | null;
|
|
1525
1525
|
}
|
|
1526
1526
|
/**
|
|
1527
|
-
* Wikidot
|
|
1527
|
+
* Wikidot page
|
|
1528
1528
|
*/
|
|
1529
1529
|
declare class Page {
|
|
1530
1530
|
readonly site: Site;
|
|
@@ -1553,82 +1553,82 @@ declare class Page {
|
|
|
1553
1553
|
private _votes;
|
|
1554
1554
|
constructor(data: PageData);
|
|
1555
1555
|
/**
|
|
1556
|
-
*
|
|
1556
|
+
* Get page URL
|
|
1557
1557
|
*/
|
|
1558
1558
|
getUrl(): string;
|
|
1559
1559
|
/**
|
|
1560
|
-
*
|
|
1560
|
+
* Whether page ID has been acquired
|
|
1561
1561
|
*/
|
|
1562
1562
|
isIdAcquired(): boolean;
|
|
1563
1563
|
/**
|
|
1564
|
-
*
|
|
1564
|
+
* Get page ID
|
|
1565
1565
|
*/
|
|
1566
1566
|
get id(): number | null;
|
|
1567
1567
|
/**
|
|
1568
|
-
*
|
|
1568
|
+
* Set page ID
|
|
1569
1569
|
*/
|
|
1570
1570
|
set id(value: number | null);
|
|
1571
1571
|
/**
|
|
1572
|
-
*
|
|
1572
|
+
* Get source code
|
|
1573
1573
|
*/
|
|
1574
1574
|
get source(): PageSource | null;
|
|
1575
1575
|
/**
|
|
1576
|
-
*
|
|
1576
|
+
* Set source code
|
|
1577
1577
|
*/
|
|
1578
1578
|
set source(value: PageSource | null);
|
|
1579
1579
|
/**
|
|
1580
|
-
*
|
|
1580
|
+
* Get revision history
|
|
1581
1581
|
*/
|
|
1582
1582
|
get revisions(): PageRevisionCollection | null;
|
|
1583
1583
|
/**
|
|
1584
|
-
*
|
|
1584
|
+
* Set revision history
|
|
1585
1585
|
*/
|
|
1586
1586
|
set revisions(value: PageRevisionCollection | null);
|
|
1587
1587
|
/**
|
|
1588
|
-
*
|
|
1588
|
+
* Get vote information
|
|
1589
1589
|
*/
|
|
1590
1590
|
get votes(): PageVoteCollection | null;
|
|
1591
1591
|
/**
|
|
1592
|
-
*
|
|
1592
|
+
* Set vote information
|
|
1593
1593
|
*/
|
|
1594
1594
|
set votes(value: PageVoteCollection | null);
|
|
1595
1595
|
/**
|
|
1596
|
-
*
|
|
1596
|
+
* Get latest revision
|
|
1597
1597
|
*/
|
|
1598
1598
|
get latestRevision(): PageRevision | undefined;
|
|
1599
1599
|
/**
|
|
1600
|
-
*
|
|
1601
|
-
* @param operation -
|
|
1602
|
-
* @throws ID
|
|
1600
|
+
* Ensure page ID is available (auto-acquire if not yet acquired)
|
|
1601
|
+
* @param operation - Operation name (for error message)
|
|
1602
|
+
* @throws If ID acquisition fails
|
|
1603
1603
|
*/
|
|
1604
1604
|
private ensureId;
|
|
1605
1605
|
/**
|
|
1606
|
-
*
|
|
1606
|
+
* Delete page
|
|
1607
1607
|
*/
|
|
1608
1608
|
destroy(): WikidotResultAsync<void>;
|
|
1609
1609
|
/**
|
|
1610
|
-
*
|
|
1610
|
+
* Save tags
|
|
1611
1611
|
*/
|
|
1612
1612
|
commitTags(): WikidotResultAsync<void>;
|
|
1613
1613
|
/**
|
|
1614
|
-
*
|
|
1615
|
-
* @param parentFullname -
|
|
1614
|
+
* Set parent page
|
|
1615
|
+
* @param parentFullname - Parent page fullname (null to remove)
|
|
1616
1616
|
*/
|
|
1617
1617
|
setParent(parentFullname: string | null): WikidotResultAsync<void>;
|
|
1618
1618
|
/**
|
|
1619
|
-
*
|
|
1620
|
-
* @param value -
|
|
1621
|
-
* @returns
|
|
1619
|
+
* Vote on page
|
|
1620
|
+
* @param value - Vote value
|
|
1621
|
+
* @returns New rating
|
|
1622
1622
|
*/
|
|
1623
1623
|
vote(value: number): WikidotResultAsync<number>;
|
|
1624
1624
|
/**
|
|
1625
|
-
*
|
|
1626
|
-
* @returns
|
|
1625
|
+
* Cancel vote
|
|
1626
|
+
* @returns New rating
|
|
1627
1627
|
*/
|
|
1628
1628
|
cancelVote(): WikidotResultAsync<number>;
|
|
1629
1629
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
* @param options -
|
|
1630
|
+
* Edit the page
|
|
1631
|
+
* @param options - Edit options
|
|
1632
1632
|
*/
|
|
1633
1633
|
edit(options: {
|
|
1634
1634
|
title?: string;
|
|
@@ -1637,105 +1637,105 @@ declare class Page {
|
|
|
1637
1637
|
forceEdit?: boolean;
|
|
1638
1638
|
}): WikidotResultAsync<void>;
|
|
1639
1639
|
/**
|
|
1640
|
-
*
|
|
1641
|
-
* @param newFullname -
|
|
1640
|
+
* Rename the page
|
|
1641
|
+
* @param newFullname - New fullname
|
|
1642
1642
|
*/
|
|
1643
1643
|
rename(newFullname: string): WikidotResultAsync<void>;
|
|
1644
1644
|
/**
|
|
1645
|
-
*
|
|
1645
|
+
* Get list of files attached to the page
|
|
1646
1646
|
*/
|
|
1647
1647
|
getFiles(): WikidotResultAsync<PageFileCollection>;
|
|
1648
1648
|
/**
|
|
1649
|
-
*
|
|
1649
|
+
* Get the discussion thread for the page
|
|
1650
1650
|
*/
|
|
1651
1651
|
getDiscussion(): WikidotResultAsync<import("../forum").ForumThread | null>;
|
|
1652
1652
|
/**
|
|
1653
|
-
*
|
|
1654
|
-
* @returns
|
|
1653
|
+
* Get the list of meta tags for the page
|
|
1654
|
+
* @returns Meta tag collection
|
|
1655
1655
|
*/
|
|
1656
1656
|
getMetas(): WikidotResultAsync<PageMetaCollection>;
|
|
1657
1657
|
/**
|
|
1658
|
-
*
|
|
1659
|
-
* @param name -
|
|
1660
|
-
* @param content -
|
|
1658
|
+
* Set a meta tag
|
|
1659
|
+
* @param name - Meta tag name
|
|
1660
|
+
* @param content - Meta tag value
|
|
1661
1661
|
*/
|
|
1662
1662
|
setMeta(name: string, content: string): WikidotResultAsync<void>;
|
|
1663
1663
|
/**
|
|
1664
|
-
*
|
|
1665
|
-
* @param name -
|
|
1664
|
+
* Delete a meta tag
|
|
1665
|
+
* @param name - Meta tag name
|
|
1666
1666
|
*/
|
|
1667
1667
|
deleteMeta(name: string): WikidotResultAsync<void>;
|
|
1668
1668
|
/**
|
|
1669
|
-
*
|
|
1670
|
-
* @returns
|
|
1669
|
+
* Get page source (auto-acquire if not yet acquired)
|
|
1670
|
+
* @returns Page source
|
|
1671
1671
|
*/
|
|
1672
1672
|
getSource(): WikidotResultAsync<PageSource>;
|
|
1673
1673
|
/**
|
|
1674
|
-
*
|
|
1675
|
-
* @returns
|
|
1674
|
+
* Get revision history (auto-acquire if not yet acquired)
|
|
1675
|
+
* @returns Revision collection
|
|
1676
1676
|
*/
|
|
1677
1677
|
getRevisions(): WikidotResultAsync<PageRevisionCollection>;
|
|
1678
1678
|
/**
|
|
1679
|
-
*
|
|
1680
|
-
* @returns
|
|
1679
|
+
* Get vote information (auto-acquire if not yet acquired)
|
|
1680
|
+
* @returns Vote collection
|
|
1681
1681
|
*/
|
|
1682
1682
|
getVotes(): WikidotResultAsync<PageVoteCollection>;
|
|
1683
1683
|
toString(): string;
|
|
1684
1684
|
}
|
|
1685
1685
|
/**
|
|
1686
|
-
*
|
|
1686
|
+
* Page collection
|
|
1687
1687
|
*/
|
|
1688
1688
|
declare class PageCollection extends Array<Page> {
|
|
1689
1689
|
readonly site: Site;
|
|
1690
1690
|
constructor(site: Site, pages?: Page[]);
|
|
1691
1691
|
/**
|
|
1692
|
-
*
|
|
1693
|
-
* @param fullname -
|
|
1694
|
-
* @returns
|
|
1692
|
+
* Find by fullname
|
|
1693
|
+
* @param fullname - Page fullname
|
|
1694
|
+
* @returns Page (undefined if not found)
|
|
1695
1695
|
*/
|
|
1696
1696
|
findByFullname(fullname: string): Page | undefined;
|
|
1697
1697
|
/**
|
|
1698
|
-
*
|
|
1698
|
+
* Acquire page IDs in bulk
|
|
1699
1699
|
*/
|
|
1700
1700
|
getPageIds(): WikidotResultAsync<PageCollection>;
|
|
1701
1701
|
/**
|
|
1702
|
-
*
|
|
1702
|
+
* Acquire page sources in bulk
|
|
1703
1703
|
*/
|
|
1704
1704
|
getPageSources(): WikidotResultAsync<PageCollection>;
|
|
1705
1705
|
/**
|
|
1706
|
-
*
|
|
1706
|
+
* Acquire page revisions in bulk
|
|
1707
1707
|
*/
|
|
1708
1708
|
getPageRevisions(): WikidotResultAsync<PageCollection>;
|
|
1709
1709
|
/**
|
|
1710
|
-
*
|
|
1710
|
+
* Acquire page votes in bulk
|
|
1711
1711
|
*/
|
|
1712
1712
|
getPageVotes(): WikidotResultAsync<PageCollection>;
|
|
1713
1713
|
/**
|
|
1714
|
-
*
|
|
1714
|
+
* Internal method to acquire page IDs in bulk
|
|
1715
1715
|
*/
|
|
1716
1716
|
static acquirePageIds(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
|
|
1717
1717
|
/**
|
|
1718
|
-
*
|
|
1718
|
+
* Internal method to acquire page sources in bulk
|
|
1719
1719
|
*/
|
|
1720
1720
|
static acquirePageSources(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
|
|
1721
1721
|
/**
|
|
1722
|
-
*
|
|
1722
|
+
* Internal method to acquire page revisions in bulk
|
|
1723
1723
|
*/
|
|
1724
1724
|
static acquirePageRevisions(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
|
|
1725
1725
|
/**
|
|
1726
|
-
*
|
|
1726
|
+
* Internal method to acquire page votes in bulk
|
|
1727
1727
|
*/
|
|
1728
1728
|
static acquirePageVotes(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
|
|
1729
1729
|
/**
|
|
1730
|
-
* ListPagesModule
|
|
1730
|
+
* Parse ListPagesModule response
|
|
1731
1731
|
*/
|
|
1732
1732
|
static parse(site: Site, htmlBody: cheerio.CheerioAPI, _parseUser: (element: cheerio.Cheerio<AnyNode>) => AbstractUser): PageCollection;
|
|
1733
1733
|
/**
|
|
1734
|
-
*
|
|
1734
|
+
* Search pages
|
|
1735
1735
|
*/
|
|
1736
1736
|
static searchPages(site: Site, parseUser: (element: cheerio.Cheerio<AnyNode>) => AbstractUser, query?: SearchPagesQuery | null): WikidotResultAsync<PageCollection>;
|
|
1737
1737
|
/**
|
|
1738
|
-
*
|
|
1738
|
+
* Create or edit a page
|
|
1739
1739
|
*/
|
|
1740
1740
|
static createOrEdit(site: Site, fullname: string, options?: {
|
|
1741
1741
|
pageId?: number | null;
|
|
@@ -1747,7 +1747,7 @@ declare class PageCollection extends Array<Page> {
|
|
|
1747
1747
|
}): WikidotResultAsync<void>;
|
|
1748
1748
|
}
|
|
1749
1749
|
/**
|
|
1750
|
-
*
|
|
1750
|
+
* Site change history data
|
|
1751
1751
|
*/
|
|
1752
1752
|
interface SiteChangeData {
|
|
1753
1753
|
site: Site;
|
|
@@ -1760,7 +1760,7 @@ interface SiteChangeData {
|
|
|
1760
1760
|
comment: string;
|
|
1761
1761
|
}
|
|
1762
1762
|
/**
|
|
1763
|
-
*
|
|
1763
|
+
* Site change history
|
|
1764
1764
|
*/
|
|
1765
1765
|
declare class SiteChange {
|
|
1766
1766
|
readonly site: Site;
|
|
@@ -1773,22 +1773,22 @@ declare class SiteChange {
|
|
|
1773
1773
|
readonly comment: string;
|
|
1774
1774
|
constructor(data: SiteChangeData);
|
|
1775
1775
|
/**
|
|
1776
|
-
*
|
|
1776
|
+
* Get page URL
|
|
1777
1777
|
*/
|
|
1778
1778
|
getPageUrl(): string;
|
|
1779
1779
|
toString(): string;
|
|
1780
1780
|
}
|
|
1781
1781
|
/**
|
|
1782
|
-
*
|
|
1782
|
+
* Site change history collection
|
|
1783
1783
|
*/
|
|
1784
1784
|
declare class SiteChangeCollection extends Array<SiteChange> {
|
|
1785
1785
|
readonly site: Site;
|
|
1786
1786
|
constructor(site: Site, changes?: SiteChange[]);
|
|
1787
1787
|
/**
|
|
1788
|
-
*
|
|
1789
|
-
* @param site -
|
|
1790
|
-
* @param options -
|
|
1791
|
-
* @returns
|
|
1788
|
+
* Get recent change history
|
|
1789
|
+
* @param site - Site instance
|
|
1790
|
+
* @param options - Options
|
|
1791
|
+
* @returns Change history collection
|
|
1792
1792
|
*/
|
|
1793
1793
|
static acquire(site: Site, options?: {
|
|
1794
1794
|
perPage?: number;
|
|
@@ -1797,21 +1797,21 @@ declare class SiteChangeCollection extends Array<SiteChange> {
|
|
|
1797
1797
|
}): WikidotResultAsync<SiteChangeCollection>;
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
1800
|
-
*
|
|
1800
|
+
* Single page operations accessor
|
|
1801
1801
|
*/
|
|
1802
1802
|
declare class PageAccessor {
|
|
1803
1803
|
readonly site: Site;
|
|
1804
1804
|
constructor(site: Site);
|
|
1805
1805
|
/**
|
|
1806
|
-
* UNIX
|
|
1807
|
-
* @param unixName -
|
|
1808
|
-
* @returns
|
|
1806
|
+
* Get page by UNIX name
|
|
1807
|
+
* @param unixName - Page UNIX name (e.g., 'scp-173')
|
|
1808
|
+
* @returns Page (null if not found)
|
|
1809
1809
|
*/
|
|
1810
1810
|
get(unixName: string): WikidotResultAsync<Page | null>;
|
|
1811
1811
|
/**
|
|
1812
|
-
*
|
|
1813
|
-
* @param fullname -
|
|
1814
|
-
* @param options -
|
|
1812
|
+
* Create a page
|
|
1813
|
+
* @param fullname - Page fullname (e.g., 'scp-173')
|
|
1814
|
+
* @param options - Creation options
|
|
1815
1815
|
* @returns void
|
|
1816
1816
|
*/
|
|
1817
1817
|
create(fullname: string, options?: {
|
|
@@ -1822,28 +1822,28 @@ declare class PageAccessor {
|
|
|
1822
1822
|
}): WikidotResultAsync<void>;
|
|
1823
1823
|
}
|
|
1824
1824
|
/**
|
|
1825
|
-
*
|
|
1825
|
+
* Page list operations accessor
|
|
1826
1826
|
*/
|
|
1827
1827
|
declare class PagesAccessor {
|
|
1828
1828
|
readonly site: Site;
|
|
1829
1829
|
constructor(site: Site);
|
|
1830
1830
|
/**
|
|
1831
|
-
*
|
|
1832
|
-
* @param params -
|
|
1833
|
-
* @returns
|
|
1831
|
+
* Search pages matching conditions
|
|
1832
|
+
* @param params - Search conditions
|
|
1833
|
+
* @returns Page collection
|
|
1834
1834
|
*/
|
|
1835
1835
|
search(params?: SearchPagesQueryParams): WikidotResultAsync<PageCollection>;
|
|
1836
1836
|
/**
|
|
1837
|
-
*
|
|
1838
|
-
* @returns
|
|
1837
|
+
* Get all pages
|
|
1838
|
+
* @returns Page collection
|
|
1839
1839
|
*/
|
|
1840
1840
|
all(): WikidotResultAsync<PageCollection>;
|
|
1841
1841
|
/**
|
|
1842
|
-
*
|
|
1843
|
-
* @param options -
|
|
1844
|
-
* @param options.perPage -
|
|
1845
|
-
* @param options.page -
|
|
1846
|
-
* @returns
|
|
1842
|
+
* Get recent changes
|
|
1843
|
+
* @param options - Options
|
|
1844
|
+
* @param options.perPage - Items per page (default: 20)
|
|
1845
|
+
* @param options.page - Page number (default: 1)
|
|
1846
|
+
* @returns Change history collection
|
|
1847
1847
|
*/
|
|
1848
1848
|
getRecentChanges(options?: {
|
|
1849
1849
|
perPage?: number;
|
|
@@ -1851,7 +1851,7 @@ declare class PagesAccessor {
|
|
|
1851
1851
|
}): WikidotResultAsync<SiteChangeCollection>;
|
|
1852
1852
|
}
|
|
1853
1853
|
/**
|
|
1854
|
-
*
|
|
1854
|
+
* Site data
|
|
1855
1855
|
*/
|
|
1856
1856
|
interface SiteData {
|
|
1857
1857
|
id: number;
|
|
@@ -1861,111 +1861,111 @@ interface SiteData {
|
|
|
1861
1861
|
sslSupported: boolean;
|
|
1862
1862
|
}
|
|
1863
1863
|
/**
|
|
1864
|
-
*
|
|
1864
|
+
* Site class
|
|
1865
1865
|
*/
|
|
1866
1866
|
declare class Site {
|
|
1867
1867
|
readonly client: Client;
|
|
1868
|
-
/**
|
|
1868
|
+
/** Site ID */
|
|
1869
1869
|
readonly id: number;
|
|
1870
|
-
/**
|
|
1870
|
+
/** Site title */
|
|
1871
1871
|
readonly title: string;
|
|
1872
|
-
/** UNIX
|
|
1872
|
+
/** UNIX name (e.g., scp-jp) */
|
|
1873
1873
|
readonly unixName: string;
|
|
1874
|
-
/**
|
|
1874
|
+
/** Domain */
|
|
1875
1875
|
readonly domain: string;
|
|
1876
|
-
/** SSL
|
|
1876
|
+
/** SSL support flag */
|
|
1877
1877
|
readonly sslSupported: boolean;
|
|
1878
|
-
/**
|
|
1878
|
+
/** Page accessor */
|
|
1879
1879
|
private _page;
|
|
1880
|
-
/**
|
|
1880
|
+
/** Pages accessor */
|
|
1881
1881
|
private _pages;
|
|
1882
|
-
/**
|
|
1882
|
+
/** Forum accessor */
|
|
1883
1883
|
private _forum;
|
|
1884
|
-
/**
|
|
1884
|
+
/** Member accessor */
|
|
1885
1885
|
private _member;
|
|
1886
1886
|
constructor(client: Client, data: SiteData);
|
|
1887
1887
|
/**
|
|
1888
|
-
*
|
|
1888
|
+
* Get page accessor
|
|
1889
1889
|
*/
|
|
1890
1890
|
get page(): PageAccessor;
|
|
1891
1891
|
/**
|
|
1892
|
-
*
|
|
1892
|
+
* Get pages accessor
|
|
1893
1893
|
*/
|
|
1894
1894
|
get pages(): PagesAccessor;
|
|
1895
1895
|
/**
|
|
1896
|
-
*
|
|
1896
|
+
* Get forum accessor
|
|
1897
1897
|
*/
|
|
1898
1898
|
get forum(): ForumAccessor;
|
|
1899
1899
|
/**
|
|
1900
|
-
*
|
|
1900
|
+
* Get member accessor
|
|
1901
1901
|
*/
|
|
1902
1902
|
get member(): MemberAccessor;
|
|
1903
1903
|
/**
|
|
1904
|
-
*
|
|
1904
|
+
* Get base URL of the site
|
|
1905
1905
|
*/
|
|
1906
1906
|
getBaseUrl(): string;
|
|
1907
1907
|
/**
|
|
1908
|
-
*
|
|
1909
|
-
* @param bodies -
|
|
1910
|
-
* @returns AMC
|
|
1908
|
+
* Execute AMC request to this site
|
|
1909
|
+
* @param bodies - Request body array
|
|
1910
|
+
* @returns AMC response array
|
|
1911
1911
|
*/
|
|
1912
1912
|
amcRequest(bodies: AMCRequestBody[]): WikidotResultAsync<AMCResponse[]>;
|
|
1913
1913
|
/**
|
|
1914
|
-
*
|
|
1915
|
-
* @param body -
|
|
1916
|
-
* @returns AMC
|
|
1914
|
+
* Execute a single AMC request
|
|
1915
|
+
* @param body - Request body
|
|
1916
|
+
* @returns AMC response
|
|
1917
1917
|
*/
|
|
1918
1918
|
amcRequestSingle(body: AMCRequestBody): WikidotResultAsync<AMCResponse>;
|
|
1919
1919
|
/**
|
|
1920
|
-
* UNIX
|
|
1921
|
-
* @param client -
|
|
1922
|
-
* @param unixName -
|
|
1923
|
-
* @returns
|
|
1920
|
+
* Get site from UNIX name
|
|
1921
|
+
* @param client - Client
|
|
1922
|
+
* @param unixName - Site UNIX name (e.g., 'scp-jp')
|
|
1923
|
+
* @returns Site
|
|
1924
1924
|
*/
|
|
1925
1925
|
static fromUnixName(client: Client, unixName: string): WikidotResultAsync<Site>;
|
|
1926
1926
|
toString(): string;
|
|
1927
1927
|
}
|
|
1928
1928
|
/**
|
|
1929
|
-
*
|
|
1929
|
+
* Forum operations accessor
|
|
1930
1930
|
*/
|
|
1931
1931
|
declare class ForumAccessor {
|
|
1932
1932
|
readonly site: Site;
|
|
1933
1933
|
constructor(site: Site);
|
|
1934
1934
|
/**
|
|
1935
|
-
*
|
|
1936
|
-
* @returns
|
|
1935
|
+
* Get forum category list
|
|
1936
|
+
* @returns Category list
|
|
1937
1937
|
*/
|
|
1938
1938
|
getCategories(): WikidotResultAsync<ForumCategoryCollection>;
|
|
1939
1939
|
/**
|
|
1940
|
-
*
|
|
1941
|
-
* @param threadId -
|
|
1942
|
-
* @returns
|
|
1940
|
+
* Get thread
|
|
1941
|
+
* @param threadId - Thread ID
|
|
1942
|
+
* @returns Thread
|
|
1943
1943
|
*/
|
|
1944
1944
|
getThread(threadId: number): WikidotResultAsync<ForumThread2>;
|
|
1945
1945
|
/**
|
|
1946
|
-
*
|
|
1947
|
-
* @param threadIds -
|
|
1948
|
-
* @returns
|
|
1946
|
+
* Get multiple threads
|
|
1947
|
+
* @param threadIds - Array of thread IDs
|
|
1948
|
+
* @returns Thread collection
|
|
1949
1949
|
*/
|
|
1950
1950
|
getThreads(threadIds: number[]): WikidotResultAsync<ForumThreadCollection>;
|
|
1951
1951
|
}
|
|
1952
1952
|
/**
|
|
1953
|
-
*
|
|
1953
|
+
* Site operations accessor
|
|
1954
1954
|
*/
|
|
1955
1955
|
declare class SiteAccessor {
|
|
1956
1956
|
readonly client: Client;
|
|
1957
1957
|
constructor(client: Client);
|
|
1958
1958
|
/**
|
|
1959
|
-
* UNIX
|
|
1959
|
+
* Get site by UNIX name
|
|
1960
1960
|
*
|
|
1961
|
-
* @param unixName -
|
|
1962
|
-
* @returns Result
|
|
1961
|
+
* @param unixName - Site UNIX name (e.g., 'scp-jp')
|
|
1962
|
+
* @returns Site object wrapped in Result type
|
|
1963
1963
|
*
|
|
1964
1964
|
* @example
|
|
1965
1965
|
* ```typescript
|
|
1966
1966
|
* const siteResult = await client.site.get('scp-jp');
|
|
1967
1967
|
* if (!siteResult.isOk()) {
|
|
1968
|
-
* throw new Error('
|
|
1968
|
+
* throw new Error('Failed to get site');
|
|
1969
1969
|
* }
|
|
1970
1970
|
* const site = siteResult.value;
|
|
1971
1971
|
* ```
|
|
@@ -1973,148 +1973,148 @@ declare class SiteAccessor {
|
|
|
1973
1973
|
get(unixName: string): WikidotResultAsync<Site>;
|
|
1974
1974
|
}
|
|
1975
1975
|
/**
|
|
1976
|
-
*
|
|
1976
|
+
* User retrieval options
|
|
1977
1977
|
*/
|
|
1978
1978
|
interface GetUserOptions {
|
|
1979
|
-
/**
|
|
1979
|
+
/** Throw error if user not found (default: false) */
|
|
1980
1980
|
raiseWhenNotFound?: boolean;
|
|
1981
1981
|
}
|
|
1982
1982
|
/**
|
|
1983
|
-
*
|
|
1983
|
+
* User operations accessor
|
|
1984
1984
|
*/
|
|
1985
1985
|
declare class UserAccessor {
|
|
1986
1986
|
readonly client: Client;
|
|
1987
1987
|
constructor(client: Client);
|
|
1988
1988
|
/**
|
|
1989
|
-
*
|
|
1989
|
+
* Get user by username
|
|
1990
1990
|
*
|
|
1991
|
-
* @param name -
|
|
1992
|
-
* @param options -
|
|
1993
|
-
* @returns Result
|
|
1991
|
+
* @param name - Username
|
|
1992
|
+
* @param options - Retrieval options
|
|
1993
|
+
* @returns User wrapped in Result type (null if not found, error if raiseWhenNotFound is true)
|
|
1994
1994
|
*
|
|
1995
1995
|
* @example
|
|
1996
1996
|
* ```typescript
|
|
1997
1997
|
* const userResult = await client.user.get('username');
|
|
1998
1998
|
* if (!userResult.isOk()) {
|
|
1999
|
-
* throw new Error('
|
|
1999
|
+
* throw new Error('Failed to get user');
|
|
2000
2000
|
* }
|
|
2001
2001
|
* const user = userResult.value;
|
|
2002
2002
|
* ```
|
|
2003
2003
|
*/
|
|
2004
2004
|
get(name: string, options?: GetUserOptions): WikidotResultAsync<User | null>;
|
|
2005
2005
|
/**
|
|
2006
|
-
*
|
|
2007
|
-
* @param names -
|
|
2008
|
-
* @param options -
|
|
2009
|
-
* @returns
|
|
2006
|
+
* Get users from multiple usernames
|
|
2007
|
+
* @param names - Array of usernames
|
|
2008
|
+
* @param options - Retrieval options
|
|
2009
|
+
* @returns User collection (null for non-existent users, error if raiseWhenNotFound is true)
|
|
2010
2010
|
*/
|
|
2011
2011
|
getMany(names: string[], options?: GetUserOptions): WikidotResultAsync<UserCollection>;
|
|
2012
2012
|
}
|
|
2013
2013
|
/**
|
|
2014
|
-
*
|
|
2014
|
+
* Client creation options
|
|
2015
2015
|
*/
|
|
2016
2016
|
interface ClientOptions {
|
|
2017
|
-
/** Wikidot
|
|
2017
|
+
/** Wikidot username */
|
|
2018
2018
|
username?: string;
|
|
2019
|
-
/** Wikidot
|
|
2019
|
+
/** Wikidot password */
|
|
2020
2020
|
password?: string;
|
|
2021
|
-
/**
|
|
2021
|
+
/** Base domain (default: wikidot.com) */
|
|
2022
2022
|
domain?: string;
|
|
2023
|
-
/** AMC
|
|
2023
|
+
/** AMC configuration override */
|
|
2024
2024
|
amcConfig?: Partial<AMCConfig>;
|
|
2025
2025
|
}
|
|
2026
2026
|
/**
|
|
2027
|
-
* Wikidot
|
|
2028
|
-
*
|
|
2027
|
+
* Wikidot client
|
|
2028
|
+
* Main entry point of the library
|
|
2029
2029
|
*/
|
|
2030
2030
|
declare class Client {
|
|
2031
|
-
/** AMC
|
|
2031
|
+
/** AMC client */
|
|
2032
2032
|
readonly amcClient: AMCClient;
|
|
2033
|
-
/**
|
|
2033
|
+
/** Base domain */
|
|
2034
2034
|
readonly domain: string;
|
|
2035
|
-
/**
|
|
2035
|
+
/** User operations accessor */
|
|
2036
2036
|
readonly user: UserAccessor;
|
|
2037
|
-
/**
|
|
2037
|
+
/** Site operations accessor */
|
|
2038
2038
|
readonly site: SiteAccessor;
|
|
2039
|
-
/**
|
|
2039
|
+
/** Private message operations accessor */
|
|
2040
2040
|
readonly privateMessage: PrivateMessageAccessor;
|
|
2041
|
-
/**
|
|
2041
|
+
/** Username of the logged-in user */
|
|
2042
2042
|
private _username;
|
|
2043
|
-
/**
|
|
2043
|
+
/** Logged-in user */
|
|
2044
2044
|
private _me;
|
|
2045
2045
|
/**
|
|
2046
|
-
*
|
|
2047
|
-
* create
|
|
2046
|
+
* Private constructor
|
|
2047
|
+
* Use the create method to create an instance
|
|
2048
2048
|
*/
|
|
2049
2049
|
private constructor();
|
|
2050
2050
|
/**
|
|
2051
|
-
*
|
|
2051
|
+
* Get the username of the logged-in user
|
|
2052
2052
|
*/
|
|
2053
2053
|
get username(): string | null;
|
|
2054
2054
|
/**
|
|
2055
|
-
*
|
|
2056
|
-
*
|
|
2055
|
+
* Get the logged-in user
|
|
2056
|
+
* Returns null if not logged in
|
|
2057
2057
|
*/
|
|
2058
2058
|
get me(): User | null;
|
|
2059
2059
|
/**
|
|
2060
|
-
*
|
|
2060
|
+
* Create a client
|
|
2061
2061
|
*
|
|
2062
|
-
* @param options -
|
|
2063
|
-
* @returns Result
|
|
2062
|
+
* @param options - Client options
|
|
2063
|
+
* @returns Client instance wrapped in Result type
|
|
2064
2064
|
*
|
|
2065
2065
|
* @example
|
|
2066
2066
|
* ```typescript
|
|
2067
2067
|
* import { Client } from '@ukwhatn/wikidot';
|
|
2068
2068
|
*
|
|
2069
|
-
* //
|
|
2069
|
+
* // Create a client
|
|
2070
2070
|
* const clientResult = await Client.create({
|
|
2071
2071
|
* username: 'your_username',
|
|
2072
2072
|
* password: 'your_password',
|
|
2073
2073
|
* });
|
|
2074
2074
|
*
|
|
2075
|
-
* // Result
|
|
2075
|
+
* // Result type requires isOk() check before accessing .value
|
|
2076
2076
|
* if (!clientResult.isOk()) {
|
|
2077
|
-
* throw new Error('
|
|
2077
|
+
* throw new Error('Failed to create client');
|
|
2078
2078
|
* }
|
|
2079
2079
|
* const client = clientResult.value;
|
|
2080
2080
|
*
|
|
2081
|
-
* //
|
|
2081
|
+
* // Now you can access client.site, etc.
|
|
2082
2082
|
* const siteResult = await client.site.get('scp-jp');
|
|
2083
2083
|
* ```
|
|
2084
2084
|
*/
|
|
2085
2085
|
static create(options?: ClientOptions): WikidotResultAsync<Client>;
|
|
2086
2086
|
/**
|
|
2087
|
-
*
|
|
2088
|
-
* @param options -
|
|
2089
|
-
* @returns
|
|
2087
|
+
* Create an unauthenticated client
|
|
2088
|
+
* @param options - Client options (excluding credentials)
|
|
2089
|
+
* @returns Client instance
|
|
2090
2090
|
*/
|
|
2091
2091
|
static createAnonymous(options?: Omit<ClientOptions, "username" | "password">): Client;
|
|
2092
2092
|
/**
|
|
2093
|
-
*
|
|
2094
|
-
* @returns
|
|
2093
|
+
* Check login status
|
|
2094
|
+
* @returns true if logged in
|
|
2095
2095
|
*/
|
|
2096
2096
|
isLoggedIn(): boolean;
|
|
2097
2097
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
*
|
|
2100
|
-
* @returns
|
|
2098
|
+
* Require login
|
|
2099
|
+
* Returns LoginRequiredError if not logged in
|
|
2100
|
+
* @returns void on success
|
|
2101
2101
|
*/
|
|
2102
2102
|
requireLogin(): WikidotResult<void>;
|
|
2103
2103
|
/**
|
|
2104
|
-
*
|
|
2105
|
-
*
|
|
2104
|
+
* Close the client
|
|
2105
|
+
* Attempts to logout if a session exists
|
|
2106
2106
|
*/
|
|
2107
2107
|
close(): WikidotResultAsync<void>;
|
|
2108
2108
|
}
|
|
2109
2109
|
/**
|
|
2110
|
-
*
|
|
2110
|
+
* Private message operations accessor
|
|
2111
2111
|
*
|
|
2112
2112
|
* @example
|
|
2113
2113
|
* ```typescript
|
|
2114
|
-
* //
|
|
2114
|
+
* // Get inbox
|
|
2115
2115
|
* const inboxResult = await client.privateMessage.inbox();
|
|
2116
2116
|
* if (!inboxResult.isOk()) {
|
|
2117
|
-
* throw new Error('
|
|
2117
|
+
* throw new Error('Failed to get inbox');
|
|
2118
2118
|
* }
|
|
2119
2119
|
* const inbox = inboxResult.value;
|
|
2120
2120
|
* ```
|
|
@@ -2123,51 +2123,51 @@ declare class PrivateMessageAccessor {
|
|
|
2123
2123
|
readonly client: Client;
|
|
2124
2124
|
constructor(client: Client);
|
|
2125
2125
|
/**
|
|
2126
|
-
*
|
|
2126
|
+
* Get message by message ID
|
|
2127
2127
|
*
|
|
2128
|
-
* @param id -
|
|
2129
|
-
* @returns Result
|
|
2128
|
+
* @param id - Message ID
|
|
2129
|
+
* @returns Message object wrapped in Result type
|
|
2130
2130
|
*/
|
|
2131
2131
|
get(id: number): WikidotResultAsync<PrivateMessage>;
|
|
2132
2132
|
/**
|
|
2133
|
-
*
|
|
2134
|
-
* @param ids -
|
|
2135
|
-
* @returns
|
|
2133
|
+
* Get messages from multiple message IDs
|
|
2134
|
+
* @param ids - Array of message IDs
|
|
2135
|
+
* @returns Message collection
|
|
2136
2136
|
*/
|
|
2137
2137
|
getMessages(ids: number[]): WikidotResultAsync<PrivateMessageCollection>;
|
|
2138
2138
|
/**
|
|
2139
|
-
*
|
|
2140
|
-
* @returns
|
|
2139
|
+
* Get inbox message list
|
|
2140
|
+
* @returns Inbox
|
|
2141
2141
|
*/
|
|
2142
2142
|
inbox(): WikidotResultAsync<PrivateMessageInbox>;
|
|
2143
2143
|
/**
|
|
2144
|
-
*
|
|
2145
|
-
* @returns
|
|
2144
|
+
* Get sent box message list
|
|
2145
|
+
* @returns Sent box
|
|
2146
2146
|
*/
|
|
2147
2147
|
sentBox(): WikidotResultAsync<PrivateMessageSentBox>;
|
|
2148
2148
|
/**
|
|
2149
|
-
*
|
|
2150
|
-
* @param recipient -
|
|
2151
|
-
* @param subject -
|
|
2152
|
-
* @param body -
|
|
2149
|
+
* Send a private message
|
|
2150
|
+
* @param recipient - Recipient
|
|
2151
|
+
* @param subject - Subject
|
|
2152
|
+
* @param body - Body
|
|
2153
2153
|
*/
|
|
2154
2154
|
send(recipient: User, subject: string, body: string): WikidotResultAsync<void>;
|
|
2155
2155
|
}
|
|
2156
2156
|
import * as cheerio2 from "cheerio";
|
|
2157
2157
|
import { AnyNode as AnyNode2 } from "domhandler";
|
|
2158
2158
|
/**
|
|
2159
|
-
* printuser
|
|
2159
|
+
* Parse printuser element and return user object
|
|
2160
2160
|
*
|
|
2161
|
-
* @param client - Wikidot
|
|
2162
|
-
* @param elem -
|
|
2163
|
-
* @returns
|
|
2161
|
+
* @param client - Wikidot client
|
|
2162
|
+
* @param elem - Element to parse (element with printuser class)
|
|
2163
|
+
* @returns Parsed user object
|
|
2164
2164
|
*/
|
|
2165
2165
|
declare function parseUser2(client: ClientRef, elem: cheerio2.Cheerio<AnyNode2>): AbstractUser;
|
|
2166
2166
|
/**
|
|
2167
|
-
* odate
|
|
2167
|
+
* Parse date from odate element
|
|
2168
2168
|
*
|
|
2169
|
-
* @param elem -
|
|
2170
|
-
* @returns
|
|
2169
|
+
* @param elem - Element to parse (odate element)
|
|
2170
|
+
* @returns Parsed Date, or null on parse failure
|
|
2171
2171
|
*/
|
|
2172
2172
|
declare function parseOdate(elem: cheerio2.Cheerio<AnyNode2>): Date | null;
|
|
2173
2173
|
export { wdOkAsync, wdOk, wdErrAsync, wdErr, userLookup, setupConsoleHandler, parseUser2 as parseUser, parseOdate, pageLookup, nullHandler, memberLookup, maskSensitiveData, logout, login, logger, isSuccessResponse, getLogger, fromPromise, consoleHandler, combineResults, amcResponseSchema, WikidotUser, WikidotStatusError, WikidotResultAsync, WikidotResult, WikidotError, UserType, UserIdentifier, UserData, UserCollection, UserAccessor, User, UnexpectedError, TargetExistsError, TargetError, SiteUnixName, SiteRef, SiteMemberData, SiteMember, SiteData, SiteChangeData, SiteChangeCollection, SiteChange, SiteApplicationData, SiteApplication, SiteAccessor, Site, SessionError, SessionCreateError, SearchPagesQueryParams, SearchPagesQuery, ResponseDataError, QuickModuleName, QuickModule, QMCUser, QMCPage, PrivateMessageSentBox, PrivateMessageInbox, PrivateMessageData, PrivateMessageCollection, PrivateMessageAccessor, PrivateMessage, PagesAccessor, PageVoteData, PageVoteCollection, PageVote, PageSourceData, PageSource, PageRevisionData, PageRevisionCollection, PageRevision, PageRef, PageMetaData, PageMetaCollection, PageMeta, PageFullname, PageFileData, PageFileCollection, PageFile, PageData, PageCollection, PageAccessor, Page, NotFoundException, NoElementError, MemberAccessor, LoginRequiredError, Logger, LogLevel, LogHandler, GuestUser, GetUserOptions, ForumThreadRef, ForumThreadData, ForumThreadCollection, ForumThread2 as ForumThread, ForumPostData, ForumPostCollection, ForumPost, ForumCategoryRef, ForumCategoryData, ForumCategoryCollection, ForumCategory, ForumAccessor, ForbiddenError, DeletedUser, DateTimeString, DEFAULT_PER_PAGE, DEFAULT_MODULE_BODY, DEFAULT_AMC_CONFIG, ClientRef, ClientOptions, Client, AuthClientContext, AnonymousUser, AbstractUser, AMCSuccessResponse, AMCResponse, AMCRequestOptions, AMCRequestBody, AMCHttpError, AMCHeaderRef, AMCHeader, AMCError, AMCConfig, AMCClientRef, AMCClient };
|