narou 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -35
  3. package/dist/index.browser.cjs +87 -1230
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.d.cts +31 -24
  6. package/dist/index.browser.d.mts +47 -0
  7. package/dist/index.browser.mjs +66 -0
  8. package/dist/index.browser.mjs.map +1 -0
  9. package/dist/index.cjs +147 -1281
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.common-8lS2K_1Y.mjs +1166 -0
  12. package/dist/index.common-8lS2K_1Y.mjs.map +1 -0
  13. package/dist/index.common-CYj0n0aU.cjs +1346 -0
  14. package/dist/index.common-CYj0n0aU.cjs.map +1 -0
  15. package/dist/index.d.cts +39 -23
  16. package/dist/index.d.mts +63 -0
  17. package/dist/index.mjs +128 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/user-search-BY6FdEe7.d.cts +1394 -0
  20. package/dist/user-search-Besgk-Hx.d.mts +1394 -0
  21. package/package.json +34 -45
  22. package/pnpm-lock.yaml +2523 -2175
  23. package/src/index.browser.ts +21 -5
  24. package/src/index.ts +16 -3
  25. package/src/narou-fetch.ts +4 -3
  26. package/src/narou-jsonp.ts +4 -2
  27. package/src/narou-search-results.ts +2 -1
  28. package/src/narou.ts +53 -13
  29. package/src/params.ts +2 -2
  30. package/src/ranking-history.ts +13 -4
  31. package/src/ranking.ts +99 -26
  32. package/src/search-builder-r18.ts +23 -6
  33. package/src/search-builder.ts +183 -76
  34. package/src/user-search.ts +9 -2
  35. package/src/util/date.ts +38 -0
  36. package/src/util/jsonp.ts +61 -6
  37. package/src/util/type.ts +23 -0
  38. package/src/util/unzipp.ts +9 -0
  39. package/dist/chunk-4VC3246A.js +0 -83
  40. package/dist/chunk-4VC3246A.js.map +0 -1
  41. package/dist/chunk-4ZP5YNWI.js +0 -1
  42. package/dist/chunk-4ZP5YNWI.js.map +0 -1
  43. package/dist/chunk-AZT2OXBZ.js +0 -26
  44. package/dist/chunk-AZT2OXBZ.js.map +0 -1
  45. package/dist/chunk-CDOBNSCL.js +0 -407
  46. package/dist/chunk-CDOBNSCL.js.map +0 -1
  47. package/dist/chunk-K22KVNAH.js +0 -94
  48. package/dist/chunk-K22KVNAH.js.map +0 -1
  49. package/dist/chunk-NVMUSXA5.js +0 -23
  50. package/dist/chunk-NVMUSXA5.js.map +0 -1
  51. package/dist/chunk-P7QOZBII.js +0 -386
  52. package/dist/chunk-P7QOZBII.js.map +0 -1
  53. package/dist/chunk-RITMMCZE.js +0 -37
  54. package/dist/chunk-RITMMCZE.js.map +0 -1
  55. package/dist/chunk-SNPBEVCY.js +0 -44
  56. package/dist/chunk-SNPBEVCY.js.map +0 -1
  57. package/dist/chunk-UN3W2CT3.js +0 -72
  58. package/dist/chunk-UN3W2CT3.js.map +0 -1
  59. package/dist/chunk-WYSPGQ3S.js +0 -44
  60. package/dist/chunk-WYSPGQ3S.js.map +0 -1
  61. package/dist/chunk-XAUB42TO.js +0 -15
  62. package/dist/chunk-XAUB42TO.js.map +0 -1
  63. package/dist/chunk-XVH2CU2Q.js +0 -39
  64. package/dist/chunk-XVH2CU2Q.js.map +0 -1
  65. package/dist/index.browser.d.ts +0 -40
  66. package/dist/index.browser.js +0 -125
  67. package/dist/index.browser.js.map +0 -1
  68. package/dist/index.common.cjs +0 -1058
  69. package/dist/index.common.cjs.map +0 -1
  70. package/dist/index.common.d.cts +0 -6
  71. package/dist/index.common.d.ts +0 -6
  72. package/dist/index.common.js +0 -75
  73. package/dist/index.common.js.map +0 -1
  74. package/dist/index.d.ts +0 -47
  75. package/dist/index.js +0 -130
  76. package/dist/index.js.map +0 -1
  77. package/dist/narou-CatW_TC9.d.cts +0 -301
  78. package/dist/narou-fH9osIoh.d.ts +0 -301
  79. package/dist/narou-fetch.cjs +0 -161
  80. package/dist/narou-fetch.cjs.map +0 -1
  81. package/dist/narou-fetch.d.cts +0 -20
  82. package/dist/narou-fetch.d.ts +0 -20
  83. package/dist/narou-fetch.js +0 -10
  84. package/dist/narou-fetch.js.map +0 -1
  85. package/dist/narou-jsonp.cjs +0 -159
  86. package/dist/narou-jsonp.cjs.map +0 -1
  87. package/dist/narou-jsonp.d.cts +0 -13
  88. package/dist/narou-jsonp.d.ts +0 -13
  89. package/dist/narou-jsonp.js +0 -10
  90. package/dist/narou-jsonp.js.map +0 -1
  91. package/dist/narou-ranking-results.cjs +0 -19
  92. package/dist/narou-ranking-results.cjs.map +0 -1
  93. package/dist/narou-ranking-results.d.cts +0 -4
  94. package/dist/narou-ranking-results.d.ts +0 -4
  95. package/dist/narou-ranking-results.js +0 -1
  96. package/dist/narou-ranking-results.js.map +0 -1
  97. package/dist/narou-search-results-D5yqPRZ7.d.ts +0 -727
  98. package/dist/narou-search-results-DWCJWTC5.d.cts +0 -727
  99. package/dist/narou-search-results.cjs +0 -62
  100. package/dist/narou-search-results.cjs.map +0 -1
  101. package/dist/narou-search-results.d.cts +0 -2
  102. package/dist/narou-search-results.d.ts +0 -2
  103. package/dist/narou-search-results.js +0 -11
  104. package/dist/narou-search-results.js.map +0 -1
  105. package/dist/narou.cjs +0 -109
  106. package/dist/narou.cjs.map +0 -1
  107. package/dist/narou.d.cts +0 -4
  108. package/dist/narou.d.ts +0 -4
  109. package/dist/narou.js +0 -8
  110. package/dist/narou.js.map +0 -1
  111. package/dist/params.cjs +0 -448
  112. package/dist/params.cjs.map +0 -1
  113. package/dist/params.d.cts +0 -2
  114. package/dist/params.d.ts +0 -2
  115. package/dist/params.js +0 -41
  116. package/dist/params.js.map +0 -1
  117. package/dist/ranking-history.cjs +0 -39
  118. package/dist/ranking-history.cjs.map +0 -1
  119. package/dist/ranking-history.d.cts +0 -17
  120. package/dist/ranking-history.d.ts +0 -17
  121. package/dist/ranking-history.js +0 -7
  122. package/dist/ranking-history.js.map +0 -1
  123. package/dist/ranking.cjs +0 -674
  124. package/dist/ranking.cjs.map +0 -1
  125. package/dist/ranking.d.cts +0 -47
  126. package/dist/ranking.d.ts +0 -47
  127. package/dist/ranking.js +0 -9
  128. package/dist/ranking.js.map +0 -1
  129. package/dist/search-builder-r18.cjs +0 -488
  130. package/dist/search-builder-r18.cjs.map +0 -1
  131. package/dist/search-builder-r18.d.cts +0 -32
  132. package/dist/search-builder-r18.d.ts +0 -32
  133. package/dist/search-builder-r18.js +0 -9
  134. package/dist/search-builder-r18.js.map +0 -1
  135. package/dist/search-builder.cjs +0 -525
  136. package/dist/search-builder.cjs.map +0 -1
  137. package/dist/search-builder.d.cts +0 -4
  138. package/dist/search-builder.d.ts +0 -4
  139. package/dist/search-builder.js +0 -12
  140. package/dist/search-builder.js.map +0 -1
  141. package/dist/user-search.cjs +0 -301
  142. package/dist/user-search.cjs.map +0 -1
  143. package/dist/user-search.d.cts +0 -66
  144. package/dist/user-search.d.ts +0 -66
  145. package/dist/user-search.js +0 -9
  146. package/dist/user-search.js.map +0 -1
  147. package/dist/util/jsonp.cjs +0 -63
  148. package/dist/util/jsonp.cjs.map +0 -1
  149. package/dist/util/jsonp.d.cts +0 -13
  150. package/dist/util/jsonp.d.ts +0 -13
  151. package/dist/util/jsonp.js +0 -7
  152. package/dist/util/jsonp.js.map +0 -1
  153. package/dist/util/type.cjs +0 -19
  154. package/dist/util/type.cjs.map +0 -1
  155. package/dist/util/type.d.cts +0 -4
  156. package/dist/util/type.d.ts +0 -4
  157. package/dist/util/type.js +0 -1
  158. package/dist/util/type.js.map +0 -1
  159. package/dist/util/unzipp.cjs +0 -47
  160. package/dist/util/unzipp.cjs.map +0 -1
  161. package/dist/util/unzipp.d.cts +0 -3
  162. package/dist/util/unzipp.d.ts +0 -3
  163. package/dist/util/unzipp.js +0 -7
  164. package/dist/util/unzipp.js.map +0 -1
@@ -1,301 +0,0 @@
1
- import { r as NarouSearchResult, a as ParamsBaseWithOrder, q as GzipLevel, d as SearchResultFieldNames, S as SearchParams, g as Order, o as NovelTypeParam, m as BuntaiParam, D as DateParam, N as NarouSearchResults, j as BigGenre, G as Genre, F as Fields, u as SearchResultFields, O as OptionalFields, v as SearchResultOptionalFields, y as PickedNarouSearchResult, b as RankingParams, c as RankingHistoryParams, U as UserSearchParams, s as UserSearchResult } from './narou-search-results-DWCJWTC5.cjs';
2
- import { RankingHistoryRawResult } from './ranking-history.cjs';
3
- import { Join } from './util/type.cjs';
4
-
5
- type DefaultSearchResultFields = keyof Omit<NarouSearchResult, "weekly_unique" | "noveltype" | "nocgenre" | "xid">;
6
- declare abstract class SearchBuilderBase<TParams extends ParamsBaseWithOrder<TOrder>, TOrder extends string> {
7
- protected params: TParams;
8
- protected api: NarouNovel;
9
- /**
10
- * constructor
11
- * @private
12
- */
13
- constructor(params: TParams | undefined, api: NarouNovel);
14
- protected static distinct<T>(array: readonly T[]): T[];
15
- protected static array2string<T extends string | number>(n: T | readonly T[]): Join<T>;
16
- /**
17
- *
18
- * @return {SearchBuilder} this
19
- */
20
- limit(num: number): this;
21
- /**
22
- *
23
- * @return {SearchBuilder} this
24
- */
25
- start(num: number): this;
26
- /**
27
- *
28
- * @return {SearchBuilder} this
29
- */
30
- page(no: number, count?: number): this;
31
- /**
32
- * 出力順序を指定する。指定しない場合は新着順となります。
33
- * old 古い順
34
- * @param {TOrder} order 出力順序
35
- * @return {SearchBuilder} this
36
- */
37
- order(order: TOrder): this;
38
- /**
39
- * gzip圧縮する。
40
- *
41
- * 転送量上限を減らすためにも推奨
42
- * @param {GzipLevel} level gzip圧縮レベル(1~5)
43
- * @return {SearchBuilder} this
44
- */
45
- gzip(level: GzipLevel): this;
46
- /**
47
- * クエリパラメータをセットする
48
- * @private
49
- * @return {SearchBuilder} this
50
- */
51
- protected set(obj: TParams): this;
52
- /**
53
- * クエリパラメータを削除する
54
- */
55
- protected unset(key: keyof TParams): this;
56
- }
57
- declare abstract class NovelSearchBuilderBase<T extends SearchResultFieldNames> extends SearchBuilderBase<SearchParams, Order> {
58
- /**
59
- * a
60
- * @return {SearchBuilder} this
61
- */
62
- word(word: string): this;
63
- /**
64
- *
65
- * @return {SearchBuilder} this
66
- */
67
- notWord(word: string): this;
68
- /**
69
- *
70
- * @return {SearchBuilder} this
71
- */
72
- byTitle(bool?: boolean): this;
73
- /**
74
- *
75
- * @return {SearchBuilder} this
76
- */
77
- byOutline(bool?: boolean): this;
78
- /**
79
- *
80
- * @return {SearchBuilder} this
81
- */
82
- byKeyword(bool?: boolean): this;
83
- /**
84
- *
85
- * @return {SearchBuilder} this
86
- */
87
- byAuthor(bool?: boolean): this;
88
- /**
89
- *
90
- * @return {SearchBuilder} this
91
- */
92
- isBL(bool?: boolean): this;
93
- /**
94
- *
95
- * @return {SearchBuilder} this
96
- */
97
- isGL(bool?: boolean): this;
98
- /**
99
- *
100
- * @return {SearchBuilder} this
101
- */
102
- isZankoku(bool?: boolean): this;
103
- /**
104
- *
105
- * @return {SearchBuilder} this
106
- */
107
- isTensei(bool?: boolean): this;
108
- /**
109
- *
110
- * @return {SearchBuilder} this
111
- */
112
- isTenni(bool?: boolean): this;
113
- /**
114
- *
115
- * @return {SearchBuilder} this
116
- */
117
- isTT(): this;
118
- /**
119
- *
120
- * @return {SearchBuilder} this
121
- */
122
- length(length: number | readonly number[]): this;
123
- /**
124
- *
125
- * @return {SearchBuilder} this
126
- */
127
- kaiwaritu(num: number): this;
128
- kaiwaritu(min: number, max: number): this;
129
- /**
130
- *
131
- * @return {SearchBuilder} this
132
- */
133
- sasie(num: number | readonly number[]): this;
134
- /**
135
- *
136
- * @return {SearchBuilder} this
137
- */
138
- time(num: number | readonly number[]): this;
139
- /**
140
- *
141
- * @return {SearchBuilder} this
142
- */
143
- ncode(ncodes: string | readonly string[]): this;
144
- /**
145
- *
146
- * @return {SearchBuilder} this
147
- */
148
- type(type: NovelTypeParam): this;
149
- /**
150
- *
151
- * @return {SearchBuilder} this
152
- */
153
- buntai(buntai: BuntaiParam | readonly BuntaiParam[]): this;
154
- /**
155
- *
156
- * @return {SearchBuilder} this
157
- */
158
- isStop(bool?: boolean): this;
159
- /**
160
- *
161
- * @return {SearchBuilder} this
162
- */
163
- isPickup(bool?: boolean): this;
164
- /**
165
- *
166
- * @return {SearchBuilder} this
167
- */
168
- lastUpdate(date: DateParam): this;
169
- lastUpdate(from: number, to: number): this;
170
- lastUpdate(from: Date, to: Date): this;
171
- lastNovelUpdate(date: DateParam): this;
172
- lastNovelUpdate(from: number, to: number): this;
173
- lastNovelUpdate(from: Date, to: Date): this;
174
- /**
175
- * なろう小説APIへの検索リクエストを実行する
176
- * @returns {Promise<NarouSearchResults>} 検索結果
177
- */
178
- execute(): Promise<NarouSearchResults<NarouSearchResult, T>>;
179
- }
180
- /**
181
- * 検索ヘルパー
182
- * @class SearchBuilder
183
- */
184
- declare class SearchBuilder<T extends keyof NarouSearchResult = DefaultSearchResultFields, TOpt extends keyof NarouSearchResult = never> extends NovelSearchBuilderBase<T | TOpt> {
185
- /**
186
- *
187
- * @return {SearchBuilder} this
188
- */
189
- bigGenre(genre: BigGenre | readonly BigGenre[]): this;
190
- /**
191
- *
192
- * @return {SearchBuilder} this
193
- */
194
- notBigGenre(genre: BigGenre | readonly BigGenre[]): this;
195
- /**
196
- *
197
- * @return {SearchBuilder} this
198
- */
199
- genre(genre: Genre | readonly Genre[]): this;
200
- /**
201
- *
202
- * @return {SearchBuilder} this
203
- */
204
- notGenre(genre: Genre | readonly Genre[]): this;
205
- /**
206
- *
207
- * @return {SearchBuilder} this
208
- */
209
- userId(ids: number | readonly number[]): this;
210
- /**
211
- *
212
- * @return {SearchBuilder} this
213
- */
214
- isR15(bool?: boolean): this;
215
- /**
216
- *
217
- * @return {SearchBuilder} this
218
- */
219
- fields<TFields extends Fields>(fields: TFields | readonly TFields[]): SearchBuilder<SearchResultFields<TFields>, TOpt>;
220
- opt<TFields extends OptionalFields>(option: TFields | readonly TFields[]): SearchBuilder<T, SearchResultOptionalFields<TFields>>;
221
- }
222
-
223
- /**
224
- * ランキングAPIの結果
225
- * @see https://dev.syosetu.com/man/rankapi/#output
226
- */
227
- interface NarouRankingResult {
228
- /** Nコード */
229
- ncode: string;
230
- /** 順位 */
231
- rank: number;
232
- /** ポイント */
233
- pt: number;
234
- }
235
- /**
236
- * ランキングと小説情報をマージした結果
237
- */
238
- type RankingResult<T extends SearchResultFieldNames = DefaultSearchResultFields> = Partial<PickedNarouSearchResult<T>> & NarouRankingResult;
239
-
240
- /**
241
- * なろう小説APIへのリクエストパラメータ
242
- */
243
- type NarouParams = SearchParams | RankingParams | RankingHistoryParams | UserSearchParams;
244
- /**
245
- * なろう小説APIへのリクエストを実行する
246
- * @class NarouNovel
247
- * @private
248
- */
249
- declare abstract class NarouNovel {
250
- /**
251
- * なろうAPIへのAPIリクエストを実行する
252
- * @param params クエリパラメータ
253
- * @param endpoint APIエンドポイント
254
- * @returns 実行結果
255
- */
256
- protected abstract execute<T>(params: NarouParams, endpoint: string): Promise<T>;
257
- /**
258
- * APIへの検索リクエストを実行する
259
- * @param params クエリパラメータ
260
- * @param endpoint APIエンドポイント
261
- * @returns 検索結果
262
- */
263
- protected executeSearch<T extends keyof NarouSearchResult>(params: SearchParams, endpoint?: string): Promise<NarouSearchResults<NarouSearchResult, T>>;
264
- /**
265
- * 小説APIへの検索リクエストを実行する
266
- * @param params クエリパラメータ
267
- * @returns 検索結果
268
- * @see https://dev.syosetu.com/man/api/
269
- */
270
- executeNovel<T extends keyof NarouSearchResult>(params: SearchParams): Promise<NarouSearchResults<NarouSearchResult, T>>;
271
- /**
272
- * R18小説APIへの検索リクエストを実行する
273
- * @param params クエリパラメータ
274
- * @returns 検索結果
275
- * @see https://dev.syosetu.com/xman/api/
276
- */
277
- executeNovel18<T extends keyof NarouSearchResult>(params: SearchParams): Promise<NarouSearchResults<NarouSearchResult, T>>;
278
- /**
279
- * ランキングAPIへのリクエストを実行する
280
- * @param params クエリパラメータ
281
- * @returns ランキング結果
282
- * @see https://dev.syosetu.com/man/rankapi/
283
- */
284
- executeRanking(params: RankingParams): Promise<NarouRankingResult[]>;
285
- /**
286
- * 殿堂入りAPiへのリクエストを実行する
287
- * @param params クエリパラメータ
288
- * @returns ランキング履歴結果
289
- * @see https://dev.syosetu.com/man/rankinapi/
290
- */
291
- executeRankingHistory(params: RankingHistoryParams): Promise<RankingHistoryRawResult[]>;
292
- /**
293
- * ユーザー検索APIへのリクエストを実行する
294
- * @param params クエリパラメータ
295
- * @returns 検索結果
296
- * @see https://dev.syosetu.com/man/userapi/
297
- */
298
- executeUserSearch<T extends keyof UserSearchResult>(params: UserSearchParams): Promise<NarouSearchResults<UserSearchResult, T>>;
299
- }
300
-
301
- export { type DefaultSearchResultFields as D, NarouNovel as N, type RankingResult as R, SearchBuilder as S, type NarouParams as a, type NarouRankingResult as b, SearchBuilderBase as c, NovelSearchBuilderBase as d };
@@ -1,301 +0,0 @@
1
- import { r as NarouSearchResult, a as ParamsBaseWithOrder, q as GzipLevel, d as SearchResultFieldNames, S as SearchParams, g as Order, o as NovelTypeParam, m as BuntaiParam, D as DateParam, N as NarouSearchResults, j as BigGenre, G as Genre, F as Fields, u as SearchResultFields, O as OptionalFields, v as SearchResultOptionalFields, y as PickedNarouSearchResult, b as RankingParams, c as RankingHistoryParams, U as UserSearchParams, s as UserSearchResult } from './narou-search-results-D5yqPRZ7.js';
2
- import { RankingHistoryRawResult } from './ranking-history.js';
3
- import { Join } from './util/type.js';
4
-
5
- type DefaultSearchResultFields = keyof Omit<NarouSearchResult, "weekly_unique" | "noveltype" | "nocgenre" | "xid">;
6
- declare abstract class SearchBuilderBase<TParams extends ParamsBaseWithOrder<TOrder>, TOrder extends string> {
7
- protected params: TParams;
8
- protected api: NarouNovel;
9
- /**
10
- * constructor
11
- * @private
12
- */
13
- constructor(params: TParams | undefined, api: NarouNovel);
14
- protected static distinct<T>(array: readonly T[]): T[];
15
- protected static array2string<T extends string | number>(n: T | readonly T[]): Join<T>;
16
- /**
17
- *
18
- * @return {SearchBuilder} this
19
- */
20
- limit(num: number): this;
21
- /**
22
- *
23
- * @return {SearchBuilder} this
24
- */
25
- start(num: number): this;
26
- /**
27
- *
28
- * @return {SearchBuilder} this
29
- */
30
- page(no: number, count?: number): this;
31
- /**
32
- * 出力順序を指定する。指定しない場合は新着順となります。
33
- * old 古い順
34
- * @param {TOrder} order 出力順序
35
- * @return {SearchBuilder} this
36
- */
37
- order(order: TOrder): this;
38
- /**
39
- * gzip圧縮する。
40
- *
41
- * 転送量上限を減らすためにも推奨
42
- * @param {GzipLevel} level gzip圧縮レベル(1~5)
43
- * @return {SearchBuilder} this
44
- */
45
- gzip(level: GzipLevel): this;
46
- /**
47
- * クエリパラメータをセットする
48
- * @private
49
- * @return {SearchBuilder} this
50
- */
51
- protected set(obj: TParams): this;
52
- /**
53
- * クエリパラメータを削除する
54
- */
55
- protected unset(key: keyof TParams): this;
56
- }
57
- declare abstract class NovelSearchBuilderBase<T extends SearchResultFieldNames> extends SearchBuilderBase<SearchParams, Order> {
58
- /**
59
- * a
60
- * @return {SearchBuilder} this
61
- */
62
- word(word: string): this;
63
- /**
64
- *
65
- * @return {SearchBuilder} this
66
- */
67
- notWord(word: string): this;
68
- /**
69
- *
70
- * @return {SearchBuilder} this
71
- */
72
- byTitle(bool?: boolean): this;
73
- /**
74
- *
75
- * @return {SearchBuilder} this
76
- */
77
- byOutline(bool?: boolean): this;
78
- /**
79
- *
80
- * @return {SearchBuilder} this
81
- */
82
- byKeyword(bool?: boolean): this;
83
- /**
84
- *
85
- * @return {SearchBuilder} this
86
- */
87
- byAuthor(bool?: boolean): this;
88
- /**
89
- *
90
- * @return {SearchBuilder} this
91
- */
92
- isBL(bool?: boolean): this;
93
- /**
94
- *
95
- * @return {SearchBuilder} this
96
- */
97
- isGL(bool?: boolean): this;
98
- /**
99
- *
100
- * @return {SearchBuilder} this
101
- */
102
- isZankoku(bool?: boolean): this;
103
- /**
104
- *
105
- * @return {SearchBuilder} this
106
- */
107
- isTensei(bool?: boolean): this;
108
- /**
109
- *
110
- * @return {SearchBuilder} this
111
- */
112
- isTenni(bool?: boolean): this;
113
- /**
114
- *
115
- * @return {SearchBuilder} this
116
- */
117
- isTT(): this;
118
- /**
119
- *
120
- * @return {SearchBuilder} this
121
- */
122
- length(length: number | readonly number[]): this;
123
- /**
124
- *
125
- * @return {SearchBuilder} this
126
- */
127
- kaiwaritu(num: number): this;
128
- kaiwaritu(min: number, max: number): this;
129
- /**
130
- *
131
- * @return {SearchBuilder} this
132
- */
133
- sasie(num: number | readonly number[]): this;
134
- /**
135
- *
136
- * @return {SearchBuilder} this
137
- */
138
- time(num: number | readonly number[]): this;
139
- /**
140
- *
141
- * @return {SearchBuilder} this
142
- */
143
- ncode(ncodes: string | readonly string[]): this;
144
- /**
145
- *
146
- * @return {SearchBuilder} this
147
- */
148
- type(type: NovelTypeParam): this;
149
- /**
150
- *
151
- * @return {SearchBuilder} this
152
- */
153
- buntai(buntai: BuntaiParam | readonly BuntaiParam[]): this;
154
- /**
155
- *
156
- * @return {SearchBuilder} this
157
- */
158
- isStop(bool?: boolean): this;
159
- /**
160
- *
161
- * @return {SearchBuilder} this
162
- */
163
- isPickup(bool?: boolean): this;
164
- /**
165
- *
166
- * @return {SearchBuilder} this
167
- */
168
- lastUpdate(date: DateParam): this;
169
- lastUpdate(from: number, to: number): this;
170
- lastUpdate(from: Date, to: Date): this;
171
- lastNovelUpdate(date: DateParam): this;
172
- lastNovelUpdate(from: number, to: number): this;
173
- lastNovelUpdate(from: Date, to: Date): this;
174
- /**
175
- * なろう小説APIへの検索リクエストを実行する
176
- * @returns {Promise<NarouSearchResults>} 検索結果
177
- */
178
- execute(): Promise<NarouSearchResults<NarouSearchResult, T>>;
179
- }
180
- /**
181
- * 検索ヘルパー
182
- * @class SearchBuilder
183
- */
184
- declare class SearchBuilder<T extends keyof NarouSearchResult = DefaultSearchResultFields, TOpt extends keyof NarouSearchResult = never> extends NovelSearchBuilderBase<T | TOpt> {
185
- /**
186
- *
187
- * @return {SearchBuilder} this
188
- */
189
- bigGenre(genre: BigGenre | readonly BigGenre[]): this;
190
- /**
191
- *
192
- * @return {SearchBuilder} this
193
- */
194
- notBigGenre(genre: BigGenre | readonly BigGenre[]): this;
195
- /**
196
- *
197
- * @return {SearchBuilder} this
198
- */
199
- genre(genre: Genre | readonly Genre[]): this;
200
- /**
201
- *
202
- * @return {SearchBuilder} this
203
- */
204
- notGenre(genre: Genre | readonly Genre[]): this;
205
- /**
206
- *
207
- * @return {SearchBuilder} this
208
- */
209
- userId(ids: number | readonly number[]): this;
210
- /**
211
- *
212
- * @return {SearchBuilder} this
213
- */
214
- isR15(bool?: boolean): this;
215
- /**
216
- *
217
- * @return {SearchBuilder} this
218
- */
219
- fields<TFields extends Fields>(fields: TFields | readonly TFields[]): SearchBuilder<SearchResultFields<TFields>, TOpt>;
220
- opt<TFields extends OptionalFields>(option: TFields | readonly TFields[]): SearchBuilder<T, SearchResultOptionalFields<TFields>>;
221
- }
222
-
223
- /**
224
- * ランキングAPIの結果
225
- * @see https://dev.syosetu.com/man/rankapi/#output
226
- */
227
- interface NarouRankingResult {
228
- /** Nコード */
229
- ncode: string;
230
- /** 順位 */
231
- rank: number;
232
- /** ポイント */
233
- pt: number;
234
- }
235
- /**
236
- * ランキングと小説情報をマージした結果
237
- */
238
- type RankingResult<T extends SearchResultFieldNames = DefaultSearchResultFields> = Partial<PickedNarouSearchResult<T>> & NarouRankingResult;
239
-
240
- /**
241
- * なろう小説APIへのリクエストパラメータ
242
- */
243
- type NarouParams = SearchParams | RankingParams | RankingHistoryParams | UserSearchParams;
244
- /**
245
- * なろう小説APIへのリクエストを実行する
246
- * @class NarouNovel
247
- * @private
248
- */
249
- declare abstract class NarouNovel {
250
- /**
251
- * なろうAPIへのAPIリクエストを実行する
252
- * @param params クエリパラメータ
253
- * @param endpoint APIエンドポイント
254
- * @returns 実行結果
255
- */
256
- protected abstract execute<T>(params: NarouParams, endpoint: string): Promise<T>;
257
- /**
258
- * APIへの検索リクエストを実行する
259
- * @param params クエリパラメータ
260
- * @param endpoint APIエンドポイント
261
- * @returns 検索結果
262
- */
263
- protected executeSearch<T extends keyof NarouSearchResult>(params: SearchParams, endpoint?: string): Promise<NarouSearchResults<NarouSearchResult, T>>;
264
- /**
265
- * 小説APIへの検索リクエストを実行する
266
- * @param params クエリパラメータ
267
- * @returns 検索結果
268
- * @see https://dev.syosetu.com/man/api/
269
- */
270
- executeNovel<T extends keyof NarouSearchResult>(params: SearchParams): Promise<NarouSearchResults<NarouSearchResult, T>>;
271
- /**
272
- * R18小説APIへの検索リクエストを実行する
273
- * @param params クエリパラメータ
274
- * @returns 検索結果
275
- * @see https://dev.syosetu.com/xman/api/
276
- */
277
- executeNovel18<T extends keyof NarouSearchResult>(params: SearchParams): Promise<NarouSearchResults<NarouSearchResult, T>>;
278
- /**
279
- * ランキングAPIへのリクエストを実行する
280
- * @param params クエリパラメータ
281
- * @returns ランキング結果
282
- * @see https://dev.syosetu.com/man/rankapi/
283
- */
284
- executeRanking(params: RankingParams): Promise<NarouRankingResult[]>;
285
- /**
286
- * 殿堂入りAPiへのリクエストを実行する
287
- * @param params クエリパラメータ
288
- * @returns ランキング履歴結果
289
- * @see https://dev.syosetu.com/man/rankinapi/
290
- */
291
- executeRankingHistory(params: RankingHistoryParams): Promise<RankingHistoryRawResult[]>;
292
- /**
293
- * ユーザー検索APIへのリクエストを実行する
294
- * @param params クエリパラメータ
295
- * @returns 検索結果
296
- * @see https://dev.syosetu.com/man/userapi/
297
- */
298
- executeUserSearch<T extends keyof UserSearchResult>(params: UserSearchParams): Promise<NarouSearchResults<UserSearchResult, T>>;
299
- }
300
-
301
- export { type DefaultSearchResultFields as D, NarouNovel as N, type RankingResult as R, SearchBuilder as S, type NarouParams as a, type NarouRankingResult as b, SearchBuilderBase as c, NovelSearchBuilderBase as d };