@agility/management-sdk 0.1.22 → 0.1.24
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.
- package/README.md +84 -2
- package/dist/apiMethods/assetMethods.js +38 -38
- package/dist/apiMethods/batchMethods.js +5 -5
- package/dist/apiMethods/clientInstance.js +9 -9
- package/dist/apiMethods/containerMethods.d.ts +1 -1
- package/dist/apiMethods/containerMethods.js +20 -19
- package/dist/apiMethods/contentMethods.d.ts +2 -2
- package/dist/apiMethods/contentMethods.js +64 -56
- package/dist/apiMethods/instanceMethods.js +3 -3
- package/dist/apiMethods/instanceUserMethods.js +12 -12
- package/dist/apiMethods/modelMethods.js +15 -15
- package/dist/apiMethods/pageMethods.d.ts +1 -1
- package/dist/apiMethods/pageMethods.js +72 -68
- package/dist/apiMethods/serverUserMethods.js +4 -4
- package/dist/apiMethods/webhookMethods.js +11 -11
- package/dist/enums/assetGroupingType.js +1 -1
- package/dist/enums/batchOperationType.js +1 -1
- package/dist/enums/batchState..js +1 -1
- package/dist/enums/pageItemTemplateType.js +1 -1
- package/dist/index.js +1 -5
- package/dist/models/exception.js +0 -2
- package/dist/models/locales.js +0 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,8 +12,82 @@
|
|
|
12
12
|
### Prerequisites
|
|
13
13
|
1. Clone the repository agility-cms-management-sdk-typescript.
|
|
14
14
|
2. Import the index file to make use of the Options class.
|
|
15
|
-
3.
|
|
16
|
-
|
|
15
|
+
3. You will need valid Agility CMS credentials to authenticate and obtain an access token.
|
|
16
|
+
|
|
17
|
+
### Authentication
|
|
18
|
+
Before using the SDK, you must authenticate against the Agility Management API to obtain a valid access token. This token is required for all subsequent API requests.
|
|
19
|
+
|
|
20
|
+
The authentication process uses OAuth 2.0 and requires multiple steps:
|
|
21
|
+
|
|
22
|
+
1. First, initiate the authorization flow by making a GET request to the authorization endpoint:
|
|
23
|
+
```javascript
|
|
24
|
+
const authUrl = 'https://mgmt.aglty.io/oauth/authorize';
|
|
25
|
+
const params = new URLSearchParams({
|
|
26
|
+
response_type: 'code',
|
|
27
|
+
redirect_uri: 'YOUR_REDIRECT_URI',
|
|
28
|
+
state: 'YOUR_STATE',
|
|
29
|
+
scope: 'openid profile email offline_access'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Redirect the user to the authorization URL
|
|
33
|
+
window.location.href = `${authUrl}?${params.toString()}`;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. After successful authentication, you'll receive an authorization code at your redirect URI. Use this code to obtain an access token:
|
|
37
|
+
```javascript
|
|
38
|
+
const response = await fetch('https://mgmt.aglty.io/oauth/token', {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
42
|
+
},
|
|
43
|
+
body: new URLSearchParams({
|
|
44
|
+
code: 'YOUR_AUTHORIZATION_CODE'
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { access_token, refresh_token, expires_in } = await response.json();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
3. Use the obtained token to initialize the SDK:
|
|
52
|
+
```javascript
|
|
53
|
+
import * as mgmtApi from "./index";
|
|
54
|
+
|
|
55
|
+
// Initialize the Options Class with your authentication token
|
|
56
|
+
let options = new mgmtApi.Options();
|
|
57
|
+
options.token = access_token; // Use the token obtained from authentication
|
|
58
|
+
|
|
59
|
+
// Initialize the APIClient Class
|
|
60
|
+
let apiClient = new mgmtApi.ApiClient(options);
|
|
61
|
+
|
|
62
|
+
let guid = "<<Provide the Guid of the Website>>";
|
|
63
|
+
let locale = "<<Provide the locale of the Website>>"; // Example: en-us
|
|
64
|
+
|
|
65
|
+
// Now you can make authenticated requests
|
|
66
|
+
var contentItem = await apiClient.contentMethods.getContentItem(22, guid, locale);
|
|
67
|
+
console.log(JSON.stringify(contentItem));
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
4. When the access token expires, use the refresh token to obtain a new access token:
|
|
71
|
+
```javascript
|
|
72
|
+
const response = await fetch('https://mgmt.aglty.io/oauth/refresh', {
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: {
|
|
75
|
+
'Content-Type': 'application/json'
|
|
76
|
+
},
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
refresh_token: 'YOUR_REFRESH_TOKEN'
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const { access_token, refresh_token, expires_in } = await response.json();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Note:
|
|
86
|
+
- The access token has a limited lifetime (typically 1 hour)
|
|
87
|
+
- The refresh token can be used to obtain new access tokens
|
|
88
|
+
- Store refresh tokens securely and never expose them in client-side code
|
|
89
|
+
- Implement proper error handling for authentication failures
|
|
90
|
+
|
|
17
91
|
4. Create an object of Method class(es), which can be used to create and perform operations. Following is the description of Classes and their respective methods -
|
|
18
92
|
|
|
19
93
|
### Making a Request
|
|
@@ -662,6 +736,14 @@ Returns: An object with the requested Webhook.
|
|
|
662
736
|
| `guid` | `string` | Current website guid.|
|
|
663
737
|
| `webhookID` | `string` | The webhookID of the requested webhook.|
|
|
664
738
|
|
|
739
|
+
## Class Instance
|
|
740
|
+
|
|
741
|
+
### getLocales
|
|
742
|
+
| Parameter | Type | Description |
|
|
743
|
+
| :-------- | :------- | :------------------------- |
|
|
744
|
+
| `guid` | `string` | Current website guid.|
|
|
745
|
+
|
|
746
|
+
Returns: An array of locales. ex. ['en-us','fr-ca']
|
|
665
747
|
|
|
666
748
|
## Running the SDK Locally
|
|
667
749
|
|
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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
|
|
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
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
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
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -51,7 +51,7 @@ var AssetMethods = /** @class */ (function () {
|
|
|
51
51
|
switch (_a.label) {
|
|
52
52
|
case 0:
|
|
53
53
|
_a.trys.push([0, 2, , 3]);
|
|
54
|
-
apiPath = "asset/delete/"
|
|
54
|
+
apiPath = "asset/delete/" + mediaID;
|
|
55
55
|
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
|
|
56
56
|
case 1:
|
|
57
57
|
resp = _a.sent();
|
|
@@ -59,7 +59,7 @@ var AssetMethods = /** @class */ (function () {
|
|
|
59
59
|
return [2 /*return*/, resp.data];
|
|
60
60
|
case 2:
|
|
61
61
|
err_1 = _a.sent();
|
|
62
|
-
throw new exception_1.Exception("Unable to delete the media for mediaID: "
|
|
62
|
+
throw new exception_1.Exception("Unable to delete the media for mediaID: " + mediaID, err_1);
|
|
63
63
|
case 3: return [2 /*return*/];
|
|
64
64
|
}
|
|
65
65
|
});
|
|
@@ -73,14 +73,14 @@ var AssetMethods = /** @class */ (function () {
|
|
|
73
73
|
case 0:
|
|
74
74
|
_a.trys.push([0, 2, , 3]);
|
|
75
75
|
folder = encodeURIComponent(newFolder);
|
|
76
|
-
apiPath = "asset/move/"
|
|
76
|
+
apiPath = "asset/move/" + mediaID + "?newFolder=" + folder;
|
|
77
77
|
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
|
|
78
78
|
case 1:
|
|
79
79
|
resp = _a.sent();
|
|
80
80
|
return [2 /*return*/, resp.data];
|
|
81
81
|
case 2:
|
|
82
82
|
err_2 = _a.sent();
|
|
83
|
-
throw new exception_1.Exception("Unable to move the media for mediaID: "
|
|
83
|
+
throw new exception_1.Exception("Unable to move the media for mediaID: " + mediaID, err_2);
|
|
84
84
|
case 3: return [2 /*return*/];
|
|
85
85
|
}
|
|
86
86
|
});
|
|
@@ -93,7 +93,7 @@ var AssetMethods = /** @class */ (function () {
|
|
|
93
93
|
switch (_a.label) {
|
|
94
94
|
case 0:
|
|
95
95
|
_a.trys.push([0, 2, , 3]);
|
|
96
|
-
apiPath = "asset/list?pageSize="
|
|
96
|
+
apiPath = "asset/list?pageSize=" + pageSize + "&recordOffset=" + recordOffset;
|
|
97
97
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
98
98
|
case 1:
|
|
99
99
|
resp = _a.sent();
|
|
@@ -106,17 +106,17 @@ var AssetMethods = /** @class */ (function () {
|
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
|
-
AssetMethods.prototype.getGalleries = function (
|
|
110
|
-
|
|
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 () {
|
|
111
114
|
var apiPath, resp, err_4;
|
|
112
|
-
if (search === void 0) { search = null; }
|
|
113
|
-
if (pageSize === void 0) { pageSize = null; }
|
|
114
|
-
if (rowIndex === void 0) { rowIndex = null; }
|
|
115
115
|
return __generator(this, function (_a) {
|
|
116
116
|
switch (_a.label) {
|
|
117
117
|
case 0:
|
|
118
118
|
_a.trys.push([0, 2, , 3]);
|
|
119
|
-
apiPath = "asset/galleries?search="
|
|
119
|
+
apiPath = "asset/galleries?search=" + search + "&pageSize=" + pageSize + "&rowIndex=" + rowIndex;
|
|
120
120
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
121
121
|
case 1:
|
|
122
122
|
resp = _a.sent();
|
|
@@ -136,14 +136,14 @@ var AssetMethods = /** @class */ (function () {
|
|
|
136
136
|
switch (_a.label) {
|
|
137
137
|
case 0:
|
|
138
138
|
_a.trys.push([0, 2, , 3]);
|
|
139
|
-
apiPath = "/asset/gallery/"
|
|
139
|
+
apiPath = "/asset/gallery/" + id;
|
|
140
140
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
141
141
|
case 1:
|
|
142
142
|
resp = _a.sent();
|
|
143
143
|
return [2 /*return*/, resp.data];
|
|
144
144
|
case 2:
|
|
145
145
|
err_5 = _a.sent();
|
|
146
|
-
throw new exception_1.Exception("Unable to retrieve gallery for id "
|
|
146
|
+
throw new exception_1.Exception("Unable to retrieve gallery for id " + id, err_5);
|
|
147
147
|
case 3: return [2 /*return*/];
|
|
148
148
|
}
|
|
149
149
|
});
|
|
@@ -156,14 +156,14 @@ var AssetMethods = /** @class */ (function () {
|
|
|
156
156
|
switch (_a.label) {
|
|
157
157
|
case 0:
|
|
158
158
|
_a.trys.push([0, 2, , 3]);
|
|
159
|
-
apiPath = "/asset/gallery?galleryName="
|
|
159
|
+
apiPath = "/asset/gallery?galleryName=" + galleryName;
|
|
160
160
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
161
161
|
case 1:
|
|
162
162
|
resp = _a.sent();
|
|
163
163
|
return [2 /*return*/, resp.data];
|
|
164
164
|
case 2:
|
|
165
165
|
err_6 = _a.sent();
|
|
166
|
-
throw new exception_1.Exception("Unable to retrieve gallery for name "
|
|
166
|
+
throw new exception_1.Exception("Unable to retrieve gallery for name " + galleryName, err_6);
|
|
167
167
|
case 3: return [2 /*return*/];
|
|
168
168
|
}
|
|
169
169
|
});
|
|
@@ -183,7 +183,7 @@ var AssetMethods = /** @class */ (function () {
|
|
|
183
183
|
return [2 /*return*/, resp.data];
|
|
184
184
|
case 2:
|
|
185
185
|
err_7 = _a.sent();
|
|
186
|
-
throw new exception_1.Exception("Unable to retrieve container for guid "
|
|
186
|
+
throw new exception_1.Exception("Unable to retrieve container for guid " + guid, err_7);
|
|
187
187
|
case 3: return [2 /*return*/];
|
|
188
188
|
}
|
|
189
189
|
});
|
|
@@ -216,14 +216,14 @@ var AssetMethods = /** @class */ (function () {
|
|
|
216
216
|
switch (_a.label) {
|
|
217
217
|
case 0:
|
|
218
218
|
_a.trys.push([0, 2, , 3]);
|
|
219
|
-
apiPath = "/asset/gallery/"
|
|
219
|
+
apiPath = "/asset/gallery/" + id;
|
|
220
220
|
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
|
|
221
221
|
case 1:
|
|
222
222
|
resp = _a.sent();
|
|
223
223
|
return [2 /*return*/, resp.data];
|
|
224
224
|
case 2:
|
|
225
225
|
err_9 = _a.sent();
|
|
226
|
-
throw new exception_1.Exception("Unable to delete gallery for id "
|
|
226
|
+
throw new exception_1.Exception("Unable to delete gallery for id " + id, err_9);
|
|
227
227
|
case 3: return [2 /*return*/];
|
|
228
228
|
}
|
|
229
229
|
});
|
|
@@ -236,14 +236,14 @@ var AssetMethods = /** @class */ (function () {
|
|
|
236
236
|
switch (_a.label) {
|
|
237
237
|
case 0:
|
|
238
238
|
_a.trys.push([0, 2, , 3]);
|
|
239
|
-
apiPath = "asset/"
|
|
239
|
+
apiPath = "asset/" + mediaID;
|
|
240
240
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
241
241
|
case 1:
|
|
242
242
|
resp = _a.sent();
|
|
243
243
|
return [2 /*return*/, resp.data];
|
|
244
244
|
case 2:
|
|
245
245
|
err_10 = _a.sent();
|
|
246
|
-
throw new exception_1.Exception("Unable to retrieve asset for mediaID "
|
|
246
|
+
throw new exception_1.Exception("Unable to retrieve asset for mediaID " + mediaID, err_10);
|
|
247
247
|
case 3: return [2 /*return*/];
|
|
248
248
|
}
|
|
249
249
|
});
|
|
@@ -256,14 +256,14 @@ var AssetMethods = /** @class */ (function () {
|
|
|
256
256
|
switch (_a.label) {
|
|
257
257
|
case 0:
|
|
258
258
|
_a.trys.push([0, 2, , 3]);
|
|
259
|
-
apiPath = "asset?url="
|
|
259
|
+
apiPath = "asset?url=" + url;
|
|
260
260
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
261
261
|
case 1:
|
|
262
262
|
resp = _a.sent();
|
|
263
263
|
return [2 /*return*/, resp.data];
|
|
264
264
|
case 2:
|
|
265
265
|
err_11 = _a.sent();
|
|
266
|
-
throw new exception_1.Exception("Unable to retrieve asset for url "
|
|
266
|
+
throw new exception_1.Exception("Unable to retrieve asset for url " + url, err_11);
|
|
267
267
|
case 3: return [2 /*return*/];
|
|
268
268
|
}
|
|
269
269
|
});
|
|
@@ -279,15 +279,15 @@ var AssetMethods = /** @class */ (function () {
|
|
|
279
279
|
* @returns
|
|
280
280
|
* @memberof AssetMethods
|
|
281
281
|
*/
|
|
282
|
-
AssetMethods.prototype.upload = function (
|
|
283
|
-
|
|
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 () {
|
|
284
285
|
var apiPath, resp, err_12;
|
|
285
|
-
if (groupingID === void 0) { groupingID = -1; }
|
|
286
286
|
return __generator(this, function (_a) {
|
|
287
287
|
switch (_a.label) {
|
|
288
288
|
case 0:
|
|
289
289
|
_a.trys.push([0, 2, , 3]);
|
|
290
|
-
apiPath = "asset/upload?folderPath="
|
|
290
|
+
apiPath = "asset/upload?folderPath=" + agilityFolderPath + "&groupingID=" + groupingID;
|
|
291
291
|
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, formData)];
|
|
292
292
|
case 1:
|
|
293
293
|
resp = _a.sent();
|
|
@@ -307,7 +307,7 @@ var AssetMethods = /** @class */ (function () {
|
|
|
307
307
|
switch (_a.label) {
|
|
308
308
|
case 0:
|
|
309
309
|
_a.trys.push([0, 2, , 3]);
|
|
310
|
-
apiPath = "asset/folder?originKey="
|
|
310
|
+
apiPath = "asset/folder?originKey=" + originKey;
|
|
311
311
|
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
|
|
312
312
|
case 1:
|
|
313
313
|
resp = _a.sent();
|
|
@@ -320,15 +320,15 @@ var AssetMethods = /** @class */ (function () {
|
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
322
|
};
|
|
323
|
-
AssetMethods.prototype.deleteFolder = function (
|
|
324
|
-
|
|
323
|
+
AssetMethods.prototype.deleteFolder = function (originKey, guid, mediaID) {
|
|
324
|
+
if (mediaID === void 0) { mediaID = 0; }
|
|
325
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
325
326
|
var apiPath, err_14;
|
|
326
|
-
if (mediaID === void 0) { mediaID = 0; }
|
|
327
327
|
return __generator(this, function (_a) {
|
|
328
328
|
switch (_a.label) {
|
|
329
329
|
case 0:
|
|
330
330
|
_a.trys.push([0, 2, , 3]);
|
|
331
|
-
apiPath = "asset/folder/delete?originKey="
|
|
331
|
+
apiPath = "asset/folder/delete?originKey=" + originKey + "&mediaID=" + mediaID;
|
|
332
332
|
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
|
|
333
333
|
case 1:
|
|
334
334
|
_a.sent();
|
|
@@ -341,15 +341,15 @@ var AssetMethods = /** @class */ (function () {
|
|
|
341
341
|
});
|
|
342
342
|
});
|
|
343
343
|
};
|
|
344
|
-
AssetMethods.prototype.renameFolder = function (
|
|
345
|
-
|
|
344
|
+
AssetMethods.prototype.renameFolder = function (folderName, newFolderName, guid, mediaID) {
|
|
345
|
+
if (mediaID === void 0) { mediaID = 0; }
|
|
346
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
346
347
|
var apiPath, err_15;
|
|
347
|
-
if (mediaID === void 0) { mediaID = 0; }
|
|
348
348
|
return __generator(this, function (_a) {
|
|
349
349
|
switch (_a.label) {
|
|
350
350
|
case 0:
|
|
351
351
|
_a.trys.push([0, 2, , 3]);
|
|
352
|
-
apiPath = "asset/folder/rename?folderName="
|
|
352
|
+
apiPath = "asset/folder/rename?folderName=" + folderName + "&newFolderName=" + newFolderName + "&mediaID=" + mediaID;
|
|
353
353
|
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
|
|
354
354
|
case 1:
|
|
355
355
|
_a.sent();
|
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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
|
|
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
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
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
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -52,14 +52,14 @@ var BatchMethods = /** @class */ (function () {
|
|
|
52
52
|
switch (_a.label) {
|
|
53
53
|
case 0:
|
|
54
54
|
_a.trys.push([0, 2, , 3]);
|
|
55
|
-
apiPath = "batch/"
|
|
55
|
+
apiPath = "batch/" + batchID;
|
|
56
56
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
57
57
|
case 1:
|
|
58
58
|
resp = _a.sent();
|
|
59
59
|
return [2 /*return*/, resp.data];
|
|
60
60
|
case 2:
|
|
61
61
|
err_1 = _a.sent();
|
|
62
|
-
throw new exception_1.Exception("Unable to
|
|
62
|
+
throw new exception_1.Exception("Unable to retrieve the batch for id: " + batchID, err_1);
|
|
63
63
|
case 3: return [2 /*return*/];
|
|
64
64
|
}
|
|
65
65
|
});
|
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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
|
|
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
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
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
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -78,7 +78,7 @@ var ClientInstance = /** @class */ (function () {
|
|
|
78
78
|
ClientInstance.prototype.getInstance = function (guid) {
|
|
79
79
|
var baseUrl = this.determineBaseUrl(guid);
|
|
80
80
|
var instance = axios_1.default.create({
|
|
81
|
-
baseURL:
|
|
81
|
+
baseURL: baseUrl + "/api/v1/instance/" + guid,
|
|
82
82
|
maxContentLength: Infinity,
|
|
83
83
|
maxBodyLength: Infinity
|
|
84
84
|
});
|
|
@@ -87,7 +87,7 @@ var ClientInstance = /** @class */ (function () {
|
|
|
87
87
|
ClientInstance.prototype.getAxiosInstance = function (guid) {
|
|
88
88
|
var baseUrl = this.determineBaseUrl(guid);
|
|
89
89
|
var instance = axios_1.default.create({
|
|
90
|
-
baseURL:
|
|
90
|
+
baseURL: baseUrl + "/api/v1",
|
|
91
91
|
maxContentLength: Infinity,
|
|
92
92
|
maxBodyLength: Infinity
|
|
93
93
|
});
|
|
@@ -105,7 +105,7 @@ var ClientInstance = /** @class */ (function () {
|
|
|
105
105
|
_a.trys.push([1, 3, , 4]);
|
|
106
106
|
return [4 /*yield*/, instance.get(apiPath, {
|
|
107
107
|
headers: {
|
|
108
|
-
'Authorization': "Bearer "
|
|
108
|
+
'Authorization': "Bearer " + token,
|
|
109
109
|
'Cache-Control': 'no-cache'
|
|
110
110
|
}
|
|
111
111
|
})];
|
|
@@ -132,7 +132,7 @@ var ClientInstance = /** @class */ (function () {
|
|
|
132
132
|
_a.trys.push([1, 3, , 4]);
|
|
133
133
|
return [4 /*yield*/, instance.get(apiPath, {
|
|
134
134
|
headers: {
|
|
135
|
-
'Authorization': "Bearer "
|
|
135
|
+
'Authorization': "Bearer " + token,
|
|
136
136
|
'Cache-Control': 'no-cache'
|
|
137
137
|
}
|
|
138
138
|
})];
|
|
@@ -159,7 +159,7 @@ var ClientInstance = /** @class */ (function () {
|
|
|
159
159
|
_a.trys.push([1, 3, , 4]);
|
|
160
160
|
return [4 /*yield*/, instance.delete(apiPath, {
|
|
161
161
|
headers: {
|
|
162
|
-
'Authorization': "Bearer "
|
|
162
|
+
'Authorization': "Bearer " + token,
|
|
163
163
|
'Cache-Control': 'no-cache'
|
|
164
164
|
}
|
|
165
165
|
})];
|
|
@@ -186,7 +186,7 @@ var ClientInstance = /** @class */ (function () {
|
|
|
186
186
|
_a.trys.push([1, 3, , 4]);
|
|
187
187
|
return [4 /*yield*/, instance.post(apiPath, data, {
|
|
188
188
|
headers: {
|
|
189
|
-
'Authorization': "Bearer "
|
|
189
|
+
'Authorization': "Bearer " + token,
|
|
190
190
|
'Cache-Control': 'no-cache'
|
|
191
191
|
}
|
|
192
192
|
})];
|
|
@@ -12,6 +12,6 @@ export declare class ContainerMethods {
|
|
|
12
12
|
getContainerSecurity(id: number, guid: string): Promise<Container>;
|
|
13
13
|
getContainerList(guid: string): Promise<Container[]>;
|
|
14
14
|
getNotificationList(id: number, guid: string): Promise<Notification[]>;
|
|
15
|
-
saveContainer(container: Container, guid: string): Promise<Container>;
|
|
15
|
+
saveContainer(container: Container, guid: string, forceReferenceName?: boolean): Promise<Container>;
|
|
16
16
|
deleteContainer(id: number, guid: string): Promise<string>;
|
|
17
17
|
}
|
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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
|
|
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
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
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
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -51,14 +51,14 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
51
51
|
switch (_a.label) {
|
|
52
52
|
case 0:
|
|
53
53
|
_a.trys.push([0, 2, , 3]);
|
|
54
|
-
apiPath = "container/"
|
|
54
|
+
apiPath = "container/" + id;
|
|
55
55
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
56
56
|
case 1:
|
|
57
57
|
resp = _a.sent();
|
|
58
58
|
return [2 /*return*/, resp.data];
|
|
59
59
|
case 2:
|
|
60
60
|
err_1 = _a.sent();
|
|
61
|
-
throw new exception_1.Exception("Unable to
|
|
61
|
+
throw new exception_1.Exception("Unable to retrieve the container for id: " + id, err_1);
|
|
62
62
|
case 3: return [2 /*return*/];
|
|
63
63
|
}
|
|
64
64
|
});
|
|
@@ -71,14 +71,14 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
71
71
|
switch (_a.label) {
|
|
72
72
|
case 0:
|
|
73
73
|
_a.trys.push([0, 2, , 3]);
|
|
74
|
-
apiPath = "container/model/"
|
|
74
|
+
apiPath = "container/model/" + modelId;
|
|
75
75
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
76
76
|
case 1:
|
|
77
77
|
resp = _a.sent();
|
|
78
78
|
return [2 /*return*/, resp.data];
|
|
79
79
|
case 2:
|
|
80
80
|
err_2 = _a.sent();
|
|
81
|
-
throw new exception_1.Exception("Unable to
|
|
81
|
+
throw new exception_1.Exception("Unable to retrieve the containers for id: " + modelId, err_2);
|
|
82
82
|
case 3: return [2 /*return*/];
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -91,14 +91,14 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
91
91
|
switch (_a.label) {
|
|
92
92
|
case 0:
|
|
93
93
|
_a.trys.push([0, 2, , 3]);
|
|
94
|
-
apiPath = "container/"
|
|
94
|
+
apiPath = "container/" + referenceName;
|
|
95
95
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
96
96
|
case 1:
|
|
97
97
|
resp = _a.sent();
|
|
98
98
|
return [2 /*return*/, resp.data];
|
|
99
99
|
case 2:
|
|
100
100
|
err_3 = _a.sent();
|
|
101
|
-
throw new exception_1.Exception("Unable to
|
|
101
|
+
throw new exception_1.Exception("Unable to retrieve the container for referenceName: " + referenceName, err_3);
|
|
102
102
|
case 3: return [2 /*return*/];
|
|
103
103
|
}
|
|
104
104
|
});
|
|
@@ -111,14 +111,14 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
111
111
|
switch (_a.label) {
|
|
112
112
|
case 0:
|
|
113
113
|
_a.trys.push([0, 2, , 3]);
|
|
114
|
-
apiPath = "container/"
|
|
114
|
+
apiPath = "container/" + id + "/security";
|
|
115
115
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
116
116
|
case 1:
|
|
117
117
|
resp = _a.sent();
|
|
118
118
|
return [2 /*return*/, resp.data];
|
|
119
119
|
case 2:
|
|
120
120
|
err_4 = _a.sent();
|
|
121
|
-
throw new exception_1.Exception("Unable to
|
|
121
|
+
throw new exception_1.Exception("Unable to retrieve the container for id: " + id, err_4);
|
|
122
122
|
case 3: return [2 /*return*/];
|
|
123
123
|
}
|
|
124
124
|
});
|
|
@@ -138,7 +138,7 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
138
138
|
return [2 /*return*/, resp.data];
|
|
139
139
|
case 2:
|
|
140
140
|
err_5 = _a.sent();
|
|
141
|
-
throw new exception_1.Exception("Unable to
|
|
141
|
+
throw new exception_1.Exception("Unable to retrieve the container list", err_5);
|
|
142
142
|
case 3: return [2 /*return*/];
|
|
143
143
|
}
|
|
144
144
|
});
|
|
@@ -151,34 +151,35 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
151
151
|
switch (_a.label) {
|
|
152
152
|
case 0:
|
|
153
153
|
_a.trys.push([0, 2, , 3]);
|
|
154
|
-
apiPath = "container/"
|
|
154
|
+
apiPath = "container/" + id + "/notifications";
|
|
155
155
|
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
156
156
|
case 1:
|
|
157
157
|
resp = _a.sent();
|
|
158
158
|
return [2 /*return*/, resp.data];
|
|
159
159
|
case 2:
|
|
160
160
|
err_6 = _a.sent();
|
|
161
|
-
throw new exception_1.Exception("Unable to
|
|
161
|
+
throw new exception_1.Exception("Unable to retrieve the notifications for container id: " + id, err_6);
|
|
162
162
|
case 3: return [2 /*return*/];
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
|
-
ContainerMethods.prototype.saveContainer = function (container, guid) {
|
|
167
|
+
ContainerMethods.prototype.saveContainer = function (container, guid, forceReferenceName) {
|
|
168
|
+
if (forceReferenceName === void 0) { forceReferenceName = false; }
|
|
168
169
|
return __awaiter(this, void 0, void 0, function () {
|
|
169
170
|
var apiPath, resp, err_7;
|
|
170
171
|
return __generator(this, function (_a) {
|
|
171
172
|
switch (_a.label) {
|
|
172
173
|
case 0:
|
|
173
174
|
_a.trys.push([0, 2, , 3]);
|
|
174
|
-
apiPath = "container";
|
|
175
|
+
apiPath = "container" + (forceReferenceName ? '?forceReferenceName=true' : '');
|
|
175
176
|
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, container)];
|
|
176
177
|
case 1:
|
|
177
178
|
resp = _a.sent();
|
|
178
179
|
return [2 /*return*/, resp.data];
|
|
179
180
|
case 2:
|
|
180
181
|
err_7 = _a.sent();
|
|
181
|
-
throw new exception_1.Exception("Unable to save the
|
|
182
|
+
throw new exception_1.Exception("Unable to save the container", err_7);
|
|
182
183
|
case 3: return [2 /*return*/];
|
|
183
184
|
}
|
|
184
185
|
});
|
|
@@ -191,14 +192,14 @@ var ContainerMethods = /** @class */ (function () {
|
|
|
191
192
|
switch (_a.label) {
|
|
192
193
|
case 0:
|
|
193
194
|
_a.trys.push([0, 2, , 3]);
|
|
194
|
-
apiPath = "container/"
|
|
195
|
+
apiPath = "container/" + id;
|
|
195
196
|
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
|
|
196
197
|
case 1:
|
|
197
198
|
resp = _a.sent();
|
|
198
199
|
return [2 /*return*/, resp.data];
|
|
199
200
|
case 2:
|
|
200
201
|
err_8 = _a.sent();
|
|
201
|
-
throw new exception_1.Exception("Unable to delete the
|
|
202
|
+
throw new exception_1.Exception("Unable to delete the container for id: " + id, err_8);
|
|
202
203
|
case 3: return [2 /*return*/];
|
|
203
204
|
}
|
|
204
205
|
});
|
|
@@ -18,8 +18,8 @@ export declare class ContentMethods {
|
|
|
18
18
|
approveContent(contentID: number, guid: string, locale: string, comments?: string): Promise<number[]>;
|
|
19
19
|
declineContent(contentID: number, guid: string, locale: string, comments?: string): Promise<number[]>;
|
|
20
20
|
deleteContent(contentID: number, guid: string, locale: string, comments?: string): Promise<number[]>;
|
|
21
|
-
saveContentItem(contentItem: ContentItem, guid: string, locale: string): Promise<number[]>;
|
|
22
|
-
saveContentItems(contentItems: ContentItem[], guid: string, locale: string): Promise<number[]>;
|
|
21
|
+
saveContentItem(contentItem: ContentItem, guid: string, locale: string): Promise<import("..").Batch | number[]>;
|
|
22
|
+
saveContentItems(contentItems: ContentItem[], guid: string, locale: string): Promise<import("..").Batch | number[]>;
|
|
23
23
|
getContentItems(referenceName: string, guid: string, locale: string, listParams: ListParams): Promise<ContentList>;
|
|
24
24
|
getContentList(referenceName: string, guid: string, locale: string, listParams: ListParams, filterObject?: ContentListFilterModel): Promise<ContentList>;
|
|
25
25
|
getContentHistory(locale: string, guid: string, contentID: number, take?: number, skip?: number): Promise<ContentItemHistory>;
|