{
	"plugin": "books-and-shelves",
	"apiVersion": "0.2.0",
	"root": "BooksApi",
	"declarations": "books-and-shelves-api.d.ts",
	"entries": [
		{
			"name": "BOOKS_API_VERSION",
			"kind": "const",
			"exported": true,
			"signature": "declare const BOOKS_API_VERSION = \"0.2.0\";",
			"doc": "Semantic version of Books & Shelves' public API. Consumers check it before calling anything else."
		},
		{
			"name": "isCompatible",
			"exported": true,
			"kind": "function",
			"signature": "declare function isCompatible(actual: string, wanted: string): boolean;",
			"doc": "True when a consumer built against `wanted` can use an API at `actual`: same major and a minor at least as new.\nBefore 1.0, minors break by default, so 0.x serves only the minors it promises (0.1 and up). The same rule as\nModel Hub's, used for both directions: this plugin's API, and the Hub API this plugin asks for."
		},
		{
			"name": "BOOKS_PLUGIN_ID",
			"kind": "const",
			"exported": true,
			"signature": "declare const BOOKS_PLUGIN_ID = \"books-and-shelves\";",
			"doc": ""
		},
		{
			"name": "BOOKS_READY_EVENT",
			"kind": "const",
			"exported": true,
			"signature": "declare const BOOKS_READY_EVENT = \"books-and-shelves:ready\";",
			"doc": "The workspace event Books & Shelves fires each time it loads, with its API: at startup, and when the user\ndisables and enables it again. `onBooksReady` listens for it."
		},
		{
			"name": "BookFormat",
			"exported": true,
			"kind": "type",
			"signature": "type BookFormat = \"EPUB\" | \"PDF\";",
			"doc": "The formats `bookFile` returns. Other formats (AZW3, MOBI…) are listed in `formats` but not served."
		},
		{
			"name": "BookSummary",
			"exported": true,
			"kind": "interface",
			"signature": "interface BookSummary",
			"doc": "One Calibre book, as `listBooks` gives it.",
			"members": [
				{
					"name": "id",
					"kind": "property",
					"optional": false,
					"signature": "id: number",
					"doc": "The Calibre id."
				},
				{
					"name": "title",
					"kind": "property",
					"optional": false,
					"signature": "title: string",
					"doc": ""
				},
				{
					"name": "authors",
					"kind": "property",
					"optional": false,
					"signature": "authors: string[]",
					"doc": ""
				},
				{
					"name": "formats",
					"kind": "property",
					"optional": false,
					"signature": "formats: string[]",
					"doc": "Calibre's formats for the book, upper case: `EPUB`, `PDF`, `AZW3`…"
				},
				{
					"name": "notePath",
					"kind": "property",
					"optional": false,
					"signature": "notePath: string | null",
					"doc": "The book's note in the library folder (by its `calibre_id` or `calibre_ids`), or null when it has none."
				}
			]
		},
		{
			"name": "BookFileOptions",
			"exported": true,
			"kind": "interface",
			"signature": "interface BookFileOptions",
			"doc": "",
			"members": [
				{
					"name": "convert",
					"kind": "property",
					"optional": true,
					"signature": "convert?: boolean",
					"doc": "For an EPUB the book doesn't have: when it has an AZW3 or MOBI, ask the user to convert it in Calibre. The\nconversion adds an EPUB to the book in their Calibre library, so the user is always asked first; `bookFile`\nresolves `null` when they decline. Without this, a missing EPUB rejects with `format-missing`."
				}
			]
		},
		{
			"name": "BooksErrorCode",
			"exported": true,
			"kind": "type",
			"signature": "type BooksErrorCode = \"server-off\" | \"server-error\" | \"book-missing\" | \"format-missing\" | \"shelf-missing\" | \"conversion-failed\" | \"no-text\" | \"invalid-request\";",
			"doc": "Why a call failed:\n- `server-off`: Calibre's Content Server isn't set or doesn't answer (and, for `listBooks`/`shelfMembers`, no\n  library folder is set to read the library file instead). `bookFile` and `pdfText` always need the server.\n- `server-error`: the server answered with an error (a login it asks for, a refused change, a failure).\n- `book-missing`: Calibre has no book with that id.\n- `format-missing`: the book has no file in that format (and none to convert from, or `convert` wasn't asked).\n- `shelf-missing`: no shelf note has that id or name.\n- `conversion-failed`: Calibre tried to convert the book and couldn't.\n- `no-text`: the PDF has no text layer (a scan).\n- `invalid-request`: the arguments are malformed (an id that isn't a number, an unknown format)."
		},
		{
			"name": "BooksApi",
			"exported": true,
			"kind": "interface",
			"signature": "interface BooksApi",
			"doc": "",
			"members": [
				{
					"name": "version",
					"kind": "property",
					"optional": false,
					"signature": "readonly version: string",
					"doc": "Semantic version of this API. Check it with `isCompatible` (or use `getBooks`)."
				},
				{
					"name": "listBooks",
					"kind": "method",
					"optional": false,
					"signature": "listBooks(which: number[] | {\n    shelf: string;\n}): Promise<BookSummary[]>",
					"doc": "Books by Calibre id (in the order asked), or a shelf's books (by Calibre id). Works from the Content Server, or\nread-only from the library file when the server is off and a library folder is set. Rejects with\n`book-missing` naming any id Calibre doesn't have."
				},
				{
					"name": "bookFile",
					"kind": "method",
					"optional": false,
					"signature": "bookFile(id: number, format: BookFormat, opts?: BookFileOptions): Promise<ArrayBuffer | null>",
					"doc": "A book file's bytes, through the Content Server. With `{ convert: true }`, an EPUB the book lacks is made\nfrom its AZW3 or MOBI after the user agrees (`null` if they decline). Rejects with `server-off` when the\nserver is off, even if the library file is readable."
				},
				{
					"name": "pdfText",
					"kind": "method",
					"optional": false,
					"signature": "pdfText(id: number): Promise<string>",
					"doc": "A PDF's text, page by page (pages separated by a blank line), through Obsidian's PDF.js."
				},
				{
					"name": "shelfMembers",
					"kind": "method",
					"optional": false,
					"signature": "shelfMembers(shelf: string): Promise<number[]>",
					"doc": "The Calibre ids of the books on a shelf, ascending: by the shelf's rule, pinned, not excluded (the same test as\nthe shelf's Base). A shelf is named by its `collection_id`, or its note's name or path. Book notes without a\n`calibre_id` aren't included."
				},
				{
					"name": "calibreChecks",
					"kind": "method",
					"optional": false,
					"signature": "calibreChecks(): Promise<CalibreChecks>",
					"doc": "The Calibre settings Books & Shelves depends on, checked against the Content Server now: that it answers, that\nany login works, that the library exists, and that it allows changes (needed to convert a book or write to it).\nEach check that fails says how to set it right in Calibre. Never rejects: a server that doesn't answer is a\nfailed check. Since 0.2."
				}
			]
		},
		{
			"name": "CalibreCheckState",
			"exported": true,
			"kind": "type",
			"signature": "type CalibreCheckState = \"ok\" | \"bad\" | \"off\";",
			"doc": ""
		},
		{
			"name": "CalibreCheck",
			"exported": true,
			"kind": "interface",
			"signature": "interface CalibreCheck",
			"doc": "One Calibre setting as checked.",
			"members": [
				{
					"name": "id",
					"kind": "property",
					"optional": false,
					"signature": "id: \"server\" | \"login\" | \"library\" | \"changes\"",
					"doc": ""
				},
				{
					"name": "name",
					"kind": "property",
					"optional": false,
					"signature": "name: string",
					"doc": "The setting in a word or two: \"Content Server\", \"Login\", \"Library\", \"Changes\"."
				},
				{
					"name": "state",
					"kind": "property",
					"optional": false,
					"signature": "state: CalibreCheckState",
					"doc": "`off`: not checked, because an earlier check failed."
				},
				{
					"name": "text",
					"kind": "property",
					"optional": false,
					"signature": "text: string",
					"doc": "What was found."
				},
				{
					"name": "fix",
					"kind": "property",
					"optional": true,
					"signature": "fix?: string",
					"doc": "Where to set it right in Calibre, when `state` is `bad`."
				}
			]
		},
		{
			"name": "CalibreChecks",
			"exported": true,
			"kind": "interface",
			"signature": "interface CalibreChecks",
			"doc": "",
			"members": [
				{
					"name": "ok",
					"kind": "property",
					"optional": false,
					"signature": "ok: boolean",
					"doc": "Every check passed."
				},
				{
					"name": "reads",
					"kind": "property",
					"optional": false,
					"signature": "reads: boolean",
					"doc": "The server answers and the library exists: books can be read."
				},
				{
					"name": "writes",
					"kind": "property",
					"optional": false,
					"signature": "writes: boolean",
					"doc": "The server allows changes."
				},
				{
					"name": "checks",
					"kind": "property",
					"optional": false,
					"signature": "checks: CalibreCheck[]",
					"doc": ""
				}
			]
		},
		{
			"name": "GetBooksResult",
			"exported": true,
			"kind": "type",
			"signature": "type GetBooksResult = {\n    books: BooksApi;\n} | {\n    books: null;\n    reason: \"missing\" | \"incompatible\";\n    message: string;\n    version?: string;\n};",
			"doc": ""
		},
		{
			"name": "getBooks",
			"exported": true,
			"kind": "function",
			"signature": "declare function getBooks(app: unknown, wanted: string): GetBooksResult;",
			"doc": "Finds Books & Shelves in this vault and checks its API version against the one you built for."
		},
		{
			"name": "onBooksReady",
			"exported": true,
			"kind": "function",
			"signature": "declare function onBooksReady(app: unknown, plugin: {\n    registerEvent(ref: unknown): void;\n}, wanted: string, cb: (books: BooksApi) => void): void;",
			"doc": "Runs `cb` with the API now if Books & Shelves is loaded (and compatible with `wanted`), and again each time it\nloads: it fires `books-and-shelves:ready` on the workspace at the end of its `onload`. The listener is registered\non your plugin, so it stops when your plugin unloads.\n\n```ts\nonBooksReady(this.app, this, '0.1.0', (books) => (this.books = books));\n```"
		}
	]
}
