From ea03e8f1decb2c0f2f08470d02c51be5b0aa7ec3 Mon Sep 17 00:00:00 2001 From: Marco <50334010+mogagnon@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:50:36 -0400 Subject: [PATCH] fix: add interface for catalogContent [CIUG-791] --- src/resources/Catalogs/CatalogContent.ts | 11 ++++++++--- src/resources/Catalogs/CatalogInterfaces.ts | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/resources/Catalogs/CatalogContent.ts b/src/resources/Catalogs/CatalogContent.ts index 6ad2b057d..625a2a44a 100644 --- a/src/resources/Catalogs/CatalogContent.ts +++ b/src/resources/Catalogs/CatalogContent.ts @@ -1,5 +1,6 @@ import API from '../../APICore.js'; import Resource from '../Resource.js'; +import {CatalogMetadata, CatalogMetadataName} from './CatalogInterfaces.js'; export type ObjectType = { objectType: string; @@ -9,14 +10,18 @@ export default class CatalogContent extends Resource { static baseUrl = `/rest/organizations/${API.orgPlaceholder}/catalogcontent/source`; getObjectTypes(sourceId: string) { - return this.api.get(`${CatalogContent.baseUrl}/${sourceId}/objecttypes`); + return this.api.get(`${CatalogContent.baseUrl}/${sourceId}/objecttypes`); } getMetadataValues(sourceId: string, objectType: ObjectType) { - return this.api.get(this.buildPath(`${CatalogContent.baseUrl}/${sourceId}/metadatavalues`, objectType)); + return this.api.get( + this.buildPath(`${CatalogContent.baseUrl}/${sourceId}/metadatavalues`, objectType), + ); } getMetadata(sourceId: string, objectType: ObjectType) { - return this.api.get(this.buildPath(`${CatalogContent.baseUrl}/${sourceId}/metadata`, objectType)); + return this.api.get( + this.buildPath(`${CatalogContent.baseUrl}/${sourceId}/metadata`, objectType), + ); } } diff --git a/src/resources/Catalogs/CatalogInterfaces.ts b/src/resources/Catalogs/CatalogInterfaces.ts index c8a161c40..6e34521ca 100644 --- a/src/resources/Catalogs/CatalogInterfaces.ts +++ b/src/resources/Catalogs/CatalogInterfaces.ts @@ -426,3 +426,19 @@ export interface CatalogFieldStatsOptions { */ forceRefresh?: boolean; } + +export interface CatalogMetadata { + /** + * Metadata seen on catalog documents with a sample of values. + */ + metadataValuesByName: { + [name: string]: string[]; + }; +} + +export interface CatalogMetadataName { + /** + * Metadata name seen on catalog documents. + */ + metadataNames: string[]; +}