mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
Add complete Box integration with file management (upload, download, get info, list folders, create/delete folders, copy, search, update metadata) and Box Sign e-signature support (create/get/list/cancel/resend sign requests). Includes OAuth provider setup, internal upload API route following the Dropbox pattern, block configurations, icon, and generated docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import type { ToolConfig, ToolResponse } from '@/tools/types'
|
|
import type { BoxDeleteFileParams } from './types'
|
|
|
|
export const boxDeleteFileTool: ToolConfig<BoxDeleteFileParams, ToolResponse> = {
|
|
id: 'box_delete_file',
|
|
name: 'Box Delete File',
|
|
description: 'Delete a file from Box',
|
|
version: '1.0.0',
|
|
|
|
oauth: {
|
|
required: true,
|
|
provider: 'box',
|
|
},
|
|
|
|
params: {
|
|
accessToken: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'hidden',
|
|
description: 'OAuth access token for Box API',
|
|
},
|
|
fileId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'The ID of the file to delete',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => `https://api.box.com/2.0/files/${params.fileId.trim()}`,
|
|
method: 'DELETE',
|
|
headers: (params) => ({
|
|
Authorization: `Bearer ${params.accessToken}`,
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response) => {
|
|
if (response.status === 204) {
|
|
return {
|
|
success: true,
|
|
output: {
|
|
deleted: true,
|
|
message: 'File deleted successfully',
|
|
},
|
|
}
|
|
}
|
|
|
|
const data = await response.json()
|
|
throw new Error(data.message || `Box API error: ${response.status}`)
|
|
},
|
|
|
|
outputs: {
|
|
deleted: { type: 'boolean', description: 'Whether the file was successfully deleted' },
|
|
message: { type: 'string', description: 'Success confirmation message' },
|
|
},
|
|
}
|