2019-08-31 20:51:14 -07:00
|
|
|
import { getListUrlRoot } from '@datahub/data-models/api/dataset/shared/lists';
|
|
|
|
import { ApiVersion } from '@datahub/utils/api/shared';
|
|
|
|
import { getJSON } from '@datahub/utils/api/fetcher';
|
|
|
|
import { IDataPlatform } from '@datahub/metadata-types/types/entity/dataset/platform';
|
|
|
|
|
2020-08-26 15:44:50 -07:00
|
|
|
/**
|
|
|
|
* Defines the url endpoint for the list of dataset compliance data types and attributes
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2019-08-31 20:51:14 -07:00
|
|
|
const platformsUrl = `${getListUrlRoot(ApiVersion.v2)}/platforms`;
|
|
|
|
|
2020-08-26 15:44:50 -07:00
|
|
|
/**
|
|
|
|
* Requests the list of compliance data types and the related attributes
|
|
|
|
* @returns {Promise<Array<IComplianceDataType>>}
|
|
|
|
*/
|
2019-08-31 20:51:14 -07:00
|
|
|
export const readDataPlatforms = (): Promise<Array<IDataPlatform>> =>
|
2020-08-26 15:44:50 -07:00
|
|
|
getJSON({ url: platformsUrl })
|
|
|
|
.then(({ platforms }) => platforms || [])
|
|
|
|
.catch(() => []);
|