mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 22:01:10 +00:00
Adds API and architecture documentation for the book reading feature
This commit is contained in:
1 parent
fb0aa431df
commit
2bdb2b2d19
19 files changed
+479
-9
No files matched your search
@@ -14,6 +14,18 @@
|
||||
- [Get Books Lite](#get-books-lite)
|
||||
- [Get Books Lite Request](#get-books-lite-request)
|
||||
- [Get Books Lite Response](#get-books-lite-response)
|
||||
- [Get Reading Availability](#get-reading-availability)
|
||||
- [Get Reading Availability Request](#get-reading-availability-request)
|
||||
- [Get Reading Availability Response](#get-reading-availability-response)
|
||||
- [Get Reading Manifest](#get-reading-manifest)
|
||||
- [Get Reading Manifest Request](#get-reading-manifest-request)
|
||||
- [Get Reading Manifest Response](#get-reading-manifest-response)
|
||||
- [Get Reading Resource](#get-reading-resource)
|
||||
- [Get Reading Resource Request](#get-reading-resource-request)
|
||||
- [Get Reading Resource Response](#get-reading-resource-response)
|
||||
- [Get Reading Section](#get-reading-section)
|
||||
- [Get Reading Section Request](#get-reading-section-request)
|
||||
- [Get Reading Section Response](#get-reading-section-response)
|
||||
|
||||
## Book
|
||||
|
||||
@@ -393,3 +405,121 @@ GET api/v1/books/lite?libraryId=3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a¤tPage
|
||||
"numberOfPages": 1
|
||||
}
|
||||
```
|
||||
|
||||
### Get Reading Availability
|
||||
|
||||
#### Get Reading Availability Request
|
||||
|
||||
```js
|
||||
GET api/v1/books/{bookId}/reading/availability
|
||||
```
|
||||
|
||||
Reports whether the book identified by `bookId` can be opened for reading: the book reader that supports the format of the book is resolved and its enablement for the media library of the book is checked, without extracting the book. When the book cannot be read, the response carries the code of the error preventing it, so the client can tell a missing book reader apart from a disabled one.
|
||||
|
||||
#### Get Reading Availability Response
|
||||
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"bookId": "32b336e8-dafc-4a08-9dec-9454e66dd55d",
|
||||
"libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
|
||||
"isAvailable": true,
|
||||
"errorCode": null
|
||||
}
|
||||
```
|
||||
|
||||
### Get Reading Manifest
|
||||
|
||||
#### Get Reading Manifest Request
|
||||
|
||||
```js
|
||||
GET api/v1/books/{bookId}/reading/manifest
|
||||
```
|
||||
|
||||
Opens the book identified by `bookId` for reading by extracting its contents through the book reader that is enabled for its media library, and returns the reading manifest: the title and author of the book, its hierarchical table of contents, its ordered spine of reading sections, the keys of its resources, and whether it has extractable text content. A scanned book, whose pages are only images, has no text content and is displayed as page images.
|
||||
|
||||
#### Get Reading Manifest Response
|
||||
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "The Fellowship of the Ring",
|
||||
"author": "J.R.R. Tolkien",
|
||||
"coverResourceKey": "0f4d6e2b1c9a4f3e8d7c6b5a4f3e2d1c",
|
||||
"tableOfContents": [
|
||||
{
|
||||
"label": "Chapter One",
|
||||
"locationRef": "chapter1",
|
||||
"children": [
|
||||
{
|
||||
"label": "Part One",
|
||||
"locationRef": "chapter1",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"spine": [
|
||||
{
|
||||
"locationRef": "chapter1",
|
||||
"title": "Chapter One"
|
||||
},
|
||||
{
|
||||
"locationRef": "chapter2",
|
||||
"title": "Chapter Two"
|
||||
}
|
||||
],
|
||||
"resourceKeys": [
|
||||
"0f4d6e2b1c9a4f3e8d7c6b5a4f3e2d1c"
|
||||
],
|
||||
"hasTextContent": true
|
||||
}
|
||||
```
|
||||
|
||||
### Get Reading Section
|
||||
|
||||
#### Get Reading Section Request
|
||||
|
||||
```js
|
||||
GET api/v1/books/{bookId}/reading/sections/{locationRef}
|
||||
```
|
||||
|
||||
Returns the reading section identified by `locationRef` of the book identified by `bookId`. The section content is sanitized by the host before it is served, and its references to the resources of the book are resolved by the client through the resource endpoint. The `locationRef` of a section is taken from the spine of the reading manifest of the book.
|
||||
|
||||
#### Get Reading Section Response
|
||||
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"locationRef": "chapter1",
|
||||
"title": "Chapter One",
|
||||
"contentHtml": "<section><h1>Chapter One</h1><p>First paragraph.</p></section>"
|
||||
}
|
||||
```
|
||||
|
||||
### Get Reading Resource
|
||||
|
||||
#### Get Reading Resource Request
|
||||
|
||||
```js
|
||||
GET api/v1/books/{bookId}/reading/resources/{resourceKey}
|
||||
```
|
||||
|
||||
Returns the binary resource identified by `resourceKey` of the book identified by `bookId` (for example an image, a font, or a stylesheet of the book, or a page image of a scanned PDF that is rendered on demand). The `resourceKey` of a resource is taken from the reading manifest of the book.
|
||||
|
||||
#### Get Reading Resource Response
|
||||
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
|
||||
The response is the raw bytes of the resource, served with the `Content-Type` of the resource and with `X-Content-Type-Options: nosniff`. A resource whose declared media type could be rendered as an active document (for example an SVG) is served as an opaque binary download instead.
|
||||
@@ -23,6 +23,12 @@
|
||||
- [Reorder Library Metadata Providers](#reorder-library-metadata-providers)
|
||||
- [Reorder Library Metadata Providers Request](#reorder-library-metadata-providers-request)
|
||||
- [Reorder Library Metadata Providers Response](#reorder-library-metadata-providers-response)
|
||||
- [Get Library Book Readers](#get-library-book-readers)
|
||||
- [Get Library Book Readers Request](#get-library-book-readers-request)
|
||||
- [Get Library Book Readers Response](#get-library-book-readers-response)
|
||||
- [Set Library Book Reader Enabled](#set-library-book-reader-enabled)
|
||||
- [Set Library Book Reader Enabled Request](#set-library-book-reader-enabled-request)
|
||||
- [Set Library Book Reader Enabled Response](#set-library-book-reader-enabled-response)
|
||||
|
||||
## Plugins
|
||||
|
||||
@@ -207,3 +213,62 @@ PUT api/v1/libraries/{libraryId}/metadata-providers/reorder
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
|
||||
### Get Library Book Readers
|
||||
|
||||
#### Get Library Book Readers Request
|
||||
|
||||
```js
|
||||
GET api/v1/libraries/{libraryId}/book-readers
|
||||
```
|
||||
|
||||
Returns the book readers available for the media library, one entry per plugin that provides a book reader, along with whether the reader is enabled for the media library. A book can be opened for reading only through a book reader that is enabled for its media library.
|
||||
|
||||
#### Get Library Book Readers Response
|
||||
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"pluginId": "f0d1a2b3-4c5d-4e6f-8a7b-9c0d1e2f3a4b",
|
||||
"name": "EPUB Reader",
|
||||
"supportedExtensions": [
|
||||
".epub"
|
||||
],
|
||||
"isEnabled": true
|
||||
},
|
||||
{
|
||||
"pluginId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
|
||||
"name": "PDF Reader",
|
||||
"supportedExtensions": [
|
||||
".pdf"
|
||||
],
|
||||
"isEnabled": false
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Set Library Book Reader Enabled
|
||||
|
||||
#### Set Library Book Reader Enabled Request
|
||||
|
||||
```js
|
||||
PUT api/v1/libraries/{libraryId}/book-readers/{pluginId}/enabled
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
|
||||
"pluginId": "f0d1a2b3-4c5d-4e6f-8a7b-9c0d1e2f3a4b",
|
||||
"isEnabled": true
|
||||
}
|
||||
```
|
||||
|
||||
#### Set Library Book Reader Enabled Response
|
||||
|
||||
```js
|
||||
200 Ok
|
||||
```
|
||||
@@ -33,7 +33,10 @@ Returns the settings of the currently authenticated user.
|
||||
"isPaginationEnabled": true,
|
||||
"itemsPerPage": 50,
|
||||
"ignoreThePrefixForAlphaPicker": true,
|
||||
"isThemeCachingEnabled": true
|
||||
"isThemeCachingEnabled": true,
|
||||
"shouldAggregateMetadataWhenMissing": true,
|
||||
"shouldRenderPdfAsImages": false,
|
||||
"shouldPreserveBookStyles": true
|
||||
}
|
||||
```
|
||||
|
||||
@@ -52,7 +55,10 @@ Updates the settings of the currently authenticated user.
|
||||
"isPaginationEnabled": true,
|
||||
"itemsPerPage": 50,
|
||||
"ignoreThePrefixForAlphaPicker": true,
|
||||
"isThemeCachingEnabled": true
|
||||
"isThemeCachingEnabled": true,
|
||||
"shouldAggregateMetadataWhenMissing": true,
|
||||
"shouldRenderPdfAsImages": false,
|
||||
"shouldPreserveBookStyles": true
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user