← Public packages
@kody/blandPublic
src/index.ts
77 lines · 1.7 KB · TypeScript/**
* @kody/bland — Bland.ai voice call helpers (send, poll transcript, stop).
* Use when any Kody-connected agent should place Bland calls like Dialbot.
*
* @param input - action name plus that action's fields
* @returns Action result
*
* @example
* import bland from 'kody:@kody/bland'
* await bland({ action: 'smoke-test' })
*/
import adapt from './adapt.ts'
import getCall from './get-call.ts'
import listCalls from './list-calls.ts'
import me from './me.ts'
import { parseAction } from './core.ts'
import sendCall from './send-call.ts'
import settings from './settings.ts'
import smokeTest from './smoke-test.ts'
import stopCall from './stop-call.ts'
const ACTIONS = [
'smoke-test',
'send-call',
'list-calls',
'get-call',
'stop-call',
'me',
'settings',
'adapt',
] as const
export type BlandAction = (typeof ACTIONS)[number]
export default async function bland(input: Record<string, unknown> = {}) {
const action = parseAction(input.action, ACTIONS, 'smoke-test', 'bland')
switch (action) {
case 'smoke-test':
return smokeTest(input as any)
case 'send-call':
return sendCall(input as any)
case 'list-calls':
return listCalls(input as any)
case 'get-call':
return getCall(input as any)
case 'stop-call':
return stopCall(input as any)
case 'me':
return me(input as any)
case 'settings':
return settings(input as any)
case 'adapt':
return adapt()
default:
return parseAction(action, ACTIONS, 'smoke-test', 'bland')
}
}
export {
adapt,
getCall,
listCalls,
me,
sendCall,
settings,
smokeTest,
stopCall,
}
export {
API_BASE_URL,
API_HOST,
BlandApiError,
blandRequest,
setupUrls,
apiKeySetupUrl,
} from './core.ts'