export type DeleteApiV1WorkspaceWorkflowSlugArgs = {workspace: string, slug: string}; export type DeleteApiV1WorkspaceWorkflowSlugOptions = {baseUrl?: string | undefined, ServiceTokenAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Workflow * * DELETE /v1/{workspace}/workflow/{slug}/ */ export const deleteApiV1WorkspaceWorkflowSlug = async (args: DeleteApiV1WorkspaceWorkflowSlugArgs, options?: DeleteApiV1WorkspaceWorkflowSlugOptions) => { const {baseUrl = "https://management-api.suprsend.com", fetch: fetchFn = fetch, ServiceTokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ServiceTokenAuth !== undefined) headers.set("Authorization", ServiceTokenAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/${encodeURIComponent(String(args.workspace))}/workflow/${encodeURIComponent(String(args.slug))}/${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 };