@agility/management-sdk 0.1.14 → 0.1.16

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 (141) hide show
  1. package/.yarn/cache/@types-node-npm-18.11.9-d21dd6ec05-cc0aae109e.zip +0 -0
  2. package/.yarn/cache/asynckit-npm-0.4.0-c718858525-7b78c451df.zip +0 -0
  3. package/.yarn/cache/axios-npm-0.27.2-dbe3a48aea-38cb754046.zip +0 -0
  4. package/.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-49fa4aeb49.zip +0 -0
  5. package/.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-46fe6e83e2.zip +0 -0
  6. package/.yarn/cache/follow-redirects-npm-1.15.2-1ec1dd82be-faa66059b6.zip +0 -0
  7. package/.yarn/cache/form-data-npm-4.0.0-916facec2d-01135bf867.zip +0 -0
  8. package/.yarn/cache/mime-db-npm-1.52.0-b5371d6fd2-0d99a03585.zip +0 -0
  9. package/.yarn/cache/mime-types-npm-2.1.35-dd9ea9f3e2-89a5b7f1de.zip +0 -0
  10. package/.yarn/cache/typescript-npm-4.9.5-6427b65ee6-ee000bc268.zip +0 -0
  11. package/.yarn/cache/typescript-patch-f8edcd7439-1f8f3b6aae.zip +0 -0
  12. package/.yarn/install-state.gz +0 -0
  13. package/dist/apiClient.d.ts +19 -19
  14. package/dist/apiClient.js +24 -24
  15. package/dist/apiMethods/assetMethods.d.ts +34 -24
  16. package/dist/apiMethods/assetMethods.js +325 -315
  17. package/dist/apiMethods/batchMethods.d.ts +11 -11
  18. package/dist/apiMethods/batchMethods.js +117 -117
  19. package/dist/apiMethods/clientInstance.d.ts +18 -18
  20. package/dist/apiMethods/clientInstance.js +170 -168
  21. package/dist/apiMethods/containerMethods.d.ts +17 -17
  22. package/dist/apiMethods/containerMethods.js +209 -209
  23. package/dist/apiMethods/contentMethods.d.ts +20 -20
  24. package/dist/apiMethods/contentMethods.js +359 -359
  25. package/dist/apiMethods/instanceUserMethods.d.ts +13 -13
  26. package/dist/apiMethods/instanceUserMethods.js +111 -111
  27. package/dist/apiMethods/modelMethods.d.ts +14 -14
  28. package/dist/apiMethods/modelMethods.js +170 -170
  29. package/dist/apiMethods/pageMethods.d.ts +28 -28
  30. package/dist/apiMethods/pageMethods.js +446 -446
  31. package/dist/enums/assetGroupingType.d.ts +3 -3
  32. package/dist/enums/assetGroupingType.js +7 -7
  33. package/dist/enums/batchOperationType.d.ts +19 -19
  34. package/dist/enums/batchOperationType.js +23 -23
  35. package/dist/enums/batchState..d.ts +7 -7
  36. package/dist/enums/batchState..js +11 -11
  37. package/dist/enums/pageItemTemplateType.d.ts +4 -4
  38. package/dist/enums/pageItemTemplateType.js +8 -8
  39. package/dist/index.d.ts +23 -23
  40. package/dist/index.js +39 -39
  41. package/dist/models/assetContainer.d.ts +7 -7
  42. package/dist/models/assetContainer.js +9 -9
  43. package/dist/models/assetGalleries.d.ts +5 -5
  44. package/dist/models/assetGalleries.js +9 -9
  45. package/dist/models/assetMediaGrouping.d.ts +17 -17
  46. package/dist/models/assetMediaGrouping.js +9 -9
  47. package/dist/models/assetMediaGroupingMetaData.d.ts +4 -4
  48. package/dist/models/assetMediaGroupingMetaData.js +9 -9
  49. package/dist/models/batch.d.ts +29 -29
  50. package/dist/models/batch.js +9 -9
  51. package/dist/models/batchItem.d.ts +13 -13
  52. package/dist/models/batchItem.js +9 -9
  53. package/dist/models/container.d.ts +47 -47
  54. package/dist/models/container.js +9 -9
  55. package/dist/models/contentItem.d.ts +37 -37
  56. package/dist/models/contentItem.js +33 -33
  57. package/dist/models/contentSectionDefaultModule.d.ts +7 -7
  58. package/dist/models/contentSectionDefaultModule.js +9 -9
  59. package/dist/models/contentSectionDefinition.d.ts +35 -35
  60. package/dist/models/contentSectionDefinition.js +9 -9
  61. package/dist/models/contentViewColumn.d.ts +8 -8
  62. package/dist/models/contentViewColumn.js +9 -9
  63. package/dist/models/exception.d.ts +4 -4
  64. package/dist/models/exception.js +28 -28
  65. package/dist/models/instanceRole.d.ts +7 -7
  66. package/dist/models/instanceRole.js +9 -9
  67. package/dist/models/instanceUser.d.ts +14 -14
  68. package/dist/models/instanceUser.js +9 -9
  69. package/dist/models/media.d.ts +30 -30
  70. package/dist/models/media.js +15 -15
  71. package/dist/models/model.d.ts +30 -30
  72. package/dist/models/model.js +15 -15
  73. package/dist/models/notification.d.ts +13 -13
  74. package/dist/models/notification.js +9 -9
  75. package/dist/models/options.d.ts +7 -7
  76. package/dist/models/options.js +9 -9
  77. package/dist/models/pageItem.d.ts +56 -56
  78. package/dist/models/pageItem.js +39 -39
  79. package/dist/models/pageModel.d.ts +14 -14
  80. package/dist/models/pageModel.js +9 -9
  81. package/dist/models/sharedModule.d.ts +7 -7
  82. package/dist/models/sharedModule.js +9 -9
  83. package/dist/models/sitemap.d.ts +20 -20
  84. package/dist/models/sitemap.js +15 -15
  85. package/dist/models/websiteUser.d.ts +22 -22
  86. package/dist/models/websiteUser.js +15 -15
  87. package/package.json +3 -2
  88. package/dist/apiMethods/apiClient.d.ts +0 -19
  89. package/dist/apiMethods/apiClient.js +0 -24
  90. package/dist/src/apiMethods/assetMethods.d.ts +0 -14
  91. package/dist/src/apiMethods/assetMethods.js +0 -172
  92. package/dist/src/apiMethods/batchMethods.d.ts +0 -11
  93. package/dist/src/apiMethods/batchMethods.js +0 -117
  94. package/dist/src/apiMethods/clientInstance.d.ts +0 -8
  95. package/dist/src/apiMethods/clientInstance.js +0 -156
  96. package/dist/src/apiMethods/containerMethods.d.ts +0 -16
  97. package/dist/src/apiMethods/containerMethods.js +0 -189
  98. package/dist/src/apiMethods/contentMethods.d.ts +0 -20
  99. package/dist/src/apiMethods/contentMethods.js +0 -359
  100. package/dist/src/apiMethods/instanceUserMethods.d.ts +0 -13
  101. package/dist/src/apiMethods/instanceUserMethods.js +0 -111
  102. package/dist/src/apiMethods/modelMethods.d.ts +0 -13
  103. package/dist/src/apiMethods/modelMethods.js +0 -150
  104. package/dist/src/apiMethods/pageMethods.d.ts +0 -20
  105. package/dist/src/apiMethods/pageMethods.js +0 -323
  106. package/dist/src/enums/batchOperationType.d.ts +0 -19
  107. package/dist/src/enums/batchOperationType.js +0 -23
  108. package/dist/src/enums/batchState..d.ts +0 -7
  109. package/dist/src/enums/batchState..js +0 -11
  110. package/dist/src/index.d.ts +0 -14
  111. package/dist/src/index.js +0 -30
  112. package/dist/src/models/batch.d.ts +0 -29
  113. package/dist/src/models/batch.js +0 -9
  114. package/dist/src/models/batchItem.d.ts +0 -13
  115. package/dist/src/models/batchItem.js +0 -9
  116. package/dist/src/models/container.d.ts +0 -47
  117. package/dist/src/models/container.js +0 -9
  118. package/dist/src/models/contentItem.d.ts +0 -37
  119. package/dist/src/models/contentItem.js +0 -33
  120. package/dist/src/models/contentViewColumn.d.ts +0 -8
  121. package/dist/src/models/contentViewColumn.js +0 -9
  122. package/dist/src/models/exception.d.ts +0 -4
  123. package/dist/src/models/exception.js +0 -28
  124. package/dist/src/models/instanceRole.d.ts +0 -7
  125. package/dist/src/models/instanceRole.js +0 -9
  126. package/dist/src/models/instanceUser.d.ts +0 -14
  127. package/dist/src/models/instanceUser.js +0 -9
  128. package/dist/src/models/media.d.ts +0 -30
  129. package/dist/src/models/media.js +0 -15
  130. package/dist/src/models/model.d.ts +0 -30
  131. package/dist/src/models/model.js +0 -15
  132. package/dist/src/models/notification.d.ts +0 -13
  133. package/dist/src/models/notification.js +0 -9
  134. package/dist/src/models/options.d.ts +0 -7
  135. package/dist/src/models/options.js +0 -9
  136. package/dist/src/models/pageItem.d.ts +0 -56
  137. package/dist/src/models/pageItem.js +0 -39
  138. package/dist/src/models/sitemap.d.ts +0 -20
  139. package/dist/src/models/sitemap.js +0 -15
  140. package/dist/src/models/websiteUser.d.ts +0 -22
  141. package/dist/src/models/websiteUser.js +0 -15
@@ -1,315 +1,325 @@
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
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.AssetMethods = void 0;
40
- var clientInstance_1 = require("./clientInstance");
41
- var exception_1 = require("../models/exception");
42
- var AssetMethods = /** @class */ (function () {
43
- function AssetMethods(options) {
44
- this._options = options;
45
- this._clientInstance = new clientInstance_1.ClientInstance(this._options);
46
- }
47
- AssetMethods.prototype.deleteFile = function (mediaID, guid) {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var apiPath, resp, err_1;
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0:
53
- _a.trys.push([0, 2, , 3]);
54
- apiPath = "asset/delete/".concat(mediaID);
55
- return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
56
- case 1:
57
- resp = _a.sent();
58
- ;
59
- return [2 /*return*/, resp.data];
60
- case 2:
61
- err_1 = _a.sent();
62
- throw new exception_1.Exception("Unable to delete the media for mediaID: ".concat(mediaID), err_1);
63
- case 3: return [2 /*return*/];
64
- }
65
- });
66
- });
67
- };
68
- AssetMethods.prototype.moveFile = function (mediaID, newFolder, guid) {
69
- return __awaiter(this, void 0, void 0, function () {
70
- var folder, apiPath, resp, err_2;
71
- return __generator(this, function (_a) {
72
- switch (_a.label) {
73
- case 0:
74
- _a.trys.push([0, 2, , 3]);
75
- folder = encodeURIComponent(newFolder);
76
- apiPath = "asset/move/".concat(mediaID, "?newFolder=").concat(folder);
77
- return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
78
- case 1:
79
- resp = _a.sent();
80
- return [2 /*return*/, resp.data];
81
- case 2:
82
- err_2 = _a.sent();
83
- throw new exception_1.Exception("Unable to move the media for mediaID: ".concat(mediaID), err_2);
84
- case 3: return [2 /*return*/];
85
- }
86
- });
87
- });
88
- };
89
- AssetMethods.prototype.getMediaList = function (pageSize, recordOffset, guid) {
90
- return __awaiter(this, void 0, void 0, function () {
91
- var apiPath, resp, err_3;
92
- return __generator(this, function (_a) {
93
- switch (_a.label) {
94
- case 0:
95
- _a.trys.push([0, 2, , 3]);
96
- apiPath = "asset/list?pageSize=".concat(pageSize, "&recordOffset=").concat(recordOffset);
97
- return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
98
- case 1:
99
- resp = _a.sent();
100
- return [2 /*return*/, resp.data];
101
- case 2:
102
- err_3 = _a.sent();
103
- throw new exception_1.Exception("Unable to retrieve assets for the website.", err_3);
104
- case 3: return [2 /*return*/];
105
- }
106
- });
107
- });
108
- };
109
- AssetMethods.prototype.getGalleries = function (guid, search, pageSize, rowIndex) {
110
- if (search === void 0) { search = null; }
111
- if (pageSize === void 0) { pageSize = null; }
112
- if (rowIndex === void 0) { rowIndex = null; }
113
- return __awaiter(this, void 0, void 0, function () {
114
- var apiPath, resp, err_4;
115
- return __generator(this, function (_a) {
116
- switch (_a.label) {
117
- case 0:
118
- _a.trys.push([0, 2, , 3]);
119
- apiPath = "asset/galleries?search=".concat(search, "&pageSize=").concat(pageSize, "&rowIndex=").concat(rowIndex);
120
- return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
121
- case 1:
122
- resp = _a.sent();
123
- return [2 /*return*/, resp.data];
124
- case 2:
125
- err_4 = _a.sent();
126
- throw new exception_1.Exception("Unable to retrieve galleries for the website.", err_4);
127
- case 3: return [2 /*return*/];
128
- }
129
- });
130
- });
131
- };
132
- AssetMethods.prototype.getGalleryById = function (guid, id) {
133
- return __awaiter(this, void 0, void 0, function () {
134
- var apiPath, resp, err_5;
135
- return __generator(this, function (_a) {
136
- switch (_a.label) {
137
- case 0:
138
- _a.trys.push([0, 2, , 3]);
139
- apiPath = "/asset/gallery/".concat(id);
140
- return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
141
- case 1:
142
- resp = _a.sent();
143
- return [2 /*return*/, resp.data];
144
- case 2:
145
- err_5 = _a.sent();
146
- throw new exception_1.Exception("Unable to retrieve gallery for id ".concat(id), err_5);
147
- case 3: return [2 /*return*/];
148
- }
149
- });
150
- });
151
- };
152
- AssetMethods.prototype.getGalleryByName = function (guid, galleryName) {
153
- return __awaiter(this, void 0, void 0, function () {
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 = "/asset/gallery?galleryName=".concat(galleryName);
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 retrieve gallery for name ".concat(galleryName), err_6);
167
- case 3: return [2 /*return*/];
168
- }
169
- });
170
- });
171
- };
172
- AssetMethods.prototype.getDefaultContainer = function (guid) {
173
- return __awaiter(this, void 0, void 0, function () {
174
- var apiPath, resp, err_7;
175
- return __generator(this, function (_a) {
176
- switch (_a.label) {
177
- case 0:
178
- _a.trys.push([0, 2, , 3]);
179
- apiPath = "/asset/container";
180
- return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
181
- case 1:
182
- resp = _a.sent();
183
- return [2 /*return*/, resp.data];
184
- case 2:
185
- err_7 = _a.sent();
186
- throw new exception_1.Exception("Unable to retrieve container for guid ".concat(guid), err_7);
187
- case 3: return [2 /*return*/];
188
- }
189
- });
190
- });
191
- };
192
- AssetMethods.prototype.saveGallery = function (guid, gallery) {
193
- return __awaiter(this, void 0, void 0, function () {
194
- var apiPath, resp, err_8;
195
- return __generator(this, function (_a) {
196
- switch (_a.label) {
197
- case 0:
198
- _a.trys.push([0, 2, , 3]);
199
- apiPath = "/asset/gallery";
200
- return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, gallery)];
201
- case 1:
202
- resp = _a.sent();
203
- return [2 /*return*/, resp.data];
204
- case 2:
205
- err_8 = _a.sent();
206
- throw new exception_1.Exception("Unable to save gallery", err_8);
207
- case 3: return [2 /*return*/];
208
- }
209
- });
210
- });
211
- };
212
- AssetMethods.prototype.deleteGallery = function (guid, id) {
213
- return __awaiter(this, void 0, void 0, function () {
214
- var apiPath, resp, err_9;
215
- return __generator(this, function (_a) {
216
- switch (_a.label) {
217
- case 0:
218
- _a.trys.push([0, 2, , 3]);
219
- apiPath = "/asset/gallery/".concat(id);
220
- return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
221
- case 1:
222
- resp = _a.sent();
223
- return [2 /*return*/, resp.data];
224
- case 2:
225
- err_9 = _a.sent();
226
- throw new exception_1.Exception("Unable to delete gallery for id ".concat(id), err_9);
227
- case 3: return [2 /*return*/];
228
- }
229
- });
230
- });
231
- };
232
- AssetMethods.prototype.getAssetByID = function (mediaID, guid) {
233
- return __awaiter(this, void 0, void 0, function () {
234
- var apiPath, resp, err_10;
235
- return __generator(this, function (_a) {
236
- switch (_a.label) {
237
- case 0:
238
- _a.trys.push([0, 2, , 3]);
239
- apiPath = "asset/".concat(mediaID);
240
- return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
241
- case 1:
242
- resp = _a.sent();
243
- return [2 /*return*/, resp.data];
244
- case 2:
245
- err_10 = _a.sent();
246
- throw new exception_1.Exception("Unable to retrieve asset for mediaID ".concat(mediaID), err_10);
247
- case 3: return [2 /*return*/];
248
- }
249
- });
250
- });
251
- };
252
- AssetMethods.prototype.getAssetByUrl = function (url, guid) {
253
- return __awaiter(this, void 0, void 0, function () {
254
- var apiPath, resp, err_11;
255
- return __generator(this, function (_a) {
256
- switch (_a.label) {
257
- case 0:
258
- _a.trys.push([0, 2, , 3]);
259
- apiPath = "asset?url=".concat(url);
260
- return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
261
- case 1:
262
- resp = _a.sent();
263
- return [2 /*return*/, resp.data];
264
- case 2:
265
- err_11 = _a.sent();
266
- throw new exception_1.Exception("Unable to retrieve asset for url ".concat(url), err_11);
267
- case 3: return [2 /*return*/];
268
- }
269
- });
270
- });
271
- };
272
- AssetMethods.prototype.upload = function (formData, agilityFolderPath, guid, groupingID) {
273
- if (groupingID === void 0) { groupingID = -1; }
274
- return __awaiter(this, void 0, void 0, function () {
275
- var apiPath, resp, err_12;
276
- return __generator(this, function (_a) {
277
- switch (_a.label) {
278
- case 0:
279
- _a.trys.push([0, 2, , 3]);
280
- apiPath = "asset/upload?folderPath=".concat(agilityFolderPath, "&groupingID=").concat(groupingID);
281
- return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, formData)];
282
- case 1:
283
- resp = _a.sent();
284
- return [2 /*return*/, resp.data];
285
- case 2:
286
- err_12 = _a.sent();
287
- throw new exception_1.Exception("Unable to upload media.", err_12);
288
- case 3: return [2 /*return*/];
289
- }
290
- });
291
- });
292
- };
293
- AssetMethods.prototype.createFolder = function (originKey, guid) {
294
- return __awaiter(this, void 0, void 0, function () {
295
- var apiPath, resp, err_13;
296
- return __generator(this, function (_a) {
297
- switch (_a.label) {
298
- case 0:
299
- _a.trys.push([0, 2, , 3]);
300
- apiPath = "asset/folder?originKey=".concat(originKey);
301
- return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
302
- case 1:
303
- resp = _a.sent();
304
- return [2 /*return*/, resp.data];
305
- case 2:
306
- err_13 = _a.sent();
307
- throw new exception_1.Exception('Unable to create folder.', err_13);
308
- case 3: return [2 /*return*/];
309
- }
310
- });
311
- });
312
- };
313
- return AssetMethods;
314
- }());
315
- exports.AssetMethods = AssetMethods;
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
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.AssetMethods = void 0;
40
+ var clientInstance_1 = require("./clientInstance");
41
+ var exception_1 = require("../models/exception");
42
+ var AssetMethods = /** @class */ (function () {
43
+ function AssetMethods(options) {
44
+ this._options = options;
45
+ this._clientInstance = new clientInstance_1.ClientInstance(this._options);
46
+ }
47
+ AssetMethods.prototype.deleteFile = function (mediaID, guid) {
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var apiPath, resp, err_1;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0:
53
+ _a.trys.push([0, 2, , 3]);
54
+ apiPath = "asset/delete/".concat(mediaID);
55
+ return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
56
+ case 1:
57
+ resp = _a.sent();
58
+ ;
59
+ return [2 /*return*/, resp.data];
60
+ case 2:
61
+ err_1 = _a.sent();
62
+ throw new exception_1.Exception("Unable to delete the media for mediaID: ".concat(mediaID), err_1);
63
+ case 3: return [2 /*return*/];
64
+ }
65
+ });
66
+ });
67
+ };
68
+ AssetMethods.prototype.moveFile = function (mediaID, newFolder, guid) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var folder, apiPath, resp, err_2;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0:
74
+ _a.trys.push([0, 2, , 3]);
75
+ folder = encodeURIComponent(newFolder);
76
+ apiPath = "asset/move/".concat(mediaID, "?newFolder=").concat(folder);
77
+ return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
78
+ case 1:
79
+ resp = _a.sent();
80
+ return [2 /*return*/, resp.data];
81
+ case 2:
82
+ err_2 = _a.sent();
83
+ throw new exception_1.Exception("Unable to move the media for mediaID: ".concat(mediaID), err_2);
84
+ case 3: return [2 /*return*/];
85
+ }
86
+ });
87
+ });
88
+ };
89
+ AssetMethods.prototype.getMediaList = function (pageSize, recordOffset, guid) {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var apiPath, resp, err_3;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0:
95
+ _a.trys.push([0, 2, , 3]);
96
+ apiPath = "asset/list?pageSize=".concat(pageSize, "&recordOffset=").concat(recordOffset);
97
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
98
+ case 1:
99
+ resp = _a.sent();
100
+ return [2 /*return*/, resp.data];
101
+ case 2:
102
+ err_3 = _a.sent();
103
+ throw new exception_1.Exception("Unable to retrieve assets for the website.", err_3);
104
+ case 3: return [2 /*return*/];
105
+ }
106
+ });
107
+ });
108
+ };
109
+ AssetMethods.prototype.getGalleries = function (guid, search, pageSize, rowIndex) {
110
+ if (search === void 0) { search = null; }
111
+ if (pageSize === void 0) { pageSize = null; }
112
+ if (rowIndex === void 0) { rowIndex = null; }
113
+ return __awaiter(this, void 0, void 0, function () {
114
+ var apiPath, resp, err_4;
115
+ return __generator(this, function (_a) {
116
+ switch (_a.label) {
117
+ case 0:
118
+ _a.trys.push([0, 2, , 3]);
119
+ apiPath = "asset/galleries?search=".concat(search, "&pageSize=").concat(pageSize, "&rowIndex=").concat(rowIndex);
120
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
121
+ case 1:
122
+ resp = _a.sent();
123
+ return [2 /*return*/, resp.data];
124
+ case 2:
125
+ err_4 = _a.sent();
126
+ throw new exception_1.Exception("Unable to retrieve galleries for the website.", err_4);
127
+ case 3: return [2 /*return*/];
128
+ }
129
+ });
130
+ });
131
+ };
132
+ AssetMethods.prototype.getGalleryById = function (guid, id) {
133
+ return __awaiter(this, void 0, void 0, function () {
134
+ var apiPath, resp, err_5;
135
+ return __generator(this, function (_a) {
136
+ switch (_a.label) {
137
+ case 0:
138
+ _a.trys.push([0, 2, , 3]);
139
+ apiPath = "/asset/gallery/".concat(id);
140
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
141
+ case 1:
142
+ resp = _a.sent();
143
+ return [2 /*return*/, resp.data];
144
+ case 2:
145
+ err_5 = _a.sent();
146
+ throw new exception_1.Exception("Unable to retrieve gallery for id ".concat(id), err_5);
147
+ case 3: return [2 /*return*/];
148
+ }
149
+ });
150
+ });
151
+ };
152
+ AssetMethods.prototype.getGalleryByName = function (guid, galleryName) {
153
+ return __awaiter(this, void 0, void 0, function () {
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 = "/asset/gallery?galleryName=".concat(galleryName);
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 retrieve gallery for name ".concat(galleryName), err_6);
167
+ case 3: return [2 /*return*/];
168
+ }
169
+ });
170
+ });
171
+ };
172
+ AssetMethods.prototype.getDefaultContainer = function (guid) {
173
+ return __awaiter(this, void 0, void 0, function () {
174
+ var apiPath, resp, err_7;
175
+ return __generator(this, function (_a) {
176
+ switch (_a.label) {
177
+ case 0:
178
+ _a.trys.push([0, 2, , 3]);
179
+ apiPath = "/asset/container";
180
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
181
+ case 1:
182
+ resp = _a.sent();
183
+ return [2 /*return*/, resp.data];
184
+ case 2:
185
+ err_7 = _a.sent();
186
+ throw new exception_1.Exception("Unable to retrieve container for guid ".concat(guid), err_7);
187
+ case 3: return [2 /*return*/];
188
+ }
189
+ });
190
+ });
191
+ };
192
+ AssetMethods.prototype.saveGallery = function (guid, gallery) {
193
+ return __awaiter(this, void 0, void 0, function () {
194
+ var apiPath, resp, err_8;
195
+ return __generator(this, function (_a) {
196
+ switch (_a.label) {
197
+ case 0:
198
+ _a.trys.push([0, 2, , 3]);
199
+ apiPath = "/asset/gallery";
200
+ return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, gallery)];
201
+ case 1:
202
+ resp = _a.sent();
203
+ return [2 /*return*/, resp.data];
204
+ case 2:
205
+ err_8 = _a.sent();
206
+ throw new exception_1.Exception("Unable to save gallery", err_8);
207
+ case 3: return [2 /*return*/];
208
+ }
209
+ });
210
+ });
211
+ };
212
+ AssetMethods.prototype.deleteGallery = function (guid, id) {
213
+ return __awaiter(this, void 0, void 0, function () {
214
+ var apiPath, resp, err_9;
215
+ return __generator(this, function (_a) {
216
+ switch (_a.label) {
217
+ case 0:
218
+ _a.trys.push([0, 2, , 3]);
219
+ apiPath = "/asset/gallery/".concat(id);
220
+ return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
221
+ case 1:
222
+ resp = _a.sent();
223
+ return [2 /*return*/, resp.data];
224
+ case 2:
225
+ err_9 = _a.sent();
226
+ throw new exception_1.Exception("Unable to delete gallery for id ".concat(id), err_9);
227
+ case 3: return [2 /*return*/];
228
+ }
229
+ });
230
+ });
231
+ };
232
+ AssetMethods.prototype.getAssetByID = function (mediaID, guid) {
233
+ return __awaiter(this, void 0, void 0, function () {
234
+ var apiPath, resp, err_10;
235
+ return __generator(this, function (_a) {
236
+ switch (_a.label) {
237
+ case 0:
238
+ _a.trys.push([0, 2, , 3]);
239
+ apiPath = "asset/".concat(mediaID);
240
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
241
+ case 1:
242
+ resp = _a.sent();
243
+ return [2 /*return*/, resp.data];
244
+ case 2:
245
+ err_10 = _a.sent();
246
+ throw new exception_1.Exception("Unable to retrieve asset for mediaID ".concat(mediaID), err_10);
247
+ case 3: return [2 /*return*/];
248
+ }
249
+ });
250
+ });
251
+ };
252
+ AssetMethods.prototype.getAssetByUrl = function (url, guid) {
253
+ return __awaiter(this, void 0, void 0, function () {
254
+ var apiPath, resp, err_11;
255
+ return __generator(this, function (_a) {
256
+ switch (_a.label) {
257
+ case 0:
258
+ _a.trys.push([0, 2, , 3]);
259
+ apiPath = "asset?url=".concat(url);
260
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
261
+ case 1:
262
+ resp = _a.sent();
263
+ return [2 /*return*/, resp.data];
264
+ case 2:
265
+ err_11 = _a.sent();
266
+ throw new exception_1.Exception("Unable to retrieve asset for url ".concat(url), err_11);
267
+ case 3: return [2 /*return*/];
268
+ }
269
+ });
270
+ });
271
+ };
272
+ /**
273
+ * Uploads a file to the specified folder path.
274
+ *
275
+ * @param {*} formData - FormData object that axios is expecting for the Upload.
276
+ * @param {string} agilityFolderPath
277
+ * @param {string} guid
278
+ * @param {number} [groupingID=-1]
279
+ * @returns
280
+ * @memberof AssetMethods
281
+ */
282
+ AssetMethods.prototype.upload = function (formData, agilityFolderPath, guid, groupingID) {
283
+ if (groupingID === void 0) { groupingID = -1; }
284
+ return __awaiter(this, void 0, void 0, function () {
285
+ var apiPath, resp, err_12;
286
+ return __generator(this, function (_a) {
287
+ switch (_a.label) {
288
+ case 0:
289
+ _a.trys.push([0, 2, , 3]);
290
+ apiPath = "asset/upload?folderPath=".concat(agilityFolderPath, "&groupingID=").concat(groupingID);
291
+ return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, formData)];
292
+ case 1:
293
+ resp = _a.sent();
294
+ return [2 /*return*/, resp.data];
295
+ case 2:
296
+ err_12 = _a.sent();
297
+ throw new exception_1.Exception("Unable to upload media.", err_12);
298
+ case 3: return [2 /*return*/];
299
+ }
300
+ });
301
+ });
302
+ };
303
+ AssetMethods.prototype.createFolder = function (originKey, guid) {
304
+ return __awaiter(this, void 0, void 0, function () {
305
+ var apiPath, resp, err_13;
306
+ return __generator(this, function (_a) {
307
+ switch (_a.label) {
308
+ case 0:
309
+ _a.trys.push([0, 2, , 3]);
310
+ apiPath = "asset/folder?originKey=".concat(originKey);
311
+ return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
312
+ case 1:
313
+ resp = _a.sent();
314
+ return [2 /*return*/, resp.data];
315
+ case 2:
316
+ err_13 = _a.sent();
317
+ throw new exception_1.Exception('Unable to create folder.', err_13);
318
+ case 3: return [2 /*return*/];
319
+ }
320
+ });
321
+ });
322
+ };
323
+ return AssetMethods;
324
+ }());
325
+ exports.AssetMethods = AssetMethods;