← Public packages
@kody/blandPublic
src/get-call.ts
30 lines · 882 B · TypeScript/**
* Fetch one Bland call by id (`GET /v1/calls/{call_id}`): status, transcript, analysis.
* Poll until `completed` is true after send-call (about every 5 seconds).
* Read-only — no confirm required.
*
* @param input - call_id (or callId)
* @returns Call detail payload
*
* @example
* import { getCall } from 'kody:@kody/bland/get-call'
* await getCall({ call_id: '9d404c1b-6a23-4426-953a-a52c392ff8f1' })
*/
import { blandRequest, type BlandAuthInput } from './core.ts'
export type GetCallInput = BlandAuthInput & {
call_id?: string
callId?: string
}
export async function getCall(input: GetCallInput = {}) {
const callId = String(input.call_id ?? input.callId ?? '').trim()
if (!callId) throw new Error('call_id is required.')
return blandRequest({
...input,
method: 'GET',
path: '/v1/calls/' + encodeURIComponent(callId),
})
}
export default getCall