export type CreateApiIdentifiersUrlArgs = {interactors?: boolean | undefined, species?: string | undefined, pageSize?: number | undefined, page?: number | undefined, sortBy?: ('NAME' | 'TOTAL_ENTITIES' | 'TOTAL_INTERACTORS' | 'TOTAL_REACTIONS' | 'FOUND_ENTITIES' | 'FOUND_INTERACTORS' | 'FOUND_REACTIONS' | 'ENTITIES_RATIO' | 'ENTITIES_PVALUE' | 'ENTITIES_FDR' | 'REACTIONS_RATIO') | undefined, order?: ('ASC' | 'DESC') | undefined, resource?: ('TOTAL' | 'UNIPROT' | 'ENSEMBL' | 'CHEBI' | 'IUPHAR' | 'MIRBASE' | 'NCBI_PROTEIN' | 'EMBL' | 'COMPOUND' | 'PUBCHEM_COMPOUND') | undefined, pValue?: number | undefined, includeDisease?: boolean | undefined, min?: number | undefined, max?: number | undefined, importableOnly?: boolean | undefined, body: BodyInit}; export type CreateApiIdentifiersUrlOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Analyse the identifiers contained in the provided url over the different species * * POST /identifiers/url */ export const createApiIdentifiersUrl = async (args: CreateApiIdentifiersUrlArgs, options: CreateApiIdentifiersUrlOptions) => { 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.species != null) query.append("species", String(args.species)) if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.page != null) query.append("page", String(args.page)) if (args.sortBy != null) query.append("sortBy", String(args.sortBy)) if (args.order != null) query.append("order", String(args.order)) if (args.resource != null) query.append("resource", String(args.resource)) if (args.pValue != null) query.append("pValue", String(args.pValue)) if (args.includeDisease != null) query.append("includeDisease", String(args.includeDisease)) if (args.min != null) query.append("min", String(args.min)) if (args.max != null) query.append("max", String(args.max)) if (args.importableOnly != null) query.append("importableOnly", String(args.importableOnly)) const url = `${baseUrl.replace(/\/+$/, '')}/identifiers/url${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 };