@agility/management-sdk 0.1.0 → 0.1.1

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.
Files changed (56) hide show
  1. package/README.md +395 -397
  2. package/dist/apiMethods/assetMethods.d.ts +14 -14
  3. package/dist/apiMethods/assetMethods.js +95 -95
  4. package/dist/apiMethods/batchMethods.d.ts +11 -11
  5. package/dist/apiMethods/batchMethods.js +65 -65
  6. package/dist/apiMethods/clientInstance.d.ts +8 -8
  7. package/dist/apiMethods/clientInstance.js +77 -77
  8. package/dist/apiMethods/containerMethods.d.ts +16 -16
  9. package/dist/apiMethods/containerMethods.js +105 -105
  10. package/dist/apiMethods/contentMethods.d.ts +20 -20
  11. package/dist/apiMethods/contentMethods.js +175 -175
  12. package/dist/apiMethods/instanceUserMethods.d.ts +13 -13
  13. package/dist/apiMethods/instanceUserMethods.js +57 -57
  14. package/dist/apiMethods/modelMethods.d.ts +13 -13
  15. package/dist/apiMethods/modelMethods.js +81 -81
  16. package/dist/apiMethods/pageMethods.d.ts +20 -20
  17. package/dist/apiMethods/pageMethods.js +159 -159
  18. package/dist/enums/batchOperationType.d.ts +19 -19
  19. package/dist/enums/batchOperationType.js +23 -23
  20. package/dist/enums/batchState..d.ts +7 -7
  21. package/dist/enums/batchState..js +11 -11
  22. package/dist/index.d.ts +21 -21
  23. package/dist/index.js +37 -33
  24. package/dist/models/batch.d.ts +29 -29
  25. package/dist/models/batch.js +6 -6
  26. package/dist/models/batchItem.d.ts +13 -13
  27. package/dist/models/batchItem.js +6 -6
  28. package/dist/models/container.d.ts +47 -47
  29. package/dist/models/container.js +6 -6
  30. package/dist/models/contentItem.d.ts +37 -37
  31. package/dist/models/contentItem.js +18 -18
  32. package/dist/models/contentViewColumn.d.ts +8 -8
  33. package/dist/models/contentViewColumn.js +6 -6
  34. package/dist/models/exception.d.ts +4 -4
  35. package/dist/models/exception.js +10 -10
  36. package/dist/models/instanceRole.d.ts +7 -7
  37. package/dist/models/instanceRole.js +6 -6
  38. package/dist/models/instanceUser.d.ts +14 -14
  39. package/dist/models/instanceUser.js +6 -6
  40. package/dist/models/media.d.ts +30 -30
  41. package/dist/models/media.js +9 -9
  42. package/dist/models/model.d.ts +30 -30
  43. package/dist/models/model.js +9 -9
  44. package/dist/models/notification.d.ts +13 -13
  45. package/dist/models/notification.js +6 -6
  46. package/dist/models/options.d.ts +10 -10
  47. package/dist/models/options.js +25 -25
  48. package/dist/models/pageItem.d.ts +56 -56
  49. package/dist/models/pageItem.js +21 -21
  50. package/dist/models/sitemap.d.ts +20 -20
  51. package/dist/models/sitemap.js +9 -9
  52. package/dist/models/websiteUser.d.ts +22 -22
  53. package/dist/models/websiteUser.js +9 -9
  54. package/license.txt +20 -20
  55. package/package.json +39 -39
  56. package/tsconfig.json +14 -14
@@ -1,105 +1,105 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ContainerMethods = void 0;
13
- const clientInstance_1 = require("./clientInstance");
14
- const exception_1 = require("../models/exception");
15
- class ContainerMethods {
16
- constructor(options) {
17
- this._options = options;
18
- this._clientInstance = new clientInstance_1.ClientInstance();
19
- }
20
- getContainerByID(id) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- try {
23
- let apiPath = `container/${id}`;
24
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
25
- return resp.data;
26
- }
27
- catch (err) {
28
- throw new exception_1.Exception(`Unable to retreive the contianer for id: ${id}`, err);
29
- }
30
- });
31
- }
32
- getContainerByReferenceName(referenceName) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- try {
35
- let apiPath = `container/${referenceName}`;
36
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
37
- return resp.data;
38
- }
39
- catch (err) {
40
- throw new exception_1.Exception(`Unable to retreive the contianer for referenceName: ${referenceName}`, err);
41
- }
42
- });
43
- }
44
- getContainerSecurity(id) {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- try {
47
- let apiPath = `container/${id}/security`;
48
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
49
- return resp.data;
50
- }
51
- catch (err) {
52
- throw new exception_1.Exception(`Unable to retreive the contianer for id: ${id}`, err);
53
- }
54
- });
55
- }
56
- getContainerList() {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- try {
59
- let apiPath = `container/list`;
60
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
61
- return resp.data;
62
- }
63
- catch (err) {
64
- throw new exception_1.Exception(`Unable to retreive the contianer list`, err);
65
- }
66
- });
67
- }
68
- getNotificationList(id) {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- try {
71
- let apiPath = `container/${id}/notifications`;
72
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
73
- return resp.data;
74
- }
75
- catch (err) {
76
- throw new exception_1.Exception(`Unable to retreive the notifications for contianer id: ${id}`, err);
77
- }
78
- });
79
- }
80
- saveContainer(container) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- try {
83
- let apiPath = `container`;
84
- const resp = yield this._clientInstance.executePost(apiPath, this._options, container);
85
- return resp.data;
86
- }
87
- catch (err) {
88
- throw new exception_1.Exception(`Unable to save the contianer`, err);
89
- }
90
- });
91
- }
92
- deleteContainer(id) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- try {
95
- let apiPath = `container/${id}`;
96
- const resp = yield this._clientInstance.executeDelete(apiPath, this._options);
97
- return resp.data;
98
- }
99
- catch (err) {
100
- throw new exception_1.Exception(`Unable to delete the contianer for id: ${id}`, err);
101
- }
102
- });
103
- }
104
- }
105
- exports.ContainerMethods = ContainerMethods;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ContainerMethods = void 0;
13
+ const clientInstance_1 = require("./clientInstance");
14
+ const exception_1 = require("../models/exception");
15
+ class ContainerMethods {
16
+ constructor(options) {
17
+ this._options = options;
18
+ this._clientInstance = new clientInstance_1.ClientInstance();
19
+ }
20
+ getContainerByID(id) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ try {
23
+ let apiPath = `container/${id}`;
24
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
25
+ return resp.data;
26
+ }
27
+ catch (err) {
28
+ throw new exception_1.Exception(`Unable to retreive the contianer for id: ${id}`, err);
29
+ }
30
+ });
31
+ }
32
+ getContainerByReferenceName(referenceName) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ try {
35
+ let apiPath = `container/${referenceName}`;
36
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
37
+ return resp.data;
38
+ }
39
+ catch (err) {
40
+ throw new exception_1.Exception(`Unable to retreive the contianer for referenceName: ${referenceName}`, err);
41
+ }
42
+ });
43
+ }
44
+ getContainerSecurity(id) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ try {
47
+ let apiPath = `container/${id}/security`;
48
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
49
+ return resp.data;
50
+ }
51
+ catch (err) {
52
+ throw new exception_1.Exception(`Unable to retreive the contianer for id: ${id}`, err);
53
+ }
54
+ });
55
+ }
56
+ getContainerList() {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ try {
59
+ let apiPath = `container/list`;
60
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
61
+ return resp.data;
62
+ }
63
+ catch (err) {
64
+ throw new exception_1.Exception(`Unable to retreive the contianer list`, err);
65
+ }
66
+ });
67
+ }
68
+ getNotificationList(id) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ try {
71
+ let apiPath = `container/${id}/notifications`;
72
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
73
+ return resp.data;
74
+ }
75
+ catch (err) {
76
+ throw new exception_1.Exception(`Unable to retreive the notifications for contianer id: ${id}`, err);
77
+ }
78
+ });
79
+ }
80
+ saveContainer(container) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ try {
83
+ let apiPath = `container`;
84
+ const resp = yield this._clientInstance.executePost(apiPath, this._options, container);
85
+ return resp.data;
86
+ }
87
+ catch (err) {
88
+ throw new exception_1.Exception(`Unable to save the contianer`, err);
89
+ }
90
+ });
91
+ }
92
+ deleteContainer(id) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ try {
95
+ let apiPath = `container/${id}`;
96
+ const resp = yield this._clientInstance.executeDelete(apiPath, this._options);
97
+ return resp.data;
98
+ }
99
+ catch (err) {
100
+ throw new exception_1.Exception(`Unable to delete the contianer for id: ${id}`, err);
101
+ }
102
+ });
103
+ }
104
+ }
105
+ exports.ContainerMethods = ContainerMethods;
@@ -1,20 +1,20 @@
1
- import { Options } from "../models/options";
2
- import { ClientInstance } from "./clientInstance";
3
- import { ContentItem, ContentList } from "../models/contentItem";
4
- import { BatchMethods } from "./batchMethods";
5
- export declare class ContentMethods {
6
- _options: Options;
7
- _clientInstance: ClientInstance;
8
- _batchMethods: BatchMethods;
9
- constructor(options: Options);
10
- getContentItem(contentID: number): Promise<ContentItem>;
11
- publishContent(contentID: number, comments?: string): Promise<number[]>;
12
- unPublishContent(contentID: number, comments?: string): Promise<number[]>;
13
- contentRequestApproval(contentID: number, comments?: string): Promise<number[]>;
14
- approveContent(contentID: number, comments?: string): Promise<number[]>;
15
- declineContent(contentID: number, comments?: string): Promise<number[]>;
16
- deleteContent(contentID: number, comments?: string): Promise<number[]>;
17
- saveContentItem(contentItem: ContentItem): Promise<number[]>;
18
- saveContentItems(contentItems: ContentItem[]): Promise<number[]>;
19
- getContentItems(referenceName: string, filter?: string, fields?: string, sortDirection?: string, sortField?: string, take?: number, skip?: number): Promise<ContentList>;
20
- }
1
+ import { Options } from "../models/options";
2
+ import { ClientInstance } from "./clientInstance";
3
+ import { ContentItem, ContentList } from "../models/contentItem";
4
+ import { BatchMethods } from "./batchMethods";
5
+ export declare class ContentMethods {
6
+ _options: Options;
7
+ _clientInstance: ClientInstance;
8
+ _batchMethods: BatchMethods;
9
+ constructor(options: Options);
10
+ getContentItem(contentID: number): Promise<ContentItem>;
11
+ publishContent(contentID: number, comments?: string): Promise<number[]>;
12
+ unPublishContent(contentID: number, comments?: string): Promise<number[]>;
13
+ contentRequestApproval(contentID: number, comments?: string): Promise<number[]>;
14
+ approveContent(contentID: number, comments?: string): Promise<number[]>;
15
+ declineContent(contentID: number, comments?: string): Promise<number[]>;
16
+ deleteContent(contentID: number, comments?: string): Promise<number[]>;
17
+ saveContentItem(contentItem: ContentItem): Promise<number[]>;
18
+ saveContentItems(contentItems: ContentItem[]): Promise<number[]>;
19
+ getContentItems(referenceName: string, filter?: string, fields?: string, sortDirection?: string, sortField?: string, take?: number, skip?: number): Promise<ContentList>;
20
+ }
@@ -1,175 +1,175 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ContentMethods = void 0;
13
- const clientInstance_1 = require("./clientInstance");
14
- const batchMethods_1 = require("./batchMethods");
15
- const exception_1 = require("../models/exception");
16
- class ContentMethods {
17
- constructor(options) {
18
- this._options = options;
19
- this._clientInstance = new clientInstance_1.ClientInstance();
20
- this._batchMethods = new batchMethods_1.BatchMethods(this._options);
21
- }
22
- getContentItem(contentID) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- try {
25
- let apiPath = `${this._options.locale}/item/${contentID}`;
26
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
27
- return resp.data;
28
- }
29
- catch (err) {
30
- throw new exception_1.Exception(`Unable to retreive the content for id: ${contentID}`, err);
31
- }
32
- });
33
- }
34
- publishContent(contentID, comments = null) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- try {
37
- let apiPath = `${this._options.locale}/item/${contentID}/publish?comments=${comments}`;
38
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
39
- let batchID = resp.data;
40
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
41
- let contentIDs = [];
42
- batch.items.forEach(element => contentIDs.push(element.itemID));
43
- return contentIDs;
44
- }
45
- catch (err) {
46
- throw new exception_1.Exception(`Unable to publish the content for id: ${contentID}`, err);
47
- }
48
- });
49
- }
50
- unPublishContent(contentID, comments = null) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- try {
53
- let apiPath = `${this._options.locale}/item/${contentID}/unpublish?comments=${comments}`;
54
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
55
- let batchID = resp.data;
56
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
57
- let contentIDs = [];
58
- batch.items.forEach(element => contentIDs.push(element.itemID));
59
- return contentIDs;
60
- }
61
- catch (err) {
62
- throw new exception_1.Exception(`Unable to un-publish the content for id: ${contentID}`, err);
63
- }
64
- });
65
- }
66
- contentRequestApproval(contentID, comments = null) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- try {
69
- let apiPath = `${this._options.locale}/item/${contentID}/request-approval?comments=${comments}`;
70
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
71
- let batchID = resp.data;
72
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
73
- let contentIDs = [];
74
- batch.items.forEach(element => contentIDs.push(element.itemID));
75
- return contentIDs;
76
- }
77
- catch (err) {
78
- throw new exception_1.Exception(`Unable to request approval the content for id: ${contentID}`, err);
79
- }
80
- });
81
- }
82
- approveContent(contentID, comments = null) {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- try {
85
- let apiPath = `${this._options.locale}/item/${contentID}/approve?comments=${comments}`;
86
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
87
- let batchID = resp.data;
88
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
89
- let contentIDs = [];
90
- batch.items.forEach(element => contentIDs.push(element.itemID));
91
- return contentIDs;
92
- }
93
- catch (err) {
94
- throw new exception_1.Exception(`Unable to approve the content for id: ${contentID}`, err);
95
- }
96
- });
97
- }
98
- declineContent(contentID, comments = null) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- try {
101
- let apiPath = `${this._options.locale}/item/${contentID}/decline?comments=${comments}`;
102
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
103
- let batchID = resp.data;
104
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
105
- let contentIDs = [];
106
- batch.items.forEach(element => contentIDs.push(element.itemID));
107
- return contentIDs;
108
- }
109
- catch (err) {
110
- throw new exception_1.Exception(`Unable to decline the content for id: ${contentID}`, err);
111
- }
112
- });
113
- }
114
- deleteContent(contentID, comments = null) {
115
- return __awaiter(this, void 0, void 0, function* () {
116
- try {
117
- let apiPath = `${this._options.locale}/item/${contentID}?comments=${comments}`;
118
- const resp = yield this._clientInstance.executeDelete(apiPath, this._options);
119
- let batchID = resp.data;
120
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
121
- let contentIDs = [];
122
- batch.items.forEach(element => contentIDs.push(element.itemID));
123
- return contentIDs;
124
- }
125
- catch (err) {
126
- throw new exception_1.Exception(`Unable to delete the content for id: ${contentID}`, err);
127
- }
128
- });
129
- }
130
- saveContentItem(contentItem) {
131
- return __awaiter(this, void 0, void 0, function* () {
132
- try {
133
- let apiPath = `${this._options.locale}/item`;
134
- const resp = yield this._clientInstance.executePost(apiPath, this._options, contentItem);
135
- let batchID = resp.data;
136
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
137
- let contentIDs = [];
138
- batch.items.forEach(element => contentIDs.push(element.itemID));
139
- return contentIDs;
140
- }
141
- catch (err) {
142
- throw new exception_1.Exception('Unable to create content.', err);
143
- }
144
- });
145
- }
146
- saveContentItems(contentItems) {
147
- return __awaiter(this, void 0, void 0, function* () {
148
- try {
149
- let apiPath = `${this._options.locale}/item/multi`;
150
- const resp = yield this._clientInstance.executePost(apiPath, this._options, contentItems);
151
- let batchID = resp.data;
152
- var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
153
- let contentIDs = [];
154
- batch.items.forEach(element => contentIDs.push(element.itemID));
155
- return contentIDs;
156
- }
157
- catch (err) {
158
- throw new exception_1.Exception('Unable to create contents.', err);
159
- }
160
- });
161
- }
162
- getContentItems(referenceName, filter = '', fields = null, sortDirection = null, sortField = null, take = 50, skip = 0) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- try {
165
- let apiPath = `${this._options.locale}/list/${referenceName}?filter=${filter}&fields=${fields}&sortDirection=${sortDirection}&sortField=${sortField}&take=${take}&skip=${skip}`;
166
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
167
- return resp.data;
168
- }
169
- catch (err) {
170
- throw new exception_1.Exception(`Unable retreive the content details for reference name: ${referenceName}`, err);
171
- }
172
- });
173
- }
174
- }
175
- exports.ContentMethods = ContentMethods;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ContentMethods = void 0;
13
+ const clientInstance_1 = require("./clientInstance");
14
+ const batchMethods_1 = require("./batchMethods");
15
+ const exception_1 = require("../models/exception");
16
+ class ContentMethods {
17
+ constructor(options) {
18
+ this._options = options;
19
+ this._clientInstance = new clientInstance_1.ClientInstance();
20
+ this._batchMethods = new batchMethods_1.BatchMethods(this._options);
21
+ }
22
+ getContentItem(contentID) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ try {
25
+ let apiPath = `${this._options.locale}/item/${contentID}`;
26
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
27
+ return resp.data;
28
+ }
29
+ catch (err) {
30
+ throw new exception_1.Exception(`Unable to retreive the content for id: ${contentID}`, err);
31
+ }
32
+ });
33
+ }
34
+ publishContent(contentID, comments = null) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ let apiPath = `${this._options.locale}/item/${contentID}/publish?comments=${comments}`;
38
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
39
+ let batchID = resp.data;
40
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
41
+ let contentIDs = [];
42
+ batch.items.forEach(element => contentIDs.push(element.itemID));
43
+ return contentIDs;
44
+ }
45
+ catch (err) {
46
+ throw new exception_1.Exception(`Unable to publish the content for id: ${contentID}`, err);
47
+ }
48
+ });
49
+ }
50
+ unPublishContent(contentID, comments = null) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ try {
53
+ let apiPath = `${this._options.locale}/item/${contentID}/unpublish?comments=${comments}`;
54
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
55
+ let batchID = resp.data;
56
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
57
+ let contentIDs = [];
58
+ batch.items.forEach(element => contentIDs.push(element.itemID));
59
+ return contentIDs;
60
+ }
61
+ catch (err) {
62
+ throw new exception_1.Exception(`Unable to un-publish the content for id: ${contentID}`, err);
63
+ }
64
+ });
65
+ }
66
+ contentRequestApproval(contentID, comments = null) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ try {
69
+ let apiPath = `${this._options.locale}/item/${contentID}/request-approval?comments=${comments}`;
70
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
71
+ let batchID = resp.data;
72
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
73
+ let contentIDs = [];
74
+ batch.items.forEach(element => contentIDs.push(element.itemID));
75
+ return contentIDs;
76
+ }
77
+ catch (err) {
78
+ throw new exception_1.Exception(`Unable to request approval the content for id: ${contentID}`, err);
79
+ }
80
+ });
81
+ }
82
+ approveContent(contentID, comments = null) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ try {
85
+ let apiPath = `${this._options.locale}/item/${contentID}/approve?comments=${comments}`;
86
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
87
+ let batchID = resp.data;
88
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
89
+ let contentIDs = [];
90
+ batch.items.forEach(element => contentIDs.push(element.itemID));
91
+ return contentIDs;
92
+ }
93
+ catch (err) {
94
+ throw new exception_1.Exception(`Unable to approve the content for id: ${contentID}`, err);
95
+ }
96
+ });
97
+ }
98
+ declineContent(contentID, comments = null) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ try {
101
+ let apiPath = `${this._options.locale}/item/${contentID}/decline?comments=${comments}`;
102
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
103
+ let batchID = resp.data;
104
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
105
+ let contentIDs = [];
106
+ batch.items.forEach(element => contentIDs.push(element.itemID));
107
+ return contentIDs;
108
+ }
109
+ catch (err) {
110
+ throw new exception_1.Exception(`Unable to decline the content for id: ${contentID}`, err);
111
+ }
112
+ });
113
+ }
114
+ deleteContent(contentID, comments = null) {
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ try {
117
+ let apiPath = `${this._options.locale}/item/${contentID}?comments=${comments}`;
118
+ const resp = yield this._clientInstance.executeDelete(apiPath, this._options);
119
+ let batchID = resp.data;
120
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
121
+ let contentIDs = [];
122
+ batch.items.forEach(element => contentIDs.push(element.itemID));
123
+ return contentIDs;
124
+ }
125
+ catch (err) {
126
+ throw new exception_1.Exception(`Unable to delete the content for id: ${contentID}`, err);
127
+ }
128
+ });
129
+ }
130
+ saveContentItem(contentItem) {
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ try {
133
+ let apiPath = `${this._options.locale}/item`;
134
+ const resp = yield this._clientInstance.executePost(apiPath, this._options, contentItem);
135
+ let batchID = resp.data;
136
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
137
+ let contentIDs = [];
138
+ batch.items.forEach(element => contentIDs.push(element.itemID));
139
+ return contentIDs;
140
+ }
141
+ catch (err) {
142
+ throw new exception_1.Exception('Unable to create content.', err);
143
+ }
144
+ });
145
+ }
146
+ saveContentItems(contentItems) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ try {
149
+ let apiPath = `${this._options.locale}/item/multi`;
150
+ const resp = yield this._clientInstance.executePost(apiPath, this._options, contentItems);
151
+ let batchID = resp.data;
152
+ var batch = yield this._batchMethods.Retry(() => __awaiter(this, void 0, void 0, function* () { return yield this._batchMethods.getBatch(batchID); }));
153
+ let contentIDs = [];
154
+ batch.items.forEach(element => contentIDs.push(element.itemID));
155
+ return contentIDs;
156
+ }
157
+ catch (err) {
158
+ throw new exception_1.Exception('Unable to create contents.', err);
159
+ }
160
+ });
161
+ }
162
+ getContentItems(referenceName, filter = '', fields = null, sortDirection = null, sortField = null, take = 50, skip = 0) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ try {
165
+ let apiPath = `${this._options.locale}/list/${referenceName}?filter=${filter}&fields=${fields}&sortDirection=${sortDirection}&sortField=${sortField}&take=${take}&skip=${skip}`;
166
+ const resp = yield this._clientInstance.executeGet(apiPath, this._options);
167
+ return resp.data;
168
+ }
169
+ catch (err) {
170
+ throw new exception_1.Exception(`Unable retreive the content details for reference name: ${referenceName}`, err);
171
+ }
172
+ });
173
+ }
174
+ }
175
+ exports.ContentMethods = ContentMethods;
@@ -1,13 +1,13 @@
1
- import { Options } from "../models/options";
2
- import { ClientInstance } from "./clientInstance";
3
- import { InstanceUser } from "../models/instanceUser";
4
- import { WebsiteUser } from "../models/websiteUser";
5
- import { InstanceRole } from "../models/instanceRole";
6
- export declare class InstanceUserMethods {
7
- _options: Options;
8
- _clientInstance: ClientInstance;
9
- constructor(options: Options);
10
- getUsers(): Promise<WebsiteUser>;
11
- saveUser(emailAddress: string, roles: InstanceRole[], firstName?: string, lastName?: string): Promise<InstanceUser>;
12
- deleteUser(userId: number): Promise<string>;
13
- }
1
+ import { Options } from "../models/options";
2
+ import { ClientInstance } from "./clientInstance";
3
+ import { InstanceUser } from "../models/instanceUser";
4
+ import { WebsiteUser } from "../models/websiteUser";
5
+ import { InstanceRole } from "../models/instanceRole";
6
+ export declare class InstanceUserMethods {
7
+ _options: Options;
8
+ _clientInstance: ClientInstance;
9
+ constructor(options: Options);
10
+ getUsers(): Promise<WebsiteUser>;
11
+ saveUser(emailAddress: string, roles: InstanceRole[], firstName?: string, lastName?: string): Promise<InstanceUser>;
12
+ deleteUser(userId: number): Promise<string>;
13
+ }