Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* Releases updated version of datahub-web client UI code

* Fix typo in yarn lock

* Change yarn lock to match yarn registry directories

* Previous commit missed some paths

* Even more changes to yarnlock missing in previous commit

* Include codegen file for typings

* Add files to get parity for datahub-web and current OS datahub-midtier

* Add in typo fix from previous commit - change to proper license

* Implement proper OS fix for person entity picture url

* Workarounds for open source DH issues

* Fixes institutional memory api and removes unopensourced tabs for datasets

* Fixes search dataset deprecation and user search issue as a result of changes

* Remove internal only options in the avatar menu
2020-08-26 15:44:50 -07:00

24 lines
1.2 KiB
TypeScript

import { DataModelName } from '@datahub/data-models/constants/entity';
import { getJSON } from '@datahub/utils/api/fetcher';
import { entityApiByUrn } from '@datahub/data-models/api/entity';
/**
* Creates a url to the top consumers endpoint for a specific entity by urn
* @param {DataModelName} entityType - the type of entity for which we are making this request
* @param {string} urn - identifier for the specific entity for which we want to construct the url
*/
const topConsumersUrlByEntityAndUrn = (entityType: DataModelName, urn: string): string =>
`${entityApiByUrn(urn, entityType)}/top-consumers`;
/**
* Given an entity type and urn, construct a getter that retrieves the top consumers aspect for the entity
* @param {DataModelName} entityType - the type of entity for which we want to read like information
* @param {string} urn - the identifier for the entity for which we want to read like information
*/
export const readTopConsumersForEntity = (
entityType: DataModelName,
urn: string
): Promise<Com.Linkedin.Common.EntityTopUsage> => {
return getJSON<Com.Linkedin.Common.EntityTopUsage>({ url: topConsumersUrlByEntityAndUrn(entityType, urn) });
};