ReferenceSDKClient
Documents
SDK reference for documents — Create and manage documents that can be referenced in document nodes.
Create and manage documents that can be referenced in document nodes.
createDocument
Create a new document that can be referenced in document nodes
POST
Usage:
const result = await swirls.client.documents.createDocument({
projectId: '...',
name: '...',
label: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | No | |
projectId | string | Yes | |
folderId | string | null | No | |
name | string | Yes | |
label | string | Yes | |
description | string | No | |
content | string | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string |
getDocument
Get a document by ID
GET
Usage:
const result = await swirls.client.documents.getDocument({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
folderId | string | null | |
name | string | |
label | string | |
description | string | null | |
content | string | null | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
updateDocument
Update a document
PUT
Usage:
const result = await swirls.client.documents.updateDocument({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
name | string | No | |
description | string | No | |
content | string | null | No | |
folderId | string | null | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
folderId | string | null | |
name | string | |
label | string | |
description | string | null | |
content | string | null | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
deleteDocument
Delete a document
DELETE
Usage:
const result = await swirls.client.documents.deleteDocument({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
listDocuments
List all documents in a project
GET
Usage:
const result = await swirls.client.documents.listDocuments({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
folderId | string | null | No | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |