DocumentsApi
All URIs are relative to /api
| Method | HTTP request | Description |
|---|---|---|
| _delete | DELETE /documents/{lookup} | Delete document(s) by name |
| list | GET /documents | List documents |
| retrieve | GET /documents/{key} | Download a document |
_delete
_delete(lookup)
Delete document(s) by name
Deletes generated PDF documents by name, all documents with this name are deleted.
Example
import {
Configuration,
DocumentsApi,
} from '@pdf-generator/client';
import type { DeleteRequest } from '@pdf-generator/client';
async function example() {
console.log("🚀 Testing @pdf-generator/client SDK...");
const config = new Configuration({
// To configure API key authorization: api-key
apiKey: "YOUR API KEY",
});
const api = new DocumentsApi(config);
const body = {
// string | Document filename
lookup: lookup_example,
} satisfies DeleteRequest;
try {
const data = await api._delete(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| lookup | string | Document filename | [Defaults to undefined] |
Return type
void (Empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 204 | Document deleted | - |
| 404 | Document not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list
ListDocumentsResponseDto list(startOffset, limit, nameFilter, template, start)
List documents
List generated PDF documents for the organization with pagination and optional filtering.
Example
import {
Configuration,
DocumentsApi,
} from '@pdf-generator/client';
import type { ListRequest } from '@pdf-generator/client';
async function example() {
console.log("🚀 Testing @pdf-generator/client SDK...");
const config = new Configuration({
// To configure API key authorization: api-key
apiKey: "YOUR API KEY",
});
const api = new DocumentsApi(config);
const body = {
// string | Pagination offset (0-based), use the startOffset from the previous response (optional)
startOffset: 0,
// number | Maximum number of documents to return (default 100) (optional)
limit: 100,
// string | Partial match filter on document name (optional)
nameFilter: invoice,
// number | Filter by template ID (optional)
template: 1,
// any | Pagination offset (0-based) (optional)
start: ...,
} satisfies ListRequest;
try {
const data = await api.list(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| startOffset | string | Pagination offset (0-based), use the startOffset from the previous response | [Optional] [Defaults to undefined] |
| limit | number | Maximum number of documents to return (default 100) | [Optional] [Defaults to undefined] |
| nameFilter | string | Partial match filter on document name | [Optional] [Defaults to undefined] |
| template | number | Filter by template ID | [Optional] [Defaults to undefined] |
| start | any | Pagination offset (0-based) | [Optional] [Defaults to undefined] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
retrieve
Blob retrieve(key, dl)
Download a document
Download a generated PDF document by its filename key.
Example
import {
Configuration,
DocumentsApi,
} from '@pdf-generator/client';
import type { RetrieveRequest } from '@pdf-generator/client';
async function example() {
console.log("🚀 Testing @pdf-generator/client SDK...");
const config = new Configuration({
// To configure API key authorization: api-key
apiKey: "YOUR API KEY",
});
const api = new DocumentsApi(config);
const body = {
// string | Document filename key
key: key_example,
// string | Set to \"1\" to force download with Content-Disposition attachment header (optional)
dl: dl_example,
} satisfies RetrieveRequest;
try {
const data = await api.retrieve(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| key | string | Document filename key | [Defaults to undefined] |
| dl | string | Set to "1" to force download with Content-Disposition attachment header | [Optional] [Defaults to undefined] |
Return type
Blob
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
application/pdf,application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | - | |
| 404 | Document not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]