export type GetApiTokenTokenPathwaysBinnedArgs = {token: string, resource?: ('TOTAL' | 'UNIPROT' | 'ENSEMBL' | 'CHEBI' | 'IUPHAR' | 'MIRBASE' | 'NCBI_PROTEIN' | 'EMBL' | 'COMPOUND' | 'PUBCHEM_COMPOUND') | undefined, binSize?: string | undefined, species?: string | undefined, pValue?: number | undefined, includeDisease?: boolean | undefined}; export type GetApiTokenTokenPathwaysBinnedOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Returns a list of binned hit pathway sizes associated with the token * * GET /token/{token}/pathways/binned */ export const getApiTokenTokenPathwaysBinned = async (args: GetApiTokenTokenPathwaysBinnedArgs, options: GetApiTokenTokenPathwaysBinnedOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.resource != null) query.append("resource", String(args.resource)) if (args.binSize != null) query.append("binSize", String(args.binSize)) if (args.species != null) query.append("species", String(args.species)) if (args.pValue != null) query.append("pValue", String(args.pValue)) if (args.includeDisease != null) query.append("includeDisease", String(args.includeDisease)) const url = `${baseUrl.replace(/\/+$/, '')}/token/${encodeURIComponent(String(args.token))}/pathways/binned${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 };