narou 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +35 -29
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +82 -122
- package/dist/index.browser.js.map +1 -1
- package/dist/index.common.d.ts +14 -9
- package/dist/index.common.d.ts.map +1 -1
- package/dist/index.common.js +34 -24
- package/dist/index.common.js.map +1 -1
- package/dist/index.d.ts +42 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -124
- package/dist/index.js.map +1 -1
- package/dist/narou-fetch.d.ts +12 -12
- package/dist/narou-fetch.js +45 -128
- package/dist/narou-fetch.js.map +1 -1
- package/dist/narou-jsonp.d.ts +9 -9
- package/dist/narou-jsonp.js +23 -100
- package/dist/narou-jsonp.js.map +1 -1
- package/dist/narou-ranking-results.d.ts +9 -9
- package/dist/narou-ranking-results.js +2 -2
- package/dist/narou-search-results.d.ts +130 -120
- package/dist/narou-search-results.d.ts.map +1 -1
- package/dist/narou-search-results.js +62 -65
- package/dist/narou-search-results.js.map +1 -1
- package/dist/narou.d.ts +25 -24
- package/dist/narou.d.ts.map +1 -1
- package/dist/narou.js +29 -104
- package/dist/narou.js.map +1 -1
- package/dist/params.d.ts +323 -282
- package/dist/params.d.ts.map +1 -1
- package/dist/params.js +246 -229
- package/dist/params.js.map +1 -1
- package/dist/ranking-history.d.ts +13 -13
- package/dist/ranking-history.js +13 -13
- package/dist/ranking-history.js.map +1 -1
- package/dist/ranking.d.ts +45 -45
- package/dist/ranking.js +86 -155
- package/dist/ranking.js.map +1 -1
- package/dist/search-builder-r18.d.ts +28 -28
- package/dist/search-builder-r18.d.ts.map +1 -1
- package/dist/search-builder-r18.js +44 -64
- package/dist/search-builder-r18.js.map +1 -1
- package/dist/search-builder.d.ts +219 -234
- package/dist/search-builder.d.ts.map +1 -1
- package/dist/search-builder.js +380 -440
- package/dist/search-builder.js.map +1 -1
- package/dist/user-search.d.ts +63 -0
- package/dist/user-search.d.ts.map +1 -0
- package/dist/user-search.js +94 -0
- package/dist/user-search.js.map +1 -0
- package/dist/util/jsonp.d.ts +16 -16
- package/dist/util/jsonp.js +45 -47
- package/dist/util/jsonp.js.map +1 -1
- package/dist/util/type.d.ts +3 -3
- package/dist/util/type.js +2 -2
- package/dist/util/unzipp.d.ts +3 -3
- package/dist/util/unzipp.js +11 -56
- package/dist/util/unzipp.js.map +1 -1
- package/dist.esm/index.browser.js +86 -0
- package/dist.esm/index.browser.js.map +1 -0
- package/dist.esm/index.common.js +38 -0
- package/dist.esm/index.common.js.map +1 -0
- package/dist.esm/index.js +94 -0
- package/dist.esm/index.js.map +1 -0
- package/dist.esm/narou-fetch.js +49 -0
- package/dist.esm/narou-fetch.js.map +1 -0
- package/dist.esm/narou-jsonp.js +27 -0
- package/dist.esm/narou-jsonp.js.map +1 -0
- package/dist.esm/narou-ranking-results.js +3 -0
- package/dist.esm/narou-ranking-results.js.map +1 -0
- package/dist.esm/narou-search-results.js +63 -0
- package/dist.esm/narou-search-results.js.map +1 -0
- package/dist.esm/narou.js +33 -0
- package/dist.esm/narou.js.map +1 -0
- package/dist.esm/params.js +247 -0
- package/dist.esm/params.js.map +1 -0
- package/dist.esm/ranking-history.js +14 -0
- package/dist.esm/ranking-history.js.map +1 -0
- package/dist.esm/ranking.js +90 -0
- package/dist.esm/ranking.js.map +1 -0
- package/dist.esm/search-builder-r18.js +45 -0
- package/dist.esm/search-builder-r18.js.map +1 -0
- package/dist.esm/search-builder.js +381 -0
- package/dist.esm/search-builder.js.map +1 -0
- package/dist.esm/user-search.js +94 -0
- package/dist.esm/user-search.js.map +1 -0
- package/dist.esm/util/jsonp.js +46 -0
- package/dist.esm/util/jsonp.js.map +1 -0
- package/dist.esm/util/type.js +3 -0
- package/dist.esm/util/type.js.map +1 -0
- package/dist.esm/util/unzipp.js +12 -0
- package/dist.esm/util/unzipp.js.map +1 -0
- package/package.json +18 -8
- package/src/index.browser.ts +12 -1
- package/src/index.common.ts +18 -29
- package/src/index.ts +20 -3
- package/src/narou-search-results.ts +20 -7
- package/src/narou.ts +26 -11
- package/src/params.ts +60 -15
- package/src/search-builder-r18.ts +9 -9
- package/src/search-builder.ts +96 -102
- package/src/user-search.ts +109 -0
package/src/index.browser.ts
CHANGED
|
@@ -4,6 +4,7 @@ import SearchBuilder from "./search-builder";
|
|
|
4
4
|
import SearchBuilderR18 from "./search-builder-r18";
|
|
5
5
|
import RankingBuilder from "./ranking";
|
|
6
6
|
import { formatRankingHistory, RankingHistoryResult } from "./ranking-history";
|
|
7
|
+
import UserSearchBuilder from "./user-search";
|
|
7
8
|
|
|
8
9
|
export * from "./index.common";
|
|
9
10
|
export { NarouNovelJsonp };
|
|
@@ -38,6 +39,15 @@ export function searchR18(
|
|
|
38
39
|
return builder;
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* ユーザ検索
|
|
44
|
+
*/
|
|
45
|
+
export function searchUser(word = "", api: NarouNovel = narouNovelJsonp) {
|
|
46
|
+
const builder = new UserSearchBuilder({}, api);
|
|
47
|
+
if (word != "") builder.word(word);
|
|
48
|
+
return builder;
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
export function ranking(api: NarouNovel = narouNovelJsonp): RankingBuilder {
|
|
42
52
|
const builder = new RankingBuilder({}, api);
|
|
43
53
|
return builder;
|
|
@@ -57,7 +67,8 @@ export async function rankingHistory(
|
|
|
57
67
|
|
|
58
68
|
export default {
|
|
59
69
|
search,
|
|
60
|
-
ranking,
|
|
61
70
|
searchR18,
|
|
71
|
+
searchUser,
|
|
72
|
+
ranking,
|
|
62
73
|
rankingHistory,
|
|
63
74
|
};
|
package/src/index.common.ts
CHANGED
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
import NarouNovel from "./narou";
|
|
2
2
|
import NarouSearchResults from "./narou-search-results";
|
|
3
|
+
import SearchBuilder from "./search-builder";
|
|
4
|
+
import SearchBuilderR18 from "./search-builder-r18";
|
|
5
|
+
import RankingBuilder from "./ranking";
|
|
3
6
|
|
|
4
|
-
export { NarouNovel, NarouSearchResults };
|
|
5
|
-
|
|
6
|
-
export { RankingHistoryResult } from "./ranking-history";
|
|
7
|
-
export {
|
|
8
|
-
RankingType,
|
|
9
|
-
Fields,
|
|
10
|
-
SearchResultFieldNames,
|
|
11
|
-
Order,
|
|
12
|
-
BigGenre,
|
|
13
|
-
BigGenreNotation,
|
|
14
|
-
Genre,
|
|
15
|
-
GenreNotation,
|
|
16
|
-
R18Site,
|
|
17
|
-
R18SiteNotation,
|
|
18
|
-
BuntaiParam,
|
|
19
|
-
NovelTypeParam,
|
|
20
|
-
BooleanNumber,
|
|
21
|
-
} from "./params";
|
|
22
7
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
export {
|
|
33
|
-
export
|
|
8
|
+
NarouNovel,
|
|
9
|
+
NarouSearchResults,
|
|
10
|
+
SearchBuilder,
|
|
11
|
+
SearchBuilderR18,
|
|
12
|
+
RankingBuilder,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export * from "./ranking-history";
|
|
16
|
+
export * from "./params";
|
|
17
|
+
export { NarouParams } from "./narou";
|
|
18
|
+
export * from "./narou-search-results";
|
|
19
|
+
export * from "./narou-ranking-results";
|
|
20
|
+
export * from "./search-builder";
|
|
21
|
+
export * from "./search-builder-r18";
|
|
22
|
+
export * from "./user-search";
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import RankingBuilder from "./ranking";
|
|
|
5
5
|
import { formatRankingHistory, RankingHistoryResult } from "./ranking-history";
|
|
6
6
|
import SearchBuilder from "./search-builder";
|
|
7
7
|
import SearchBuilderR18 from "./search-builder-r18";
|
|
8
|
+
import UserSearchBuilder from "./user-search";
|
|
8
9
|
|
|
9
10
|
export * from "./index.common";
|
|
10
11
|
export { NarouNovelFetch, NarouNovelJsonp };
|
|
@@ -12,7 +13,7 @@ export { NarouNovelFetch, NarouNovelJsonp };
|
|
|
12
13
|
const narouNovelFetch = new NarouNovelFetch();
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* なろう小説 API で小説を検索する
|
|
16
17
|
* @param {string} [word] - 検索ワード
|
|
17
18
|
* @returns {SearchBuilder}
|
|
18
19
|
*/
|
|
@@ -26,7 +27,7 @@ export function search(
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
+
* 18禁小説 API で小説を検索する
|
|
30
31
|
* @param {string} [word] - 検索ワード
|
|
31
32
|
* @returns {SearchBuilder}
|
|
32
33
|
*/
|
|
@@ -39,11 +40,26 @@ export function searchR18(
|
|
|
39
40
|
return builder;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* なろうユーザ検索 API でユーザを検索する
|
|
45
|
+
*/
|
|
46
|
+
export function searchUser(word = "", api: NarouNovel = narouNovelFetch) {
|
|
47
|
+
const builder = new UserSearchBuilder({}, api);
|
|
48
|
+
if (word != "") builder.word(word);
|
|
49
|
+
return builder;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* なろう小説ランキング API でランキングを取得する
|
|
54
|
+
*/
|
|
42
55
|
export function ranking(api: NarouNovel = narouNovelFetch): RankingBuilder {
|
|
43
56
|
const builder = new RankingBuilder({}, api);
|
|
44
57
|
return builder;
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
/**
|
|
61
|
+
* なろう殿堂入り API でランキング履歴を取得する
|
|
62
|
+
*/
|
|
47
63
|
export async function rankingHistory(
|
|
48
64
|
ncode: string,
|
|
49
65
|
api: NarouNovel = narouNovelFetch
|
|
@@ -58,7 +74,8 @@ export async function rankingHistory(
|
|
|
58
74
|
|
|
59
75
|
export default {
|
|
60
76
|
search,
|
|
61
|
-
ranking,
|
|
62
77
|
searchR18,
|
|
78
|
+
searchUser,
|
|
79
|
+
ranking,
|
|
63
80
|
rankingHistory,
|
|
64
81
|
};
|
|
@@ -7,29 +7,27 @@ import {
|
|
|
7
7
|
BigGenre,
|
|
8
8
|
R18Fields,
|
|
9
9
|
OptionalFields,
|
|
10
|
+
UserFields,
|
|
10
11
|
} from "./params";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* なろう小説API検索結果
|
|
14
15
|
* @class NarouSearchResults
|
|
15
16
|
*/
|
|
16
|
-
export default class NarouSearchResults<T extends keyof
|
|
17
|
+
export default class NarouSearchResults<T, TKey extends keyof T> {
|
|
17
18
|
allcount: number;
|
|
18
19
|
limit: number;
|
|
19
20
|
start: number;
|
|
20
21
|
page: number;
|
|
21
22
|
length: number;
|
|
22
|
-
values:
|
|
23
|
+
values: readonly Pick<T, TKey>[];
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* @constractor
|
|
26
27
|
* @private
|
|
27
28
|
*/
|
|
28
29
|
constructor(
|
|
29
|
-
[header, ...result]: [
|
|
30
|
-
{ allcount: number },
|
|
31
|
-
...PickedNarouSearchResult<T>[]
|
|
32
|
-
],
|
|
30
|
+
[header, ...result]: [{ allcount: number }, ...Pick<T, TKey>[]],
|
|
33
31
|
params: SearchParams
|
|
34
32
|
) {
|
|
35
33
|
const count = header.allcount;
|
|
@@ -142,6 +140,17 @@ export interface NarouSearchResult {
|
|
|
142
140
|
weekly_unique: number;
|
|
143
141
|
}
|
|
144
142
|
|
|
143
|
+
export interface UserSearchResult {
|
|
144
|
+
userid: number;
|
|
145
|
+
name: string;
|
|
146
|
+
yomikata: string;
|
|
147
|
+
name1st: string;
|
|
148
|
+
novel_cnt: number;
|
|
149
|
+
review_cnt: number;
|
|
150
|
+
novel_length: number;
|
|
151
|
+
sum_global_point: number;
|
|
152
|
+
}
|
|
153
|
+
|
|
145
154
|
export const PcOrK = {
|
|
146
155
|
Ketai: 1,
|
|
147
156
|
Pc: 2,
|
|
@@ -165,7 +174,7 @@ export type SearchResultFields<T extends Fields> = {
|
|
|
165
174
|
[K in keyof typeof Fields]: typeof Fields[K] extends T ? K : never;
|
|
166
175
|
}[keyof typeof Fields];
|
|
167
176
|
|
|
168
|
-
export type
|
|
177
|
+
export type SearchResultOptionalFields<T extends OptionalFields> = {
|
|
169
178
|
[K in keyof typeof OptionalFields]: typeof OptionalFields[K] extends T
|
|
170
179
|
? K
|
|
171
180
|
: never;
|
|
@@ -175,6 +184,10 @@ export type SearchResultR18Fields<T extends R18Fields> = {
|
|
|
175
184
|
[K in keyof typeof R18Fields]: typeof R18Fields[K] extends T ? K : never;
|
|
176
185
|
}[keyof typeof R18Fields];
|
|
177
186
|
|
|
187
|
+
export type UserSearchResultFields<T extends UserFields> = {
|
|
188
|
+
[K in keyof typeof UserFields]: typeof UserFields[K] extends T ? K : never;
|
|
189
|
+
}[keyof typeof UserFields];
|
|
190
|
+
|
|
178
191
|
export type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<
|
|
179
192
|
NarouSearchResult,
|
|
180
193
|
T
|
package/src/narou.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { NarouRankingResult } from "./narou-ranking-results";
|
|
2
|
-
import NarouSearchResults, {
|
|
3
|
-
|
|
2
|
+
import NarouSearchResults, {
|
|
3
|
+
NarouSearchResult,
|
|
4
|
+
UserSearchResult,
|
|
5
|
+
} from "./narou-search-results";
|
|
6
|
+
import {
|
|
7
|
+
RankingHistoryParams,
|
|
8
|
+
RankingParams,
|
|
9
|
+
SearchParams,
|
|
10
|
+
UserSearchParams,
|
|
11
|
+
} from "./params";
|
|
4
12
|
import { RankingHistoryRawResult } from "./ranking-history";
|
|
5
13
|
|
|
6
|
-
export type NarouParams =
|
|
14
|
+
export type NarouParams =
|
|
15
|
+
| SearchParams
|
|
16
|
+
| RankingParams
|
|
17
|
+
| RankingHistoryParams
|
|
18
|
+
| UserSearchParams;
|
|
7
19
|
|
|
8
20
|
/**
|
|
9
21
|
* なろう小説APIへのリクエストを実行する
|
|
@@ -23,18 +35,15 @@ export default abstract class NarouNovel {
|
|
|
23
35
|
): Promise<T>;
|
|
24
36
|
|
|
25
37
|
async executeSearch<T extends keyof NarouSearchResult>(
|
|
26
|
-
params:
|
|
38
|
+
params: SearchParams,
|
|
27
39
|
endpoint = "https://api.syosetu.com/novelapi/api/"
|
|
28
|
-
): Promise<NarouSearchResults<T>> {
|
|
29
|
-
return new NarouSearchResults
|
|
30
|
-
await this.execute(params, endpoint),
|
|
31
|
-
params
|
|
32
|
-
);
|
|
40
|
+
): Promise<NarouSearchResults<NarouSearchResult, T>> {
|
|
41
|
+
return new NarouSearchResults(await this.execute(params, endpoint), params);
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
async executeNovel<T extends keyof NarouSearchResult>(
|
|
36
45
|
params: SearchParams
|
|
37
|
-
): Promise<NarouSearchResults<T>> {
|
|
46
|
+
): Promise<NarouSearchResults<NarouSearchResult, T>> {
|
|
38
47
|
return await this.executeSearch(
|
|
39
48
|
params,
|
|
40
49
|
"https://api.syosetu.com/novelapi/api/"
|
|
@@ -43,7 +52,7 @@ export default abstract class NarouNovel {
|
|
|
43
52
|
|
|
44
53
|
async executeNovel18<T extends keyof NarouSearchResult>(
|
|
45
54
|
params: SearchParams
|
|
46
|
-
): Promise<NarouSearchResults<T>> {
|
|
55
|
+
): Promise<NarouSearchResults<NarouSearchResult, T>> {
|
|
47
56
|
return await this.executeSearch(
|
|
48
57
|
params,
|
|
49
58
|
"https://api.syosetu.com/novel18api/api/"
|
|
@@ -59,4 +68,10 @@ export default abstract class NarouNovel {
|
|
|
59
68
|
): Promise<RankingHistoryRawResult[]> {
|
|
60
69
|
return await this.execute(params, "https://api.syosetu.com/rank/rankin/");
|
|
61
70
|
}
|
|
71
|
+
|
|
72
|
+
async executeUserSearch<T extends keyof UserSearchResult>(
|
|
73
|
+
params: UserSearchParams
|
|
74
|
+
): Promise<NarouSearchResults<UserSearchResult, T>> {
|
|
75
|
+
return await this.execute(params, "https://api.syosetu.com/userapi/api/");
|
|
76
|
+
}
|
|
62
77
|
}
|
package/src/params.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NarouSearchResult } from "./narou-search-results";
|
|
1
|
+
import { NarouSearchResult, UserSearchResult } from "./narou-search-results";
|
|
2
2
|
import { Join } from "./util/type";
|
|
3
3
|
|
|
4
4
|
export const RankingType = {
|
|
@@ -9,6 +9,18 @@ export const RankingType = {
|
|
|
9
9
|
} as const;
|
|
10
10
|
export type RankingType = typeof RankingType[keyof typeof RankingType];
|
|
11
11
|
|
|
12
|
+
export interface ParamsBase {
|
|
13
|
+
gzip?: GzipLevel;
|
|
14
|
+
out?: "json" | "jsonp";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ParamsBaseWithOrder<TOrder extends string> extends ParamsBase {
|
|
18
|
+
of?: string;
|
|
19
|
+
lim?: number;
|
|
20
|
+
st?: number;
|
|
21
|
+
order?: TOrder;
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
/**
|
|
13
25
|
* {@link SearchBuilder#Fields}メソッドにパラメータを指定する際のヘルパー。
|
|
14
26
|
* @typedef {Object} Fields
|
|
@@ -38,14 +50,7 @@ export type RankingType = typeof RankingType[keyof typeof RankingType];
|
|
|
38
50
|
* @property {string} novelupdated_at 小説の更新日時
|
|
39
51
|
* @property {string} updated_at 最終更新日時(注意:システム用で小説更新時とは関係ありません)
|
|
40
52
|
*/
|
|
41
|
-
export interface SearchParams {
|
|
42
|
-
gzip?: GzipLevel;
|
|
43
|
-
out?: "json";
|
|
44
|
-
of?: string;
|
|
45
|
-
lim?: number;
|
|
46
|
-
st?: number;
|
|
47
|
-
order?: Order;
|
|
48
|
-
|
|
53
|
+
export interface SearchParams extends ParamsBaseWithOrder<Order> {
|
|
49
54
|
word?: string;
|
|
50
55
|
notword?: string;
|
|
51
56
|
title?: BooleanNumber;
|
|
@@ -104,16 +109,34 @@ export interface SearchParams {
|
|
|
104
109
|
opt?: Join<OptionalFields>;
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
export interface RankingParams {
|
|
112
|
+
export interface RankingParams extends ParamsBase {
|
|
108
113
|
rtype: `${string}-${RankingType}`;
|
|
109
|
-
gzip?: GzipLevel;
|
|
110
|
-
out?: "json";
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
export interface RankingHistoryParams {
|
|
116
|
+
export interface RankingHistoryParams extends ParamsBase {
|
|
114
117
|
ncode: string;
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* ユーザー検索パラメータ
|
|
122
|
+
*/
|
|
123
|
+
export interface UserSearchParams extends ParamsBaseWithOrder<UserOrder> {
|
|
124
|
+
/** 単語を指定できます。半角または全角スペースで区切るとAND抽出になります。部分一致でHITします。検索の対象はユーザ名とユーザ名のフリガナです。 */
|
|
125
|
+
word?: string;
|
|
126
|
+
/** 含みたくない単語を指定できます。スペースで区切ることにより含ませない単語を増やせます。部分一致で除外されます。除外の対象はユーザ名とユーザ名のフリガナです。 */
|
|
127
|
+
notword?: string;
|
|
128
|
+
/** ユーザIDで抽出可能。 */
|
|
129
|
+
userid?: number;
|
|
130
|
+
/** 抽出するユーザのユーザ名のフリガナの頭文字を指定できます。頭文字はユーザ名のフリガナをひらがなに変換し、最初の1文字が「ぁ」~「ん」の場合に対象となります。 */
|
|
131
|
+
name1st?: string;
|
|
132
|
+
/** 抽出するユーザの小説投稿数の下限を指定できます。小説投稿件数が指定された数値以上のユーザを抽出します。 */
|
|
133
|
+
minnovel?: number;
|
|
134
|
+
/** 抽出するユーザの小説投稿数の上限を指定できます。小説投稿件数が指定された数値以下のユーザを抽出します。 */
|
|
135
|
+
maxnovel?: number;
|
|
136
|
+
/** 抽出するユーザのレビュー投稿数の下限を指定できます。レビュー投稿件数が指定された数値以上のユーザを抽出します。 */
|
|
137
|
+
minreview?: number;
|
|
138
|
+
/** 抽出するユーザのレビュー投稿数の上限を指定できます。レビュー投稿件数が指定された数値以下のユーザを抽出します。 */
|
|
139
|
+
maxreview?: number;
|
|
117
140
|
}
|
|
118
141
|
|
|
119
142
|
export const BooleanNumber = {
|
|
@@ -216,6 +239,18 @@ export type R18Fields = typeof R18Fields[keyof Omit<
|
|
|
216
239
|
"novel_type" | "weekly_unique" | "biggenre" | "genre"
|
|
217
240
|
>];
|
|
218
241
|
|
|
242
|
+
export const UserFields = {
|
|
243
|
+
userid: "u",
|
|
244
|
+
name: "n",
|
|
245
|
+
yomikata: "y",
|
|
246
|
+
name1st: "1",
|
|
247
|
+
novel_cnt: "nc",
|
|
248
|
+
review_cnt: "rc",
|
|
249
|
+
novel_length: "nl",
|
|
250
|
+
sum_global_point: "sg",
|
|
251
|
+
} as const;
|
|
252
|
+
export type UserFields = typeof UserFields[keyof UserSearchResult];
|
|
253
|
+
|
|
219
254
|
export const OptionalFields = {
|
|
220
255
|
weekly_unique: "weekly",
|
|
221
256
|
} as const;
|
|
@@ -379,4 +414,14 @@ export const NovelTypeParam = {
|
|
|
379
414
|
} as const;
|
|
380
415
|
export type NovelTypeParam = typeof NovelTypeParam[keyof typeof NovelTypeParam];
|
|
381
416
|
|
|
417
|
+
export const UserOrder = {
|
|
418
|
+
New: "new",
|
|
419
|
+
NovelCount: "novelcnt",
|
|
420
|
+
ReviewCount: "reviewcnt",
|
|
421
|
+
NovelLength: "novellength",
|
|
422
|
+
SumGlobalPoint: "sumglobalpoint",
|
|
423
|
+
Old: "old",
|
|
424
|
+
} as const;
|
|
425
|
+
export type UserOrder = typeof UserOrder[keyof typeof UserOrder];
|
|
426
|
+
|
|
382
427
|
export type GzipLevel = 0 | 1 | 2 | 3 | 4 | 5;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NovelSearchBuilderBase } from "./search-builder";
|
|
2
2
|
import NarouSearchResults, {
|
|
3
3
|
NarouSearchResult,
|
|
4
4
|
SearchResultR18Fields,
|
|
5
|
-
|
|
5
|
+
SearchResultOptionalFields,
|
|
6
6
|
} from "./narou-search-results";
|
|
7
7
|
import {
|
|
8
8
|
R18Site,
|
|
@@ -23,18 +23,18 @@ export type DefaultR18SearchResultFields = keyof Omit<
|
|
|
23
23
|
export default class SearchBuilderR18<
|
|
24
24
|
T extends SearchResultFieldNames = DefaultR18SearchResultFields,
|
|
25
25
|
TOpt extends keyof NarouSearchResult = never
|
|
26
|
-
> extends
|
|
26
|
+
> extends NovelSearchBuilderBase<T | TOpt> {
|
|
27
27
|
/**
|
|
28
28
|
* なろう小説APIへの検索リクエストを実行する
|
|
29
29
|
* @override
|
|
30
30
|
* @returns {Promise<NarouSearchResults>} 検索結果
|
|
31
31
|
*/
|
|
32
|
-
execute(): Promise<NarouSearchResults<T | TOpt>> {
|
|
32
|
+
execute(): Promise<NarouSearchResults<NarouSearchResult, T | TOpt>> {
|
|
33
33
|
return this.api.executeNovel18(this.params);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
r18Site(sites: R18Site | readonly R18Site[]) {
|
|
37
|
-
this.set({ nocgenre:
|
|
37
|
+
this.set({ nocgenre: NovelSearchBuilderBase.array2string(sites) });
|
|
38
38
|
return this;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -43,7 +43,7 @@ export default class SearchBuilderR18<
|
|
|
43
43
|
* @return {SearchBuilder} this
|
|
44
44
|
*/
|
|
45
45
|
xid(ids: number | readonly number[]) {
|
|
46
|
-
this.set({ xid:
|
|
46
|
+
this.set({ xid: NovelSearchBuilderBase.array2string(ids) });
|
|
47
47
|
return this;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -54,15 +54,15 @@ export default class SearchBuilderR18<
|
|
|
54
54
|
fields<TFields extends R18Fields>(
|
|
55
55
|
fields: TFields | readonly TFields[]
|
|
56
56
|
): SearchBuilderR18<SearchResultR18Fields<R18Fields>> {
|
|
57
|
-
this.set({ of:
|
|
57
|
+
this.set({ of: NovelSearchBuilderBase.array2string(fields) });
|
|
58
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
59
|
return this as any;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
opt<TFields extends OptionalFields>(
|
|
63
63
|
option: TFields | readonly TFields[]
|
|
64
|
-
): SearchBuilderR18<T,
|
|
65
|
-
this.set({ opt:
|
|
64
|
+
): SearchBuilderR18<T, SearchResultOptionalFields<TFields>> {
|
|
65
|
+
this.set({ opt: NovelSearchBuilderBase.array2string(option) });
|
|
66
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
67
|
return this as any;
|
|
68
68
|
}
|