ReferenceSDKClient
fileValues
SDK reference for filevalues —
createUploadGrant
Mint a short-lived upload grant for workflow file values (presigned PUT budget)
POST
Usage:
const result = await swirls.client.fileValues.createUploadGrant({
projectId: '...',
purpose: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
purpose | "workflow_input" | "review" | "form" | "cli" | "chat" | "execution" | Yes | |
environment | string | No | |
ttlSeconds | number | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
expiresAt | string | |
maxBytes | number | |
maxFiles | number |
initUpload
Reserve quota and return a presigned PUT URL for a pending file object
POST
Usage:
const result = await swirls.client.fileValues.initUpload({
projectId: '...',
grantId: '...',
name: '...',
mediaType: '...',
size: 1,
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
grantId | string | Yes | |
name | string | Yes | |
mediaType | string | Yes | |
size | number | Yes |
Output:
| Field | Type | Description |
|---|---|---|
objectId | string | |
uploadUrl | string | |
expiresAt | string |
completeUpload
Verify uploaded bytes in R2 and mint a ready file handle
POST
Usage:
const result = await swirls.client.fileValues.completeUpload({
projectId: '...',
grantId: '...',
objectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
grantId | string | Yes | |
objectId | string | Yes | |
sha256 | string | No |
Output:
| Field | Type | Description |
|---|---|---|
kind | "swirls.file" | |
id | string | |
mediaType | string | |
name | string | |
size | number | |
sha256 | string |
previewFile
Authorize preview of a ready file object and return a short-lived signed GET URL
GET
Usage:
const result = await swirls.client.fileValues.previewFile({
projectId: '...',
objectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
objectId | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
url | string | |
expiresAt | string |