export type GetApiProvidersGetPrimaryLocationAssignmentsForProviderIdsArgs = {providerIds: Array, dateFrom: string, dateTo: string}; export type GetApiProvidersGetPrimaryLocationAssignmentsForProviderIdsOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get provider primary location assignments by Provider Ids * * GET /providers/GetPrimaryLocationAssignmentsForProviderIds */ export const getApiProvidersGetPrimaryLocationAssignmentsForProviderIds = async (args: GetApiProvidersGetPrimaryLocationAssignmentsForProviderIdsArgs, options?: GetApiProvidersGetPrimaryLocationAssignmentsForProviderIdsOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.providerIds ?? []) query.append("providerIds", String(item)) if (args.dateFrom != null) query.append("dateFrom", String(args.dateFrom)) if (args.dateTo != null) query.append("dateTo", String(args.dateTo)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/providers/GetPrimaryLocationAssignmentsForProviderIds${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 };