SWIRLS_
ReferenceSDKClient

Buckets

SDK reference for buckets — Manage file storage buckets, upload/download files, and create signed URLs.

Manage file storage buckets, upload/download files, and create signed URLs.

createBucket

Create a new storage bucket

POST

Usage:

const result = await swirls.client.buckets.createBucket({
  projectId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
bucketNamestringNo
publicbooleanNo
fileSizeLimitnumberNo

Output:

FieldTypeDescription
bucketNamestring
createdboolean
policiesDeployedboolean

listFiles

List files and folders in a storage bucket

GET

Usage:

const result = await swirls.client.buckets.listFiles({
  projectId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
pathstringNo
limitnumberNo
offsetnumberNo

Output:

FieldTypeDescription
filesobject[]
foldersobject[]

deleteFile

Delete a file from the storage bucket

POST

Usage:

const result = await swirls.client.buckets.deleteFile({
  projectId: '...',
  path: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
pathstringYes

Output:

FieldTypeDescription
successboolean

deleteFiles

Delete multiple files from the storage bucket

POST

Usage:

const result = await swirls.client.buckets.deleteFiles({
  projectId: '...',
  paths: [],
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
pathsstring[]Yes

Output:

FieldTypeDescription
deletedstring[]
failedstring[]

createSignedUrl

Create a signed download URL for a file in the storage bucket

POST

Usage:

const result = await swirls.client.buckets.createSignedUrl({
  projectId: '...',
  path: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
pathstringYes
expiresInnumberNo

Output:

FieldTypeDescription
signedUrlstring
expiresAtstring

createSignedUploadUrl

Create a signed upload URL for uploading a file to the storage bucket

POST

Usage:

const result = await swirls.client.buckets.createSignedUploadUrl({
  projectId: '...',
  path: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
pathstringYes

Output:

FieldTypeDescription
signedUrlstring
tokenstring
pathstring

moveFile

Move a file within the storage bucket

POST

Usage:

const result = await swirls.client.buckets.moveFile({
  projectId: '...',
  sourcePath: '...',
  destinationPath: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
sourcePathstringYes
destinationPathstringYes

Output:

FieldTypeDescription
successboolean

copyFile

Copy a file within the storage bucket

POST

Usage:

const result = await swirls.client.buckets.copyFile({
  projectId: '...',
  sourcePath: '...',
  destinationPath: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
sourcePathstringYes
destinationPathstringYes

Output:

FieldTypeDescription
pathstring

On this page