UNPKG

contentful-management

Version:
23 lines 935 B
import * as raw from './raw'; import copy from 'fast-copy'; const getBaseUrl = params => `/organizations/${params.organizationId}/app_definitions/${params.appDefinitionId}/resource_provider/resource_types`; const getEntityUrl = params => `${getBaseUrl(params)}/${params.resourceTypeId}`; const getSpaceEnvUrl = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/resource_types`; export const get = (http, params) => { return raw.get(http, getEntityUrl(params)); }; export const upsert = (http, params, rawData, headers) => { const data = copy(rawData); return raw.put(http, getEntityUrl(params), data, { headers }); }; export const del = (http, params) => { return raw.del(http, getEntityUrl(params)); }; export const getMany = (http, params) => { return raw.get(http, getBaseUrl(params)); }; export const getForEnvironment = (http, params) => { return raw.get(http, getSpaceEnvUrl(params)); };