Files
sim/apps/sim/tools/box/delete_file.ts
Waleed Latif c893ec7d89 feat(box): add Box and Box Sign integrations
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>
2026-03-18 22:09:39 -07:00

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' },
},
}