Skip to content

Commit

Permalink
Atlas #4 - Adding fetchRelatedManifests function to Places service
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Apr 2, 2024
1 parent 63d392b commit 6b2e34e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/core-data/src/services/Places.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,29 @@ import Api from '../utils/Api';
* @param id
* @param projectIds
* @param params
*
* @returns {Promise<any>}
*/
const fetchOne = (baseUrl, id, projectIds, params = {}) => {
const url = Api.buildUrl(baseUrl, 'places', id, projectIds, params);
return fetch(url).then((response) => response.json());
};

/**
* Calls the GET /core_data/public/places/:id/manifests API endpoint.
*
* @param baseUrl
* @param id
* @param projectIds
* @param params
*
* @returns {Promise<any>}
*/
const fetchRelatedManifests = (baseUrl, id, projectIds, params = {}) => {
const url = Api.buildNestedUrl(baseUrl, 'places', id, 'manifests', projectIds, params);
return fetch(url).then((response) => response.json());
};

/**
* Calls the GET /core_data/public/places/:id/media_contents API endpoint.
*
Expand All @@ -27,7 +43,7 @@ const fetchOne = (baseUrl, id, projectIds, params = {}) => {
* @returns {Promise<any>}
*/
const fetchRelatedMedia = (baseUrl, id, projectIds, params = {}) => {
const url = Api.buildNestedUrl(baseUrl, 'places', id, 'manifests', projectIds, params);
const url = Api.buildNestedUrl(baseUrl, 'places', id, 'media_contents', projectIds, params);
return fetch(url).then((response) => response.json());
};

Expand Down Expand Up @@ -93,6 +109,7 @@ const fetchRelatedTaxonomies = (baseUrl, id, projectIds, params = {}) => {

export default {
fetchOne,
fetchRelatedManifests,
fetchRelatedMedia,
fetchRelatedOrganizations,
fetchRelatedPeople,
Expand Down

0 comments on commit 6b2e34e

Please sign in to comment.