export type DtosFormGenerationRequest = {callback_url: string, employee_ids?: Array | undefined, carrier_ids?: Array | undefined, plan_ids?: Array | undefined}; export type CreateApiVVersionCompaniesIdEnrollmentFormsArgs = {id: string, version: string, body: DtosFormGenerationRequest}; export type CreateApiVVersionCompaniesIdEnrollmentFormsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * generate forms * * POST /v{version}/companies/{id}/enrollment-forms */ export const createApiVVersionCompaniesIdEnrollmentForms = async (args: CreateApiVVersionCompaniesIdEnrollmentFormsArgs, options: CreateApiVVersionCompaniesIdEnrollmentFormsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.id != null) query.append("id", String(args.id)) const url = `${baseUrl.replace(/\/+$/, '')}/v${encodeURIComponent(String(args.version))}/companies/${encodeURIComponent(String(args.id))}/enrollment-forms${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 };