export type GetApiTombaV1LocationArgs = {domain: string}; export type GetApiTombaV1LocationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get employee location distribution for a domain. * * GET /tomba/v1/location */ export const getApiTombaV1Location = async (args: GetApiTombaV1LocationArgs, options?: GetApiTombaV1LocationOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.domain != null) query.append("domain", String(args.domain)) const url = `${baseUrl.replace(/\/+$/, '')}/tomba/v1/location${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };