@agility/management-sdk 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,7 @@ import { PageItem } from "../models/pageItem";
|
|
|
4
4
|
import { Sitemap } from "../models/sitemap";
|
|
5
5
|
import { BatchMethods } from "./batchMethods";
|
|
6
6
|
import { PageModel } from "../models/pageModel";
|
|
7
|
+
import { ContentSectionDefinition } from "../models/contentSectionDefinition";
|
|
7
8
|
export declare class PageMethods {
|
|
8
9
|
_options: Options;
|
|
9
10
|
_clientInstance: ClientInstance;
|
|
@@ -14,6 +15,7 @@ export declare class PageMethods {
|
|
|
14
15
|
getPageTemplate(guid: string, locale: string, pageTemplateId: number): Promise<PageModel>;
|
|
15
16
|
getPageTemplateName(guid: string, locale: string, templateName: string): Promise<PageModel>;
|
|
16
17
|
deletePageTemplate(guid: string, locale: string, pageTemplateId: number): Promise<string>;
|
|
18
|
+
getPageItemTemplates(guid: string, locale: string, id: number): Promise<ContentSectionDefinition[]>;
|
|
17
19
|
savePageTemplate(guid: string, locale: string, pageModel: PageModel): Promise<PageModel>;
|
|
18
20
|
getPage(pageID: number, guid: string, locale: string): Promise<PageItem>;
|
|
19
21
|
publishPage(pageID: number, guid: string, locale: string, comments?: string): Promise<number[]>;
|
|
@@ -149,9 +149,29 @@ var PageMethods = /** @class */ (function () {
|
|
|
149
149
|
});
|
|
150
150
|
});
|
|
151
151
|
};
|
|
152
|
-
PageMethods.prototype.
|
|
152
|
+
PageMethods.prototype.getPageItemTemplates = function (guid, locale, id) {
|
|
153
153
|
return __awaiter(this, void 0, void 0, function () {
|
|
154
154
|
var apiPath, resp, err_6;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
_a.trys.push([0, 2, , 3]);
|
|
159
|
+
apiPath = "".concat(locale, "/page/template/items/").concat(id);
|
|
160
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
161
|
+
case 1:
|
|
162
|
+
resp = _a.sent();
|
|
163
|
+
return [2 /*return*/, resp.data];
|
|
164
|
+
case 2:
|
|
165
|
+
err_6 = _a.sent();
|
|
166
|
+
throw new exception_1.Exception("Unable to retreive Page Template Items.", err_6);
|
|
167
|
+
case 3: return [2 /*return*/];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
PageMethods.prototype.savePageTemplate = function (guid, locale, pageModel) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
var apiPath, resp, err_7;
|
|
155
175
|
return __generator(this, function (_a) {
|
|
156
176
|
switch (_a.label) {
|
|
157
177
|
case 0:
|
|
@@ -162,8 +182,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
162
182
|
resp = _a.sent();
|
|
163
183
|
return [2 /*return*/, resp.data];
|
|
164
184
|
case 2:
|
|
165
|
-
|
|
166
|
-
throw new exception_1.Exception("Unable to save Page Template.",
|
|
185
|
+
err_7 = _a.sent();
|
|
186
|
+
throw new exception_1.Exception("Unable to save Page Template.", err_7);
|
|
167
187
|
case 3: return [2 /*return*/];
|
|
168
188
|
}
|
|
169
189
|
});
|
|
@@ -171,7 +191,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
171
191
|
};
|
|
172
192
|
PageMethods.prototype.getPage = function (pageID, guid, locale) {
|
|
173
193
|
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
-
var apiPath, resp,
|
|
194
|
+
var apiPath, resp, err_8;
|
|
175
195
|
return __generator(this, function (_a) {
|
|
176
196
|
switch (_a.label) {
|
|
177
197
|
case 0:
|
|
@@ -182,8 +202,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
182
202
|
resp = _a.sent();
|
|
183
203
|
return [2 /*return*/, resp.data];
|
|
184
204
|
case 2:
|
|
185
|
-
|
|
186
|
-
throw new exception_1.Exception("Unable to retreive page for id ".concat(pageID, "."),
|
|
205
|
+
err_8 = _a.sent();
|
|
206
|
+
throw new exception_1.Exception("Unable to retreive page for id ".concat(pageID, "."), err_8);
|
|
187
207
|
case 3: return [2 /*return*/];
|
|
188
208
|
}
|
|
189
209
|
});
|
|
@@ -192,7 +212,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
192
212
|
PageMethods.prototype.publishPage = function (pageID, guid, locale, comments) {
|
|
193
213
|
if (comments === void 0) { comments = null; }
|
|
194
214
|
return __awaiter(this, void 0, void 0, function () {
|
|
195
|
-
var apiPath, resp, batchID_1, batch, pageIDs_1,
|
|
215
|
+
var apiPath, resp, batchID_1, batch, pageIDs_1, err_9;
|
|
196
216
|
var _this = this;
|
|
197
217
|
return __generator(this, function (_a) {
|
|
198
218
|
switch (_a.label) {
|
|
@@ -215,8 +235,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
215
235
|
batch.items.forEach(function (element) { return pageIDs_1.push(element.itemID); });
|
|
216
236
|
return [2 /*return*/, pageIDs_1];
|
|
217
237
|
case 3:
|
|
218
|
-
|
|
219
|
-
throw new exception_1.Exception("Unable to publish the page for id: ".concat(pageID),
|
|
238
|
+
err_9 = _a.sent();
|
|
239
|
+
throw new exception_1.Exception("Unable to publish the page for id: ".concat(pageID), err_9);
|
|
220
240
|
case 4: return [2 /*return*/];
|
|
221
241
|
}
|
|
222
242
|
});
|
|
@@ -225,7 +245,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
225
245
|
PageMethods.prototype.unPublishPage = function (pageID, guid, locale, comments) {
|
|
226
246
|
if (comments === void 0) { comments = null; }
|
|
227
247
|
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
-
var apiPath, resp, batchID_2, batch, pageIDs_2,
|
|
248
|
+
var apiPath, resp, batchID_2, batch, pageIDs_2, err_10;
|
|
229
249
|
var _this = this;
|
|
230
250
|
return __generator(this, function (_a) {
|
|
231
251
|
switch (_a.label) {
|
|
@@ -248,8 +268,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
248
268
|
batch.items.forEach(function (element) { return pageIDs_2.push(element.itemID); });
|
|
249
269
|
return [2 /*return*/, pageIDs_2];
|
|
250
270
|
case 3:
|
|
251
|
-
|
|
252
|
-
throw new exception_1.Exception("Unable to un-publish the page for id: ".concat(pageID),
|
|
271
|
+
err_10 = _a.sent();
|
|
272
|
+
throw new exception_1.Exception("Unable to un-publish the page for id: ".concat(pageID), err_10);
|
|
253
273
|
case 4: return [2 /*return*/];
|
|
254
274
|
}
|
|
255
275
|
});
|
|
@@ -258,7 +278,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
258
278
|
PageMethods.prototype.pageRequestApproval = function (pageID, guid, locale, comments) {
|
|
259
279
|
if (comments === void 0) { comments = null; }
|
|
260
280
|
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
-
var apiPath, resp, batchID_3, batch, pageIDs_3,
|
|
281
|
+
var apiPath, resp, batchID_3, batch, pageIDs_3, err_11;
|
|
262
282
|
var _this = this;
|
|
263
283
|
return __generator(this, function (_a) {
|
|
264
284
|
switch (_a.label) {
|
|
@@ -281,8 +301,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
281
301
|
batch.items.forEach(function (element) { return pageIDs_3.push(element.itemID); });
|
|
282
302
|
return [2 /*return*/, pageIDs_3];
|
|
283
303
|
case 3:
|
|
284
|
-
|
|
285
|
-
throw new exception_1.Exception("Unable to request approval the page for id: ".concat(pageID),
|
|
304
|
+
err_11 = _a.sent();
|
|
305
|
+
throw new exception_1.Exception("Unable to request approval the page for id: ".concat(pageID), err_11);
|
|
286
306
|
case 4: return [2 /*return*/];
|
|
287
307
|
}
|
|
288
308
|
});
|
|
@@ -291,7 +311,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
291
311
|
PageMethods.prototype.approvePage = function (pageID, guid, locale, comments) {
|
|
292
312
|
if (comments === void 0) { comments = null; }
|
|
293
313
|
return __awaiter(this, void 0, void 0, function () {
|
|
294
|
-
var apiPath, resp, batchID_4, batch, pageIDs_4,
|
|
314
|
+
var apiPath, resp, batchID_4, batch, pageIDs_4, err_12;
|
|
295
315
|
var _this = this;
|
|
296
316
|
return __generator(this, function (_a) {
|
|
297
317
|
switch (_a.label) {
|
|
@@ -314,8 +334,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
314
334
|
batch.items.forEach(function (element) { return pageIDs_4.push(element.itemID); });
|
|
315
335
|
return [2 /*return*/, pageIDs_4];
|
|
316
336
|
case 3:
|
|
317
|
-
|
|
318
|
-
throw new exception_1.Exception("Unable to approve the page for id: ".concat(pageID),
|
|
337
|
+
err_12 = _a.sent();
|
|
338
|
+
throw new exception_1.Exception("Unable to approve the page for id: ".concat(pageID), err_12);
|
|
319
339
|
case 4: return [2 /*return*/];
|
|
320
340
|
}
|
|
321
341
|
});
|
|
@@ -324,7 +344,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
324
344
|
PageMethods.prototype.declinePage = function (pageID, guid, locale, comments) {
|
|
325
345
|
if (comments === void 0) { comments = null; }
|
|
326
346
|
return __awaiter(this, void 0, void 0, function () {
|
|
327
|
-
var apiPath, resp, batchID_5, batch, pageIDs_5,
|
|
347
|
+
var apiPath, resp, batchID_5, batch, pageIDs_5, err_13;
|
|
328
348
|
var _this = this;
|
|
329
349
|
return __generator(this, function (_a) {
|
|
330
350
|
switch (_a.label) {
|
|
@@ -347,8 +367,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
347
367
|
batch.items.forEach(function (element) { return pageIDs_5.push(element.itemID); });
|
|
348
368
|
return [2 /*return*/, pageIDs_5];
|
|
349
369
|
case 3:
|
|
350
|
-
|
|
351
|
-
throw new exception_1.Exception("Unable to decline the page for id: ".concat(pageID),
|
|
370
|
+
err_13 = _a.sent();
|
|
371
|
+
throw new exception_1.Exception("Unable to decline the page for id: ".concat(pageID), err_13);
|
|
352
372
|
case 4: return [2 /*return*/];
|
|
353
373
|
}
|
|
354
374
|
});
|
|
@@ -357,7 +377,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
357
377
|
PageMethods.prototype.deletePage = function (pageID, guid, locale, comments) {
|
|
358
378
|
if (comments === void 0) { comments = null; }
|
|
359
379
|
return __awaiter(this, void 0, void 0, function () {
|
|
360
|
-
var apiPath, resp, batchID_6, batch, pageIDs_6,
|
|
380
|
+
var apiPath, resp, batchID_6, batch, pageIDs_6, err_14;
|
|
361
381
|
var _this = this;
|
|
362
382
|
return __generator(this, function (_a) {
|
|
363
383
|
switch (_a.label) {
|
|
@@ -380,8 +400,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
380
400
|
batch.items.forEach(function (element) { return pageIDs_6.push(element.itemID); });
|
|
381
401
|
return [2 /*return*/, pageIDs_6];
|
|
382
402
|
case 3:
|
|
383
|
-
|
|
384
|
-
throw new exception_1.Exception("Unable to delete the page for id: ".concat(pageID),
|
|
403
|
+
err_14 = _a.sent();
|
|
404
|
+
throw new exception_1.Exception("Unable to delete the page for id: ".concat(pageID), err_14);
|
|
385
405
|
case 4: return [2 /*return*/];
|
|
386
406
|
}
|
|
387
407
|
});
|
|
@@ -391,7 +411,7 @@ var PageMethods = /** @class */ (function () {
|
|
|
391
411
|
if (parentPageID === void 0) { parentPageID = -1; }
|
|
392
412
|
if (placeBeforePageItemID === void 0) { placeBeforePageItemID = -1; }
|
|
393
413
|
return __awaiter(this, void 0, void 0, function () {
|
|
394
|
-
var apiPath, resp, batchID_7, batch, pageIDs_7,
|
|
414
|
+
var apiPath, resp, batchID_7, batch, pageIDs_7, err_15;
|
|
395
415
|
var _this = this;
|
|
396
416
|
return __generator(this, function (_a) {
|
|
397
417
|
switch (_a.label) {
|
|
@@ -414,8 +434,8 @@ var PageMethods = /** @class */ (function () {
|
|
|
414
434
|
batch.items.forEach(function (element) { return pageIDs_7.push(element.itemID); });
|
|
415
435
|
return [2 /*return*/, pageIDs_7];
|
|
416
436
|
case 3:
|
|
417
|
-
|
|
418
|
-
throw new exception_1.Exception("Unable to create page. ".concat(
|
|
437
|
+
err_15 = _a.sent();
|
|
438
|
+
throw new exception_1.Exception("Unable to create page. ".concat(err_15), err_15);
|
|
419
439
|
case 4: return [2 /*return*/];
|
|
420
440
|
}
|
|
421
441
|
});
|