contentful-management
Version:
Client for Contentful's Content Management API
22 lines • 1.05 kB
JavaScript
import * as raw from './raw';
import { normalizeSelect } from './utils';
const getBaseEntryUrl = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}/snapshots`;
const getEntryUrl = params => getBaseEntryUrl(params) + `/${params.snapshotId}`;
export const getManyForEntry = (http, params) => {
return raw.get(http, getBaseEntryUrl(params), {
params: normalizeSelect(params.query)
});
};
export const getForEntry = (http, params) => {
return raw.get(http, getEntryUrl(params));
};
const getBaseContentTypeUrl = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/content_types/${params.contentTypeId}/snapshots`;
const getContentTypeUrl = params => getBaseContentTypeUrl(params) + `/${params.snapshotId}`;
export const getManyForContentType = (http, params) => {
return raw.get(http, getBaseContentTypeUrl(params), {
params: normalizeSelect(params.query)
});
};
export const getForContentType = (http, params) => {
return raw.get(http, getContentTypeUrl(params));
};