mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-13 09:54:10 +00:00
24 lines
654 B
TypeScript
24 lines
654 B
TypeScript
import { ApiRoot } from 'wherehows-web/utils/api/shared';
|
|
|
|
/**
|
|
* Defines the endpoint for datasets
|
|
* @type {string}
|
|
*/
|
|
export const datasetsUrlRoot = `${ApiRoot}/datasets`;
|
|
|
|
/**
|
|
* Constructs a url to get a dataset with a given id
|
|
* @param {number} id the id of the dataset
|
|
* @return {string} the dataset url
|
|
*/
|
|
export const datasetUrlById = (id: number): string => `${datasetsUrlRoot}/${id}`;
|
|
|
|
/**
|
|
* Constructs a url to get a dataset id given a dataset urn
|
|
* @param {string} urn
|
|
* @return {string}
|
|
*/
|
|
export const datasetIdTranslationUrlByUrn = (urn: string): string => {
|
|
return `${datasetsUrlRoot}/idfromurn/${encodeURIComponent(urn)}`;
|
|
};
|