export type CreateApiV1WorkflowsWorkflowIdPublishArgs = {workflowId: number}; export type CreateApiV1WorkflowsWorkflowIdPublishOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /v1/workflows/{workflowId}/publish */ export const createApiV1WorkflowsWorkflowIdPublish = async (args: CreateApiV1WorkflowsWorkflowIdPublishArgs, options: CreateApiV1WorkflowsWorkflowIdPublishOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v1/workflows/${encodeURIComponent(String(args.workflowId))}/publish${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };