contentful-management
Version:
Client for Contentful's Content Management API
42 lines (39 loc) • 1.19 kB
JavaScript
import copy from 'fast-copy';
import { put, del as del$1, get as get$1 } from './raw.js';
/**
* Urls
*/
const getBaseUrl = (params) => `/spaces/${params.spaceId}/environment_aliases`;
const getEnvironmentAliasUrl = (params) => getBaseUrl(params) + `/${params.environmentAliasId}`;
/**
* Endpoints
*/
const get = (http, params) => {
return get$1(http, getEnvironmentAliasUrl(params));
};
const getMany = (http, params) => {
return get$1(http, getBaseUrl(params), {
params: params.query,
});
};
const createWithId = (http, params, rawData, headers) => {
const data = copy(rawData);
return put(http, getEnvironmentAliasUrl(params), data, {
headers: headers,
});
};
const update = (http, params, rawData, headers) => {
const data = copy(rawData);
delete data.sys;
return put(http, getEnvironmentAliasUrl(params), data, {
headers: {
...headers,
'X-Contentful-Version': rawData.sys.version ?? 0,
},
});
};
const del = (http, params) => {
return del$1(http, getEnvironmentAliasUrl(params));
};
export { createWithId, del, get, getMany, update };
//# sourceMappingURL=environment-alias.js.map