export type CreateApiApiV1AccountAuthIdCallCallUuidStreamArgs = {auth_id: string, call_uuid: string, body: {service_url: string, bidirectional?: boolean | undefined, audio_track?: ('inbound' | 'outbound' | 'both') | undefined, audio_format?: ('pcm' | 'mulaw') | undefined}}; export type CreateApiApiV1AccountAuthIdCallCallUuidStreamOptions = {baseUrl?: string | undefined, AuthID?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start audio stream * * POST /api/v1/Account/{auth_id}/Call/{call_uuid}/Stream/ */ export const createApiApiV1AccountAuthIdCallCallUuidStream = async (args: CreateApiApiV1AccountAuthIdCallCallUuidStreamArgs, options?: CreateApiApiV1AccountAuthIdCallCallUuidStreamOptions) => { const {baseUrl = "https://api.vobiz.ai", fetch: fetchFn = fetch, AuthID, AuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (AuthID !== undefined) headers.set("X-Auth-ID", AuthID) if (AuthToken !== undefined) headers.set("X-Auth-Token", AuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/Account/${encodeURIComponent(String(args.auth_id))}/Call/${encodeURIComponent(String(args.call_uuid))}/Stream/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };