novel-api 0.19.1

Novel APIs from various sources
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;

#[must_use]
#[derive(Serialize)]
pub(crate) struct EmptyRequest {}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct GenericResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct PhoneCodeRequest {
    pub phone: String,
    pub sms_type: &'static str,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct LoginRequest {
    pub phone: String,
    pub phone_code: String,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct LoginResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<LoginData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct LoginData {
    pub user_info: Option<LoginUserInfo>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct LoginUserInfo {
    pub token: String,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct UserInfoResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<UserInfoData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct UserInfoData {
    pub cm_user: Option<UserInfoDataCmUser>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct UserInfoDataCmUser {
    pub nick_name: String,
    pub img_url: Url,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct MoneyResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<MoneyData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct MoneyData {
    pub account_info: Option<MoneyAccountInfo>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct MoneyAccountInfo {
    // 书币
    pub currency_balance: u32,
    //  代币
    pub coupon_balance: u32,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookSelfRequest {
    pub page_no: u16,
    pub page_size: u16,
    pub rank_type: u8,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct BookSelfResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<BookSelfData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookSelfData {
    pub book_rack_list: Option<Vec<BookRack>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookRack {
    pub book_id: u32,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookDetailRequest {
    pub book_id: String,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct BookDetailResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<BookDetailData>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct BookDetailData {
    pub book: Option<BookDetail>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookDetail {
    pub book_id: u32,
    pub book_name: Option<String>,
    pub img_url: Option<Url>,
    pub author_name: Option<String>,
    pub word_count: i32,
    pub first_classify: Option<u16>,
    pub first_classify_name: Option<String>,
    pub second_classify: Option<u16>,
    pub second_classify_name: Option<String>,
    pub end_state: Option<String>,
    pub is_vip: Option<String>,
    #[serde(deserialize_with = "crate::common::date_format_option")]
    pub latest_update_time: Option<NaiveDateTime>,
    pub notes: Option<String>,
    pub tag_list: Option<Vec<BookTag>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookTag {
    pub tag_id: u16,
    pub tag_name: String,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct PostListRequest {
    pub circle_id: String,
    pub circle_type: u8,
    pub page_no: u16,
    pub page_size: u16,
    pub rank_type: u8,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct PostListResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<PostListData>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct PostListData {
    pub list: Option<Vec<Post>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Post {
    pub post_id: u32,
    #[serde(deserialize_with = "crate::common::date_format")]
    pub create_time: NaiveDateTime,
    pub nick_name: String,
    pub post_content: String,
    pub user_img_url: Url,
    pub thumb_num: u16,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct PostDetailRequest {
    pub post_id: u32,
    pub page_no: u16,
    pub page_size: u16,
    pub rank_type: u8,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct PostDetailResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<PostDetail>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct PostDetail {
    #[serde(deserialize_with = "crate::common::date_format")]
    pub create_time: NaiveDateTime,
    pub nick_name: String,
    pub post_content: String,
    pub user_img_url: Url,
    pub thumb_num: u16,
    pub list: Vec<Reply>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Reply {
    #[serde(deserialize_with = "crate::common::date_format")]
    pub create_time: NaiveDateTime,
    pub nick_name: String,
    pub reply_content: String,
    pub reply_num: u16,
    pub user_img_url: Url,
    pub thumb_num: u16,
    pub reply_id: u32,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ReplyListRequest {
    pub reply_id: u32,
    pub page_size: u16,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct ReplyListResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<ReplyListData>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct ReplyListData {
    pub list: Option<Vec<ReplyDetail>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ReplyDetail {
    pub reply_id: u32,
    #[serde(deserialize_with = "crate::common::date_format")]
    pub create_time: NaiveDateTime,
    pub nick_name: String,
    pub reply_content: String,
    pub user_img_url: Url,
    pub thumb_num: u16,
    pub last_nick_name: Option<String>,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct VolumeInfosRequest {
    pub sort_type: &'static str,
    pub page_no: &'static str,
    pub page_size: &'static str,
    pub book_id: String,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct ChapterListResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<ChapterListData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ChapterListData {
    pub book_chapter: Option<BookChapter>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookChapter {
    pub book_id: u32,
    pub chapter_list: Option<Vec<Chapter>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Chapter {
    pub chapter_id: u32,
    pub chapter_name: String,
    pub is_buy: String,
    pub is_fee: String,
    pub price: String,
    #[serde(deserialize_with = "crate::common::date_format")]
    pub publish_time: NaiveDateTime,
    // 一些小说个别章节的 title 为空
    pub title: Option<String>,
    pub volume_id: u32,
    pub word_count: u32,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ContentRequest {
    pub book_id: String,
    pub chapter_id: String,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct ContentResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<ContentData>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct ContentData {
    pub chapter: Option<ContentChapter>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ContentChapter {
    pub content: String,
    pub img_list: Option<Vec<ContentImage>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ContentImage {
    pub img_url: Url,
    pub paragraph_index: usize,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OrderChapterRequest {
    pub view_type: &'static str,
    pub consume_type: &'static str,
    pub book_id: String,
    pub product_id: String,
    pub buy_count: &'static str,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OrderNovelRequest {
    pub view_type: &'static str,
    pub consume_type: &'static str,
    pub book_id: String,
    pub is_all_unpaid: &'static str,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CategoryRequest {
    pub page_no: u16,
    pub page_size: u16,
    pub book_type: &'static str,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct CategoryResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<CategoryData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CategoryData {
    pub classify_list: Option<Vec<Classify>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Classify {
    pub classify_id: u16,
    pub classify_name: String,
    pub child_list: Vec<ChildClassify>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ChildClassify {
    pub classify_id: u16,
    pub classify_name: String,
}

#[must_use]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct TagsRequest {
    pub page_no: u16,
    pub page_size: u16,
    pub book_type: u16,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct TagsResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<TagsData>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct TagsData {
    pub list: Option<Vec<Tag>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Tag {
    pub tag_id: u16,
    pub tag_name: String,
}

#[must_use]
#[skip_serializing_none]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SearchBookListRequest {
    pub page_no: u16,
    pub page_size: u16,
    pub rank_type: &'static str,
    pub keyword: String,
    pub is_fee: Option<String>,
    pub end_state: Option<String>,
    pub classify_ids: Option<String>,
    pub start_word: Option<String>,
    pub end_word: Option<String>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct SearchBookListResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<SearchData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SearchData {
    pub es_book_list: Option<Vec<SearchBook>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SearchBook {
    pub book_id: u32,
    pub first_classify: Option<u16>,
    pub second_classify: Option<u16>,
    pub tag_name: Option<String>,
    #[serde(deserialize_with = "crate::common::date_format_option")]
    pub latest_update_time: Option<NaiveDateTime>,
}

#[must_use]
#[skip_serializing_none]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookListRequest {
    pub page_no: u16,
    pub page_size: u16,
    pub rank_type: &'static str,
    pub first_classify: Option<String>,
    pub second_classify: Option<String>,
    pub start_word: Option<String>,
    pub end_word: Option<String>,
    pub end_state: Option<String>,
    pub is_fee: Option<String>,
}

#[must_use]
#[derive(Deserialize)]
pub(crate) struct BookListResponse {
    pub code: String,
    pub msg: String,
    pub ok: bool,
    pub data: Option<BookListData>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookListData {
    pub book_list: Option<Vec<BookListBook>>,
}

#[must_use]
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct BookListBook {
    pub book_id: u32,
    #[serde(deserialize_with = "crate::common::date_format_option")]
    pub latest_update_time: Option<NaiveDateTime>,
    pub tag_list: Option<Vec<BookTag>>,
}