contentful-management
Version:
Client for Contentful's Content Management API
33 lines (30 loc) • 1.04 kB
JavaScript
import copy from 'fast-copy';
import { del as del$1, get as get$1, put } from './raw.js';
const getBaseUrl = (params) => `/spaces/${params.spaceId}/environments/${params.environmentId}/design_tokens`;
const getMany = (http, params, headers) => {
return get$1(http, getBaseUrl(params), {
params: params.query,
headers,
});
};
const get = (http, params, headers) => {
return get$1(http, getBaseUrl(params) + `/${params.designTokenId}`, {
headers,
});
};
const upsert = (http, params, rawData, headers) => {
const { sys, ...body } = copy(rawData);
return put(http, getBaseUrl(params) + `/${params.designTokenId}`, body, {
headers: {
...(sys.version !== undefined && {
'X-Contentful-Version': sys.version,
}),
...headers,
},
});
};
const del = (http, params) => {
return del$1(http, getBaseUrl(params) + `/${params.designTokenId}`);
};
export { del, get, getMany, upsert };
//# sourceMappingURL=design-token.js.map