export type APIVersion = 'v1'; export type DeleteApiVoicesVoiceIdArgs = {voice_id: string, version?: APIVersion | undefined, 'X-Api-Key'?: string | undefined}; export type DeleteApiVoicesVoiceIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete Voice * * DELETE /voices/{voice_id} */ export const deleteApiVoicesVoiceId = async (args: DeleteApiVoicesVoiceIdArgs, options: DeleteApiVoicesVoiceIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.version != null) headers.set("version", String(args.version)) if (args['X-Api-Key'] != null) headers.set("X-Api-Key", String(args['X-Api-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/voices/${encodeURIComponent(String(args.voice_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };