export type DeleteApiRecipesOwnerNameArgs = {owner: string, name: string}; export type DeleteApiRecipesOwnerNameOptions = {baseUrl: string, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Recipe * * DELETE /recipes/{owner}/{name} * * Also accepts auth: APIKeyAuth */ export const deleteApiRecipesOwnerName = async (args: DeleteApiRecipesOwnerNameArgs, options: DeleteApiRecipesOwnerNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/recipes/${encodeURIComponent(String(args.owner))}/${encodeURIComponent(String(args.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 };