UNPKG

dc-management-sdk-js

Version:
103 lines 6.38 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.EditionsPage = exports.Edition = void 0; var __1 = require("../.."); var HalResource_1 = require("../hal/models/HalResource"); var EditionSlot_1 = require("./EditionSlot"); var Event_1 = require("./Event"); var Page_1 = require("./Page"); /** * Class representing the [Edition](https://amplience.com/docs/api/dynamic-content/management/#tag/Editions) resource. * An Edition is the main way of scheduling content to be published on a specific date. * It holds the association between slots and content items. Once all slots are valid and * there are no conflicts, it is ready to be scheduled. */ var Edition = /** @class */ (function (_super) { __extends(Edition, _super); function Edition() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * Resources and actions related to an Edition */ _this.related = { /** * Archive Edition */ archive: function () { return _this.performActionThatReturnsResource('archive', {}, {}, Edition); }, /** * Delete Edition */ delete: function () { return _this.deleteResource(); }, /** * Retrieves the Event associated with this Edition */ event: function () { return _this.fetchLinkedResource('event', {}, Event_1.Event); }, slots: { /** * Retrieves a list of slots associated with this Edition * @param options Pagination options */ list: function (options) { return _this.fetchLinkedResource('list-slots', options, EditionSlot_1.EditionSlotsPage); }, /** * Creates new edition slots from a list of content IDs */ create: function (slots) { return _this.performActionThatReturnsResource('slots', {}, slots, EditionSlot_1.EditionSlotsPage); }, }, /** * Schedule Edition */ schedule: function (ignoreWarnings, lastModifiedDate) { if (ignoreWarnings === void 0) { ignoreWarnings = false; } if (lastModifiedDate === void 0) { lastModifiedDate = new Date().toISOString(); } return _this.performActionWithoutResourceResponse('schedule', { ignoreWarnings: ignoreWarnings }, { lastModifiedDate: lastModifiedDate }, __1.HttpMethod.POST); }, /** * Unschedule Edition */ unschedule: function () { return _this.deleteLinkedResource('schedule', {}); }, /** * Updates this Edition with the changes in the mutation parameter. * @param mutation Mutated edition */ update: function (mutation) { return _this.updateResource(mutation, Edition); }, }; return _this; } return Edition; }(HalResource_1.HalResource)); exports.Edition = Edition; /** * @hidden */ var EditionsPage = /** @class */ (function (_super) { __extends(EditionsPage, _super); function EditionsPage(data) { return _super.call(this, 'editions', Edition, data) || this; } return EditionsPage; }(Page_1.Page)); exports.EditionsPage = EditionsPage; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRWRpdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvbW9kZWwvRWRpdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSwyQkFBdUQ7QUFDdkQseURBQXdEO0FBQ3hELDZDQUE4RDtBQUU5RCxpQ0FBZ0M7QUFDaEMsK0JBQThCO0FBdUM5Qjs7Ozs7R0FLRztBQUNIO0lBQTZCLDJCQUFXO0lBQXhDOztRQWtGRTs7V0FFRztRQUNhLGFBQU8sR0FBRztZQUN4Qjs7ZUFFRztZQUNILE9BQU8sRUFBRTtnQkFDUCxPQUFBLEtBQUksQ0FBQyxnQ0FBZ0MsQ0FBQyxTQUFTLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxPQUFPLENBQUM7WUFBakUsQ0FBaUU7WUFFbkU7O2VBRUc7WUFDSCxNQUFNLEVBQUUsY0FBcUIsT0FBQSxLQUFJLENBQUMsY0FBYyxFQUFFLEVBQXJCLENBQXFCO1lBRWxEOztlQUVHO1lBQ0gsS0FBSyxFQUFFLGNBQXNCLE9BQUEsS0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