export type CreateApiV3BackofficeDesignArgs = {body: {name: string, draft_id?: number | undefined, capsule_id?: number | undefined, values?: Record | undefined, mode?: ('rendering' | 'manufacturing') | undefined, description?: (string | null) | undefined, collection_ids?: Array | undefined}}; export type CreateApiV3BackofficeDesignOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Save a design * * POST /v3/backoffice/design */ export const createApiV3BackofficeDesign = async (args: CreateApiV3BackofficeDesignArgs, options?: CreateApiV3BackofficeDesignOptions) => { const {baseUrl = "https://api.rhinoartisan.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("apikey", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v3/backoffice/design${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };