export type DeleteApiApiV2ConstraintsConstraintNameArgs = {constraint_name: string}; export type DeleteApiApiV2ConstraintsConstraintNameOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a specified default constraint. * * DELETE /api/v2/constraints/{constraint_name} */ export const deleteApiApiV2ConstraintsConstraintName = async (args: DeleteApiApiV2ConstraintsConstraintNameArgs, options: DeleteApiApiV2ConstraintsConstraintNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/constraints/${encodeURIComponent(String(args.constraint_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 };