@book000/pixivts 0.55.1 → 0.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -19
- package/dist/index.cjs +1321 -0
- package/dist/index.d.cts +1662 -0
- package/dist/index.d.ts +1662 -45
- package/dist/index.js +1308 -65
- package/package.json +35 -72
- package/dist/checks.d.ts +0 -19
- package/dist/checks.d.ts.map +0 -1
- package/dist/checks.js +0 -85
- package/dist/checks.js.map +0 -1
- package/dist/checks.test.d.ts +0 -2
- package/dist/checks.test.d.ts.map +0 -1
- package/dist/checks.test.js +0 -306
- package/dist/checks.test.js.map +0 -1
- package/dist/http-client.d.ts +0 -66
- package/dist/http-client.d.ts.map +0 -1
- package/dist/http-client.js +0 -138
- package/dist/http-client.js.map +0 -1
- package/dist/http-client.test.d.ts +0 -2
- package/dist/http-client.test.d.ts.map +0 -1
- package/dist/http-client.test.js +0 -149
- package/dist/http-client.test.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/options.d.ts +0 -317
- package/dist/options.d.ts.map +0 -1
- package/dist/options.js +0 -222
- package/dist/options.js.map +0 -1
- package/dist/options.test.d.ts +0 -2
- package/dist/options.test.d.ts.map +0 -1
- package/dist/options.test.js +0 -117
- package/dist/options.test.js.map +0 -1
- package/dist/pixiv.d.ts +0 -317
- package/dist/pixiv.d.ts.map +0 -1
- package/dist/pixiv.js +0 -810
- package/dist/pixiv.js.map +0 -1
- package/dist/pixiv.test.d.ts +0 -2
- package/dist/pixiv.test.d.ts.map +0 -1
- package/dist/pixiv.test.js +0 -883
- package/dist/pixiv.test.js.map +0 -1
- package/dist/saving-responses/index.d.ts +0 -130
- package/dist/saving-responses/index.d.ts.map +0 -1
- package/dist/saving-responses/index.js +0 -263
- package/dist/saving-responses/index.js.map +0 -1
- package/dist/saving-responses/index.test.d.ts +0 -2
- package/dist/saving-responses/index.test.d.ts.map +0 -1
- package/dist/saving-responses/index.test.js +0 -468
- package/dist/saving-responses/index.test.js.map +0 -1
- package/dist/saving-responses/response-entity.d.ts +0 -16
- package/dist/saving-responses/response-entity.d.ts.map +0 -1
- package/dist/saving-responses/response-entity.js +0 -101
- package/dist/saving-responses/response-entity.js.map +0 -1
- package/dist/types/endpoints/v1/illust/bookmark/delete.d.ts +0 -14
- package/dist/types/endpoints/v1/illust/bookmark/delete.d.ts.map +0 -1
- package/dist/types/endpoints/v1/illust/bookmark/delete.js +0 -3
- package/dist/types/endpoints/v1/illust/bookmark/delete.js.map +0 -1
- package/dist/types/endpoints/v1/illust/detail.d.ts +0 -25
- package/dist/types/endpoints/v1/illust/detail.d.ts.map +0 -1
- package/dist/types/endpoints/v1/illust/detail.js +0 -20
- package/dist/types/endpoints/v1/illust/detail.js.map +0 -1
- package/dist/types/endpoints/v1/illust/ranking.d.ts +0 -51
- package/dist/types/endpoints/v1/illust/ranking.d.ts.map +0 -1
- package/dist/types/endpoints/v1/illust/ranking.js +0 -40
- package/dist/types/endpoints/v1/illust/ranking.js.map +0 -1
- package/dist/types/endpoints/v1/illust/recommended.d.ts +0 -104
- package/dist/types/endpoints/v1/illust/recommended.d.ts.map +0 -1
- package/dist/types/endpoints/v1/illust/recommended.js +0 -44
- package/dist/types/endpoints/v1/illust/recommended.js.map +0 -1
- package/dist/types/endpoints/v1/illust/series.d.ts +0 -45
- package/dist/types/endpoints/v1/illust/series.d.ts.map +0 -1
- package/dist/types/endpoints/v1/illust/series.js +0 -31
- package/dist/types/endpoints/v1/illust/series.js.map +0 -1
- package/dist/types/endpoints/v1/illust/ugoira/metadata.d.ts +0 -25
- package/dist/types/endpoints/v1/illust/ugoira/metadata.d.ts.map +0 -1
- package/dist/types/endpoints/v1/illust/ugoira/metadata.js +0 -20
- package/dist/types/endpoints/v1/illust/ugoira/metadata.js.map +0 -1
- package/dist/types/endpoints/v1/manga/recommended.d.ts +0 -72
- package/dist/types/endpoints/v1/manga/recommended.d.ts.map +0 -1
- package/dist/types/endpoints/v1/manga/recommended.js +0 -33
- package/dist/types/endpoints/v1/manga/recommended.js.map +0 -1
- package/dist/types/endpoints/v1/novel/bookmark/delete.d.ts +0 -14
- package/dist/types/endpoints/v1/novel/bookmark/delete.d.ts.map +0 -1
- package/dist/types/endpoints/v1/novel/bookmark/delete.js +0 -3
- package/dist/types/endpoints/v1/novel/bookmark/delete.js.map +0 -1
- package/dist/types/endpoints/v1/novel/ranking.d.ts +0 -47
- package/dist/types/endpoints/v1/novel/ranking.d.ts.map +0 -1
- package/dist/types/endpoints/v1/novel/ranking.js +0 -39
- package/dist/types/endpoints/v1/novel/ranking.js.map +0 -1
- package/dist/types/endpoints/v1/novel/recommended.d.ts +0 -72
- package/dist/types/endpoints/v1/novel/recommended.d.ts.map +0 -1
- package/dist/types/endpoints/v1/novel/recommended.js +0 -32
- package/dist/types/endpoints/v1/novel/recommended.js.map +0 -1
- package/dist/types/endpoints/v1/novel/related.d.ts +0 -37
- package/dist/types/endpoints/v1/novel/related.d.ts.map +0 -1
- package/dist/types/endpoints/v1/novel/related.js +0 -24
- package/dist/types/endpoints/v1/novel/related.js.map +0 -1
- package/dist/types/endpoints/v1/search/illust.d.ts +0 -109
- package/dist/types/endpoints/v1/search/illust.d.ts.map +0 -1
- package/dist/types/endpoints/v1/search/illust.js +0 -40
- package/dist/types/endpoints/v1/search/illust.js.map +0 -1
- package/dist/types/endpoints/v1/search/novel.d.ts +0 -103
- package/dist/types/endpoints/v1/search/novel.d.ts.map +0 -1
- package/dist/types/endpoints/v1/search/novel.js +0 -38
- package/dist/types/endpoints/v1/search/novel.js.map +0 -1
- package/dist/types/endpoints/v1/user/bookmarks/illust.d.ts +0 -48
- package/dist/types/endpoints/v1/user/bookmarks/illust.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/bookmarks/illust.js +0 -31
- package/dist/types/endpoints/v1/user/bookmarks/illust.js.map +0 -1
- package/dist/types/endpoints/v1/user/bookmarks/novel.d.ts +0 -44
- package/dist/types/endpoints/v1/user/bookmarks/novel.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/bookmarks/novel.js +0 -28
- package/dist/types/endpoints/v1/user/bookmarks/novel.js.map +0 -1
- package/dist/types/endpoints/v1/user/detail.d.ts +0 -44
- package/dist/types/endpoints/v1/user/detail.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/detail.js +0 -26
- package/dist/types/endpoints/v1/user/detail.js.map +0 -1
- package/dist/types/endpoints/v1/user/follow/add.d.ts +0 -24
- package/dist/types/endpoints/v1/user/follow/add.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/follow/add.js +0 -3
- package/dist/types/endpoints/v1/user/follow/add.js.map +0 -1
- package/dist/types/endpoints/v1/user/follow/delete.d.ts +0 -14
- package/dist/types/endpoints/v1/user/follow/delete.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/follow/delete.js +0 -3
- package/dist/types/endpoints/v1/user/follow/delete.js.map +0 -1
- package/dist/types/endpoints/v1/user/following.d.ts +0 -38
- package/dist/types/endpoints/v1/user/following.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/following.js +0 -26
- package/dist/types/endpoints/v1/user/following.js.map +0 -1
- package/dist/types/endpoints/v1/user/illusts.d.ts +0 -51
- package/dist/types/endpoints/v1/user/illusts.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/illusts.js +0 -31
- package/dist/types/endpoints/v1/user/illusts.js.map +0 -1
- package/dist/types/endpoints/v1/user/novels.d.ts +0 -43
- package/dist/types/endpoints/v1/user/novels.d.ts.map +0 -1
- package/dist/types/endpoints/v1/user/novels.js +0 -29
- package/dist/types/endpoints/v1/user/novels.js.map +0 -1
- package/dist/types/endpoints/v2/illust/bookmark/add.d.ts +0 -28
- package/dist/types/endpoints/v2/illust/bookmark/add.d.ts.map +0 -1
- package/dist/types/endpoints/v2/illust/bookmark/add.js +0 -3
- package/dist/types/endpoints/v2/illust/bookmark/add.js.map +0 -1
- package/dist/types/endpoints/v2/illust/related.d.ts +0 -48
- package/dist/types/endpoints/v2/illust/related.d.ts.map +0 -1
- package/dist/types/endpoints/v2/illust/related.js +0 -32
- package/dist/types/endpoints/v2/illust/related.js.map +0 -1
- package/dist/types/endpoints/v2/novel/bookmark/add.d.ts +0 -27
- package/dist/types/endpoints/v2/novel/bookmark/add.d.ts.map +0 -1
- package/dist/types/endpoints/v2/novel/bookmark/add.js +0 -3
- package/dist/types/endpoints/v2/novel/bookmark/add.js.map +0 -1
- package/dist/types/endpoints/v2/novel/detail.d.ts +0 -25
- package/dist/types/endpoints/v2/novel/detail.d.ts.map +0 -1
- package/dist/types/endpoints/v2/novel/detail.js +0 -20
- package/dist/types/endpoints/v2/novel/detail.js.map +0 -1
- package/dist/types/endpoints/v2/novel/series.d.ts +0 -49
- package/dist/types/endpoints/v2/novel/series.d.ts.map +0 -1
- package/dist/types/endpoints/v2/novel/series.js +0 -31
- package/dist/types/endpoints/v2/novel/series.js.map +0 -1
- package/dist/types/endpoints/webview/v2/novel.d.ts +0 -21
- package/dist/types/endpoints/webview/v2/novel.d.ts.map +0 -1
- package/dist/types/endpoints/webview/v2/novel.js +0 -18
- package/dist/types/endpoints/webview/v2/novel.js.map +0 -1
- package/dist/types/error-response.d.ts +0 -31
- package/dist/types/error-response.d.ts.map +0 -1
- package/dist/types/error-response.js +0 -3
- package/dist/types/error-response.js.map +0 -1
- package/dist/types/errors.d.ts +0 -7
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/errors.js +0 -14
- package/dist/types/errors.js.map +0 -1
- package/dist/types/pixiv-common.d.ts +0 -103
- package/dist/types/pixiv-common.d.ts.map +0 -1
- package/dist/types/pixiv-common.js +0 -68
- package/dist/types/pixiv-common.js.map +0 -1
- package/dist/types/pixiv-illust-series.d.ts +0 -56
- package/dist/types/pixiv-illust-series.d.ts.map +0 -1
- package/dist/types/pixiv-illust-series.js +0 -26
- package/dist/types/pixiv-illust-series.js.map +0 -1
- package/dist/types/pixiv-illust.d.ts +0 -180
- package/dist/types/pixiv-illust.d.ts.map +0 -1
- package/dist/types/pixiv-illust.js +0 -56
- package/dist/types/pixiv-illust.js.map +0 -1
- package/dist/types/pixiv-novel-series.d.ts +0 -84
- package/dist/types/pixiv-novel-series.d.ts.map +0 -1
- package/dist/types/pixiv-novel-series.js +0 -43
- package/dist/types/pixiv-novel-series.js.map +0 -1
- package/dist/types/pixiv-novel.d.ts +0 -131
- package/dist/types/pixiv-novel.d.ts.map +0 -1
- package/dist/types/pixiv-novel.js +0 -44
- package/dist/types/pixiv-novel.js.map +0 -1
- package/dist/types/pixiv-ugoira.d.ts +0 -50
- package/dist/types/pixiv-ugoira.d.ts.map +0 -1
- package/dist/types/pixiv-ugoira.js +0 -34
- package/dist/types/pixiv-ugoira.js.map +0 -1
- package/dist/types/pixiv-user.d.ts +0 -212
- package/dist/types/pixiv-user.d.ts.map +0 -1
- package/dist/types/pixiv-user.js +0 -118
- package/dist/types/pixiv-user.js.map +0 -1
- package/dist/utils.d.ts +0 -3
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -15
- package/dist/utils.js.map +0 -1
- package/dist/utils.test.d.ts +0 -2
- package/dist/utils.test.d.ts.map +0 -1
- package/dist/utils.test.js +0 -15
- package/dist/utils.test.js.map +0 -1
package/dist/http-client.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PixivHttpClient = void 0;
|
|
7
|
-
const qs_1 = __importDefault(require("qs"));
|
|
8
|
-
const errors_1 = require("./types/errors");
|
|
9
|
-
function headersToRecord(headers) {
|
|
10
|
-
const result = {};
|
|
11
|
-
for (const [key, value] of headers) {
|
|
12
|
-
result[key] = value;
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Calculates the wait time (in milliseconds) from the value of the Retry-After header.
|
|
18
|
-
* Supports both the delay-seconds format and the HTTP-date format,
|
|
19
|
-
* and returns the default wait time (waitMs) if neither format can be parsed.
|
|
20
|
-
*
|
|
21
|
-
* @param retryAfter - Value of the Retry-After header (null if not specified)
|
|
22
|
-
* @param waitMs - Default wait time (in milliseconds)
|
|
23
|
-
* @returns Wait time (in milliseconds)
|
|
24
|
-
*/
|
|
25
|
-
function getRetryAfterWaitTime(retryAfter, waitMs) {
|
|
26
|
-
if (!retryAfter) {
|
|
27
|
-
return waitMs;
|
|
28
|
-
}
|
|
29
|
-
// delay-seconds format
|
|
30
|
-
if (/^\d+$/.test(retryAfter.trim())) {
|
|
31
|
-
return Number.parseInt(retryAfter, 10) * 1000;
|
|
32
|
-
}
|
|
33
|
-
// HTTP-date format (e.g. "Wed, 21 Oct 2026 07:28:00 GMT")
|
|
34
|
-
const retryDate = Date.parse(retryAfter);
|
|
35
|
-
if (!Number.isNaN(retryDate)) {
|
|
36
|
-
return Math.max(0, retryDate - Date.now());
|
|
37
|
-
}
|
|
38
|
-
return waitMs;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Client that performs HTTP requests to the pixiv API.
|
|
42
|
-
*
|
|
43
|
-
* When a 429 (rate limit) response is received, it automatically retries
|
|
44
|
-
* based on the Retry-After header or the configured wait time.
|
|
45
|
-
*/
|
|
46
|
-
class PixivHttpClient {
|
|
47
|
-
/**
|
|
48
|
-
* Constructor.
|
|
49
|
-
*
|
|
50
|
-
* @param baseURL Base URL for requests
|
|
51
|
-
* @param headers Default headers to attach to all requests
|
|
52
|
-
* @param rateLimitRetryOptions Retry settings for 429 errors
|
|
53
|
-
*/
|
|
54
|
-
constructor(baseURL, headers, rateLimitRetryOptions) {
|
|
55
|
-
this.baseURL = baseURL;
|
|
56
|
-
this.defaultHeaders = headers;
|
|
57
|
-
this.rateLimitRetryOptions = rateLimitRetryOptions ?? null;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Sends a GET request.
|
|
61
|
-
*
|
|
62
|
-
* @param path Request path
|
|
63
|
-
* @param options Options such as query parameters
|
|
64
|
-
* @returns Response
|
|
65
|
-
*/
|
|
66
|
-
async get(path, options = {}) {
|
|
67
|
-
let url = `${this.baseURL}${path}`;
|
|
68
|
-
if (options.params) {
|
|
69
|
-
const queryString = qs_1.default.stringify(options.params);
|
|
70
|
-
if (queryString)
|
|
71
|
-
url += `?${queryString}`;
|
|
72
|
-
}
|
|
73
|
-
const response = await this.fetchWithRetry(url, {
|
|
74
|
-
headers: this.defaultHeaders,
|
|
75
|
-
});
|
|
76
|
-
const contentType = response.headers.get('content-type') ?? '';
|
|
77
|
-
const text = await response.text();
|
|
78
|
-
const data = (contentType.includes('application/json') ? JSON.parse(text) : text);
|
|
79
|
-
return {
|
|
80
|
-
data,
|
|
81
|
-
status: response.status,
|
|
82
|
-
headers: headersToRecord(response.headers),
|
|
83
|
-
requestHeaders: this.defaultHeaders,
|
|
84
|
-
requestBody: null,
|
|
85
|
-
responseUrl: response.url || undefined,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Sends a POST request.
|
|
90
|
-
*
|
|
91
|
-
* @param path Request path
|
|
92
|
-
* @param body Request body
|
|
93
|
-
* @param options Options such as headers
|
|
94
|
-
* @returns Response
|
|
95
|
-
*/
|
|
96
|
-
async post(path, body, options = {}) {
|
|
97
|
-
const url = `${this.baseURL}${path}`;
|
|
98
|
-
const headers = { ...this.defaultHeaders, ...options.headers };
|
|
99
|
-
const response = await this.fetchWithRetry(url, {
|
|
100
|
-
method: 'POST',
|
|
101
|
-
headers,
|
|
102
|
-
body,
|
|
103
|
-
});
|
|
104
|
-
const contentType = response.headers.get('content-type') ?? '';
|
|
105
|
-
const text = await response.text();
|
|
106
|
-
const data = (contentType.includes('application/json') ? JSON.parse(text) : text);
|
|
107
|
-
return {
|
|
108
|
-
data,
|
|
109
|
-
status: response.status,
|
|
110
|
-
headers: headersToRecord(response.headers),
|
|
111
|
-
requestHeaders: headers,
|
|
112
|
-
requestBody: body,
|
|
113
|
-
responseUrl: response.url || undefined,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
async fetchWithRetry(url, options) {
|
|
117
|
-
// Clamp to 0 or higher so the loop always runs at least once, even if a negative value is passed
|
|
118
|
-
const maxRetries = Math.max(0, this.rateLimitRetryOptions?.maxRetries ?? 3);
|
|
119
|
-
// Clamp to 0 or higher so the setTimeout wait time is never negative, even if a negative value is passed
|
|
120
|
-
const waitMs = Math.max(0, this.rateLimitRetryOptions?.waitMs ?? 10000); // default 10 sec
|
|
121
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
122
|
-
const response = await fetch(url, options);
|
|
123
|
-
if (response.status !== 429) {
|
|
124
|
-
return response;
|
|
125
|
-
}
|
|
126
|
-
// The response body of a 429 is unused, so discard it to release the connection
|
|
127
|
-
await response.body?.cancel();
|
|
128
|
-
if (attempt < maxRetries) {
|
|
129
|
-
const retryAfter = response.headers.get('Retry-After');
|
|
130
|
-
const waitTime = getRetryAfterWaitTime(retryAfter, waitMs);
|
|
131
|
-
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
throw new errors_1.PixivRateLimitError('Rate limit exceeded after maximum retries');
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.PixivHttpClient = PixivHttpClient;
|
|
138
|
-
//# sourceMappingURL=http-client.js.map
|
package/dist/http-client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,2CAAoD;AA6BpD,SAAS,eAAe,CAAC,OAAgB;IACvC,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,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AAA;gBACtD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;gBAE1D,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;YAC/D,CAAC;QACH,CAAC;QAED,MAAM,IAAI,4BAAmB,CAAC,2CAA2C,CAAC,CAAA;IAC5E,CAAC;CACF;AAvHD,0CAuHC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.test.d.ts","sourceRoot":"","sources":["../src/http-client.test.ts"],"names":[],"mappings":""}
|
package/dist/http-client.test.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const http_client_1 = require("./http-client");
|
|
4
|
-
const errors_1 = require("./types/errors");
|
|
5
|
-
describe('PixivHttpClient', () => {
|
|
6
|
-
describe('rate limit retry', () => {
|
|
7
|
-
let setTimeoutSpy;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
// Mock setTimeout so the callback runs immediately without actually waiting
|
|
10
|
-
setTimeoutSpy = jest
|
|
11
|
-
.spyOn(globalThis, 'setTimeout')
|
|
12
|
-
.mockImplementation((callback) => {
|
|
13
|
-
callback();
|
|
14
|
-
return 0;
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
jest.restoreAllMocks();
|
|
19
|
-
});
|
|
20
|
-
it('should retry and return the response when a 429 is followed by a success', async () => {
|
|
21
|
-
const fetchSpy = jest
|
|
22
|
-
.spyOn(globalThis, 'fetch')
|
|
23
|
-
.mockResolvedValueOnce(Response.json({}, { status: 429 }))
|
|
24
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
25
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {});
|
|
26
|
-
const response = await client.get('/test');
|
|
27
|
-
expect(response.status).toBe(200);
|
|
28
|
-
expect(response.data).toEqual({ ok: true });
|
|
29
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
30
|
-
// Should wait for the default wait time (10 seconds)
|
|
31
|
-
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 10000);
|
|
32
|
-
});
|
|
33
|
-
it('should throw an error when 429 persists beyond maxRetries', async () => {
|
|
34
|
-
const fetchSpy = jest
|
|
35
|
-
.spyOn(globalThis, 'fetch')
|
|
36
|
-
.mockResolvedValue(Response.json({}, { status: 429 }));
|
|
37
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 2, waitMs: 1 });
|
|
38
|
-
await expect(client.get('/test')).rejects.toThrow(errors_1.PixivRateLimitError);
|
|
39
|
-
// Called 3 times in total: the initial attempt + 2 retries (maxRetries)
|
|
40
|
-
expect(fetchSpy).toHaveBeenCalledTimes(3);
|
|
41
|
-
expect(setTimeoutSpy).toHaveBeenCalledTimes(2);
|
|
42
|
-
});
|
|
43
|
-
it('should retry multiple times in a row and succeed once 429 stops', async () => {
|
|
44
|
-
const fetchSpy = jest
|
|
45
|
-
.spyOn(globalThis, 'fetch')
|
|
46
|
-
.mockResolvedValueOnce(Response.json({}, { status: 429 }))
|
|
47
|
-
.mockResolvedValueOnce(Response.json({}, { status: 429 }))
|
|
48
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
49
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 3, waitMs: 1 });
|
|
50
|
-
const response = await client.get('/test');
|
|
51
|
-
expect(response.status).toBe(200);
|
|
52
|
-
expect(response.data).toEqual({ ok: true });
|
|
53
|
-
// Called 3 times in total: two consecutive 429s followed by a success
|
|
54
|
-
expect(fetchSpy).toHaveBeenCalledTimes(3);
|
|
55
|
-
expect(setTimeoutSpy).toHaveBeenCalledTimes(2);
|
|
56
|
-
});
|
|
57
|
-
it('should use the Retry-After header value (in seconds) as the wait time', async () => {
|
|
58
|
-
const fetchSpy = jest
|
|
59
|
-
.spyOn(globalThis, 'fetch')
|
|
60
|
-
.mockResolvedValueOnce(Response.json({}, { status: 429, headers: { 'Retry-After': '5' } }))
|
|
61
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
62
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 3, waitMs: 10000 });
|
|
63
|
-
await client.get('/test');
|
|
64
|
-
// Should wait for the Retry-After header value (in seconds) converted to milliseconds
|
|
65
|
-
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 5000);
|
|
66
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
67
|
-
});
|
|
68
|
-
it('should fall back to waitMs when the Retry-After header is neither a number nor a valid date', async () => {
|
|
69
|
-
const fetchSpy = jest
|
|
70
|
-
.spyOn(globalThis, 'fetch')
|
|
71
|
-
.mockResolvedValueOnce(Response.json({}, {
|
|
72
|
-
status: 429,
|
|
73
|
-
// Retry-After that cannot be parsed as either a seconds value or an HTTP-date
|
|
74
|
-
headers: { 'Retry-After': 'invalid-value' },
|
|
75
|
-
}))
|
|
76
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
77
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 3, waitMs: 12345 });
|
|
78
|
-
await client.get('/test');
|
|
79
|
-
// Should fall back to waitMs when Retry-After cannot be parsed as either a seconds value or an HTTP-date
|
|
80
|
-
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 12345);
|
|
81
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
82
|
-
});
|
|
83
|
-
it('should use the Retry-After header value when given as an HTTP-date', async () => {
|
|
84
|
-
const now = Date.UTC(2026, 0, 1, 0, 0, 0);
|
|
85
|
-
jest.spyOn(Date, 'now').mockReturnValue(now);
|
|
86
|
-
const fetchSpy = jest
|
|
87
|
-
.spyOn(globalThis, 'fetch')
|
|
88
|
-
.mockResolvedValueOnce(Response.json({}, {
|
|
89
|
-
status: 429,
|
|
90
|
-
// HTTP-date 7 seconds after the current time (2026-01-01T00:00:00Z)
|
|
91
|
-
headers: { 'Retry-After': 'Thu, 01 Jan 2026 00:00:07 GMT' },
|
|
92
|
-
}))
|
|
93
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
94
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 3, waitMs: 10000 });
|
|
95
|
-
await client.get('/test');
|
|
96
|
-
// Should wait for the difference (in milliseconds) between the HTTP-date and the current time
|
|
97
|
-
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 7000);
|
|
98
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
99
|
-
});
|
|
100
|
-
it('should not wait a negative time when the Retry-After HTTP-date is in the past', async () => {
|
|
101
|
-
const now = Date.UTC(2026, 0, 1, 0, 0, 10);
|
|
102
|
-
jest.spyOn(Date, 'now').mockReturnValue(now);
|
|
103
|
-
const fetchSpy = jest
|
|
104
|
-
.spyOn(globalThis, 'fetch')
|
|
105
|
-
.mockResolvedValueOnce(Response.json({}, {
|
|
106
|
-
status: 429,
|
|
107
|
-
// HTTP-date that is earlier than the current time (2026-01-01T00:00:10Z)
|
|
108
|
-
headers: { 'Retry-After': 'Thu, 01 Jan 2026 00:00:00 GMT' },
|
|
109
|
-
}))
|
|
110
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
111
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 3, waitMs: 10000 });
|
|
112
|
-
await client.get('/test');
|
|
113
|
-
// Should clamp the wait time to 0 for a date/time in the past
|
|
114
|
-
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 0);
|
|
115
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
116
|
-
});
|
|
117
|
-
it('should throw immediately without waiting when maxRetries is 0', async () => {
|
|
118
|
-
const fetchSpy = jest
|
|
119
|
-
.spyOn(globalThis, 'fetch')
|
|
120
|
-
.mockResolvedValue(Response.json({}, { status: 429 }));
|
|
121
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 0, waitMs: 10000 });
|
|
122
|
-
await expect(client.get('/test')).rejects.toThrow(errors_1.PixivRateLimitError);
|
|
123
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
124
|
-
expect(setTimeoutSpy).not.toHaveBeenCalled();
|
|
125
|
-
});
|
|
126
|
-
it('should not retry when the response status is not 429', async () => {
|
|
127
|
-
const fetchSpy = jest
|
|
128
|
-
.spyOn(globalThis, 'fetch')
|
|
129
|
-
.mockResolvedValue(Response.json({}, { status: 500 }));
|
|
130
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {});
|
|
131
|
-
const response = await client.get('/test');
|
|
132
|
-
expect(response.status).toBe(500);
|
|
133
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
134
|
-
expect(setTimeoutSpy).not.toHaveBeenCalled();
|
|
135
|
-
});
|
|
136
|
-
it('should retry on post() as well', async () => {
|
|
137
|
-
const fetchSpy = jest
|
|
138
|
-
.spyOn(globalThis, 'fetch')
|
|
139
|
-
.mockResolvedValueOnce(Response.json({}, { status: 429 }))
|
|
140
|
-
.mockResolvedValueOnce(Response.json({ ok: true }, { status: 200 }));
|
|
141
|
-
const client = new http_client_1.PixivHttpClient('https://example.com', {}, { maxRetries: 1, waitMs: 1 });
|
|
142
|
-
const response = await client.post('/test', 'body');
|
|
143
|
-
expect(response.status).toBe(200);
|
|
144
|
-
expect(response.data).toEqual({ ok: true });
|
|
145
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
//# sourceMappingURL=http-client.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.test.js","source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,cAAc,wCAAwC,CAAA;AACtD,cAAc,oCAAoC,CAAA;AAClD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,6CAA6C,CAAA;AAC3D,cAAc,4CAA4C,CAAA;AAC1D,cAAc,4CAA4C,CAAA;AAC1D,cAAc,2CAA2C,CAAA;AACzD,cAAc,sCAAsC,CAAA;AACpD,cAAc,yCAAyC,CAAA;AACvD,cAAc,0CAA0C,CAAA;AACxD,cAAc,yCAAyC,CAAA"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,gDAA6B;AAC7B,4CAAyB;AACzB,iCAA0C;AAAjC,+GAAA,OAAO,OAAS;AACzB,0CAAuB;AACvB,0CAAuB;AACvB,2DAAwC;AACxC,qEAAkD;AAClD,yDAAsC;AACtC,iDAA8B;AAC9B,uDAAoC;AACpC,8DAA2C;AAC3C,uDAAoC;AACpC,6DAA0C;AAC1C,sDAAmC;AACnC,uDAAoC;AACpC,qDAAkC;AAClC,qEAAkD;AAClD,sEAAmD;AACnD,0EAAuD;AACvD,qEAAkD;AAClD,yEAAsD;AACtD,qEAAkD;AAClD,yEAAsD;AACtD,qEAAkD;AAClD,qEAAkD;AAClD,oEAAiD;AACjD,mEAAgD;AAChD,sEAAmD;AACnD,oEAAiD;AACjD,mEAAgD;AAChD,sEAAmD;AACnD,oEAAiD;AACjD,oEAAiD;AACjD,qEAAkD;AAClD,8EAA2D;AAC3D,8EAA2D;AAC3D,6EAA0D;AAC1D,6EAA0D;AAC1D,4EAAyD;AACzD,uEAAoD;AACpD,0EAAuD;AACvD,2EAAwD;AACxD,0EAAuD"}
|
package/dist/options.d.ts
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import { GetV1IllustDetailRequest } from './types/endpoints/v1/illust/detail';
|
|
2
|
-
import { SnakeToCamel } from 'snake-camel-types';
|
|
3
|
-
import { GetV1IllustRecommendedRequest } from './types/endpoints/v1/illust/recommended';
|
|
4
|
-
import { GetV1SearchIllustRequest } from './types/endpoints/v1/search/illust';
|
|
5
|
-
import { PostV2IllustBookmarkAddRequest } from './types/endpoints/v2/illust/bookmark/add';
|
|
6
|
-
import { GetV1IllustSeriesRequest } from './types/endpoints/v1/illust/series';
|
|
7
|
-
import { GetV2NovelDetailRequest } from './types/endpoints/v2/novel/detail';
|
|
8
|
-
import { GetV1NovelRecommendedRequest } from './types/endpoints/v1/novel/recommended';
|
|
9
|
-
import { GetV1SearchNovelRequest } from './types/endpoints/v1/search/novel';
|
|
10
|
-
import { GetV2NovelSeriesRequest } from './types/endpoints/v2/novel/series';
|
|
11
|
-
import { GetV1UserDetailRequest } from './types/endpoints/v1/user/detail';
|
|
12
|
-
import { GetV1MangaRecommendedRequest } from './types/endpoints/v1/manga/recommended';
|
|
13
|
-
import { BaseSimpleCheck, CheckFunctions } from './checks';
|
|
14
|
-
import { PostV1IllustBookmarkDeleteRequest } from './types/endpoints/v1/illust/bookmark/delete';
|
|
15
|
-
import { PostV2NovelBookmarkAddRequest } from './types/endpoints/v2/novel/bookmark/add';
|
|
16
|
-
import { PostV1NovelBookmarkDeleteRequest } from './types/endpoints/v1/novel/bookmark/delete';
|
|
17
|
-
import { GetV1UserBookmarksIllustRequest } from './types/endpoints/v1/user/bookmarks/illust';
|
|
18
|
-
import { GetV1UserBookmarksNovelRequest } from './types/endpoints/v1/user/bookmarks/novel';
|
|
19
|
-
import { GetV1IllustUgoiraMetadataRequest } from './types/endpoints/v1/illust/ugoira/metadata';
|
|
20
|
-
import { GetV2IllustRelatedRequest } from './types/endpoints/v2/illust/related';
|
|
21
|
-
import { GetV1NovelRelatedRequest } from './types/endpoints/v1/novel/related';
|
|
22
|
-
import { GetV1IllustRankingRequest } from './types/endpoints/v1/illust/ranking';
|
|
23
|
-
import { GetV1NovelRankingRequest } from './types/endpoints/v1/novel/ranking';
|
|
24
|
-
import { GetWebViewV2NovelRequest } from './types/endpoints/webview/v2/novel';
|
|
25
|
-
import { GetV1UserFollowingRequest } from './types/endpoints/v1/user/following';
|
|
26
|
-
import { PostV1UserFollowAddRequest } from './types/endpoints/v1/user/follow/add';
|
|
27
|
-
import { PostV1UserFollowDeleteRequest } from './types/endpoints/v1/user/follow/delete';
|
|
28
|
-
import { GetV1UserIllustsRequest } from './types/endpoints/v1/user/illusts';
|
|
29
|
-
import { GetV1UserNovelsRequest } from './types/endpoints/v1/user/novels';
|
|
30
|
-
/**
|
|
31
|
-
* Search target
|
|
32
|
-
*/
|
|
33
|
-
export declare enum SearchTarget {
|
|
34
|
-
/** Partial match for tags */
|
|
35
|
-
PARTIAL_MATCH_FOR_TAGS = "partial_match_for_tags",
|
|
36
|
-
/** Exact match for tags */
|
|
37
|
-
EXACT_MATCH_FOR_TAGS = "exact_match_for_tags",
|
|
38
|
-
/** Title or caption (referred to as "text" in the app) */
|
|
39
|
-
TITLE_AND_CAPTION = "title_and_caption",
|
|
40
|
-
/** Keyword */
|
|
41
|
-
KEYWORD = "keyword"
|
|
42
|
-
}
|
|
43
|
-
export declare class SearchTargetCheck extends BaseSimpleCheck<SearchTarget> {
|
|
44
|
-
checks(): CheckFunctions<SearchTarget>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Sort order
|
|
48
|
-
*/
|
|
49
|
-
export declare enum SearchSort {
|
|
50
|
-
/** Newest first */
|
|
51
|
-
DATE_DESC = "date_desc",
|
|
52
|
-
/** Oldest first */
|
|
53
|
-
DATE_ASC = "date_asc",
|
|
54
|
-
/** Most popular first */
|
|
55
|
-
POPULAR_DESC = "popular_desc"
|
|
56
|
-
}
|
|
57
|
-
export declare class SearchSortCheck extends BaseSimpleCheck<SearchSort> {
|
|
58
|
-
checks(): CheckFunctions<SearchSort>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Target period
|
|
62
|
-
*/
|
|
63
|
-
export declare enum SearchIllustDuration {
|
|
64
|
-
/** Within the last day */
|
|
65
|
-
WITHIN_LAST_DAY = "within_last_day",
|
|
66
|
-
/** Within the last week */
|
|
67
|
-
WITHIN_LAST_WEEK = "within_last_week",
|
|
68
|
-
/** Within the last month */
|
|
69
|
-
WITHIN_LAST_MONTH = "within_last_month"
|
|
70
|
-
}
|
|
71
|
-
export declare class SearchIllustDurationCheck extends BaseSimpleCheck<SearchIllustDuration> {
|
|
72
|
-
checks(): CheckFunctions<SearchIllustDuration>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* OS filter
|
|
76
|
-
*/
|
|
77
|
-
export declare enum OSFilter {
|
|
78
|
-
/** iOS */
|
|
79
|
-
FOR_IOS = "for_ios",
|
|
80
|
-
/** Android */
|
|
81
|
-
FOR_ANDROID = "for_android"
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Check for OS filter
|
|
85
|
-
*/
|
|
86
|
-
export declare class OSFilterCheck extends BaseSimpleCheck<OSFilter> {
|
|
87
|
-
checks(): CheckFunctions<OSFilter>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Bookmark visibility
|
|
91
|
-
*/
|
|
92
|
-
export declare enum BookmarkRestrict {
|
|
93
|
-
/** Public */
|
|
94
|
-
PUBLIC = "public",
|
|
95
|
-
/** Private */
|
|
96
|
-
PRIVATE = "private"
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Check for bookmark visibility
|
|
100
|
-
*/
|
|
101
|
-
export declare class BookmarkRestrictCheck extends BaseSimpleCheck<BookmarkRestrict> {
|
|
102
|
-
checks(): CheckFunctions<BookmarkRestrict>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Follow visibility
|
|
106
|
-
*/
|
|
107
|
-
export declare enum FollowRestrict {
|
|
108
|
-
/** Public */
|
|
109
|
-
PUBLIC = "public",
|
|
110
|
-
/** Private */
|
|
111
|
-
PRIVATE = "private"
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Check for follow visibility
|
|
115
|
-
*/
|
|
116
|
-
export declare class FollowRestrictCheck extends BaseSimpleCheck<FollowRestrict> {
|
|
117
|
-
checks(): CheckFunctions<FollowRestrict>;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* AI content filter for search
|
|
121
|
-
*/
|
|
122
|
-
export declare enum SearchAiType {
|
|
123
|
-
/** Filter out AI-generated works */
|
|
124
|
-
FILTER_AI = 0,
|
|
125
|
-
/** Show AI-generated works */
|
|
126
|
-
SHOW_AI = 1
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Check for AI content filter type
|
|
130
|
-
*/
|
|
131
|
-
export declare class SearchAiTypeCheck extends BaseSimpleCheck<SearchAiType> {
|
|
132
|
-
checks(): CheckFunctions<SearchAiType>;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Content type for illust recommendations
|
|
136
|
-
*/
|
|
137
|
-
export declare enum IllustContentType {
|
|
138
|
-
/** Illustration */
|
|
139
|
-
ILLUST = "illust",
|
|
140
|
-
/** Manga */
|
|
141
|
-
MANGA = "manga"
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Check for illust content type
|
|
145
|
-
*/
|
|
146
|
-
export declare class IllustContentTypeCheck extends BaseSimpleCheck<IllustContentType> {
|
|
147
|
-
checks(): CheckFunctions<IllustContentType>;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Ranking type
|
|
151
|
-
*/
|
|
152
|
-
export declare enum RankingMode {
|
|
153
|
-
/** Daily */
|
|
154
|
-
DAY = "day",
|
|
155
|
-
/** For men */
|
|
156
|
-
DAY_MALE = "day_male",
|
|
157
|
-
/** For women */
|
|
158
|
-
DAY_FEMALE = "day_female",
|
|
159
|
-
/** Original */
|
|
160
|
-
WEEK_ORIGINAL = "week_original",
|
|
161
|
-
/** Rookie */
|
|
162
|
-
WEEK_ROOKIE = "week_rookie",
|
|
163
|
-
/** Weekly */
|
|
164
|
-
WEEK = "week",
|
|
165
|
-
/** Monthly */
|
|
166
|
-
MONTH = "month",
|
|
167
|
-
/** AI-generated */
|
|
168
|
-
DAY_AI = "day_ai",
|
|
169
|
-
/** R-18 daily */
|
|
170
|
-
DAY_R18 = "day_r18",
|
|
171
|
-
/** R-18 weekly */
|
|
172
|
-
WEEK_R18 = "week_r18",
|
|
173
|
-
/** R-18 for men */
|
|
174
|
-
DAY_MALE_R18 = "day_male_r18",
|
|
175
|
-
/** R-18 for women */
|
|
176
|
-
DAY_FEMALE_R18 = "day_female_r18",
|
|
177
|
-
/** R-18 AI-generated */
|
|
178
|
-
DAY_R18_AI = "day_r18_ai"
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Check for ranking type
|
|
182
|
-
*/
|
|
183
|
-
export declare class RankingModeCheck extends BaseSimpleCheck<RankingMode> {
|
|
184
|
-
checks(): CheckFunctions<RankingMode>;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Makes some properties of an object required while making the rest optional
|
|
188
|
-
*
|
|
189
|
-
* @see https://mongolyy.hatenablog.com/entry/2022/03/10/001139
|
|
190
|
-
* @see https://qiita.com/yuu_1st/items/71c4fc9cc95a72fa4df9
|
|
191
|
-
*/
|
|
192
|
-
export type SomeRequired<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
193
|
-
/**
|
|
194
|
-
* Overwrites specific properties of an object
|
|
195
|
-
*
|
|
196
|
-
* @see https://qiita.com/ibaragi/items/2a6412aeaca5703694b1
|
|
197
|
-
*/
|
|
198
|
-
export type Overwrite<T, U extends {
|
|
199
|
-
[Key in keyof T]?: unknown;
|
|
200
|
-
}> = Omit<T, keyof U> & U;
|
|
201
|
-
/**
|
|
202
|
-
* Illust search options
|
|
203
|
-
*/
|
|
204
|
-
export type SearchIllustOptions = SomeRequired<SnakeToCamel<GetV1SearchIllustRequest>, 'word'>;
|
|
205
|
-
/**
|
|
206
|
-
* Options for getting illust ranking
|
|
207
|
-
*/
|
|
208
|
-
export type IllustRankingOptions = SnakeToCamel<Partial<GetV1IllustRankingRequest>>;
|
|
209
|
-
/**
|
|
210
|
-
* Options for getting illust details
|
|
211
|
-
*/
|
|
212
|
-
export type IllustDetailOptions = SnakeToCamel<GetV1IllustDetailRequest>;
|
|
213
|
-
/**
|
|
214
|
-
* Options for getting related illusts
|
|
215
|
-
*/
|
|
216
|
-
export type IllustRelatedOptions = SnakeToCamel<GetV2IllustRelatedRequest>;
|
|
217
|
-
/**
|
|
218
|
-
* Options for getting recommended illusts
|
|
219
|
-
*/
|
|
220
|
-
export type RecommendedIllustOptions = SnakeToCamel<Partial<GetV1IllustRecommendedRequest>>;
|
|
221
|
-
/**
|
|
222
|
-
* Options for getting illust series
|
|
223
|
-
*/
|
|
224
|
-
export type IllustSeriesOptions = SomeRequired<SnakeToCamel<GetV1IllustSeriesRequest>, 'illustSeriesId'>;
|
|
225
|
-
/**
|
|
226
|
-
* Options for adding an illust bookmark
|
|
227
|
-
*/
|
|
228
|
-
export type IllustBookmarkAddOptions = SomeRequired<SnakeToCamel<PostV2IllustBookmarkAddRequest>, 'illustId'>;
|
|
229
|
-
/**
|
|
230
|
-
* Options for removing an illust bookmark
|
|
231
|
-
*/
|
|
232
|
-
export type IllustBookmarkDeleteOptions = SnakeToCamel<PostV1IllustBookmarkDeleteRequest>;
|
|
233
|
-
/**
|
|
234
|
-
* Options for getting recommended manga
|
|
235
|
-
*/
|
|
236
|
-
export type MangaRecommendedOptions = SnakeToCamel<Partial<GetV1MangaRecommendedRequest>>;
|
|
237
|
-
/**
|
|
238
|
-
* Options for getting ugoira details
|
|
239
|
-
*/
|
|
240
|
-
export type UgoiraDetailOptions = SnakeToCamel<GetV1IllustUgoiraMetadataRequest>;
|
|
241
|
-
/**
|
|
242
|
-
* Options for getting novel details
|
|
243
|
-
*/
|
|
244
|
-
export type NovelDetailOptions = SnakeToCamel<GetV2NovelDetailRequest>;
|
|
245
|
-
/**
|
|
246
|
-
* Options for getting novel text
|
|
247
|
-
*/
|
|
248
|
-
export type NovelTextOptions = SnakeToCamel<GetWebViewV2NovelRequest>;
|
|
249
|
-
/**
|
|
250
|
-
* Options for getting related novels
|
|
251
|
-
*/
|
|
252
|
-
export type NovelRelatedOptions = SnakeToCamel<GetV1NovelRelatedRequest>;
|
|
253
|
-
/**
|
|
254
|
-
* Novel search options
|
|
255
|
-
*/
|
|
256
|
-
export type SearchNovelOptions = SomeRequired<SnakeToCamel<GetV1SearchNovelRequest>, 'word'>;
|
|
257
|
-
/**
|
|
258
|
-
* Options for getting novel ranking
|
|
259
|
-
*/
|
|
260
|
-
export type NovelRankingOptions = SnakeToCamel<Partial<GetV1NovelRankingRequest>>;
|
|
261
|
-
/**
|
|
262
|
-
* Options for getting recommended novels
|
|
263
|
-
*/
|
|
264
|
-
export type RecommendedNovelOptions = Overwrite<SnakeToCamel<Partial<GetV1NovelRecommendedRequest>>, {
|
|
265
|
-
/**
|
|
266
|
-
* IDs of novels already recommended (?)
|
|
267
|
-
*
|
|
268
|
-
* @default undefined
|
|
269
|
-
* @beta
|
|
270
|
-
*/
|
|
271
|
-
alreadyRecommended?: number[];
|
|
272
|
-
}>;
|
|
273
|
-
/**
|
|
274
|
-
* Options for getting novel series details
|
|
275
|
-
*/
|
|
276
|
-
export type NovelSeriesOptions = SomeRequired<SnakeToCamel<GetV2NovelSeriesRequest>, 'seriesId'>;
|
|
277
|
-
/**
|
|
278
|
-
* Options for adding a novel bookmark
|
|
279
|
-
*/
|
|
280
|
-
export type NovelBookmarkAddOptions = SomeRequired<SnakeToCamel<PostV2NovelBookmarkAddRequest>, 'novelId'>;
|
|
281
|
-
/**
|
|
282
|
-
* Options for removing a novel bookmark
|
|
283
|
-
*/
|
|
284
|
-
export type NovelBookmarkDeleteOptions = SnakeToCamel<PostV1NovelBookmarkDeleteRequest>;
|
|
285
|
-
/**
|
|
286
|
-
* Options for getting user details
|
|
287
|
-
*/
|
|
288
|
-
export type UserDetailOptions = SnakeToCamel<GetV1UserDetailRequest>;
|
|
289
|
-
/**
|
|
290
|
-
* Options for getting a user's illust bookmarks
|
|
291
|
-
*/
|
|
292
|
-
export type UserBookmarksIllustOptions = SomeRequired<SnakeToCamel<GetV1UserBookmarksIllustRequest>, 'userId'>;
|
|
293
|
-
/**
|
|
294
|
-
* Options for getting a user's novel bookmarks
|
|
295
|
-
*/
|
|
296
|
-
export type UserBookmarksNovelOptions = SomeRequired<SnakeToCamel<GetV1UserBookmarksNovelRequest>, 'userId'>;
|
|
297
|
-
/**
|
|
298
|
-
* Options for getting the list of users a user is following
|
|
299
|
-
*/
|
|
300
|
-
export type UserFollowingOptions = SomeRequired<SnakeToCamel<GetV1UserFollowingRequest>, 'userId'>;
|
|
301
|
-
/**
|
|
302
|
-
* Options for following a user
|
|
303
|
-
*/
|
|
304
|
-
export type UserFollowAddOptions = SomeRequired<SnakeToCamel<PostV1UserFollowAddRequest>, 'userId'>;
|
|
305
|
-
/**
|
|
306
|
-
* Options for unfollowing a user
|
|
307
|
-
*/
|
|
308
|
-
export type UserFollowDeleteOptions = SnakeToCamel<PostV1UserFollowDeleteRequest>;
|
|
309
|
-
/**
|
|
310
|
-
* Options for getting a user's illusts
|
|
311
|
-
*/
|
|
312
|
-
export type UserIllustsOptions = SomeRequired<SnakeToCamel<GetV1UserIllustsRequest>, 'userId'>;
|
|
313
|
-
/**
|
|
314
|
-
* Options for getting a user's novels
|
|
315
|
-
*/
|
|
316
|
-
export type UserNovelsOptions = SomeRequired<SnakeToCamel<GetV1UserNovelsRequest>, 'userId'>;
|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