SWIRLS_
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:

ParameterTypeRequiredDescription
idstringNo
projectIdstringYes
folderIdstring | nullNo
namestringYes
labelstringYes
descriptionstringNo
contentstringNo

Output:

FieldTypeDescription
idstring

getDocument

Get a document by ID

GET

Usage:

const result = await swirls.client.documents.getDocument({
  id: '...',
})

Input:

ParameterTypeRequiredDescription
idstringYes

Output:

FieldTypeDescription
idstring
projectIdstring
folderIdstring | null
namestring
labelstring
descriptionstring | null
contentstring | null
createdAtunknown
orgIdstring | null
userIdstring

updateDocument

Update a document

PUT

Usage:

const result = await swirls.client.documents.updateDocument({
  id: '...',
})

Input:

ParameterTypeRequiredDescription
idstringYes
namestringNo
descriptionstringNo
contentstring | nullNo
folderIdstring | nullNo

Output:

FieldTypeDescription
idstring
projectIdstring
folderIdstring | null
namestring
labelstring
descriptionstring | null
contentstring | null
createdAtunknown
orgIdstring | null
userIdstring

deleteDocument

Delete a document

DELETE

Usage:

const result = await swirls.client.documents.deleteDocument({
  id: '...',
})

Input:

ParameterTypeRequiredDescription
idstringYes

listDocuments

List all documents in a project

GET

Usage:

const result = await swirls.client.documents.listDocuments({
  projectId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
folderIdstring | nullNo
paginationobjectNo

Output:

FieldTypeDescription
paginationobject
resultsobject[]
totalCountnumber

On this page