export type CreateApiMappingUrlProjectionArgs = {interactors?: boolean | undefined, importableOnly?: boolean | undefined, body: BodyInit}; export type CreateApiMappingUrlProjectionOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Maps the identifiers contained in the provided url over the different species and projects the result to Homo Sapiens * * POST /mapping/url/projection */ export const createApiMappingUrlProjection = async (args: CreateApiMappingUrlProjectionArgs, options: CreateApiMappingUrlProjectionOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "text/plain") if (args.interactors != null) query.append("interactors", String(args.interactors)) if (args.importableOnly != null) query.append("importableOnly", String(args.importableOnly)) const url = `${baseUrl.replace(/\/+$/, '')}/mapping/url/projection${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };