UNPKG

contentful-management

Version:
33 lines (30 loc) 1.21 kB
import copy from 'fast-copy'; import { post, del as del$1, get as get$1, put } from './raw.js'; import { normalizeSelect } from './utils.js'; const getBaseUrl = (params) => `/organizations/${params.organizationId}/teams`; const getEntityUrl = (params) => `${getBaseUrl(params)}/${params.teamId}`; const get = (http, params) => get$1(http, getEntityUrl(params)); const getMany = (http, params) => get$1(http, getBaseUrl(params), { params: normalizeSelect(params.query), }); const getManyForSpace = (http, params) => { return get$1(http, `/spaces/${params.spaceId}/teams`, { params: normalizeSelect(params.query), }); }; const create = (http, params, rawData, headers) => { return post(http, getBaseUrl(params), rawData, { headers }); }; const update = (http, params, rawData, headers) => { const data = copy(rawData); delete data.sys; return put(http, getEntityUrl(params), data, { headers: { 'X-Contentful-Version': rawData.sys.version ?? 0, ...headers, }, }); }; const del = (http, params) => del$1(http, getEntityUrl(params)); export { create, del, get, getMany, getManyForSpace, update }; //# sourceMappingURL=team.js.map