export type DeleteApiFabricFabricApiFunctionFxNameArgs = {fabric: unknown, 'fx-name': unknown}; export type DeleteApiFabricFabricApiFunctionFxNameOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove a edge function. * * DELETE /_fabric/{fabric}/_api/function/{fx-name} * * Also accepts auth: BearerAuth */ export const deleteApiFabricFabricApiFunctionFxName = async (args: DeleteApiFabricFabricApiFunctionFxNameArgs, options: DeleteApiFabricFabricApiFunctionFxNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/_fabric/${encodeURIComponent(String(args.fabric))}/_api/function/${encodeURIComponent(String(args['fx-name']))}${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 };