export type CreateApiVoiceInterpretersIdsArgs = {'Accept-Language'?: string | undefined, ids: Array, body: BodyInit}; export type CreateApiVoiceInterpretersIdsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Sends a text to a given human language interpreter(s). * * POST /voice/interpreters/{ids} */ export const createApiVoiceInterpretersIds = async (args: CreateApiVoiceInterpretersIdsArgs, options: CreateApiVoiceInterpretersIdsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "text/plain") if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) const url = `${baseUrl.replace(/\/+$/, '')}/voice/interpreters/${encodeURIComponent(String(args.ids))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };