export type DeleteApiApiV1AppsKeyArgs = {key: string, removeDescriptor?: boolean | undefined}; export type DeleteApiApiV1AppsKeyOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * DELETE /api/v1/apps/{key} */ export const deleteApiApiV1AppsKey = async (args: DeleteApiApiV1AppsKeyArgs, options: DeleteApiApiV1AppsKeyOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.removeDescriptor != null) query.append("removeDescriptor", String(args.removeDescriptor)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/apps/${encodeURIComponent(String(args.key))}${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 (await res.json()) as unknown };