export type DeleteApiCommunityIdFileFileIdArgs = {id: string, fileId: string}; export type DeleteApiCommunityIdFileFileIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a file * * DELETE /community/{id}/file/{fileId} */ export const deleteApiCommunityIdFileFileId = async (args: DeleteApiCommunityIdFileFileIdArgs, options?: DeleteApiCommunityIdFileFileIdOptions) => { const {baseUrl = "https://api.openpage.fun/v1", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/community/${encodeURIComponent(String(args.id))}/file/${encodeURIComponent(String(args.fileId))}${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 };