Skip to content

Commit

Permalink
feat: remove version number in get objecttype call (#822)
Browse files Browse the repository at this point in the history
* feat: remove version number in get objecttype call

* fix: change naming
  • Loading branch information
cjun-coveo authored May 23, 2024
1 parent 238d542 commit 3b5e628
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
12 changes: 1 addition & 11 deletions src/resources/Catalogs/CatalogContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ export type ObjectType = {
objectType: string;
};

export type Version = {
version: number;
};

export default class CatalogContent extends Resource {
static baseUrl = `/rest/organizations/${API.orgPlaceholder}/catalogcontent/source`;

getObjectTypeV2(sourceId: string, version: Version) {
return this.api.get<CatalogObjectType>(
this.buildPath(`${CatalogContent.baseUrl}/${sourceId}/objecttypes`, version),
);
}

getObjectTypes(sourceId: string) {
return this.api.get<string[]>(`${CatalogContent.baseUrl}/${sourceId}/objecttypes`);
return this.api.get<CatalogObjectType>(`${CatalogContent.baseUrl}/${sourceId}/objecttypes`);
}

getMetadataValues(sourceId: string, objectType: ObjectType) {
Expand Down
14 changes: 0 additions & 14 deletions src/resources/Catalogs/tests/CatalogContent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ describe('CatalogContent', () => {
metadata = new CatalogContent(api, serverlessApi);
});

describe('getObjectTypeV2', () => {
it('should make a GET call to the specific CatalogContent url', () => {
const defaultOptions: queryString.StringifyOptions = {skipEmptyString: true, skipNull: true, sort: false};
const sourceId = 'McDonald';
const version = {version: 2};

metadata.getObjectTypeV2(sourceId, version);
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(
`${baseUrl}/${sourceId}/objecttypes?${queryString.stringify(version, {...defaultOptions})}`,
);
});
});

describe('getObjectTypes', () => {
it('should make a GET call to the specific CatalogContent url', () => {
const sourceId = 'McDonald';
Expand Down

0 comments on commit 3b5e628

Please sign in to comment.