export type DeleteApiV1FilesFileIdArgs = {file_id: string, 'x-api-key': string}; export type DeleteApiV1FilesFileIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete File * * DELETE /v1/files/{file_id} */ export const deleteApiV1FilesFileId = async (args: DeleteApiV1FilesFileIdArgs, options: DeleteApiV1FilesFileIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/files/${encodeURIComponent(String(args.file_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 };