UNPKG

@contentstack/management

Version:

The Content Management API is used to manage the content of your Contentstack account

39 lines 2.25 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _createClass from "@babel/runtime/helpers/createClass"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * @namespace ContentstackCollection */ var ContentstackCollection = /*#__PURE__*/_createClass(function ContentstackCollection(response, http) { var _http$httpClientParam; var stackHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var wrapperCollection = arguments.length > 3 ? arguments[3] : undefined; _classCallCheck(this, ContentstackCollection); var data = response.data || {}; if (stackHeaders) { data.stackHeaders = stackHeaders; } if ((http === null || http === void 0 || (_http$httpClientParam = http.httpClientParams) === null || _http$httpClientParam === void 0 || (_http$httpClientParam = _http$httpClientParam.headers) === null || _http$httpClientParam === void 0 ? void 0 : _http$httpClientParam.includeResHeaders) === true) { data.stackHeaders = _objectSpread(_objectSpread({}, data.stackHeaders), {}, { responseHeaders: response.headers }); } if (wrapperCollection) { this.items = wrapperCollection(http, data); } if (data.schema !== undefined) { this.schema = data.schema; } if (data.content_type !== undefined) { this.content_type = data.content_type; } if (data.count !== undefined) { this.count = data.count; } if (data.notice !== undefined) { this.notice = data.notice; } }); export { ContentstackCollection as default };