export type GetApiTokenTokenArgs = {token: string, 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}; export type GetApiTokenTokenOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Returns the result associated with the token * * GET /token/{token} */ export const getApiTokenToken = async (args: GetApiTokenTokenArgs, options: GetApiTokenTokenOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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(/\/+$/, '')}/token/${encodeURIComponent(String(args.token))}${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 };