export type PatchApiV1AgentsAgentIdAudioCacheEntryIdFileArgs = {'X-Filename'?: string | undefined, body: BodyInit}; export type PatchApiV1AgentsAgentIdAudioCacheEntryIdFileOptions = {baseUrl?: string | undefined, polyApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace cached audio file * * PATCH /v1/agents/{agentId}/audio-cache/{entryId}/file */ export const patchApiV1AgentsAgentIdAudioCacheEntryIdFile = async (args: PatchApiV1AgentsAgentIdAudioCacheEntryIdFileArgs, options?: PatchApiV1AgentsAgentIdAudioCacheEntryIdFileOptions) => { const {baseUrl = "https://api.us.poly.ai", fetch: fetchFn = fetch, polyApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "audio/wav") if (args['X-Filename'] != null) headers.set("X-Filename", String(args['X-Filename'])) if (polyApiKey !== undefined) headers.set("X-API-KEY", polyApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/agents/${encodeURIComponent(String(args.agentId))}/audio-cache/${encodeURIComponent(String(args.entryId))}/file${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };