mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
* feat(ashby): add 15 new tools and fix existing tool accuracy * fix(ashby): fix response field mappings for changeStage and createNote * fix(ashby): fix websiteUrl field name in candidate.update request * fix(ashby): revert body field names to candidateId and jobId for info endpoints * fix(ashby): add subblock ID migrations for removed emailType and phoneType * fix(ashby): map removed emailType/phoneType to dummy keys to avoid data corruption
82 lines
2.0 KiB
TypeScript
82 lines
2.0 KiB
TypeScript
import type { ToolConfig, ToolResponse } from '@/tools/types'
|
|
|
|
interface AshbyListArchiveReasonsParams {
|
|
apiKey: string
|
|
}
|
|
|
|
interface AshbyListArchiveReasonsResponse extends ToolResponse {
|
|
output: {
|
|
archiveReasons: Array<{
|
|
id: string
|
|
text: string
|
|
reasonType: string
|
|
isArchived: boolean
|
|
}>
|
|
}
|
|
}
|
|
|
|
export const listArchiveReasonsTool: ToolConfig<
|
|
AshbyListArchiveReasonsParams,
|
|
AshbyListArchiveReasonsResponse
|
|
> = {
|
|
id: 'ashby_list_archive_reasons',
|
|
name: 'Ashby List Archive Reasons',
|
|
description: 'Lists all archive reasons configured in Ashby.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Ashby API Key',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: 'https://api.ashbyhq.com/archiveReason.list',
|
|
method: 'POST',
|
|
headers: (params) => ({
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Basic ${btoa(`${params.apiKey}:`)}`,
|
|
}),
|
|
body: () => ({}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
if (!data.success) {
|
|
throw new Error(data.errorInfo?.message || 'Failed to list archive reasons')
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
archiveReasons: (data.results ?? []).map((r: Record<string, unknown>) => ({
|
|
id: r.id ?? null,
|
|
text: r.text ?? null,
|
|
reasonType: r.reasonType ?? null,
|
|
isArchived: r.isArchived ?? false,
|
|
})),
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
archiveReasons: {
|
|
type: 'array',
|
|
description: 'List of archive reasons',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
id: { type: 'string', description: 'Archive reason UUID' },
|
|
text: { type: 'string', description: 'Archive reason text' },
|
|
reasonType: { type: 'string', description: 'Reason type' },
|
|
isArchived: { type: 'boolean', description: 'Whether the reason is archived' },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|