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:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
bucketName | string | No | |
public | boolean | No | |
fileSizeLimit | number | No |
Output:
| Field | Type | Description |
|---|---|---|
bucketName | string | |
created | boolean | |
policiesDeployed | boolean |
listFiles
List files and folders in a storage bucket
GET
Usage:
const result = await swirls.client.buckets.listFiles({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
path | string | No | |
limit | number | No | |
offset | number | No |
Output:
| Field | Type | Description |
|---|---|---|
files | object[] | |
folders | object[] |
deleteFile
Delete a file from the storage bucket
POST
Usage:
const result = await swirls.client.buckets.deleteFile({
projectId: '...',
path: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
path | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
success | boolean |
deleteFiles
Delete multiple files from the storage bucket
POST
Usage:
const result = await swirls.client.buckets.deleteFiles({
projectId: '...',
paths: [],
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
paths | string[] | Yes |
Output:
| Field | Type | Description |
|---|---|---|
deleted | string[] | |
failed | string[] |
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
path | string | Yes | |
expiresIn | number | No |
Output:
| Field | Type | Description |
|---|---|---|
signedUrl | string | |
expiresAt | string |
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
path | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
signedUrl | string | |
token | string | |
path | string |
moveFile
Move a file within the storage bucket
POST
Usage:
const result = await swirls.client.buckets.moveFile({
projectId: '...',
sourcePath: '...',
destinationPath: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
sourcePath | string | Yes | |
destinationPath | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
success | boolean |
copyFile
Copy a file within the storage bucket
POST
Usage:
const result = await swirls.client.buckets.copyFile({
projectId: '...',
sourcePath: '...',
destinationPath: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
sourcePath | string | Yes | |
destinationPath | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
path | string |