UNPKG

contentful-management

Version:
45 lines (42 loc) 1.41 kB
import copy from 'fast-copy'; import { post, put, del as del$1, get as get$1 } from './raw.js'; const get = (http, params) => { return get$1(http, `/spaces/${params.spaceId}/api_keys/${params.apiKeyId}`); }; const getMany = (http, params) => { return get$1(http, `/spaces/${params.spaceId}/api_keys`, { params: params.query, }); }; const create = (http, params, data, headers) => { return post(http, `/spaces/${params.spaceId}/api_keys`, data, { headers }); }; const createWithId = (http, params, data, headers) => { return put(http, `/spaces/${params.spaceId}/api_keys/${params.apiKeyId}`, data, { headers, }); }; const update = (http, params, rawData, headers) => { const data = copy(rawData); if ('accessToken' in data) { delete data.accessToken; } if ('preview_api_key' in data) { delete data.preview_api_key; } if ('policies' in data) { delete data.policies; } delete data.sys; return put(http, `/spaces/${params.spaceId}/api_keys/${params.apiKeyId}`, data, { headers: { 'X-Contentful-Version': rawData.sys.version ?? 0, ...headers, }, }); }; const del = (http, params) => { return del$1(http, `/spaces/${params.spaceId}/api_keys/${params.apiKeyId}`); }; export { create, createWithId, del, get, getMany, update }; //# sourceMappingURL=api-key.js.map