routes
Class info¶
🛈 DocStrings¶
API route implementations for Docler.
convert
async
¶
convert(
file: UploadFile,
converter: str,
chunker: str | None = None,
pdf_password: str | None = None,
images: ImagesMode = "inline",
) -> ConvertResponse
Convert a document and, with a chunker config, chunk it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
UploadFile
|
The document file. |
required |
converter
|
str
|
Converter configuration JSON. |
required |
chunker
|
str | None
|
Chunker configuration JSON (optional). |
None
|
pdf_password
|
str | None
|
Password for encrypted PDF files. |
None
|
images
|
ImagesMode
|
|
'inline'
|
Raises:
| Type | Description |
|---|---|
HTTPException
|
400 for a bad config or document, 401 for a wrong PDF password, 500 for other conversion errors. |
Source code in src/docler_api/routes.py
get_pdf_metadata
async
¶
get_pdf_metadata(file: UploadFile, pdf_password: str | None = None) -> PageMetadata
Get PDF metadata including page count and document information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
UploadFile
|
The PDF file to analyze |
required |
pdf_password
|
str | None
|
Password for encrypted PDF files |
None
|
Returns:
| Type | Description |
|---|---|
PageMetadata
|
PageMetadata containing document information |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If file is invalid or processing fails |
Source code in src/docler_api/routes.py
list_chunkers
async
¶
List all available chunkers.
Source code in src/docler_api/routes.py
list_converters
async
¶
List all available converters.
Source code in src/docler_api/routes.py
parse_client_config
¶
Parse a config sent by a client, rejecting fields only the server may set.
Raises:
| Type | Description |
|---|---|
HTTPException
|
400 if the JSON is invalid or sets a server-only field. |