@ukwhatn/wikidot 1.0.9 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +227 -79
  2. package/dist/errors.cjs +114 -0
  3. package/dist/errors.d.cts +94 -0
  4. package/dist/errors.d.ts +94 -0
  5. package/dist/errors.js +81 -0
  6. package/dist/index.cjs +4624 -0
  7. package/dist/index.d.cts +2106 -0
  8. package/dist/index.d.ts +2106 -1
  9. package/dist/index.js +2651 -6
  10. package/dist/shared/index-7dqqxq7x.js +105 -0
  11. package/dist/shared/index-f2eh3ykk.js +172 -0
  12. package/dist/shared/index-kka6e8cb.js +627 -0
  13. package/dist/shared/index-ytknx2hn.js +980 -0
  14. package/package.json +64 -26
  15. package/Makefile +0 -13
  16. package/dist/common/exceptions.d.ts +0 -95
  17. package/dist/common/exceptions.js +0 -146
  18. package/dist/common/exceptions.js.map +0 -1
  19. package/dist/common/index.d.ts +0 -1
  20. package/dist/common/index.js +0 -6
  21. package/dist/common/index.js.map +0 -1
  22. package/dist/common/logger.d.ts +0 -2
  23. package/dist/common/logger.js +0 -19
  24. package/dist/common/logger.js.map +0 -1
  25. package/dist/connector/ajax.d.ts +0 -142
  26. package/dist/connector/ajax.js +0 -259
  27. package/dist/connector/ajax.js.map +0 -1
  28. package/dist/connector/api.d.ts +0 -11
  29. package/dist/connector/api.js +0 -17
  30. package/dist/connector/api.js.map +0 -1
  31. package/dist/connector/index.d.ts +0 -0
  32. package/dist/connector/index.js +0 -2
  33. package/dist/connector/index.js.map +0 -1
  34. package/dist/index.js.map +0 -1
  35. package/dist/module/auth.d.ts +0 -8
  36. package/dist/module/auth.js +0 -77
  37. package/dist/module/auth.js.map +0 -1
  38. package/dist/module/client.d.ts +0 -39
  39. package/dist/module/client.js +0 -97
  40. package/dist/module/client.js.map +0 -1
  41. package/dist/module/index.d.ts +0 -0
  42. package/dist/module/index.js +0 -2
  43. package/dist/module/index.js.map +0 -1
  44. package/dist/module/page.d.ts +0 -102
  45. package/dist/module/page.js +0 -395
  46. package/dist/module/page.js.map +0 -1
  47. package/dist/module/pageRevision.d.ts +0 -29
  48. package/dist/module/pageRevision.js +0 -114
  49. package/dist/module/pageRevision.js.map +0 -1
  50. package/dist/module/pageSource.d.ts +0 -7
  51. package/dist/module/pageSource.js +0 -11
  52. package/dist/module/pageSource.js.map +0 -1
  53. package/dist/module/pageVote.d.ts +0 -14
  54. package/dist/module/pageVote.js +0 -20
  55. package/dist/module/pageVote.js.map +0 -1
  56. package/dist/module/privateMessage.d.ts +0 -29
  57. package/dist/module/privateMessage.js +0 -128
  58. package/dist/module/privateMessage.js.map +0 -1
  59. package/dist/module/site.d.ts +0 -32
  60. package/dist/module/site.js +0 -115
  61. package/dist/module/site.js.map +0 -1
  62. package/dist/module/siteApplication.d.ts +0 -14
  63. package/dist/module/siteApplication.js +0 -96
  64. package/dist/module/siteApplication.js.map +0 -1
  65. package/dist/module/user.d.ts +0 -56
  66. package/dist/module/user.js +0 -115
  67. package/dist/module/user.js.map +0 -1
  68. package/dist/util/index.d.ts +0 -3
  69. package/dist/util/index.js +0 -10
  70. package/dist/util/index.js.map +0 -1
  71. package/dist/util/parser/index.d.ts +0 -1
  72. package/dist/util/parser/index.js +0 -18
  73. package/dist/util/parser/index.js.map +0 -1
  74. package/dist/util/parser/odate.d.ts +0 -12
  75. package/dist/util/parser/odate.js +0 -25
  76. package/dist/util/parser/odate.js.map +0 -1
  77. package/dist/util/parser/user.d.ts +0 -16
  78. package/dist/util/parser/user.js +0 -36
  79. package/dist/util/parser/user.js.map +0 -1
  80. package/dist/util/quickModule.d.ts +0 -96
  81. package/dist/util/quickModule.js +0 -137
  82. package/dist/util/quickModule.js.map +0 -1
  83. package/dist/util/requestUtil.d.ts +0 -26
  84. package/dist/util/requestUtil.js +0 -69
  85. package/dist/util/requestUtil.js.map +0 -1
  86. package/dist/util/stringUtil.d.ts +0 -21
  87. package/dist/util/stringUtil.js +0 -64
  88. package/dist/util/stringUtil.js.map +0 -1
  89. package/dist/util/table/charTable.d.ts +0 -3
  90. package/dist/util/table/charTable.js +0 -472
  91. package/dist/util/table/charTable.js.map +0 -1
  92. package/dist/util/table/index.d.ts +0 -1
  93. package/dist/util/table/index.js +0 -18
  94. package/dist/util/table/index.js.map +0 -1
@@ -0,0 +1,2106 @@
1
+ /**
2
+ * Wikidotライブラリの基底エラークラス
3
+ * 全てのカスタムエラーはこのクラスを継承する
4
+ */
5
+ declare abstract class WikidotError extends Error {
6
+ /** エラー名 */
7
+ readonly name: string;
8
+ /**
9
+ * @param message - エラーメッセージ
10
+ */
11
+ constructor(message: string);
12
+ }
13
+ /**
14
+ * 予期せぬエラー
15
+ * 内部的な不整合やバグを表す
16
+ */
17
+ declare class UnexpectedError extends WikidotError {}
18
+ /**
19
+ * Ajax Module Connector関連の基底エラー
20
+ */
21
+ declare class AMCError extends WikidotError {}
22
+ /**
23
+ * HTTPステータスコードエラー
24
+ * AMCへのリクエストがHTTPエラーで失敗した場合
25
+ */
26
+ declare class AMCHttpError extends AMCError {
27
+ /** HTTPステータスコード */
28
+ readonly statusCode: number;
29
+ /**
30
+ * @param message - エラーメッセージ
31
+ * @param statusCode - HTTPステータスコード
32
+ */
33
+ constructor(message: string, statusCode: number);
34
+ }
35
+ /**
36
+ * Wikidotステータスコードエラー
37
+ * AMCレスポンスのstatusがokでない場合
38
+ */
39
+ declare class WikidotStatusError extends AMCError {
40
+ /** Wikidotステータスコード文字列 */
41
+ readonly statusCode: string;
42
+ /**
43
+ * @param message - エラーメッセージ
44
+ * @param statusCode - ステータスコード(例: 'not_ok', 'try_again')
45
+ */
46
+ constructor(message: string, statusCode: string);
47
+ }
48
+ /**
49
+ * レスポンスデータエラー
50
+ * レスポンスのパースに失敗した場合
51
+ */
52
+ declare class ResponseDataError extends AMCError {}
53
+ /**
54
+ * セッション関連の基底エラー
55
+ */
56
+ declare class SessionError extends WikidotError {}
57
+ /**
58
+ * セッション作成失敗エラー
59
+ * ログイン試行が失敗した場合にスロー
60
+ */
61
+ declare class SessionCreateError extends SessionError {}
62
+ /**
63
+ * ログイン必須エラー
64
+ * 認証が必要な操作を未ログイン状態で実行した場合にスロー
65
+ */
66
+ declare class LoginRequiredError extends SessionError {
67
+ constructor(message?: string);
68
+ }
69
+ /**
70
+ * リソース未発見エラー
71
+ * 要求されたリソースが存在しない場合
72
+ */
73
+ declare class NotFoundException extends WikidotError {}
74
+ /**
75
+ * リソース既存エラー
76
+ * 作成しようとしたリソースが既に存在する場合
77
+ */
78
+ declare class TargetExistsError extends WikidotError {}
79
+ /**
80
+ * ターゲット状態エラー
81
+ * リソースが操作不可能な状態の場合(ロック中など)
82
+ */
83
+ declare class TargetError extends WikidotError {}
84
+ /**
85
+ * アクセス拒否エラー
86
+ * 権限不足で操作が拒否された場合
87
+ */
88
+ declare class ForbiddenError extends WikidotError {}
89
+ /**
90
+ * HTML要素未発見エラー
91
+ * パース中に必要な要素が見つからない場合
92
+ */
93
+ declare class NoElementError extends WikidotError {}
94
+ /**
95
+ * ロギング機能を提供するモジュール
96
+ *
97
+ * このモジュールは、ライブラリ全体で使用されるロガーを設定し、提供する。
98
+ * デフォルトでは出力を行わず、アプリケーション側でのログ制御を可能にする。
99
+ */
100
+ /**
101
+ * ログレベル
102
+ */
103
+ type LogLevel = "debug" | "info" | "warn" | "error";
104
+ /**
105
+ * ロガーハンドラー
106
+ */
107
+ type LogHandler = (level: LogLevel, name: string, message: string, ...args: unknown[]) => void;
108
+ /**
109
+ * NullHandler: 何も出力しない(デフォルト)
110
+ */
111
+ declare const nullHandler: LogHandler;
112
+ /**
113
+ * ConsoleHandler: コンソールに出力する
114
+ */
115
+ declare const consoleHandler: LogHandler;
116
+ /**
117
+ * ロガークラス
118
+ */
119
+ declare class Logger {
120
+ private readonly name;
121
+ private handler;
122
+ private level;
123
+ constructor(name: string, handler?: LogHandler, level?: LogLevel);
124
+ /**
125
+ * ハンドラーを設定
126
+ */
127
+ setHandler(handler: LogHandler): void;
128
+ /**
129
+ * ログレベルを設定
130
+ */
131
+ setLevel(level: LogLevel): void;
132
+ /**
133
+ * 指定レベルがログ出力対象かどうか
134
+ */
135
+ private shouldLog;
136
+ /**
137
+ * ログ出力
138
+ */
139
+ private log;
140
+ debug(message: string, ...args: unknown[]): void;
141
+ info(message: string, ...args: unknown[]): void;
142
+ warn(message: string, ...args: unknown[]): void;
143
+ error(message: string, ...args: unknown[]): void;
144
+ }
145
+ /**
146
+ * ロガーを取得
147
+ * @param name - ロガー名(デフォルト: "wikidot")
148
+ * @returns ロガーインスタンス
149
+ */
150
+ declare function getLogger(name?: string): Logger;
151
+ /**
152
+ * コンソール出力用ハンドラを設定
153
+ * @param logger - 設定するロガー
154
+ * @param level - ログレベル(デフォルト: "warn")
155
+ */
156
+ declare function setupConsoleHandler(logger: Logger, level?: LogLevel): void;
157
+ /**
158
+ * パッケージ全体で使用されるデフォルトロガー
159
+ */
160
+ declare const logger: Logger;
161
+ /** 日時型(ISO 8601形式) */
162
+ type DateTimeString = string;
163
+ /** ユーザーIDまたはユーザー名 */
164
+ type UserIdentifier = number | string;
165
+ /** サイトUNIX名 */
166
+ type SiteUnixName = string;
167
+ /** ページフルネーム(カテゴリ:名前) */
168
+ type PageFullname = string;
169
+ import { Result, ResultAsync } from "neverthrow";
170
+ /** 同期Result型エイリアス */
171
+ type WikidotResult<T> = Result<T, WikidotError>;
172
+ /** 非同期Result型エイリアス */
173
+ type WikidotResultAsync<T> = ResultAsync<T, WikidotError>;
174
+ /** 成功Resultを生成 */
175
+ declare const wdOk: <T>(value: T) => WikidotResult<T>;
176
+ /** エラーResultを生成 */
177
+ declare const wdErr: <E extends WikidotError>(error: E) => WikidotResult<never>;
178
+ /** 成功ResultAsyncを生成 */
179
+ declare const wdOkAsync: <T>(value: T) => WikidotResultAsync<T>;
180
+ /** エラーResultAsyncを生成 */
181
+ declare const wdErrAsync: <E extends WikidotError>(error: E) => WikidotResultAsync<never>;
182
+ /** Promiseからの変換 */
183
+ declare const fromPromise: <T>(promise: Promise<T>, errorMapper: (error: unknown) => WikidotError) => WikidotResultAsync<T>;
184
+ /** 複数ResultAsyncの結合 */
185
+ declare const combineResults: <T>(results: WikidotResultAsync<T>[]) => WikidotResultAsync<T[]>;
186
+ /**
187
+ * Ajax Module Connector設定
188
+ */
189
+ interface AMCConfig {
190
+ /** リクエストタイムアウト(ミリ秒) */
191
+ timeout: number;
192
+ /** リトライ上限回数 */
193
+ retryLimit: number;
194
+ /** リトライ基本間隔(ミリ秒) */
195
+ retryInterval: number;
196
+ /** 最大バックオフ(ミリ秒) */
197
+ maxBackoff: number;
198
+ /** バックオフ係数 */
199
+ backoffFactor: number;
200
+ /** 最大並列リクエスト数 */
201
+ semaphoreLimit: number;
202
+ }
203
+ /** デフォルトAMC設定 */
204
+ declare const DEFAULT_AMC_CONFIG: AMCConfig;
205
+ /**
206
+ * AMCリクエストヘッダーを管理するクラス
207
+ */
208
+ declare class AMCHeader {
209
+ private cookies;
210
+ private contentType;
211
+ private userAgent;
212
+ private referer;
213
+ /**
214
+ * @param options - ヘッダー初期化オプション
215
+ */
216
+ constructor(options?: {
217
+ contentType?: string;
218
+ userAgent?: string;
219
+ referer?: string;
220
+ });
221
+ /**
222
+ * Cookieを設定する
223
+ * @param name - Cookie名
224
+ * @param value - Cookie値
225
+ */
226
+ setCookie(name: string, value: string): void;
227
+ /**
228
+ * Cookieを削除する
229
+ * @param name - Cookie名
230
+ */
231
+ deleteCookie(name: string): void;
232
+ /**
233
+ * Cookieを取得する
234
+ * @param name - Cookie名
235
+ * @returns Cookie値、存在しない場合はundefined
236
+ */
237
+ getCookie(name: string): string | undefined;
238
+ /**
239
+ * HTTPヘッダーオブジェクトを取得する
240
+ * @returns ヘッダー辞書
241
+ */
242
+ getHeaders(): Record<string, string>;
243
+ }
244
+ import { z } from "zod";
245
+ /**
246
+ * AMCリクエストボディの値型
247
+ */
248
+ type AMCRequestBodyValue = string | number | boolean | null | undefined | Record<string, unknown> | AMCRequestBodyValue[];
249
+ /**
250
+ * AMCリクエストボディの型定義
251
+ */
252
+ interface AMCRequestBody {
253
+ moduleName?: string;
254
+ action?: string;
255
+ event?: string;
256
+ [key: string]: AMCRequestBodyValue;
257
+ }
258
+ /**
259
+ * AMCレスポンスのベーススキーマ
260
+ */
261
+ declare const baseSchema: z.ZodObject<{
262
+ status: z.ZodString;
263
+ body: z.ZodOptional<z.ZodString>;
264
+ message: z.ZodOptional<z.ZodString>;
265
+ }>;
266
+ /**
267
+ * AMCレスポンススキーマ
268
+ */
269
+ declare const amcResponseSchema: z.ZodType<z.infer<typeof baseSchema> & Record<string, unknown>>;
270
+ /**
271
+ * AMCレスポンス型
272
+ */
273
+ type AMCResponse = z.infer<typeof amcResponseSchema>;
274
+ /**
275
+ * 成功したAMCレスポンス
276
+ */
277
+ interface AMCSuccessResponse {
278
+ status: "ok";
279
+ body: string;
280
+ [key: string]: unknown;
281
+ }
282
+ /**
283
+ * AMCレスポンスが成功かどうかを判定する型ガード
284
+ * @param response - AMCレスポンス
285
+ * @returns 成功レスポンスの場合true
286
+ */
287
+ declare function isSuccessResponse(response: AMCResponse): response is AMCSuccessResponse;
288
+ /**
289
+ * 機密情報をマスクする(ログ出力用)
290
+ * @param body - マスク対象のリクエストボディ
291
+ * @returns マスクされたボディ
292
+ */
293
+ declare function maskSensitiveData(body: AMCRequestBody): Record<string, unknown>;
294
+ /**
295
+ * AMCリクエストオプション
296
+ */
297
+ interface AMCRequestOptions {
298
+ /** サイト名(デフォルト: www) */
299
+ siteName?: string;
300
+ /** SSL対応(省略時は自動検出) */
301
+ sslSupported?: boolean;
302
+ /** エラーを例外として投げずに結果に含める(デフォルト: false) */
303
+ returnExceptions?: boolean;
304
+ }
305
+ /**
306
+ * Ajax Module Connectorクライアント
307
+ * Wikidot AMCエンドポイントへのリクエストを管理する
308
+ */
309
+ declare class AMCClient {
310
+ /** kyインスタンス */
311
+ private readonly ky;
312
+ /** 並列リクエスト制限 */
313
+ private readonly limit;
314
+ /** ヘッダー管理 */
315
+ readonly header: AMCHeader;
316
+ /** 設定 */
317
+ readonly config: AMCConfig;
318
+ /** ベースドメイン */
319
+ readonly domain: string;
320
+ /** SSL対応状況のキャッシュ */
321
+ private sslCache;
322
+ /**
323
+ * @param config - AMC設定(省略時はデフォルト値)
324
+ * @param domain - ベースドメイン(デフォルト: wikidot.com)
325
+ */
326
+ constructor(config?: Partial<AMCConfig>, domain?: string);
327
+ /**
328
+ * サイトの存在とSSL対応状況を確認する
329
+ * @param siteName - サイト名
330
+ * @returns SSL対応状況(true: HTTPS、false: HTTP)
331
+ */
332
+ checkSiteSSL(siteName: string): WikidotResultAsync<boolean>;
333
+ /**
334
+ * AMCリクエストを実行する
335
+ * @param bodies - リクエストボディ配列
336
+ * @param siteName - サイト名(省略時はwww)
337
+ * @param sslSupported - SSL対応(省略時は自動検出)
338
+ * @returns レスポンス配列
339
+ */
340
+ request(bodies: AMCRequestBody[], siteName?: string, sslSupported?: boolean): WikidotResultAsync<AMCResponse[]>;
341
+ /**
342
+ * AMCリクエストを実行する(オプション指定版)
343
+ * @param bodies - リクエストボディ配列
344
+ * @param options - リクエストオプション
345
+ * @returns レスポンス配列(returnExceptionsがtrueの場合はエラーも含む)
346
+ */
347
+ requestWithOptions(bodies: AMCRequestBody[], options?: AMCRequestOptions): WikidotResultAsync<(AMCResponse | WikidotError)[]>;
348
+ /**
349
+ * 単一リクエストを実行する内部メソッド
350
+ * @param body - リクエストボディ
351
+ * @param url - リクエストURL
352
+ * @returns レスポンス
353
+ */
354
+ private singleRequest;
355
+ }
356
+ /**
357
+ * クライアント参照インターフェース
358
+ * Client型への直接依存を避けるために使用
359
+ */
360
+ interface ClientRef {
361
+ /**
362
+ * ログインが必要な操作の前に呼び出す
363
+ * @returns ログインしていない場合はエラー
364
+ */
365
+ requireLogin(): {
366
+ isErr(): boolean;
367
+ error?: Error;
368
+ };
369
+ /**
370
+ * ログイン済みかどうか
371
+ */
372
+ isLoggedIn(): boolean;
373
+ }
374
+ /**
375
+ * AMCHeaderの最小インターフェース
376
+ */
377
+ interface AMCHeaderRef {
378
+ getHeaders(): Record<string, string>;
379
+ setCookie(name: string, value: string): void;
380
+ deleteCookie(name: string): void;
381
+ }
382
+ /**
383
+ * AMCClientの最小インターフェース
384
+ */
385
+ interface AMCClientRef {
386
+ header: AMCHeaderRef;
387
+ request(bodies: AMCRequestBody[]): WikidotResultAsync<AMCResponse[]>;
388
+ }
389
+ /**
390
+ * 認証処理で必要なクライアントコンテキスト
391
+ * auth.tsがclient.tsに直接依存することを避けるために使用
392
+ */
393
+ interface AuthClientContext {
394
+ amcClient: AMCClientRef;
395
+ }
396
+ /**
397
+ * サイト参照インターフェース
398
+ * Site型への直接依存を避けるために使用
399
+ */
400
+ interface SiteRef {
401
+ /**
402
+ * サイトID
403
+ */
404
+ readonly id: number;
405
+ /**
406
+ * UNIX名(例: scp-jp)
407
+ */
408
+ readonly unixName: string;
409
+ /**
410
+ * ドメイン
411
+ */
412
+ readonly domain: string;
413
+ /**
414
+ * SSL対応フラグ
415
+ */
416
+ readonly sslSupported: boolean;
417
+ /**
418
+ * クライアント参照
419
+ */
420
+ readonly client: ClientRef;
421
+ /**
422
+ * AMCリクエストを実行
423
+ */
424
+ amcRequest(bodies: AMCRequestBody[]): WikidotResultAsync<AMCResponse[]>;
425
+ /**
426
+ * 単一のAMCリクエストを実行
427
+ */
428
+ amcRequestSingle(body: AMCRequestBody): WikidotResultAsync<AMCResponse>;
429
+ }
430
+ /**
431
+ * フォーラムカテゴリ参照インターフェース
432
+ */
433
+ interface ForumCategoryRef {
434
+ /**
435
+ * カテゴリID
436
+ */
437
+ readonly id: number;
438
+ /**
439
+ * カテゴリタイトル
440
+ */
441
+ readonly title: string;
442
+ /**
443
+ * サイト参照
444
+ */
445
+ readonly site: SiteRef;
446
+ }
447
+ /**
448
+ * フォーラムスレッド参照インターフェース
449
+ * ForumThread型への直接依存を避けるために使用
450
+ */
451
+ interface ForumThreadRef {
452
+ /**
453
+ * スレッドID
454
+ */
455
+ readonly id: number;
456
+ /**
457
+ * スレッドタイトル
458
+ */
459
+ readonly title: string;
460
+ /**
461
+ * サイト参照
462
+ */
463
+ readonly site: SiteRef;
464
+ /**
465
+ * カテゴリ参照(存在する場合)
466
+ */
467
+ readonly category?: ForumCategoryRef | null;
468
+ }
469
+ /**
470
+ * ページ参照インターフェース
471
+ * Page型への直接依存を避けるために使用
472
+ */
473
+ interface PageRef {
474
+ /**
475
+ * ページID(取得後に設定される)
476
+ */
477
+ readonly id: number | null;
478
+ /**
479
+ * フルネーム(category:name 形式)
480
+ */
481
+ readonly fullname: string;
482
+ /**
483
+ * ページ名
484
+ */
485
+ readonly name: string;
486
+ /**
487
+ * カテゴリ
488
+ */
489
+ readonly category: string;
490
+ /**
491
+ * サイト参照
492
+ */
493
+ readonly site: SiteRef;
494
+ }
495
+ /**
496
+ * ユーザー名とパスワードでWikidotにログインする
497
+ * @param client - クライアントコンテキスト(AMCClientを持つオブジェクト)
498
+ * @param username - ユーザー名
499
+ * @param password - パスワード
500
+ * @returns 成功時はvoid、失敗時はSessionCreateError
501
+ */
502
+ declare function login(client: AuthClientContext, username: string, password: string): WikidotResultAsync<void>;
503
+ /**
504
+ * ログアウトする
505
+ * @param client - クライアントコンテキスト(AMCClientを持つオブジェクト)
506
+ * @returns 成功時はvoid
507
+ */
508
+ declare function logout(client: AuthClientContext): WikidotResultAsync<void>;
509
+ /**
510
+ * ユーザー種別
511
+ */
512
+ type UserType = "user" | "deleted" | "anonymous" | "guest" | "wikidot";
513
+ /**
514
+ * ユーザー基底インターフェース
515
+ */
516
+ interface AbstractUser {
517
+ /** クライアント */
518
+ readonly client: ClientRef;
519
+ /** ユーザーID */
520
+ readonly id: number;
521
+ /** ユーザー名 */
522
+ readonly name: string;
523
+ /** UNIX形式のユーザー名 */
524
+ readonly unixName: string | null;
525
+ /** アバターURL */
526
+ readonly avatarUrl: string | null;
527
+ /** IPアドレス(匿名ユーザーの場合のみ) */
528
+ readonly ip: string | null;
529
+ /** ユーザー種別 */
530
+ readonly userType: UserType;
531
+ /** ユーザー種別を判定 */
532
+ isUser(): boolean;
533
+ isDeletedUser(): boolean;
534
+ isAnonymousUser(): boolean;
535
+ isGuestUser(): boolean;
536
+ isWikidotUser(): boolean;
537
+ }
538
+ /**
539
+ * 匿名ユーザー
540
+ */
541
+ declare class AnonymousUser implements AbstractUser {
542
+ readonly client: ClientRef;
543
+ /** ユーザーID(匿名は0) */
544
+ readonly id: number;
545
+ /** ユーザー名(匿名は"Anonymous") */
546
+ readonly name: string;
547
+ /** UNIX形式のユーザー名 */
548
+ readonly unixName: string;
549
+ /** アバターURL(匿名はnull) */
550
+ readonly avatarUrl: string | null;
551
+ /** IPアドレス */
552
+ readonly ip: string;
553
+ /** ユーザー種別 */
554
+ readonly userType: UserType;
555
+ constructor(client: ClientRef, ip: string);
556
+ isUser(): boolean;
557
+ isDeletedUser(): boolean;
558
+ isAnonymousUser(): boolean;
559
+ isGuestUser(): boolean;
560
+ isWikidotUser(): boolean;
561
+ toString(): string;
562
+ }
563
+ /**
564
+ * 削除済みユーザー
565
+ */
566
+ declare class DeletedUser implements AbstractUser {
567
+ readonly client: ClientRef;
568
+ /** 削除済みユーザーID */
569
+ readonly id: number;
570
+ /** ユーザー名(削除済みは"account deleted") */
571
+ readonly name: string;
572
+ /** UNIX形式のユーザー名 */
573
+ readonly unixName: string;
574
+ /** アバターURL(削除済みはnull) */
575
+ readonly avatarUrl: string | null;
576
+ /** IPアドレス(削除済みはnull) */
577
+ readonly ip: string | null;
578
+ /** ユーザー種別 */
579
+ readonly userType: UserType;
580
+ constructor(client: ClientRef, id: number);
581
+ isUser(): boolean;
582
+ isDeletedUser(): boolean;
583
+ isAnonymousUser(): boolean;
584
+ isGuestUser(): boolean;
585
+ isWikidotUser(): boolean;
586
+ toString(): string;
587
+ }
588
+ /**
589
+ * ゲストユーザー
590
+ */
591
+ declare class GuestUser implements AbstractUser {
592
+ readonly client: ClientRef;
593
+ /** ユーザーID(ゲストは0) */
594
+ readonly id: number;
595
+ /** ゲスト名 */
596
+ readonly name: string;
597
+ /** UNIX形式のユーザー名(ゲストはnull) */
598
+ readonly unixName: string | null;
599
+ /** アバターURL(Gravatarの場合あり) */
600
+ readonly avatarUrl: string | null;
601
+ /** IPアドレス(ゲストはnull) */
602
+ readonly ip: string | null;
603
+ /** ユーザー種別 */
604
+ readonly userType: UserType;
605
+ constructor(client: ClientRef, name: string, avatarUrl?: string | null);
606
+ isUser(): boolean;
607
+ isDeletedUser(): boolean;
608
+ isAnonymousUser(): boolean;
609
+ isGuestUser(): boolean;
610
+ isWikidotUser(): boolean;
611
+ toString(): string;
612
+ }
613
+ /**
614
+ * ユーザーコレクション
615
+ */
616
+ declare class UserCollection extends Array<User | null> {
617
+ constructor(users?: (User | null)[]);
618
+ /**
619
+ * ユーザー名で検索
620
+ * @param name - ユーザー名
621
+ * @returns ユーザーまたはundefined
622
+ */
623
+ findByName(name: string): User | undefined;
624
+ /**
625
+ * ユーザーIDで検索
626
+ * @param id - ユーザーID
627
+ * @returns ユーザーまたはundefined
628
+ */
629
+ findById(id: number): User | undefined;
630
+ /**
631
+ * nullを除いたユーザーのみを返す
632
+ * @returns null以外のユーザー配列
633
+ */
634
+ filterNonNull(): User[];
635
+ }
636
+ /**
637
+ * ユーザーデータ
638
+ */
639
+ interface UserData {
640
+ id: number;
641
+ name: string;
642
+ displayName?: string | null;
643
+ avatarUrl?: string | null;
644
+ unixName?: string;
645
+ }
646
+ /**
647
+ * 通常ユーザー
648
+ */
649
+ declare class User implements AbstractUser {
650
+ readonly client: ClientRef;
651
+ /** ユーザーID */
652
+ readonly id: number;
653
+ /** ユーザー名 */
654
+ readonly name: string;
655
+ /** 表示名 */
656
+ readonly displayName: string | null;
657
+ /** アバターURL */
658
+ readonly avatarUrl: string | null;
659
+ /** UNIX形式のユーザー名 */
660
+ readonly unixName: string;
661
+ /** IPアドレス(通常ユーザーではnull) */
662
+ readonly ip: string | null;
663
+ /** ユーザー種別 */
664
+ readonly userType: UserType;
665
+ constructor(client: ClientRef, data: UserData);
666
+ /**
667
+ * ユーザー名からユーザーを取得する
668
+ * @param client - クライアント
669
+ * @param name - ユーザー名
670
+ * @returns ユーザー(存在しない場合はnull)
671
+ */
672
+ static fromName(client: ClientRef, name: string): WikidotResultAsync<User | null>;
673
+ /**
674
+ * 複数ユーザー名からユーザーを取得する
675
+ * @param client - クライアント
676
+ * @param names - ユーザー名配列
677
+ * @returns ユーザーコレクション
678
+ */
679
+ static fromNames(client: ClientRef, names: string[]): WikidotResultAsync<UserCollection>;
680
+ isUser(): boolean;
681
+ isDeletedUser(): boolean;
682
+ isAnonymousUser(): boolean;
683
+ isGuestUser(): boolean;
684
+ isWikidotUser(): boolean;
685
+ toString(): string;
686
+ }
687
+ /**
688
+ * Wikidotシステムユーザー
689
+ */
690
+ declare class WikidotUser implements AbstractUser {
691
+ readonly client: ClientRef;
692
+ /** ユーザーID(Wikidotシステムは0) */
693
+ readonly id: number;
694
+ /** ユーザー名 */
695
+ readonly name: string;
696
+ /** UNIX形式のユーザー名 */
697
+ readonly unixName: string;
698
+ /** アバターURL(システムユーザーはnull) */
699
+ readonly avatarUrl: string | null;
700
+ /** IPアドレス(システムユーザーはnull) */
701
+ readonly ip: string | null;
702
+ /** ユーザー種別 */
703
+ readonly userType: UserType;
704
+ constructor(client: ClientRef);
705
+ isUser(): boolean;
706
+ isDeletedUser(): boolean;
707
+ isAnonymousUser(): boolean;
708
+ isGuestUser(): boolean;
709
+ isWikidotUser(): boolean;
710
+ toString(): string;
711
+ }
712
+ /**
713
+ * プライベートメッセージデータ
714
+ */
715
+ interface PrivateMessageData {
716
+ client: Client;
717
+ id: number;
718
+ sender: AbstractUser;
719
+ recipient: AbstractUser;
720
+ subject: string;
721
+ body: string;
722
+ createdAt: Date;
723
+ }
724
+ /**
725
+ * プライベートメッセージ
726
+ */
727
+ declare class PrivateMessage {
728
+ readonly client: Client;
729
+ readonly id: number;
730
+ readonly sender: AbstractUser;
731
+ readonly recipient: AbstractUser;
732
+ readonly subject: string;
733
+ readonly body: string;
734
+ readonly createdAt: Date;
735
+ constructor(data: PrivateMessageData);
736
+ /**
737
+ * メッセージIDからメッセージを取得する
738
+ * @param client - クライアント
739
+ * @param messageId - メッセージID
740
+ * @returns プライベートメッセージ
741
+ */
742
+ static fromId(client: Client, messageId: number): WikidotResultAsync<PrivateMessage>;
743
+ /**
744
+ * プライベートメッセージを送信する
745
+ * @param client - クライアント
746
+ * @param recipient - 受信者
747
+ * @param subject - 件名
748
+ * @param body - 本文
749
+ */
750
+ static send(client: Client, recipient: User, subject: string, body: string): WikidotResultAsync<void>;
751
+ toString(): string;
752
+ }
753
+ /**
754
+ * プライベートメッセージコレクション
755
+ */
756
+ declare class PrivateMessageCollection extends Array<PrivateMessage> {
757
+ readonly client: Client;
758
+ constructor(client: Client, messages?: PrivateMessage[]);
759
+ /**
760
+ * IDで検索
761
+ */
762
+ findById(id: number): PrivateMessage | undefined;
763
+ /**
764
+ * メッセージIDのリストからメッセージを取得する
765
+ */
766
+ static fromIds(client: Client, messageIds: number[]): WikidotResultAsync<PrivateMessageCollection>;
767
+ /**
768
+ * モジュールからメッセージを取得する内部メソッド
769
+ */
770
+ protected static acquireFromModule(client: Client, moduleName: string): WikidotResultAsync<PrivateMessageCollection>;
771
+ }
772
+ /**
773
+ * 受信箱
774
+ */
775
+ declare class PrivateMessageInbox extends PrivateMessageCollection {
776
+ /**
777
+ * 受信箱のメッセージをすべて取得する
778
+ */
779
+ static acquire(client: Client): WikidotResultAsync<PrivateMessageInbox>;
780
+ }
781
+ /**
782
+ * 送信箱
783
+ */
784
+ declare class PrivateMessageSentBox extends PrivateMessageCollection {
785
+ /**
786
+ * 送信箱のメッセージをすべて取得する
787
+ */
788
+ static acquire(client: Client): WikidotResultAsync<PrivateMessageSentBox>;
789
+ }
790
+ import { Element } from "domhandler";
791
+ /**
792
+ * フォーラム投稿データ
793
+ */
794
+ interface ForumPostData {
795
+ thread: ForumThreadRef;
796
+ id: number;
797
+ title: string;
798
+ text: string;
799
+ element: Element;
800
+ createdBy: AbstractUser;
801
+ createdAt: Date;
802
+ editedBy?: AbstractUser | null;
803
+ editedAt?: Date | null;
804
+ parentId?: number | null;
805
+ }
806
+ /**
807
+ * フォーラム投稿
808
+ */
809
+ declare class ForumPost {
810
+ readonly thread: ForumThreadRef;
811
+ readonly id: number;
812
+ title: string;
813
+ readonly text: string;
814
+ readonly element: Element;
815
+ readonly createdBy: AbstractUser;
816
+ readonly createdAt: Date;
817
+ readonly editedBy: AbstractUser | null;
818
+ readonly editedAt: Date | null;
819
+ private _parentId;
820
+ private _source;
821
+ constructor(data: ForumPostData);
822
+ /**
823
+ * 親投稿ID
824
+ */
825
+ get parentId(): number | null;
826
+ /**
827
+ * ソースコード(Wikidot記法)を取得
828
+ */
829
+ getSource(): WikidotResultAsync<string>;
830
+ /**
831
+ * 投稿を編集する
832
+ * @param source - 新しいソース(Wikidot記法)
833
+ * @param title - 新しいタイトル(省略時は現在のタイトルを維持)
834
+ */
835
+ edit(source: string, title?: string): WikidotResultAsync<void>;
836
+ toString(): string;
837
+ }
838
+ /**
839
+ * フォーラム投稿コレクション
840
+ */
841
+ declare class ForumPostCollection extends Array<ForumPost> {
842
+ readonly thread: ForumThreadRef;
843
+ constructor(thread: ForumThreadRef, posts?: ForumPost[]);
844
+ /**
845
+ * IDで検索
846
+ * @param id - 投稿ID
847
+ * @returns 投稿(存在しない場合はundefined)
848
+ */
849
+ findById(id: number): ForumPost | undefined;
850
+ /**
851
+ * HTMLから投稿をパースする(内部メソッド)
852
+ */
853
+ private static _parse;
854
+ /**
855
+ * スレッド内の全投稿を取得
856
+ */
857
+ static acquireAllInThread(thread: ForumThreadRef): WikidotResultAsync<ForumPostCollection>;
858
+ }
859
+ /**
860
+ * フォーラムスレッドデータ
861
+ */
862
+ interface ForumThreadData {
863
+ site: Site;
864
+ id: number;
865
+ title: string;
866
+ description: string;
867
+ createdBy: AbstractUser | null;
868
+ createdAt: Date;
869
+ postCount: number;
870
+ category?: ForumCategory | null;
871
+ }
872
+ /**
873
+ * フォーラムスレッド
874
+ */
875
+ declare class ForumThread2 {
876
+ readonly site: Site;
877
+ readonly id: number;
878
+ readonly title: string;
879
+ readonly description: string;
880
+ readonly createdBy: AbstractUser | null;
881
+ readonly createdAt: Date;
882
+ postCount: number;
883
+ readonly category: ForumCategory | null;
884
+ private _posts;
885
+ constructor(data: ForumThreadData);
886
+ /**
887
+ * スレッドURL
888
+ */
889
+ getUrl(): string;
890
+ /**
891
+ * 投稿一覧を取得
892
+ */
893
+ getPosts(): WikidotResultAsync<ForumPostCollection>;
894
+ /**
895
+ * スレッドに返信
896
+ */
897
+ reply(source: string, title?: string, parentPostId?: number | null): WikidotResultAsync<ForumThread2>;
898
+ toString(): string;
899
+ /**
900
+ * IDからスレッドを取得
901
+ */
902
+ static getFromId(site: Site, threadId: number, category?: ForumCategory | null): WikidotResultAsync<ForumThread2>;
903
+ }
904
+ /**
905
+ * フォーラムスレッドコレクション
906
+ */
907
+ declare class ForumThreadCollection extends Array<ForumThread2> {
908
+ readonly site: Site;
909
+ constructor(site: Site, threads?: ForumThread2[]);
910
+ /**
911
+ * IDで検索
912
+ */
913
+ findById(id: number): ForumThread2 | undefined;
914
+ /**
915
+ * カテゴリ内の全スレッドを取得
916
+ */
917
+ static acquireAllInCategory(category: ForumCategory): WikidotResultAsync<ForumThreadCollection>;
918
+ /**
919
+ * スレッドIDから単一のスレッドを取得
920
+ * @param site - サイト
921
+ * @param threadId - スレッドID
922
+ */
923
+ static fromId(site: Site, threadId: number): WikidotResultAsync<ForumThread2>;
924
+ /**
925
+ * スレッドIDからスレッドを取得
926
+ */
927
+ static acquireFromThreadIds(site: Site, threadIds: number[], category?: ForumCategory | null): WikidotResultAsync<ForumThreadCollection>;
928
+ }
929
+ /**
930
+ * フォーラムカテゴリデータ
931
+ */
932
+ interface ForumCategoryData {
933
+ site: Site;
934
+ id: number;
935
+ title: string;
936
+ description: string;
937
+ threadsCount: number;
938
+ postsCount: number;
939
+ }
940
+ /**
941
+ * フォーラムカテゴリ
942
+ */
943
+ declare class ForumCategory {
944
+ readonly site: Site;
945
+ readonly id: number;
946
+ readonly title: string;
947
+ readonly description: string;
948
+ readonly threadsCount: number;
949
+ readonly postsCount: number;
950
+ private _threads;
951
+ constructor(data: ForumCategoryData);
952
+ /**
953
+ * スレッド一覧を取得
954
+ */
955
+ getThreads(): WikidotResultAsync<ForumThreadCollection>;
956
+ /**
957
+ * スレッド一覧を再取得
958
+ */
959
+ reloadThreads(): WikidotResultAsync<ForumThreadCollection>;
960
+ /**
961
+ * スレッドを作成
962
+ */
963
+ createThread(title: string, description: string, source: string): WikidotResultAsync<ForumThread2>;
964
+ toString(): string;
965
+ }
966
+ /**
967
+ * フォーラムカテゴリコレクション
968
+ */
969
+ declare class ForumCategoryCollection extends Array<ForumCategory> {
970
+ readonly site: Site;
971
+ constructor(site: Site, categories?: ForumCategory[]);
972
+ /**
973
+ * IDで検索
974
+ */
975
+ findById(id: number): ForumCategory | undefined;
976
+ /**
977
+ * サイトの全カテゴリを取得
978
+ */
979
+ static acquireAll(site: Site): WikidotResultAsync<ForumCategoryCollection>;
980
+ }
981
+ /**
982
+ * QuickModuleモジュール名
983
+ */
984
+ type QuickModuleName = "MemberLookupQModule" | "UserLookupQModule" | "PageLookupQModule";
985
+ /**
986
+ * QuickModuleユーザー情報
987
+ */
988
+ interface QMCUser {
989
+ id: number;
990
+ name: string;
991
+ }
992
+ /**
993
+ * QuickModuleページ情報
994
+ */
995
+ interface QMCPage {
996
+ title: string;
997
+ unixName: string;
998
+ }
999
+ /**
1000
+ * サイトメンバーを検索
1001
+ * @param siteId - サイトID
1002
+ * @param query - 検索クエリ(ユーザー名の一部)
1003
+ * @returns マッチしたユーザー一覧
1004
+ */
1005
+ declare function memberLookup(siteId: number, query: string): WikidotResultAsync<QMCUser[]>;
1006
+ /**
1007
+ * Wikidot全体からユーザーを検索
1008
+ * @param siteId - サイトID(任意のサイトIDで可)
1009
+ * @param query - 検索クエリ(ユーザー名の一部)
1010
+ * @returns マッチしたユーザー一覧
1011
+ */
1012
+ declare function userLookup(siteId: number, query: string): WikidotResultAsync<QMCUser[]>;
1013
+ /**
1014
+ * サイト内のページを検索
1015
+ * @param siteId - サイトID
1016
+ * @param query - 検索クエリ(ページ名の一部)
1017
+ * @returns マッチしたページ一覧
1018
+ */
1019
+ declare function pageLookup(siteId: number, query: string): WikidotResultAsync<QMCPage[]>;
1020
+ /**
1021
+ * QuickModule API(後方互換性のため維持)
1022
+ * @deprecated 代わりに個別の関数(memberLookup, userLookup, pageLookup)を使用してください
1023
+ */
1024
+ declare const QuickModule: {
1025
+ memberLookup: typeof memberLookup;
1026
+ userLookup: typeof userLookup;
1027
+ pageLookup: typeof pageLookup;
1028
+ };
1029
+ /**
1030
+ * サイト参加申請データ
1031
+ */
1032
+ interface SiteApplicationData {
1033
+ site: Site;
1034
+ user: AbstractUser;
1035
+ text: string;
1036
+ }
1037
+ /**
1038
+ * サイト参加申請
1039
+ */
1040
+ declare class SiteApplication {
1041
+ readonly site: Site;
1042
+ readonly user: AbstractUser;
1043
+ readonly text: string;
1044
+ constructor(data: SiteApplicationData);
1045
+ /**
1046
+ * 未処理の参加申請をすべて取得する
1047
+ * @param site - 対象サイト
1048
+ */
1049
+ static acquireAll(site: Site): WikidotResultAsync<SiteApplication[]>;
1050
+ /**
1051
+ * 申請を処理する内部メソッド
1052
+ */
1053
+ private process;
1054
+ /**
1055
+ * 参加申請を承認する
1056
+ */
1057
+ accept(): WikidotResultAsync<void>;
1058
+ /**
1059
+ * 参加申請を拒否する
1060
+ */
1061
+ decline(): WikidotResultAsync<void>;
1062
+ toString(): string;
1063
+ }
1064
+ /**
1065
+ * サイトメンバーデータ
1066
+ */
1067
+ interface SiteMemberData {
1068
+ site: Site;
1069
+ user: AbstractUser;
1070
+ joinedAt: Date | null;
1071
+ }
1072
+ /**
1073
+ * サイトメンバー
1074
+ */
1075
+ declare class SiteMember {
1076
+ readonly site: Site;
1077
+ readonly user: AbstractUser;
1078
+ readonly joinedAt: Date | null;
1079
+ constructor(data: SiteMemberData);
1080
+ /**
1081
+ * HTMLからメンバー情報をパースする
1082
+ */
1083
+ private static parse;
1084
+ /**
1085
+ * サイトメンバー一覧を取得する
1086
+ * @param site - 対象サイト
1087
+ * @param group - グループ("admins", "moderators", または空文字で全メンバー)
1088
+ */
1089
+ static getMembers(site: Site, group?: "admins" | "moderators" | ""): WikidotResultAsync<SiteMember[]>;
1090
+ /**
1091
+ * グループ変更の内部メソッド
1092
+ */
1093
+ private changeGroup;
1094
+ /**
1095
+ * モデレーターに昇格
1096
+ */
1097
+ toModerator(): WikidotResultAsync<void>;
1098
+ /**
1099
+ * モデレーター権限を削除
1100
+ */
1101
+ removeModerator(): WikidotResultAsync<void>;
1102
+ /**
1103
+ * 管理者に昇格
1104
+ */
1105
+ toAdmin(): WikidotResultAsync<void>;
1106
+ /**
1107
+ * 管理者権限を削除
1108
+ */
1109
+ removeAdmin(): WikidotResultAsync<void>;
1110
+ toString(): string;
1111
+ }
1112
+ /**
1113
+ * サイトメンバー操作アクセサ
1114
+ */
1115
+ declare class MemberAccessor {
1116
+ readonly site: Site;
1117
+ constructor(site: Site);
1118
+ /**
1119
+ * 全メンバーを取得する
1120
+ * @returns メンバー一覧
1121
+ */
1122
+ getAll(): WikidotResultAsync<SiteMember[]>;
1123
+ /**
1124
+ * モデレーター一覧を取得する
1125
+ * @returns モデレーター一覧
1126
+ */
1127
+ getModerators(): WikidotResultAsync<SiteMember[]>;
1128
+ /**
1129
+ * 管理者一覧を取得する
1130
+ * @returns 管理者一覧
1131
+ */
1132
+ getAdmins(): WikidotResultAsync<SiteMember[]>;
1133
+ /**
1134
+ * 未処理の参加申請を取得する
1135
+ * @returns 参加申請一覧
1136
+ */
1137
+ getApplications(): WikidotResultAsync<SiteApplication[]>;
1138
+ /**
1139
+ * メンバーを検索する
1140
+ * @param query - 検索クエリ(ユーザー名の一部)
1141
+ * @returns マッチしたユーザー一覧(QMCUser形式)
1142
+ */
1143
+ lookup(query: string): WikidotResultAsync<QMCUser[]>;
1144
+ /**
1145
+ * ユーザーをサイトに招待する
1146
+ * @param user - 招待するユーザー
1147
+ * @param text - 招待メッセージ
1148
+ */
1149
+ invite(user: User, text: string): WikidotResultAsync<void>;
1150
+ }
1151
+ import * as cheerio from "cheerio";
1152
+ import { AnyNode } from "domhandler";
1153
+ /**
1154
+ * ページファイルデータ
1155
+ */
1156
+ interface PageFileData {
1157
+ page: Page;
1158
+ id: number;
1159
+ name: string;
1160
+ url: string;
1161
+ mimeType: string;
1162
+ size: number;
1163
+ }
1164
+ /**
1165
+ * ページ添付ファイル
1166
+ */
1167
+ declare class PageFile {
1168
+ readonly page: Page;
1169
+ readonly id: number;
1170
+ readonly name: string;
1171
+ readonly url: string;
1172
+ readonly mimeType: string;
1173
+ readonly size: number;
1174
+ constructor(data: PageFileData);
1175
+ toString(): string;
1176
+ }
1177
+ /**
1178
+ * ページファイルコレクション
1179
+ */
1180
+ declare class PageFileCollection extends Array<PageFile> {
1181
+ readonly page: Page;
1182
+ constructor(page: Page, files?: PageFile[]);
1183
+ /**
1184
+ * IDで検索
1185
+ */
1186
+ findById(id: number): PageFile | undefined;
1187
+ /**
1188
+ * 名前で検索
1189
+ */
1190
+ findByName(name: string): PageFile | undefined;
1191
+ /**
1192
+ * サイズ文字列をバイト数に変換
1193
+ */
1194
+ private static parseSize;
1195
+ /**
1196
+ * ページに添付されたファイル一覧を取得する
1197
+ */
1198
+ static acquire(page: Page): WikidotResultAsync<PageFileCollection>;
1199
+ }
1200
+ /**
1201
+ * ページメタタグデータ
1202
+ */
1203
+ interface PageMetaData {
1204
+ page: PageRef;
1205
+ name: string;
1206
+ content: string;
1207
+ }
1208
+ /**
1209
+ * ページメタタグ
1210
+ */
1211
+ declare class PageMeta {
1212
+ readonly page: PageRef;
1213
+ readonly name: string;
1214
+ content: string;
1215
+ constructor(data: PageMetaData);
1216
+ /**
1217
+ * メタタグの値を更新する
1218
+ * @param content - 新しい値
1219
+ */
1220
+ update(content: string): WikidotResultAsync<void>;
1221
+ /**
1222
+ * メタタグを削除する
1223
+ */
1224
+ delete(): WikidotResultAsync<void>;
1225
+ toString(): string;
1226
+ }
1227
+ /**
1228
+ * ページメタタグコレクション
1229
+ */
1230
+ declare class PageMetaCollection extends Array<PageMeta> {
1231
+ readonly page: PageRef;
1232
+ constructor(page: PageRef, metas?: PageMeta[]);
1233
+ /**
1234
+ * 名前で検索
1235
+ * @param name - メタタグ名
1236
+ * @returns メタタグ(存在しない場合はundefined)
1237
+ */
1238
+ findByName(name: string): PageMeta | undefined;
1239
+ /**
1240
+ * ページのメタタグを取得する
1241
+ * @param page - ページ参照
1242
+ * @returns メタタグコレクション
1243
+ */
1244
+ static acquire(page: PageRef): WikidotResultAsync<PageMetaCollection>;
1245
+ /**
1246
+ * メタタグを設定する
1247
+ * @param page - ページ参照
1248
+ * @param name - メタタグ名
1249
+ * @param content - メタタグの値
1250
+ */
1251
+ static setMeta(page: PageRef, name: string, content: string): WikidotResultAsync<void>;
1252
+ /**
1253
+ * メタタグを削除する
1254
+ * @param page - ページ参照
1255
+ * @param name - メタタグ名
1256
+ */
1257
+ static deleteMeta(page: PageRef, name: string): WikidotResultAsync<void>;
1258
+ }
1259
+ /**
1260
+ * ページソースデータ
1261
+ */
1262
+ interface PageSourceData {
1263
+ page: Page;
1264
+ wikiText: string;
1265
+ }
1266
+ /**
1267
+ * ページのソースコード(Wikidot記法)
1268
+ */
1269
+ declare class PageSource {
1270
+ /** ソースが属するページ */
1271
+ readonly page: Page;
1272
+ /** ソースコード(Wikidot記法) */
1273
+ readonly wikiText: string;
1274
+ constructor(data: PageSourceData);
1275
+ toString(): string;
1276
+ }
1277
+ /**
1278
+ * ページリビジョンデータ
1279
+ */
1280
+ interface PageRevisionData {
1281
+ page: Page;
1282
+ id: number;
1283
+ revNo: number;
1284
+ createdBy: AbstractUser;
1285
+ createdAt: Date;
1286
+ comment: string;
1287
+ }
1288
+ /**
1289
+ * ページのリビジョン(編集履歴のバージョン)
1290
+ */
1291
+ declare class PageRevision {
1292
+ /** リビジョンが属するページ */
1293
+ readonly page: Page;
1294
+ /** リビジョンID */
1295
+ readonly id: number;
1296
+ /** リビジョン番号 */
1297
+ readonly revNo: number;
1298
+ /** リビジョン作成者 */
1299
+ readonly createdBy: AbstractUser;
1300
+ /** リビジョン作成日時 */
1301
+ readonly createdAt: Date;
1302
+ /** 編集コメント */
1303
+ readonly comment: string;
1304
+ /** ソースコード(内部キャッシュ) */
1305
+ private _source;
1306
+ /** HTML表示(内部キャッシュ) */
1307
+ private _html;
1308
+ constructor(data: PageRevisionData);
1309
+ /**
1310
+ * ソースコードが取得済みかどうか
1311
+ */
1312
+ isSourceAcquired(): boolean;
1313
+ /**
1314
+ * HTML表示が取得済みかどうか
1315
+ */
1316
+ isHtmlAcquired(): boolean;
1317
+ /**
1318
+ * ソースコード(キャッシュ済み)を取得
1319
+ */
1320
+ get source(): PageSource | null;
1321
+ /**
1322
+ * ソースコードを設定
1323
+ */
1324
+ set source(value: PageSource | null);
1325
+ /**
1326
+ * HTML表示(キャッシュ済み)を取得
1327
+ */
1328
+ get html(): string | null;
1329
+ /**
1330
+ * HTML表示を設定
1331
+ */
1332
+ set html(value: string | null);
1333
+ /**
1334
+ * リビジョンのソースを取得する(REV-001)
1335
+ * @returns ソース文字列
1336
+ */
1337
+ getSource(): WikidotResultAsync<string>;
1338
+ /**
1339
+ * リビジョンのHTMLを取得する(REV-002)
1340
+ * @returns HTML文字列
1341
+ */
1342
+ getHtml(): WikidotResultAsync<string>;
1343
+ toString(): string;
1344
+ }
1345
+ /**
1346
+ * ページリビジョンコレクション
1347
+ */
1348
+ declare class PageRevisionCollection extends Array<PageRevision> {
1349
+ readonly page: Page | null;
1350
+ constructor(page: Page | null, revisions?: PageRevision[]);
1351
+ /**
1352
+ * IDで検索
1353
+ * @param id - リビジョンID
1354
+ * @returns リビジョン(存在しない場合はundefined)
1355
+ */
1356
+ findById(id: number): PageRevision | undefined;
1357
+ /**
1358
+ * 全リビジョンのソースを一括取得する
1359
+ * @returns ソース文字列の配列
1360
+ */
1361
+ getSources(): WikidotResultAsync<string[]>;
1362
+ /**
1363
+ * 全リビジョンのHTMLを一括取得する
1364
+ * @returns HTML文字列の配列
1365
+ */
1366
+ getHtmls(): WikidotResultAsync<string[]>;
1367
+ }
1368
+ /**
1369
+ * ページ投票データ
1370
+ */
1371
+ interface PageVoteData {
1372
+ page: Page;
1373
+ user: AbstractUser;
1374
+ value: number;
1375
+ }
1376
+ /**
1377
+ * ページへの投票(レーティング)
1378
+ */
1379
+ declare class PageVote {
1380
+ /** 投票が属するページ */
1381
+ readonly page: Page;
1382
+ /** 投票したユーザー */
1383
+ readonly user: AbstractUser;
1384
+ /** 投票値(+1/-1 または 数値) */
1385
+ readonly value: number;
1386
+ constructor(data: PageVoteData);
1387
+ toString(): string;
1388
+ }
1389
+ /**
1390
+ * ページ投票コレクション
1391
+ */
1392
+ declare class PageVoteCollection extends Array<PageVote> {
1393
+ readonly page: Page;
1394
+ constructor(page: Page, votes?: PageVote[]);
1395
+ /**
1396
+ * ユーザーで検索
1397
+ * @param user - 検索するユーザー
1398
+ * @returns 投票(存在しない場合はundefined)
1399
+ */
1400
+ findByUser(user: AbstractUser): PageVote | undefined;
1401
+ }
1402
+ /**
1403
+ * ページ検索クエリのパラメータ
1404
+ */
1405
+ interface SearchPagesQueryParams {
1406
+ /** ページタイプ(例: 'normal', 'admin') */
1407
+ pagetype?: string;
1408
+ /** カテゴリ名 */
1409
+ category?: string;
1410
+ /** 検索対象タグ(AND条件) */
1411
+ tags?: string | string[];
1412
+ /** 親ページ名 */
1413
+ parent?: string;
1414
+ /** リンク先ページ名 */
1415
+ linkTo?: string;
1416
+ /** 作成日時条件 */
1417
+ createdAt?: string;
1418
+ /** 更新日時条件 */
1419
+ updatedAt?: string;
1420
+ /** 作成者 */
1421
+ createdBy?: AbstractUser | string;
1422
+ /** レーティング条件 */
1423
+ rating?: string;
1424
+ /** 投票数条件 */
1425
+ votes?: string;
1426
+ /** ページ名条件 */
1427
+ name?: string;
1428
+ /** フルネーム(完全一致) */
1429
+ fullname?: string;
1430
+ /** 範囲指定 */
1431
+ range?: string;
1432
+ /** ソート順(例: 'created_at desc') */
1433
+ order?: string;
1434
+ /** 取得開始位置 */
1435
+ offset?: number;
1436
+ /** 取得件数制限 */
1437
+ limit?: number;
1438
+ /** 1ページあたり件数 */
1439
+ perPage?: number;
1440
+ /** 個別表示 */
1441
+ separate?: string;
1442
+ /** ラッパー表示 */
1443
+ wrapper?: string;
1444
+ }
1445
+ /**
1446
+ * デフォルトの1ページあたり件数
1447
+ */
1448
+ declare const DEFAULT_PER_PAGE = 250;
1449
+ /**
1450
+ * デフォルトのモジュールボディフィールド
1451
+ */
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
+ /**
1454
+ * ページ検索クエリ
1455
+ */
1456
+ declare class SearchPagesQuery {
1457
+ /** ページタイプ */
1458
+ pagetype: string;
1459
+ /** カテゴリ */
1460
+ category: string;
1461
+ /** タグ */
1462
+ tags: string | string[] | null;
1463
+ /** 親ページ */
1464
+ parent: string | null;
1465
+ /** リンク先 */
1466
+ linkTo: string | null;
1467
+ /** 作成日時条件 */
1468
+ createdAt: string | null;
1469
+ /** 更新日時条件 */
1470
+ updatedAt: string | null;
1471
+ /** 作成者 */
1472
+ createdBy: AbstractUser | string | null;
1473
+ /** レーティング条件 */
1474
+ rating: string | null;
1475
+ /** 投票数条件 */
1476
+ votes: string | null;
1477
+ /** ページ名条件 */
1478
+ name: string | null;
1479
+ /** フルネーム条件 */
1480
+ fullname: string | null;
1481
+ /** 範囲 */
1482
+ range: string | null;
1483
+ /** ソート順 */
1484
+ order: string;
1485
+ /** オフセット */
1486
+ offset: number;
1487
+ /** 取得件数制限 */
1488
+ limit: number | null;
1489
+ /** 1ページあたり件数 */
1490
+ perPage: number;
1491
+ /** 個別表示 */
1492
+ separate: string;
1493
+ /** ラッパー表示 */
1494
+ wrapper: string;
1495
+ constructor(params?: SearchPagesQueryParams);
1496
+ /**
1497
+ * 辞書形式に変換
1498
+ */
1499
+ asDict(): Record<string, unknown>;
1500
+ }
1501
+ /**
1502
+ * ページデータ
1503
+ */
1504
+ interface PageData {
1505
+ site: Site;
1506
+ fullname: string;
1507
+ name: string;
1508
+ category: string;
1509
+ title: string;
1510
+ childrenCount: number;
1511
+ commentsCount: number;
1512
+ size: number;
1513
+ rating: number;
1514
+ votesCount: number;
1515
+ ratingPercent: number | null;
1516
+ revisionsCount: number;
1517
+ parentFullname: string | null;
1518
+ tags: string[];
1519
+ createdBy: AbstractUser | null;
1520
+ createdAt: Date;
1521
+ updatedBy: AbstractUser | null;
1522
+ updatedAt: Date;
1523
+ commentedBy: AbstractUser | null;
1524
+ commentedAt: Date | null;
1525
+ }
1526
+ /**
1527
+ * Wikidotページ
1528
+ */
1529
+ declare class Page {
1530
+ readonly site: Site;
1531
+ readonly fullname: string;
1532
+ readonly name: string;
1533
+ readonly category: string;
1534
+ title: string;
1535
+ childrenCount: number;
1536
+ commentsCount: number;
1537
+ size: number;
1538
+ rating: number;
1539
+ votesCount: number;
1540
+ ratingPercent: number | null;
1541
+ revisionsCount: number;
1542
+ parentFullname: string | null;
1543
+ tags: string[];
1544
+ readonly createdBy: AbstractUser | null;
1545
+ readonly createdAt: Date;
1546
+ updatedBy: AbstractUser | null;
1547
+ updatedAt: Date;
1548
+ commentedBy: AbstractUser | null;
1549
+ commentedAt: Date | null;
1550
+ private _id;
1551
+ private _source;
1552
+ private _revisions;
1553
+ private _votes;
1554
+ constructor(data: PageData);
1555
+ /**
1556
+ * ページURLを取得
1557
+ */
1558
+ getUrl(): string;
1559
+ /**
1560
+ * ページIDが取得済みかどうか
1561
+ */
1562
+ isIdAcquired(): boolean;
1563
+ /**
1564
+ * ページIDを取得
1565
+ */
1566
+ get id(): number | null;
1567
+ /**
1568
+ * ページIDを設定
1569
+ */
1570
+ set id(value: number | null);
1571
+ /**
1572
+ * ソースコードを取得
1573
+ */
1574
+ get source(): PageSource | null;
1575
+ /**
1576
+ * ソースコードを設定
1577
+ */
1578
+ set source(value: PageSource | null);
1579
+ /**
1580
+ * リビジョン履歴を取得
1581
+ */
1582
+ get revisions(): PageRevisionCollection | null;
1583
+ /**
1584
+ * リビジョン履歴を設定
1585
+ */
1586
+ set revisions(value: PageRevisionCollection | null);
1587
+ /**
1588
+ * 投票情報を取得
1589
+ */
1590
+ get votes(): PageVoteCollection | null;
1591
+ /**
1592
+ * 投票情報を設定
1593
+ */
1594
+ set votes(value: PageVoteCollection | null);
1595
+ /**
1596
+ * 最新リビジョンを取得
1597
+ */
1598
+ get latestRevision(): PageRevision | undefined;
1599
+ /**
1600
+ * ページIDが必須の操作で、IDがない場合にエラーを返すヘルパー
1601
+ * @param operation - 操作名(エラーメッセージ用)
1602
+ * @returns ページIDまたはエラーResult
1603
+ */
1604
+ private requireId;
1605
+ /**
1606
+ * ページを削除する
1607
+ */
1608
+ destroy(): WikidotResultAsync<void>;
1609
+ /**
1610
+ * タグを保存する
1611
+ */
1612
+ commitTags(): WikidotResultAsync<void>;
1613
+ /**
1614
+ * 親ページを設定する
1615
+ * @param parentFullname - 親ページのフルネーム(nullで解除)
1616
+ */
1617
+ setParent(parentFullname: string | null): WikidotResultAsync<void>;
1618
+ /**
1619
+ * ページに投票する
1620
+ * @param value - 投票値
1621
+ * @returns 新しいレーティング
1622
+ */
1623
+ vote(value: number): WikidotResultAsync<number>;
1624
+ /**
1625
+ * 投票をキャンセルする
1626
+ * @returns 新しいレーティング
1627
+ */
1628
+ cancelVote(): WikidotResultAsync<number>;
1629
+ /**
1630
+ * ページを編集する
1631
+ * @param options - 編集オプション
1632
+ */
1633
+ edit(options: {
1634
+ title?: string;
1635
+ source?: string;
1636
+ comment?: string;
1637
+ forceEdit?: boolean;
1638
+ }): WikidotResultAsync<void>;
1639
+ /**
1640
+ * ページ名を変更する
1641
+ * @param newFullname - 新しいフルネーム
1642
+ */
1643
+ rename(newFullname: string): WikidotResultAsync<void>;
1644
+ /**
1645
+ * ページに添付されたファイル一覧を取得する
1646
+ */
1647
+ getFiles(): WikidotResultAsync<PageFileCollection>;
1648
+ /**
1649
+ * ページのディスカッションスレッドを取得する
1650
+ */
1651
+ getDiscussion(): WikidotResultAsync<import("../forum").ForumThread | null>;
1652
+ /**
1653
+ * ページのメタタグ一覧を取得する
1654
+ * @returns メタタグコレクション
1655
+ */
1656
+ getMetas(): WikidotResultAsync<PageMetaCollection>;
1657
+ /**
1658
+ * メタタグを設定する
1659
+ * @param name - メタタグ名
1660
+ * @param content - メタタグの値
1661
+ */
1662
+ setMeta(name: string, content: string): WikidotResultAsync<void>;
1663
+ /**
1664
+ * メタタグを削除する
1665
+ * @param name - メタタグ名
1666
+ */
1667
+ deleteMeta(name: string): WikidotResultAsync<void>;
1668
+ toString(): string;
1669
+ }
1670
+ /**
1671
+ * ページコレクション
1672
+ */
1673
+ declare class PageCollection extends Array<Page> {
1674
+ readonly site: Site;
1675
+ constructor(site: Site, pages?: Page[]);
1676
+ /**
1677
+ * フルネームで検索
1678
+ * @param fullname - ページのフルネーム
1679
+ * @returns ページ(存在しない場合はundefined)
1680
+ */
1681
+ findByFullname(fullname: string): Page | undefined;
1682
+ /**
1683
+ * ページIDを一括取得
1684
+ */
1685
+ getPageIds(): WikidotResultAsync<PageCollection>;
1686
+ /**
1687
+ * ページソースを一括取得
1688
+ */
1689
+ getPageSources(): WikidotResultAsync<PageCollection>;
1690
+ /**
1691
+ * ページリビジョンを一括取得
1692
+ */
1693
+ getPageRevisions(): WikidotResultAsync<PageCollection>;
1694
+ /**
1695
+ * ページ投票を一括取得
1696
+ */
1697
+ getPageVotes(): WikidotResultAsync<PageCollection>;
1698
+ /**
1699
+ * ページIDを一括取得する内部メソッド
1700
+ */
1701
+ static acquirePageIds(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
1702
+ /**
1703
+ * ページソースを一括取得する内部メソッド
1704
+ */
1705
+ static acquirePageSources(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
1706
+ /**
1707
+ * ページリビジョンを一括取得する内部メソッド
1708
+ */
1709
+ static acquirePageRevisions(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
1710
+ /**
1711
+ * ページ投票を一括取得する内部メソッド
1712
+ */
1713
+ static acquirePageVotes(site: Site, pages: Page[]): WikidotResultAsync<PageCollection>;
1714
+ /**
1715
+ * ListPagesModuleレスポンスをパース
1716
+ */
1717
+ static parse(site: Site, htmlBody: cheerio.CheerioAPI, _parseUser: (element: cheerio.Cheerio<AnyNode>) => AbstractUser): PageCollection;
1718
+ /**
1719
+ * ページ検索
1720
+ */
1721
+ static searchPages(site: Site, parseUser: (element: cheerio.Cheerio<AnyNode>) => AbstractUser, query?: SearchPagesQuery | null): WikidotResultAsync<PageCollection>;
1722
+ /**
1723
+ * ページを作成または編集
1724
+ */
1725
+ static createOrEdit(site: Site, fullname: string, options?: {
1726
+ pageId?: number | null;
1727
+ title?: string;
1728
+ source?: string;
1729
+ comment?: string;
1730
+ forceEdit?: boolean;
1731
+ raiseOnExists?: boolean;
1732
+ }): WikidotResultAsync<void>;
1733
+ }
1734
+ /**
1735
+ * サイト変更履歴データ
1736
+ */
1737
+ interface SiteChangeData {
1738
+ site: Site;
1739
+ pageFullname: string;
1740
+ pageTitle: string;
1741
+ revisionNo: number;
1742
+ changedBy: AbstractUser | null;
1743
+ changedAt: Date | null;
1744
+ flags: string[];
1745
+ comment: string;
1746
+ }
1747
+ /**
1748
+ * サイト変更履歴
1749
+ */
1750
+ declare class SiteChange {
1751
+ readonly site: Site;
1752
+ readonly pageFullname: string;
1753
+ readonly pageTitle: string;
1754
+ readonly revisionNo: number;
1755
+ readonly changedBy: AbstractUser | null;
1756
+ readonly changedAt: Date | null;
1757
+ readonly flags: string[];
1758
+ readonly comment: string;
1759
+ constructor(data: SiteChangeData);
1760
+ /**
1761
+ * ページURL
1762
+ */
1763
+ getPageUrl(): string;
1764
+ toString(): string;
1765
+ }
1766
+ /**
1767
+ * サイト変更履歴コレクション
1768
+ */
1769
+ declare class SiteChangeCollection extends Array<SiteChange> {
1770
+ readonly site: Site;
1771
+ constructor(site: Site, changes?: SiteChange[]);
1772
+ /**
1773
+ * 最近の変更履歴を取得する
1774
+ * @param site - サイト
1775
+ * @param options - オプション
1776
+ * @returns 変更履歴コレクション
1777
+ */
1778
+ static acquire(site: Site, options?: {
1779
+ perPage?: number;
1780
+ page?: number;
1781
+ limit?: number;
1782
+ }): WikidotResultAsync<SiteChangeCollection>;
1783
+ }
1784
+ /**
1785
+ * 単一ページ操作アクセサ
1786
+ */
1787
+ declare class PageAccessor {
1788
+ readonly site: Site;
1789
+ constructor(site: Site);
1790
+ /**
1791
+ * UNIX名からページを取得する
1792
+ * @param unixName - ページのUNIX名(例: 'scp-173')
1793
+ * @returns ページ(存在しない場合はnull)
1794
+ */
1795
+ get(unixName: string): WikidotResultAsync<Page | null>;
1796
+ /**
1797
+ * ページを作成する
1798
+ * @param fullname - ページのフルネーム(例: 'scp-173')
1799
+ * @param options - 作成オプション
1800
+ * @returns void
1801
+ */
1802
+ create(fullname: string, options?: {
1803
+ title?: string;
1804
+ source?: string;
1805
+ comment?: string;
1806
+ forceEdit?: boolean;
1807
+ }): WikidotResultAsync<void>;
1808
+ }
1809
+ /**
1810
+ * ページ一覧操作アクセサ
1811
+ */
1812
+ declare class PagesAccessor {
1813
+ readonly site: Site;
1814
+ constructor(site: Site);
1815
+ /**
1816
+ * 条件に合うページを検索する
1817
+ * @param params - 検索条件
1818
+ * @returns ページコレクション
1819
+ */
1820
+ search(params?: SearchPagesQueryParams): WikidotResultAsync<PageCollection>;
1821
+ /**
1822
+ * 全ページを取得する
1823
+ * @returns ページコレクション
1824
+ */
1825
+ all(): WikidotResultAsync<PageCollection>;
1826
+ /**
1827
+ * 最近の変更履歴を取得する
1828
+ * @param options - オプション
1829
+ * @param options.perPage - 1ページあたりの件数(デフォルト: 20)
1830
+ * @param options.page - ページ番号(デフォルト: 1)
1831
+ * @returns 変更履歴コレクション
1832
+ */
1833
+ getRecentChanges(options?: {
1834
+ perPage?: number;
1835
+ page?: number;
1836
+ }): WikidotResultAsync<SiteChangeCollection>;
1837
+ }
1838
+ /**
1839
+ * サイトデータ
1840
+ */
1841
+ interface SiteData {
1842
+ id: number;
1843
+ title: string;
1844
+ unixName: string;
1845
+ domain: string;
1846
+ sslSupported: boolean;
1847
+ }
1848
+ /**
1849
+ * サイトクラス
1850
+ */
1851
+ declare class Site {
1852
+ readonly client: Client;
1853
+ /** サイトID */
1854
+ readonly id: number;
1855
+ /** サイトタイトル */
1856
+ readonly title: string;
1857
+ /** UNIX名(例: scp-jp) */
1858
+ readonly unixName: string;
1859
+ /** ドメイン */
1860
+ readonly domain: string;
1861
+ /** SSL対応フラグ */
1862
+ readonly sslSupported: boolean;
1863
+ /** ページアクセサ */
1864
+ private _page;
1865
+ /** ページ一覧アクセサ */
1866
+ private _pages;
1867
+ /** フォーラムアクセサ */
1868
+ private _forum;
1869
+ /** メンバーアクセサ */
1870
+ private _member;
1871
+ constructor(client: Client, data: SiteData);
1872
+ /**
1873
+ * ページアクセサを取得
1874
+ */
1875
+ get page(): PageAccessor;
1876
+ /**
1877
+ * ページ一覧アクセサを取得
1878
+ */
1879
+ get pages(): PagesAccessor;
1880
+ /**
1881
+ * フォーラムアクセサを取得
1882
+ */
1883
+ get forum(): ForumAccessor;
1884
+ /**
1885
+ * メンバーアクセサを取得
1886
+ */
1887
+ get member(): MemberAccessor;
1888
+ /**
1889
+ * サイトのベースURLを取得
1890
+ */
1891
+ getBaseUrl(): string;
1892
+ /**
1893
+ * サイトへのAMCリクエストを実行
1894
+ * @param bodies - リクエストボディ配列
1895
+ * @returns AMCレスポンス配列
1896
+ */
1897
+ amcRequest(bodies: AMCRequestBody[]): WikidotResultAsync<AMCResponse[]>;
1898
+ /**
1899
+ * 単一のAMCリクエストを実行
1900
+ * @param body - リクエストボディ
1901
+ * @returns AMCレスポンス
1902
+ */
1903
+ amcRequestSingle(body: AMCRequestBody): WikidotResultAsync<AMCResponse>;
1904
+ /**
1905
+ * UNIX名からサイトを取得する
1906
+ * @param client - クライアント
1907
+ * @param unixName - サイトのUNIX名(例: 'scp-jp')
1908
+ * @returns サイト
1909
+ */
1910
+ static fromUnixName(client: Client, unixName: string): WikidotResultAsync<Site>;
1911
+ toString(): string;
1912
+ }
1913
+ /**
1914
+ * フォーラム操作アクセサ
1915
+ */
1916
+ declare class ForumAccessor {
1917
+ readonly site: Site;
1918
+ constructor(site: Site);
1919
+ /**
1920
+ * フォーラムカテゴリ一覧を取得
1921
+ * @returns カテゴリ一覧
1922
+ */
1923
+ getCategories(): WikidotResultAsync<ForumCategoryCollection>;
1924
+ /**
1925
+ * スレッドを取得
1926
+ * @param threadId - スレッドID
1927
+ * @returns スレッド
1928
+ */
1929
+ getThread(threadId: number): WikidotResultAsync<ForumThread2>;
1930
+ /**
1931
+ * 複数スレッドを取得
1932
+ * @param threadIds - スレッドID配列
1933
+ * @returns スレッドコレクション
1934
+ */
1935
+ getThreads(threadIds: number[]): WikidotResultAsync<ForumThreadCollection>;
1936
+ }
1937
+ /**
1938
+ * サイト操作アクセサ
1939
+ */
1940
+ declare class SiteAccessor {
1941
+ readonly client: Client;
1942
+ constructor(client: Client);
1943
+ /**
1944
+ * UNIX名からサイトを取得する
1945
+ * @param unixName - サイトのUNIX名(例: 'scp-jp')
1946
+ * @returns サイトオブジェクト
1947
+ */
1948
+ get(unixName: string): WikidotResultAsync<Site>;
1949
+ }
1950
+ /**
1951
+ * ユーザー取得オプション
1952
+ */
1953
+ interface GetUserOptions {
1954
+ /** ユーザーが見つからない場合にエラーを発生させる(デフォルト: false) */
1955
+ raiseWhenNotFound?: boolean;
1956
+ }
1957
+ /**
1958
+ * ユーザー操作アクセサ
1959
+ */
1960
+ declare class UserAccessor {
1961
+ readonly client: Client;
1962
+ constructor(client: Client);
1963
+ /**
1964
+ * ユーザー名からユーザーを取得する
1965
+ * @param name - ユーザー名
1966
+ * @param options - 取得オプション
1967
+ * @returns ユーザー(存在しない場合はnull、raiseWhenNotFoundがtrueの場合はエラー)
1968
+ */
1969
+ get(name: string, options?: GetUserOptions): WikidotResultAsync<User | null>;
1970
+ /**
1971
+ * 複数ユーザー名からユーザーを取得する
1972
+ * @param names - ユーザー名配列
1973
+ * @param options - 取得オプション
1974
+ * @returns ユーザーコレクション(存在しないユーザーはnull、raiseWhenNotFoundがtrueの場合はエラー)
1975
+ */
1976
+ getMany(names: string[], options?: GetUserOptions): WikidotResultAsync<UserCollection>;
1977
+ }
1978
+ /**
1979
+ * クライアント作成オプション
1980
+ */
1981
+ interface ClientOptions {
1982
+ /** Wikidotユーザー名 */
1983
+ username?: string;
1984
+ /** Wikidotパスワード */
1985
+ password?: string;
1986
+ /** ベースドメイン(デフォルト: wikidot.com) */
1987
+ domain?: string;
1988
+ /** AMC設定オーバーライド */
1989
+ amcConfig?: Partial<AMCConfig>;
1990
+ }
1991
+ /**
1992
+ * Wikidotクライアント
1993
+ * ライブラリのメインエントリポイント
1994
+ */
1995
+ declare class Client {
1996
+ /** AMCクライアント */
1997
+ readonly amcClient: AMCClient;
1998
+ /** ベースドメイン */
1999
+ readonly domain: string;
2000
+ /** ユーザー操作アクセサ */
2001
+ readonly user: UserAccessor;
2002
+ /** サイト操作アクセサ */
2003
+ readonly site: SiteAccessor;
2004
+ /** プライベートメッセージ操作アクセサ */
2005
+ readonly privateMessage: PrivateMessageAccessor;
2006
+ /** ログイン中のユーザー名 */
2007
+ private _username;
2008
+ /** ログイン中のユーザー */
2009
+ private _me;
2010
+ /**
2011
+ * プライベートコンストラクタ
2012
+ * createメソッドを使用してインスタンスを作成する
2013
+ */
2014
+ private constructor();
2015
+ /**
2016
+ * ログイン中のユーザー名を取得
2017
+ */
2018
+ get username(): string | null;
2019
+ /**
2020
+ * ログイン中のユーザーを取得
2021
+ * ログインしていない場合はnull
2022
+ */
2023
+ get me(): User | null;
2024
+ /**
2025
+ * クライアントを作成する
2026
+ * @param options - クライアントオプション
2027
+ * @returns クライアントインスタンス
2028
+ */
2029
+ static create(options?: ClientOptions): WikidotResultAsync<Client>;
2030
+ /**
2031
+ * 未認証クライアントを作成する
2032
+ * @param options - クライアントオプション(認証情報以外)
2033
+ * @returns クライアントインスタンス
2034
+ */
2035
+ static createAnonymous(options?: Omit<ClientOptions, "username" | "password">): Client;
2036
+ /**
2037
+ * ログイン状態を確認する
2038
+ * @returns ログイン済みならtrue
2039
+ */
2040
+ isLoggedIn(): boolean;
2041
+ /**
2042
+ * ログインを要求する
2043
+ * ログイン済みでない場合はLoginRequiredErrorを返す
2044
+ * @returns 成功時はvoid
2045
+ */
2046
+ requireLogin(): WikidotResult<void>;
2047
+ /**
2048
+ * クライアントをクローズする
2049
+ * セッションがある場合はログアウトを試みる
2050
+ */
2051
+ close(): WikidotResultAsync<void>;
2052
+ }
2053
+ /**
2054
+ * プライベートメッセージ操作アクセサ
2055
+ */
2056
+ declare class PrivateMessageAccessor {
2057
+ readonly client: Client;
2058
+ constructor(client: Client);
2059
+ /**
2060
+ * メッセージIDからメッセージを取得する
2061
+ * @param id - メッセージID
2062
+ * @returns メッセージオブジェクト
2063
+ */
2064
+ get(id: number): WikidotResultAsync<PrivateMessage>;
2065
+ /**
2066
+ * 複数のメッセージIDからメッセージを取得する
2067
+ * @param ids - メッセージID配列
2068
+ * @returns メッセージコレクション
2069
+ */
2070
+ getMessages(ids: number[]): WikidotResultAsync<PrivateMessageCollection>;
2071
+ /**
2072
+ * 受信箱のメッセージ一覧を取得する
2073
+ * @returns 受信箱
2074
+ */
2075
+ inbox(): WikidotResultAsync<PrivateMessageInbox>;
2076
+ /**
2077
+ * 送信箱のメッセージ一覧を取得する
2078
+ * @returns 送信箱
2079
+ */
2080
+ sentBox(): WikidotResultAsync<PrivateMessageSentBox>;
2081
+ /**
2082
+ * プライベートメッセージを送信する
2083
+ * @param recipient - 受信者
2084
+ * @param subject - 件名
2085
+ * @param body - 本文
2086
+ */
2087
+ send(recipient: User, subject: string, body: string): WikidotResultAsync<void>;
2088
+ }
2089
+ import * as cheerio2 from "cheerio";
2090
+ import { AnyNode as AnyNode2 } from "domhandler";
2091
+ /**
2092
+ * printuser要素をパースし、ユーザーオブジェクトを返す
2093
+ *
2094
+ * @param client - Wikidotクライアント
2095
+ * @param elem - パース対象の要素(printuserクラスがついた要素)
2096
+ * @returns パースされて得られたユーザーオブジェクト
2097
+ */
2098
+ declare function parseUser2(client: ClientRef, elem: cheerio2.Cheerio<AnyNode2>): AbstractUser;
2099
+ /**
2100
+ * odate要素から日時をパースする
2101
+ *
2102
+ * @param elem - パース対象の要素(odate要素)
2103
+ * @returns パースされたDate、パース失敗時はnull
2104
+ */
2105
+ declare function parseOdate(elem: cheerio2.Cheerio<AnyNode2>): Date | null;
2106
+ 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 };