export type CreateApiFiberV1DepthChartStartArgs = {body: {company: Record, functions?: Array | undefined}}; export type CreateApiFiberV1DepthChartStartOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Generates an organizational depth chart for a company. Classifies employees by function. Async. Poll with /depth-chart/poll. * * POST /fiber/v1/depth-chart/start */ export const createApiFiberV1DepthChartStart = async (args: CreateApiFiberV1DepthChartStartArgs, options?: CreateApiFiberV1DepthChartStartOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/fiber/v1/depth-chart/start${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 };