mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-25 02:19:58 +00:00
22 lines
782 B
TypeScript
22 lines
782 B
TypeScript
import { datasetUrlByUrn } from 'wherehows-web/utils/api/datasets/shared';
|
|
import { getJSON } from '@datahub/utils/api/fetcher';
|
|
import { FabricType } from '@datahub/metadata-types/constants/common/fabric-type';
|
|
import { encodeUrn } from '@datahub/utils/validators/urn';
|
|
|
|
/**
|
|
* Constructs the url to retrieve fabrics for a dataset
|
|
* @param {string} urn
|
|
* @return {string}
|
|
*/
|
|
const datasetFabricsUrlByUrn = (urn: string): string => `${datasetUrlByUrn(urn)}/fabrics`;
|
|
|
|
/**
|
|
* Fetches the list of fabrics for a given dataset
|
|
* @param {string} urn
|
|
* @return {Promise<Array<Fabric>>}
|
|
*/
|
|
const readDatasetFabricsByUrn = (urn: string): Promise<Array<FabricType>> =>
|
|
getJSON<Array<FabricType>>({ url: datasetFabricsUrlByUrn(encodeUrn(urn)) });
|
|
|
|
export { readDatasetFabricsByUrn };
|