20 lines
763 B
TypeScript
Raw Normal View History

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';
/**
* 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`;
/**
* 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>> =>
getJSON({ url: platformsUrl })
.then(({ platforms }) => platforms || [])
.catch(() => []);