@silverfish-app/sdk 1.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.
@@ -0,0 +1,1432 @@
1
+ import { T as TDataShape, O as Options$1, a as Client, b as ClientMeta, e as RequestResult } from './types.gen-Bfm1raMe.js';
2
+
3
+ type ClientOptions = {
4
+ baseUrl: `${string}://${string}` | (string & {});
5
+ };
6
+ /**
7
+ * AuthorOut
8
+ */
9
+ type AuthorOut = {
10
+ /**
11
+ * Name
12
+ */
13
+ name: string;
14
+ /**
15
+ * Sort
16
+ */
17
+ sort: string;
18
+ };
19
+ /**
20
+ * BinaryHealthOut
21
+ *
22
+ * Availability of the Calibre binaries (optional system dependency).
23
+ */
24
+ type BinaryHealthOut = {
25
+ /**
26
+ * Convert Available
27
+ */
28
+ convert_available: boolean;
29
+ /**
30
+ * Metadata Available
31
+ */
32
+ metadata_available: boolean;
33
+ };
34
+ /**
35
+ * Body_upload_book
36
+ */
37
+ type BodyUploadBook = {
38
+ /**
39
+ * File
40
+ */
41
+ file: Blob | File;
42
+ };
43
+ /**
44
+ * BookOut
45
+ *
46
+ * A book as returned by the API.
47
+ *
48
+ * ``id`` is the public form of the book's internal id — always a string so the
49
+ * contract keeps one shape, but rendered per library mode (short base62 for
50
+ * standalone Snowflake ids, plain decimal for Calibre's small ids).
51
+ */
52
+ type BookOut = {
53
+ /**
54
+ * Author Sort
55
+ */
56
+ author_sort: string;
57
+ /**
58
+ * Authors
59
+ */
60
+ authors: Array<AuthorOut>;
61
+ /**
62
+ * Cover Url
63
+ */
64
+ cover_url: string | null;
65
+ /**
66
+ * Formats
67
+ */
68
+ formats: Array<FormatOut>;
69
+ /**
70
+ * Has Cover
71
+ */
72
+ has_cover: boolean;
73
+ /**
74
+ * Id
75
+ */
76
+ id: string;
77
+ /**
78
+ * Identifiers
79
+ */
80
+ identifiers: Array<IdentifierOut>;
81
+ /**
82
+ * Languages
83
+ */
84
+ languages: Array<string>;
85
+ /**
86
+ * Publisher
87
+ */
88
+ publisher: string | null;
89
+ /**
90
+ * Rating
91
+ */
92
+ rating: number | null;
93
+ series: SeriesOut | null;
94
+ /**
95
+ * Sort
96
+ */
97
+ sort: string;
98
+ /**
99
+ * Tags
100
+ */
101
+ tags: Array<TagOut>;
102
+ /**
103
+ * Title
104
+ */
105
+ title: string;
106
+ };
107
+ /**
108
+ * BookPage
109
+ *
110
+ * A paginated page of books.
111
+ */
112
+ type BookPage = {
113
+ /**
114
+ * Has Next
115
+ */
116
+ has_next: boolean;
117
+ /**
118
+ * Has Prev
119
+ */
120
+ has_prev: boolean;
121
+ /**
122
+ * Items
123
+ */
124
+ items: Array<BookOut>;
125
+ /**
126
+ * Page
127
+ */
128
+ page: number;
129
+ /**
130
+ * Page Size
131
+ */
132
+ page_size: number;
133
+ /**
134
+ * Total
135
+ */
136
+ total: number;
137
+ /**
138
+ * Total Pages
139
+ */
140
+ total_pages: number;
141
+ };
142
+ /**
143
+ * BookUpdate
144
+ *
145
+ * A partial book metadata update. Only provided fields are changed.
146
+ *
147
+ * Omitting a field leaves it untouched; sending ``null`` clears it (e.g.
148
+ * ``rating: null`` removes the rating). Sort keys and the on-disk path are
149
+ * recomputed by the server when title/authors change.
150
+ */
151
+ type BookUpdate = {
152
+ /**
153
+ * Authors
154
+ *
155
+ * Full author list (replaces the existing one).
156
+ */
157
+ authors?: Array<string> | null;
158
+ /**
159
+ * Comment
160
+ *
161
+ * Description/notes (HTML allowed), or null to clear.
162
+ */
163
+ comment?: string | null;
164
+ /**
165
+ * Languages
166
+ *
167
+ * Language codes (replaces the existing list).
168
+ */
169
+ languages?: Array<string> | null;
170
+ /**
171
+ * Publisher
172
+ *
173
+ * Publisher name, or null to clear.
174
+ */
175
+ publisher?: string | null;
176
+ /**
177
+ * Rating
178
+ *
179
+ * Rating 0-10 (Calibre scale), or null to clear.
180
+ */
181
+ rating?: number | null;
182
+ /**
183
+ * Series
184
+ *
185
+ * Series name, or null to clear.
186
+ */
187
+ series?: string | null;
188
+ /**
189
+ * Series Index
190
+ *
191
+ * Position within the series.
192
+ */
193
+ series_index?: number | null;
194
+ /**
195
+ * Tags
196
+ *
197
+ * Full tag list (replaces the existing one).
198
+ */
199
+ tags?: Array<string> | null;
200
+ /**
201
+ * Title
202
+ *
203
+ * New title.
204
+ */
205
+ title?: string | null;
206
+ };
207
+ /**
208
+ * ConvertRequest
209
+ *
210
+ * Request to convert a book from one format to another.
211
+ */
212
+ type ConvertRequest = {
213
+ /**
214
+ * Source Format
215
+ *
216
+ * Format to convert from. When omitted, the API picks the best available source by a default priority order.
217
+ */
218
+ source_format?: string | null;
219
+ /**
220
+ * Target Format
221
+ *
222
+ * Format to produce, e.g. 'EPUB', 'MOBI', 'AZW3', 'PDF'.
223
+ */
224
+ target_format: string;
225
+ };
226
+ /**
227
+ * EmailConfigOut
228
+ *
229
+ * Non-secret view of the email configuration (never includes the password).
230
+ *
231
+ * Whether sending is *available* is reported by ``/health`` (``send_available``);
232
+ * this is the detail view for a settings screen.
233
+ */
234
+ type EmailConfigOut = {
235
+ /**
236
+ * Configured
237
+ */
238
+ configured: boolean;
239
+ /**
240
+ * From Address
241
+ */
242
+ from_address: string;
243
+ /**
244
+ * Host
245
+ */
246
+ host: string;
247
+ /**
248
+ * Port
249
+ */
250
+ port: number;
251
+ /**
252
+ * Security
253
+ */
254
+ security: string;
255
+ };
256
+ /**
257
+ * EmailTestRequest
258
+ *
259
+ * Request to send a connectivity test email.
260
+ */
261
+ type EmailTestRequest = {
262
+ /**
263
+ * To Email
264
+ *
265
+ * Address to send the SMTP connectivity test email to.
266
+ */
267
+ to_email: string;
268
+ };
269
+ /**
270
+ * ErrorBody
271
+ *
272
+ * The body of a standardized error.
273
+ */
274
+ type ErrorBody = {
275
+ /**
276
+ * Details
277
+ */
278
+ details?: Array<ErrorDetail> | null;
279
+ /**
280
+ * Message
281
+ */
282
+ message: string;
283
+ /**
284
+ * Status
285
+ */
286
+ status: number;
287
+ };
288
+ /**
289
+ * ErrorDetail
290
+ *
291
+ * A single field-level validation problem.
292
+ */
293
+ type ErrorDetail = {
294
+ /**
295
+ * Location
296
+ */
297
+ location: string;
298
+ /**
299
+ * Message
300
+ */
301
+ message: string;
302
+ };
303
+ /**
304
+ * ErrorResponse
305
+ *
306
+ * Every error the API returns shares this shape: ``{"error": {...}}``.
307
+ */
308
+ type ErrorResponse = {
309
+ error: ErrorBody;
310
+ };
311
+ /**
312
+ * ExportRequest
313
+ *
314
+ * Request to export the library to a Calibre-format zip.
315
+ *
316
+ * The export runs asynchronously; a time-limited download link is emailed to
317
+ * ``to_email`` when it is ready (the zip is never attached — a library can be
318
+ * far larger than any mail server accepts).
319
+ *
320
+ * ``book_ids`` selects which books to export (public id strings). Omit it to
321
+ * export the whole library.
322
+ */
323
+ type ExportRequest = {
324
+ /**
325
+ * Book Ids
326
+ *
327
+ * Public ids of the books to export; omit to export the whole library.
328
+ */
329
+ book_ids?: Array<string> | null;
330
+ /**
331
+ * To Email
332
+ *
333
+ * Address that receives the download link when ready.
334
+ */
335
+ to_email: string;
336
+ };
337
+ /**
338
+ * FormatOut
339
+ */
340
+ type FormatOut = {
341
+ /**
342
+ * Download Url
343
+ */
344
+ download_url: string;
345
+ /**
346
+ * Extension
347
+ */
348
+ extension: string;
349
+ /**
350
+ * Size Bytes
351
+ */
352
+ size_bytes: number;
353
+ };
354
+ /**
355
+ * HTTPValidationError
356
+ */
357
+ type HttpValidationError = {
358
+ /**
359
+ * Detail
360
+ */
361
+ detail?: Array<ValidationError>;
362
+ };
363
+ /**
364
+ * HealthResponse
365
+ *
366
+ * Liveness payload. Typed so it appears in the OpenAPI contract.
367
+ */
368
+ type HealthResponse = {
369
+ binaries: BinaryHealthOut;
370
+ /**
371
+ * Send Available
372
+ */
373
+ send_available: boolean;
374
+ /**
375
+ * Status
376
+ */
377
+ status: string;
378
+ /**
379
+ * Version
380
+ */
381
+ version: string;
382
+ };
383
+ /**
384
+ * IdentifierOut
385
+ */
386
+ type IdentifierOut = {
387
+ /**
388
+ * Scheme
389
+ */
390
+ scheme: string;
391
+ /**
392
+ * Value
393
+ */
394
+ value: string;
395
+ };
396
+ /**
397
+ * JobOut
398
+ *
399
+ * A background job's observable state.
400
+ */
401
+ type JobOut = {
402
+ /**
403
+ * Error
404
+ *
405
+ * Failure reason when status is 'error', else null.
406
+ */
407
+ error?: string | null;
408
+ /**
409
+ * Id
410
+ *
411
+ * Opaque job id; poll it at /jobs/{job_id}.
412
+ */
413
+ id: string;
414
+ /**
415
+ * Message
416
+ *
417
+ * Human-readable description of the current step.
418
+ */
419
+ message?: string;
420
+ /**
421
+ * Progress
422
+ *
423
+ * Completion fraction from 0.0 to 1.0.
424
+ */
425
+ progress: number;
426
+ /**
427
+ * Current lifecycle state.
428
+ */
429
+ status: JobStatusOut;
430
+ /**
431
+ * What kind of work this job performs.
432
+ */
433
+ type: JobType;
434
+ };
435
+ /**
436
+ * JobStatusOut
437
+ *
438
+ * A job's lifecycle state (mirrors the core's JobStatus).
439
+ */
440
+ type JobStatusOut = 'queued' | 'running' | 'done' | 'error';
441
+ /**
442
+ * JobType
443
+ *
444
+ * The kind of background work a job performs.
445
+ */
446
+ type JobType = 'convert' | 'send' | 'export';
447
+ /**
448
+ * RefreshRequest
449
+ *
450
+ * Request to refresh a book's metadata from one of its format files.
451
+ */
452
+ type RefreshRequest = {
453
+ /**
454
+ * Source Format
455
+ *
456
+ * Which existing format to re-read metadata (and cover) from, e.g. 'EPUB'.
457
+ */
458
+ source_format: string;
459
+ };
460
+ /**
461
+ * SendRequest
462
+ *
463
+ * Request to send a book to an e-reader email address.
464
+ */
465
+ type SendRequest = {
466
+ /**
467
+ * Format
468
+ *
469
+ * Format to send. When omitted, the best available is chosen. Must be a format the book actually has, otherwise the request is rejected.
470
+ */
471
+ format?: string | null;
472
+ /**
473
+ * To Email
474
+ *
475
+ * Destination e-reader address (e.g. your Kindle email).
476
+ */
477
+ to_email: string;
478
+ };
479
+ /**
480
+ * SeriesOut
481
+ */
482
+ type SeriesOut = {
483
+ /**
484
+ * Index
485
+ */
486
+ index: number;
487
+ /**
488
+ * Name
489
+ */
490
+ name: string;
491
+ };
492
+ /**
493
+ * SortDirection
494
+ */
495
+ type SortDirection = 'asc' | 'desc';
496
+ /**
497
+ * SortField
498
+ *
499
+ * Fields a book listing can be sorted by.
500
+ */
501
+ type SortField = 'title' | 'author' | 'pubdate' | 'timestamp' | 'last_modified' | 'series' | 'rating';
502
+ /**
503
+ * TagOut
504
+ */
505
+ type TagOut = {
506
+ /**
507
+ * Name
508
+ */
509
+ name: string;
510
+ };
511
+ /**
512
+ * ValidationError
513
+ */
514
+ type ValidationError = {
515
+ /**
516
+ * Context
517
+ */
518
+ ctx?: {
519
+ [key: string]: unknown;
520
+ };
521
+ /**
522
+ * Input
523
+ */
524
+ input?: unknown;
525
+ /**
526
+ * Location
527
+ */
528
+ loc: Array<string | number>;
529
+ /**
530
+ * Message
531
+ */
532
+ msg: string;
533
+ /**
534
+ * Error Type
535
+ */
536
+ type: string;
537
+ };
538
+ type ListBooksData = {
539
+ body?: never;
540
+ path?: never;
541
+ query?: {
542
+ /**
543
+ * Page
544
+ */
545
+ page?: number;
546
+ /**
547
+ * Page Size
548
+ */
549
+ page_size?: number;
550
+ sort?: SortField;
551
+ direction?: SortDirection;
552
+ };
553
+ url: '/books';
554
+ };
555
+ type ListBooksErrors = {
556
+ /**
557
+ * Validation error
558
+ */
559
+ 422: ErrorResponse;
560
+ /**
561
+ * Internal server error
562
+ */
563
+ 500: ErrorResponse;
564
+ };
565
+ type ListBooksError = ListBooksErrors[keyof ListBooksErrors];
566
+ type ListBooksResponses = {
567
+ /**
568
+ * Successful Response
569
+ */
570
+ 200: BookPage;
571
+ };
572
+ type ListBooksResponse = ListBooksResponses[keyof ListBooksResponses];
573
+ type UploadBookData = {
574
+ body: BodyUploadBook;
575
+ path?: never;
576
+ query?: never;
577
+ url: '/books';
578
+ };
579
+ type UploadBookErrors = {
580
+ /**
581
+ * Bad request
582
+ */
583
+ 400: ErrorResponse;
584
+ /**
585
+ * Payload too large
586
+ */
587
+ 413: ErrorResponse;
588
+ /**
589
+ * Validation error
590
+ */
591
+ 422: ErrorResponse;
592
+ /**
593
+ * Internal server error
594
+ */
595
+ 500: ErrorResponse;
596
+ };
597
+ type UploadBookError = UploadBookErrors[keyof UploadBookErrors];
598
+ type UploadBookResponses = {
599
+ /**
600
+ * Successful Response
601
+ */
602
+ 201: BookOut;
603
+ };
604
+ type UploadBookResponse = UploadBookResponses[keyof UploadBookResponses];
605
+ type DeleteBookData = {
606
+ body?: never;
607
+ path: {
608
+ /**
609
+ * Book Id
610
+ */
611
+ book_id: string;
612
+ };
613
+ query?: never;
614
+ url: '/books/{book_id}';
615
+ };
616
+ type DeleteBookErrors = {
617
+ /**
618
+ * Resource not found
619
+ */
620
+ 404: ErrorResponse;
621
+ /**
622
+ * Validation Error
623
+ */
624
+ 422: HttpValidationError;
625
+ /**
626
+ * Internal server error
627
+ */
628
+ 500: ErrorResponse;
629
+ };
630
+ type DeleteBookError = DeleteBookErrors[keyof DeleteBookErrors];
631
+ type DeleteBookResponses = {
632
+ /**
633
+ * Successful Response
634
+ */
635
+ 204: void;
636
+ };
637
+ type DeleteBookResponse = DeleteBookResponses[keyof DeleteBookResponses];
638
+ type GetBookData = {
639
+ body?: never;
640
+ path: {
641
+ /**
642
+ * Book Id
643
+ */
644
+ book_id: string;
645
+ };
646
+ query?: never;
647
+ url: '/books/{book_id}';
648
+ };
649
+ type GetBookErrors = {
650
+ /**
651
+ * Resource not found
652
+ */
653
+ 404: ErrorResponse;
654
+ /**
655
+ * Validation error
656
+ */
657
+ 422: ErrorResponse;
658
+ /**
659
+ * Internal server error
660
+ */
661
+ 500: ErrorResponse;
662
+ };
663
+ type GetBookError = GetBookErrors[keyof GetBookErrors];
664
+ type GetBookResponses = {
665
+ /**
666
+ * Successful Response
667
+ */
668
+ 200: BookOut;
669
+ };
670
+ type GetBookResponse = GetBookResponses[keyof GetBookResponses];
671
+ type UpdateBookData = {
672
+ body: BookUpdate;
673
+ path: {
674
+ /**
675
+ * Book Id
676
+ */
677
+ book_id: string;
678
+ };
679
+ query?: never;
680
+ url: '/books/{book_id}';
681
+ };
682
+ type UpdateBookErrors = {
683
+ /**
684
+ * Bad request
685
+ */
686
+ 400: ErrorResponse;
687
+ /**
688
+ * Resource not found
689
+ */
690
+ 404: ErrorResponse;
691
+ /**
692
+ * Validation error
693
+ */
694
+ 422: ErrorResponse;
695
+ /**
696
+ * Internal server error
697
+ */
698
+ 500: ErrorResponse;
699
+ };
700
+ type UpdateBookError = UpdateBookErrors[keyof UpdateBookErrors];
701
+ type UpdateBookResponses = {
702
+ /**
703
+ * Successful Response
704
+ */
705
+ 200: BookOut;
706
+ };
707
+ type UpdateBookResponse = UpdateBookResponses[keyof UpdateBookResponses];
708
+ type ConvertBookData = {
709
+ body: ConvertRequest;
710
+ path: {
711
+ /**
712
+ * Book Id
713
+ */
714
+ book_id: string;
715
+ };
716
+ query?: never;
717
+ url: '/books/{book_id}/convert';
718
+ };
719
+ type ConvertBookErrors = {
720
+ /**
721
+ * Bad request
722
+ */
723
+ 400: ErrorResponse;
724
+ /**
725
+ * Resource not found
726
+ */
727
+ 404: ErrorResponse;
728
+ /**
729
+ * Conflict
730
+ */
731
+ 409: ErrorResponse;
732
+ /**
733
+ * Validation error
734
+ */
735
+ 422: ErrorResponse;
736
+ /**
737
+ * Internal server error
738
+ */
739
+ 500: ErrorResponse;
740
+ /**
741
+ * Service unavailable
742
+ */
743
+ 503: ErrorResponse;
744
+ };
745
+ type ConvertBookError = ConvertBookErrors[keyof ConvertBookErrors];
746
+ type ConvertBookResponses = {
747
+ /**
748
+ * Successful Response
749
+ */
750
+ 202: JobOut;
751
+ };
752
+ type ConvertBookResponse = ConvertBookResponses[keyof ConvertBookResponses];
753
+ type GetBookCoverData = {
754
+ body?: never;
755
+ path: {
756
+ /**
757
+ * Book Id
758
+ */
759
+ book_id: string;
760
+ };
761
+ query?: never;
762
+ url: '/books/{book_id}/cover';
763
+ };
764
+ type GetBookCoverErrors = {
765
+ /**
766
+ * Resource not found
767
+ */
768
+ 404: ErrorResponse;
769
+ /**
770
+ * Validation Error
771
+ */
772
+ 422: HttpValidationError;
773
+ /**
774
+ * Internal server error
775
+ */
776
+ 500: ErrorResponse;
777
+ };
778
+ type GetBookCoverError = GetBookCoverErrors[keyof GetBookCoverErrors];
779
+ type GetBookCoverResponses = {
780
+ /**
781
+ * Successful Response
782
+ */
783
+ 200: unknown;
784
+ };
785
+ type DeleteBookFormatData = {
786
+ body?: never;
787
+ path: {
788
+ /**
789
+ * Book Format
790
+ */
791
+ book_format: string;
792
+ /**
793
+ * Book Id
794
+ */
795
+ book_id: string;
796
+ };
797
+ query?: never;
798
+ url: '/books/{book_id}/formats/{book_format}';
799
+ };
800
+ type DeleteBookFormatErrors = {
801
+ /**
802
+ * Resource not found
803
+ */
804
+ 404: ErrorResponse;
805
+ /**
806
+ * Validation Error
807
+ */
808
+ 422: HttpValidationError;
809
+ /**
810
+ * Internal server error
811
+ */
812
+ 500: ErrorResponse;
813
+ };
814
+ type DeleteBookFormatError = DeleteBookFormatErrors[keyof DeleteBookFormatErrors];
815
+ type DeleteBookFormatResponses = {
816
+ /**
817
+ * Successful Response
818
+ */
819
+ 204: void;
820
+ };
821
+ type DeleteBookFormatResponse = DeleteBookFormatResponses[keyof DeleteBookFormatResponses];
822
+ type DownloadBookFormatData = {
823
+ body?: never;
824
+ path: {
825
+ /**
826
+ * Book Format
827
+ */
828
+ book_format: string;
829
+ /**
830
+ * Book Id
831
+ */
832
+ book_id: string;
833
+ };
834
+ query?: never;
835
+ url: '/books/{book_id}/formats/{book_format}';
836
+ };
837
+ type DownloadBookFormatErrors = {
838
+ /**
839
+ * Resource not found
840
+ */
841
+ 404: ErrorResponse;
842
+ /**
843
+ * Validation Error
844
+ */
845
+ 422: HttpValidationError;
846
+ /**
847
+ * Internal server error
848
+ */
849
+ 500: ErrorResponse;
850
+ };
851
+ type DownloadBookFormatError = DownloadBookFormatErrors[keyof DownloadBookFormatErrors];
852
+ type DownloadBookFormatResponses = {
853
+ /**
854
+ * Successful Response
855
+ */
856
+ 200: unknown;
857
+ };
858
+ type RefreshMetadataData = {
859
+ body: RefreshRequest;
860
+ path: {
861
+ /**
862
+ * Book Id
863
+ */
864
+ book_id: string;
865
+ };
866
+ query?: never;
867
+ url: '/books/{book_id}/refresh-metadata';
868
+ };
869
+ type RefreshMetadataErrors = {
870
+ /**
871
+ * Bad request
872
+ */
873
+ 400: ErrorResponse;
874
+ /**
875
+ * Resource not found
876
+ */
877
+ 404: ErrorResponse;
878
+ /**
879
+ * Validation error
880
+ */
881
+ 422: ErrorResponse;
882
+ /**
883
+ * Internal server error
884
+ */
885
+ 500: ErrorResponse;
886
+ };
887
+ type RefreshMetadataError = RefreshMetadataErrors[keyof RefreshMetadataErrors];
888
+ type RefreshMetadataResponses = {
889
+ /**
890
+ * Successful Response
891
+ */
892
+ 200: BookOut;
893
+ };
894
+ type RefreshMetadataResponse = RefreshMetadataResponses[keyof RefreshMetadataResponses];
895
+ type SendBookData = {
896
+ body: SendRequest;
897
+ path: {
898
+ /**
899
+ * Book Id
900
+ */
901
+ book_id: string;
902
+ };
903
+ query?: never;
904
+ url: '/books/{book_id}/send';
905
+ };
906
+ type SendBookErrors = {
907
+ /**
908
+ * Bad request
909
+ */
910
+ 400: ErrorResponse;
911
+ /**
912
+ * Resource not found
913
+ */
914
+ 404: ErrorResponse;
915
+ /**
916
+ * Validation error
917
+ */
918
+ 422: ErrorResponse;
919
+ /**
920
+ * Internal server error
921
+ */
922
+ 500: ErrorResponse;
923
+ /**
924
+ * Service unavailable
925
+ */
926
+ 503: ErrorResponse;
927
+ };
928
+ type SendBookError = SendBookErrors[keyof SendBookErrors];
929
+ type SendBookResponses = {
930
+ /**
931
+ * Successful Response
932
+ */
933
+ 202: JobOut;
934
+ };
935
+ type SendBookResponse = SendBookResponses[keyof SendBookResponses];
936
+ type GetEmailConfigData = {
937
+ body?: never;
938
+ path?: never;
939
+ query?: never;
940
+ url: '/config/email';
941
+ };
942
+ type GetEmailConfigErrors = {
943
+ /**
944
+ * Internal server error
945
+ */
946
+ 500: ErrorResponse;
947
+ };
948
+ type GetEmailConfigError = GetEmailConfigErrors[keyof GetEmailConfigErrors];
949
+ type GetEmailConfigResponses = {
950
+ /**
951
+ * Successful Response
952
+ */
953
+ 200: EmailConfigOut;
954
+ };
955
+ type GetEmailConfigResponse = GetEmailConfigResponses[keyof GetEmailConfigResponses];
956
+ type TestEmailConfigData = {
957
+ body: EmailTestRequest;
958
+ path?: never;
959
+ query?: never;
960
+ url: '/config/email/test';
961
+ };
962
+ type TestEmailConfigErrors = {
963
+ /**
964
+ * Validation Error
965
+ */
966
+ 422: HttpValidationError;
967
+ /**
968
+ * Internal server error
969
+ */
970
+ 500: ErrorResponse;
971
+ /**
972
+ * Service unavailable
973
+ */
974
+ 503: ErrorResponse;
975
+ };
976
+ type TestEmailConfigError = TestEmailConfigErrors[keyof TestEmailConfigErrors];
977
+ type TestEmailConfigResponses = {
978
+ /**
979
+ * Successful Response
980
+ */
981
+ 204: void;
982
+ };
983
+ type TestEmailConfigResponse = TestEmailConfigResponses[keyof TestEmailConfigResponses];
984
+ type StartExportData = {
985
+ body: ExportRequest;
986
+ path?: never;
987
+ query?: never;
988
+ url: '/export/calibre';
989
+ };
990
+ type StartExportErrors = {
991
+ /**
992
+ * Bad request
993
+ */
994
+ 400: ErrorResponse;
995
+ /**
996
+ * Validation error
997
+ */
998
+ 422: ErrorResponse;
999
+ /**
1000
+ * Internal server error
1001
+ */
1002
+ 500: ErrorResponse;
1003
+ /**
1004
+ * Service unavailable
1005
+ */
1006
+ 503: ErrorResponse;
1007
+ };
1008
+ type StartExportError = StartExportErrors[keyof StartExportErrors];
1009
+ type StartExportResponses = {
1010
+ /**
1011
+ * Successful Response
1012
+ */
1013
+ 202: JobOut;
1014
+ };
1015
+ type StartExportResponse = StartExportResponses[keyof StartExportResponses];
1016
+ type DownloadExportData = {
1017
+ body?: never;
1018
+ path: {
1019
+ /**
1020
+ * Token
1021
+ */
1022
+ token: string;
1023
+ };
1024
+ query?: never;
1025
+ url: '/export/download/{token}';
1026
+ };
1027
+ type DownloadExportErrors = {
1028
+ /**
1029
+ * Resource not found
1030
+ */
1031
+ 404: ErrorResponse;
1032
+ /**
1033
+ * Validation Error
1034
+ */
1035
+ 422: HttpValidationError;
1036
+ /**
1037
+ * Internal server error
1038
+ */
1039
+ 500: ErrorResponse;
1040
+ };
1041
+ type DownloadExportError = DownloadExportErrors[keyof DownloadExportErrors];
1042
+ type DownloadExportResponses = {
1043
+ /**
1044
+ * Successful Response
1045
+ */
1046
+ 200: unknown;
1047
+ };
1048
+ type HealthData = {
1049
+ body?: never;
1050
+ path?: never;
1051
+ query?: never;
1052
+ url: '/health';
1053
+ };
1054
+ type HealthErrors = {
1055
+ /**
1056
+ * Internal server error
1057
+ */
1058
+ 500: ErrorResponse;
1059
+ };
1060
+ type HealthError = HealthErrors[keyof HealthErrors];
1061
+ type HealthResponses = {
1062
+ /**
1063
+ * Successful Response
1064
+ */
1065
+ 200: HealthResponse;
1066
+ };
1067
+ type HealthResponse2 = HealthResponses[keyof HealthResponses];
1068
+ type GetJobData = {
1069
+ body?: never;
1070
+ path: {
1071
+ /**
1072
+ * Job Id
1073
+ */
1074
+ job_id: string;
1075
+ };
1076
+ query?: never;
1077
+ url: '/jobs/{job_id}';
1078
+ };
1079
+ type GetJobErrors = {
1080
+ /**
1081
+ * Resource not found
1082
+ */
1083
+ 404: ErrorResponse;
1084
+ /**
1085
+ * Validation Error
1086
+ */
1087
+ 422: HttpValidationError;
1088
+ /**
1089
+ * Internal server error
1090
+ */
1091
+ 500: ErrorResponse;
1092
+ };
1093
+ type GetJobError = GetJobErrors[keyof GetJobErrors];
1094
+ type GetJobResponses = {
1095
+ /**
1096
+ * Successful Response
1097
+ */
1098
+ 200: JobOut;
1099
+ };
1100
+ type GetJobResponse = GetJobResponses[keyof GetJobResponses];
1101
+ type StreamJobData = {
1102
+ body?: never;
1103
+ path: {
1104
+ /**
1105
+ * Job Id
1106
+ */
1107
+ job_id: string;
1108
+ };
1109
+ query?: never;
1110
+ url: '/jobs/{job_id}/stream';
1111
+ };
1112
+ type StreamJobErrors = {
1113
+ /**
1114
+ * Resource not found
1115
+ */
1116
+ 404: ErrorResponse;
1117
+ /**
1118
+ * Validation Error
1119
+ */
1120
+ 422: HttpValidationError;
1121
+ /**
1122
+ * Internal server error
1123
+ */
1124
+ 500: ErrorResponse;
1125
+ };
1126
+ type StreamJobError = StreamJobErrors[keyof StreamJobErrors];
1127
+ type StreamJobResponses = {
1128
+ /**
1129
+ * Successful Response
1130
+ */
1131
+ 200: unknown;
1132
+ };
1133
+ type SearchBooksData = {
1134
+ body?: never;
1135
+ path?: never;
1136
+ query?: {
1137
+ /**
1138
+ * Q
1139
+ */
1140
+ q?: string;
1141
+ /**
1142
+ * Page
1143
+ */
1144
+ page?: number;
1145
+ /**
1146
+ * Page Size
1147
+ */
1148
+ page_size?: number;
1149
+ /**
1150
+ * Include Tags
1151
+ */
1152
+ include_tags?: Array<string> | null;
1153
+ /**
1154
+ * Exclude Tags
1155
+ */
1156
+ exclude_tags?: Array<string> | null;
1157
+ /**
1158
+ * Languages
1159
+ */
1160
+ languages?: Array<string> | null;
1161
+ /**
1162
+ * Formats
1163
+ */
1164
+ formats?: Array<string> | null;
1165
+ /**
1166
+ * Rating Min
1167
+ */
1168
+ rating_min?: number | null;
1169
+ /**
1170
+ * Rating Max
1171
+ */
1172
+ rating_max?: number | null;
1173
+ };
1174
+ url: '/search';
1175
+ };
1176
+ type SearchBooksErrors = {
1177
+ /**
1178
+ * Validation error
1179
+ */
1180
+ 422: ErrorResponse;
1181
+ /**
1182
+ * Internal server error
1183
+ */
1184
+ 500: ErrorResponse;
1185
+ };
1186
+ type SearchBooksError = SearchBooksErrors[keyof SearchBooksErrors];
1187
+ type SearchBooksResponses = {
1188
+ /**
1189
+ * Successful Response
1190
+ */
1191
+ 200: BookPage;
1192
+ };
1193
+ type SearchBooksResponse = SearchBooksResponses[keyof SearchBooksResponses];
1194
+
1195
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
1196
+ /**
1197
+ * You can provide a client instance returned by `createClient()` instead of
1198
+ * individual options. This might be also useful if you want to implement a
1199
+ * custom client.
1200
+ */
1201
+ client?: Client;
1202
+ /**
1203
+ * You can pass arbitrary values through the `meta` object. This can be
1204
+ * used to access values that aren't defined as part of the SDK function.
1205
+ */
1206
+ meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
1207
+ };
1208
+ declare class HeyApiClient {
1209
+ protected client: Client;
1210
+ constructor(args?: {
1211
+ client?: Client;
1212
+ });
1213
+ }
1214
+ declare class HeyApiRegistry<T> {
1215
+ private readonly defaultKey;
1216
+ private readonly instances;
1217
+ get(key?: string): T;
1218
+ set(value: T, key?: string): void;
1219
+ }
1220
+ declare class Sdk extends HeyApiClient {
1221
+ static readonly __registry: HeyApiRegistry<Sdk>;
1222
+ constructor(args?: {
1223
+ client?: Client;
1224
+ key?: string;
1225
+ });
1226
+ /**
1227
+ * List Books
1228
+ *
1229
+ * List books, paginated and sorted.
1230
+ *
1231
+ * Returns a page of books controlled by `page` and `page_size`, ordered by
1232
+ * `sort` field in the given `direction`. Out-of-range pagination values are
1233
+ * rejected with `422`.
1234
+ */
1235
+ listBooks<ThrowOnError extends boolean = false>(options?: Options<ListBooksData, ThrowOnError>): RequestResult<ListBooksResponses, ListBooksErrors, ThrowOnError>;
1236
+ /**
1237
+ * Upload Book
1238
+ *
1239
+ * Upload a book file and create a new book.
1240
+ *
1241
+ * Accepts a multipart `file` whose extension must be one of the allowed
1242
+ * upload formats; metadata is extracted from the file on import. Returns the
1243
+ * created book with `201`, `400` if the file is rejected (unsupported
1244
+ * extension or unreadable content), or `413` if it exceeds the upload size
1245
+ * limit.
1246
+ */
1247
+ uploadBook<ThrowOnError extends boolean = false>(options: Options<UploadBookData, ThrowOnError>): RequestResult<UploadBookResponses, UploadBookErrors, ThrowOnError>;
1248
+ /**
1249
+ * Delete Book
1250
+ *
1251
+ * Delete a book and all of its files.
1252
+ *
1253
+ * Removes the book identified by `book_id` along with its stored formats and
1254
+ * cover, returning `204` with no body on success. Responds with `404` when the
1255
+ * book does not exist.
1256
+ */
1257
+ deleteBook<ThrowOnError extends boolean = false>(options: Options<DeleteBookData, ThrowOnError>): RequestResult<DeleteBookResponses, DeleteBookErrors, ThrowOnError>;
1258
+ /**
1259
+ * Get Book
1260
+ *
1261
+ * Get a single book by its public id.
1262
+ *
1263
+ * Looks up the book identified by `book_id` (the book's public id) and returns
1264
+ * its full metadata. Responds with `404` when no such book exists.
1265
+ */
1266
+ getBook<ThrowOnError extends boolean = false>(options: Options<GetBookData, ThrowOnError>): RequestResult<GetBookResponses, GetBookErrors, ThrowOnError>;
1267
+ /**
1268
+ * Update Book
1269
+ *
1270
+ * Partially update a book's metadata.
1271
+ *
1272
+ * Applies only the fields explicitly set in the request body, leaving omitted
1273
+ * fields untouched, and returns the updated book. Responds with `400` when the
1274
+ * patch is empty or violates a domain rule (e.g. an out-of-range `rating`),
1275
+ * and `404` when the book does not exist.
1276
+ */
1277
+ updateBook<ThrowOnError extends boolean = false>(options: Options<UpdateBookData, ThrowOnError>): RequestResult<UpdateBookResponses, UpdateBookErrors, ThrowOnError>;
1278
+ /**
1279
+ * Convert Book
1280
+ *
1281
+ * Convert a book to another format.
1282
+ *
1283
+ * Enqueues a background conversion to `target_format`, optionally from an
1284
+ * explicit `source_format` (otherwise the best available source is chosen), and
1285
+ * returns `202` with a job to poll at `/jobs/{id}`. Responds with `404` if the
1286
+ * book is missing, `503` if `ebook-convert` is unavailable, `409` if the target
1287
+ * format already exists or an identical conversion is already in progress, and
1288
+ * `400` if no suitable source format is available.
1289
+ */
1290
+ convertBook<ThrowOnError extends boolean = false>(options: Options<ConvertBookData, ThrowOnError>): RequestResult<ConvertBookResponses, ConvertBookErrors, ThrowOnError>;
1291
+ /**
1292
+ * Get Book Cover
1293
+ *
1294
+ * Download a book's cover image.
1295
+ *
1296
+ * Returns the cover bytes as `image/jpeg` for the book identified by
1297
+ * `book_id`. Responds with `404` when the book has no recorded cover or the
1298
+ * cover file is missing from storage.
1299
+ */
1300
+ getBookCover<ThrowOnError extends boolean = false>(options: Options<GetBookCoverData, ThrowOnError>): RequestResult<GetBookCoverResponses, GetBookCoverErrors, ThrowOnError>;
1301
+ /**
1302
+ * Delete Book Format
1303
+ *
1304
+ * Delete one format of a book.
1305
+ *
1306
+ * Removes the file for the given `book_format` of the book identified by
1307
+ * `book_id`, returning `204` with no body on success. Responds with `404` when
1308
+ * the book does not exist or it has no such format.
1309
+ */
1310
+ deleteBookFormat<ThrowOnError extends boolean = false>(options: Options<DeleteBookFormatData, ThrowOnError>): RequestResult<DeleteBookFormatResponses, DeleteBookFormatErrors, ThrowOnError>;
1311
+ /**
1312
+ * Download Book Format
1313
+ *
1314
+ * Download one format of a book.
1315
+ *
1316
+ * Returns the file for the given `book_format` of the book identified by
1317
+ * `book_id` as an `application/octet-stream` attachment, with the stored
1318
+ * filename in the `Content-Disposition` header. Responds with `404` when the
1319
+ * book lacks that format or the file is missing from storage.
1320
+ */
1321
+ downloadBookFormat<ThrowOnError extends boolean = false>(options: Options<DownloadBookFormatData, ThrowOnError>): RequestResult<DownloadBookFormatResponses, DownloadBookFormatErrors, ThrowOnError>;
1322
+ /**
1323
+ * Refresh Metadata
1324
+ *
1325
+ * Re-extract metadata from a book file and return the updated book.
1326
+ *
1327
+ * Reads metadata afresh from the book's `source_format` file and merges it in:
1328
+ * fields the extraction produced replace the current ones, fields it could not
1329
+ * read are kept. Responds with `404` when the book or requested format is not
1330
+ * found, and `400` for any other refresh failure.
1331
+ */
1332
+ refreshMetadata<ThrowOnError extends boolean = false>(options: Options<RefreshMetadataData, ThrowOnError>): RequestResult<RefreshMetadataResponses, RefreshMetadataErrors, ThrowOnError>;
1333
+ /**
1334
+ * Send Book
1335
+ *
1336
+ * Email a book to a recipient.
1337
+ *
1338
+ * Enqueues a background job to send the book to `to_email` in the requested
1339
+ * `format` (or the best available sendable format if unspecified), and returns
1340
+ * `202` with a job to poll at `/jobs/{id}`. Responds with `404` if the book is
1341
+ * missing, `503` if SMTP is not configured, and `400` if the book has no
1342
+ * matching or sendable format.
1343
+ */
1344
+ sendBook<ThrowOnError extends boolean = false>(options: Options<SendBookData, ThrowOnError>): RequestResult<SendBookResponses, SendBookErrors, ThrowOnError>;
1345
+ /**
1346
+ * Get Email Config
1347
+ *
1348
+ * Return the non-secret SMTP settings for display.
1349
+ *
1350
+ * Reports whether SMTP is `configured` along with `host`, `port`,
1351
+ * `from_address` (falling back to the username when no explicit from is set)
1352
+ * and `security`. The password is never read or returned.
1353
+ */
1354
+ getEmailConfig<ThrowOnError extends boolean = false>(options?: Options<GetEmailConfigData, ThrowOnError>): RequestResult<GetEmailConfigResponses, GetEmailConfigErrors, ThrowOnError>;
1355
+ /**
1356
+ * Test Email Config
1357
+ *
1358
+ * Send a test email to verify SMTP connectivity.
1359
+ *
1360
+ * Sends a test message to `to_email` and returns 204 on success. Responds 503
1361
+ * if SMTP is not configured, or 502 if the connection, authentication or send
1362
+ * fails.
1363
+ */
1364
+ testEmailConfig<ThrowOnError extends boolean = false>(options: Options<TestEmailConfigData, ThrowOnError>): RequestResult<TestEmailConfigResponses, TestEmailConfigErrors, ThrowOnError>;
1365
+ /**
1366
+ * Start Export
1367
+ *
1368
+ * Start an async Calibre export; the download link is emailed when ready.
1369
+ *
1370
+ * Enqueues a background job that snapshots the requested books (or the whole
1371
+ * library when `book_ids` is omitted) to a zip and emails a time-limited link
1372
+ * to `to_email`, returning 202 with the new job. Responds 503 when export is
1373
+ * unavailable (the calibredb binary is missing, SMTP is not configured, or no
1374
+ * public base URL is set for an absolute link), and 400 for a malformed book id.
1375
+ */
1376
+ startExport<ThrowOnError extends boolean = false>(options: Options<StartExportData, ThrowOnError>): RequestResult<StartExportResponses, StartExportErrors, ThrowOnError>;
1377
+ /**
1378
+ * Download Export
1379
+ *
1380
+ * Stream a finished export zip for a valid, unexpired token.
1381
+ *
1382
+ * Served via ``FileResponse``, which streams the file and honours HTTP Range
1383
+ * requests, so a large download is memory-light and resumable.
1384
+ */
1385
+ downloadExport<ThrowOnError extends boolean = false>(options: Options<DownloadExportData, ThrowOnError>): RequestResult<DownloadExportResponses, DownloadExportErrors, ThrowOnError>;
1386
+ /**
1387
+ * Health
1388
+ *
1389
+ * Report liveness and the availability of optional dependencies.
1390
+ *
1391
+ * Always returns `status` ``"ok"`` and the API `version`, plus the
1392
+ * Calibre binary availability (`convert_available`, `metadata_available`)
1393
+ * and whether send-to-ereader is usable (`send_available`, true when SMTP
1394
+ * is configured).
1395
+ */
1396
+ health<ThrowOnError extends boolean = false>(options?: Options<HealthData, ThrowOnError>): RequestResult<HealthResponses, HealthErrors, ThrowOnError>;
1397
+ /**
1398
+ * Get Job
1399
+ *
1400
+ * Return the current status and progress of a single job.
1401
+ *
1402
+ * Looks up the job by `job_id` and returns its latest state for one-shot
1403
+ * polling. Responds 404 if no job with that id exists; use `/jobs/{job_id}/stream`
1404
+ * instead to follow progress live.
1405
+ */
1406
+ getJob<ThrowOnError extends boolean = false>(options: Options<GetJobData, ThrowOnError>): RequestResult<GetJobResponses, GetJobErrors, ThrowOnError>;
1407
+ /**
1408
+ * Stream Job
1409
+ *
1410
+ * Stream a job's status/progress as Server-Sent Events until it finishes.
1411
+ *
1412
+ * One open connection replaces repeated polling. Updates are event-driven: the
1413
+ * stream blocks (in a threadpool, so the event loop stays free) until the job
1414
+ * actually changes, then emits — so it reflects each new binary output, not a
1415
+ * fixed tick.
1416
+ */
1417
+ streamJob<ThrowOnError extends boolean = false>(options: Options<StreamJobData, ThrowOnError>): RequestResult<StreamJobResponses, StreamJobErrors, ThrowOnError>;
1418
+ /**
1419
+ * Search Books
1420
+ *
1421
+ * Search books by a text query and filters.
1422
+ *
1423
+ * Returns a paginated page of books whose title, author, series or tags match
1424
+ * the query `q` (case-insensitive substring match), narrowed by the optional
1425
+ * `include_tags`, `exclude_tags`, `languages`, `formats`, and
1426
+ * `rating_min`/`rating_max` filters. Out-of-range pagination or rating values
1427
+ * are rejected with `422`.
1428
+ */
1429
+ searchBooks<ThrowOnError extends boolean = false>(options?: Options<SearchBooksData, ThrowOnError>): RequestResult<SearchBooksResponses, SearchBooksErrors, ThrowOnError>;
1430
+ }
1431
+
1432
+ export { type AuthorOut, type BinaryHealthOut, type BodyUploadBook, type BookOut, type BookPage, type BookUpdate, type ClientOptions, type ConvertBookData, type ConvertBookError, type ConvertBookErrors, type ConvertBookResponse, type ConvertBookResponses, type ConvertRequest, type DeleteBookData, type DeleteBookError, type DeleteBookErrors, type DeleteBookFormatData, type DeleteBookFormatError, type DeleteBookFormatErrors, type DeleteBookFormatResponse, type DeleteBookFormatResponses, type DeleteBookResponse, type DeleteBookResponses, type DownloadBookFormatData, type DownloadBookFormatError, type DownloadBookFormatErrors, type DownloadBookFormatResponses, type DownloadExportData, type DownloadExportError, type DownloadExportErrors, type DownloadExportResponses, type EmailConfigOut, type EmailTestRequest, type ErrorBody, type ErrorDetail, type ErrorResponse, type ExportRequest, type FormatOut, type GetBookCoverData, type GetBookCoverError, type GetBookCoverErrors, type GetBookCoverResponses, type GetBookData, type GetBookError, type GetBookErrors, type GetBookResponse, type GetBookResponses, type GetEmailConfigData, type GetEmailConfigError, type GetEmailConfigErrors, type GetEmailConfigResponse, type GetEmailConfigResponses, type GetJobData, type GetJobError, type GetJobErrors, type GetJobResponse, type GetJobResponses, type HealthData, type HealthError, type HealthErrors, type HealthResponse, type HealthResponse2, type HealthResponses, type HttpValidationError, type IdentifierOut, type JobOut, type JobStatusOut, type JobType, type ListBooksData, type ListBooksError, type ListBooksErrors, type ListBooksResponse, type ListBooksResponses, type Options, type RefreshMetadataData, type RefreshMetadataError, type RefreshMetadataErrors, type RefreshMetadataResponse, type RefreshMetadataResponses, type RefreshRequest, Sdk, type SearchBooksData, type SearchBooksError, type SearchBooksErrors, type SearchBooksResponse, type SearchBooksResponses, type SendBookData, type SendBookError, type SendBookErrors, type SendBookResponse, type SendBookResponses, type SendRequest, type SeriesOut, type SortDirection, type SortField, type StartExportData, type StartExportError, type StartExportErrors, type StartExportResponse, type StartExportResponses, type StreamJobData, type StreamJobError, type StreamJobErrors, type StreamJobResponses, type TagOut, type TestEmailConfigData, type TestEmailConfigError, type TestEmailConfigErrors, type TestEmailConfigResponse, type TestEmailConfigResponses, type UpdateBookData, type UpdateBookError, type UpdateBookErrors, type UpdateBookResponse, type UpdateBookResponses, type UploadBookData, type UploadBookError, type UploadBookErrors, type UploadBookResponse, type UploadBookResponses, type ValidationError };