@agility/management-sdk 0.1.10 → 0.1.11
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 +522 -522
- package/dist/apiClient.d.ts +19 -19
- package/dist/apiClient.js +24 -24
- package/dist/apiMethods/assetMethods.d.ts +24 -24
- package/dist/apiMethods/assetMethods.js +315 -315
- package/dist/apiMethods/batchMethods.d.ts +11 -11
- package/dist/apiMethods/batchMethods.js +117 -117
- package/dist/apiMethods/clientInstance.d.ts +18 -8
- package/dist/apiMethods/clientInstance.js +168 -156
- package/dist/apiMethods/containerMethods.d.ts +16 -16
- package/dist/apiMethods/containerMethods.js +189 -189
- package/dist/apiMethods/contentMethods.d.ts +20 -20
- package/dist/apiMethods/contentMethods.js +359 -359
- package/dist/apiMethods/instanceUserMethods.d.ts +13 -13
- package/dist/apiMethods/instanceUserMethods.js +111 -111
- package/dist/apiMethods/modelMethods.d.ts +14 -14
- package/dist/apiMethods/modelMethods.js +170 -170
- package/dist/apiMethods/pageMethods.d.ts +20 -20
- package/dist/apiMethods/pageMethods.js +323 -323
- package/dist/enums/assetGroupingType.d.ts +3 -3
- package/dist/enums/assetGroupingType.js +7 -7
- package/dist/enums/batchOperationType.d.ts +19 -19
- package/dist/enums/batchOperationType.js +23 -23
- package/dist/enums/batchState..d.ts +7 -7
- package/dist/enums/batchState..js +11 -11
- package/dist/index.d.ts +19 -19
- package/dist/index.js +31 -35
- package/dist/models/assetContainer.d.ts +7 -7
- package/dist/models/assetContainer.js +9 -9
- package/dist/models/assetGalleries.d.ts +5 -5
- package/dist/models/assetGalleries.js +9 -9
- package/dist/models/assetMediaGrouping.d.ts +17 -17
- package/dist/models/assetMediaGrouping.js +9 -9
- package/dist/models/assetMediaGroupingMetaData.d.ts +4 -4
- package/dist/models/assetMediaGroupingMetaData.js +9 -9
- package/dist/models/batch.d.ts +29 -29
- package/dist/models/batch.js +9 -9
- package/dist/models/batchItem.d.ts +13 -13
- package/dist/models/batchItem.js +9 -9
- package/dist/models/container.d.ts +47 -47
- package/dist/models/container.js +9 -9
- package/dist/models/contentItem.d.ts +37 -37
- package/dist/models/contentItem.js +33 -33
- package/dist/models/contentViewColumn.d.ts +8 -8
- package/dist/models/contentViewColumn.js +9 -9
- package/dist/models/exception.d.ts +4 -4
- package/dist/models/exception.js +26 -28
- package/dist/models/instanceRole.d.ts +7 -7
- package/dist/models/instanceRole.js +9 -9
- package/dist/models/instanceUser.d.ts +14 -14
- package/dist/models/instanceUser.js +9 -9
- package/dist/models/media.d.ts +30 -30
- package/dist/models/media.js +15 -15
- package/dist/models/model.d.ts +30 -30
- package/dist/models/model.js +15 -15
- package/dist/models/notification.d.ts +13 -13
- package/dist/models/notification.js +9 -9
- package/dist/models/options.d.ts +7 -7
- package/dist/models/options.js +9 -9
- package/dist/models/pageItem.d.ts +56 -56
- package/dist/models/pageItem.js +39 -39
- package/dist/models/sitemap.d.ts +20 -20
- package/dist/models/sitemap.js +15 -15
- package/dist/models/websiteUser.d.ts +22 -22
- package/dist/models/websiteUser.js +15 -15
- package/license.txt +20 -20
- package/package.json +39 -39
- package/tsconfig.json +14 -14
- package/dist/apiMethods/apiClient.d.ts +0 -19
- package/dist/apiMethods/apiClient.js +0 -24
- package/dist/src/apiMethods/assetMethods.d.ts +0 -14
- package/dist/src/apiMethods/assetMethods.js +0 -172
- package/dist/src/apiMethods/batchMethods.d.ts +0 -11
- package/dist/src/apiMethods/batchMethods.js +0 -117
- package/dist/src/apiMethods/clientInstance.d.ts +0 -8
- package/dist/src/apiMethods/clientInstance.js +0 -156
- package/dist/src/apiMethods/containerMethods.d.ts +0 -16
- package/dist/src/apiMethods/containerMethods.js +0 -189
- package/dist/src/apiMethods/contentMethods.d.ts +0 -20
- package/dist/src/apiMethods/contentMethods.js +0 -359
- package/dist/src/apiMethods/instanceUserMethods.d.ts +0 -13
- package/dist/src/apiMethods/instanceUserMethods.js +0 -111
- package/dist/src/apiMethods/modelMethods.d.ts +0 -13
- package/dist/src/apiMethods/modelMethods.js +0 -150
- package/dist/src/apiMethods/pageMethods.d.ts +0 -20
- package/dist/src/apiMethods/pageMethods.js +0 -323
- package/dist/src/enums/batchOperationType.d.ts +0 -19
- package/dist/src/enums/batchOperationType.js +0 -23
- package/dist/src/enums/batchState..d.ts +0 -7
- package/dist/src/enums/batchState..js +0 -11
- package/dist/src/index.d.ts +0 -14
- package/dist/src/index.js +0 -30
- package/dist/src/models/batch.d.ts +0 -29
- package/dist/src/models/batch.js +0 -9
- package/dist/src/models/batchItem.d.ts +0 -13
- package/dist/src/models/batchItem.js +0 -9
- package/dist/src/models/container.d.ts +0 -47
- package/dist/src/models/container.js +0 -9
- package/dist/src/models/contentItem.d.ts +0 -37
- package/dist/src/models/contentItem.js +0 -33
- package/dist/src/models/contentViewColumn.d.ts +0 -8
- package/dist/src/models/contentViewColumn.js +0 -9
- package/dist/src/models/exception.d.ts +0 -4
- package/dist/src/models/exception.js +0 -28
- package/dist/src/models/instanceRole.d.ts +0 -7
- package/dist/src/models/instanceRole.js +0 -9
- package/dist/src/models/instanceUser.d.ts +0 -14
- package/dist/src/models/instanceUser.js +0 -9
- package/dist/src/models/media.d.ts +0 -30
- package/dist/src/models/media.js +0 -15
- package/dist/src/models/model.d.ts +0 -30
- package/dist/src/models/model.js +0 -15
- package/dist/src/models/notification.d.ts +0 -13
- package/dist/src/models/notification.js +0 -9
- package/dist/src/models/options.d.ts +0 -7
- package/dist/src/models/options.js +0 -9
- package/dist/src/models/pageItem.d.ts +0 -56
- package/dist/src/models/pageItem.js +0 -39
- package/dist/src/models/sitemap.d.ts +0 -20
- package/dist/src/models/sitemap.js +0 -15
- package/dist/src/models/websiteUser.d.ts +0 -22
- package/dist/src/models/websiteUser.js +0 -15
|
@@ -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(guid: string): Promise<WebsiteUser>;
|
|
11
|
-
saveUser(emailAddress: string, roles: InstanceRole[], guid: string, firstName?: string, lastName?: string): Promise<InstanceUser>;
|
|
12
|
-
deleteUser(userId: number, guid: string): 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(guid: string): Promise<WebsiteUser>;
|
|
11
|
+
saveUser(emailAddress: string, roles: InstanceRole[], guid: string, firstName?: string, lastName?: string): Promise<InstanceUser>;
|
|
12
|
+
deleteUser(userId: number, guid: string): Promise<string>;
|
|
13
|
+
}
|
|
@@ -1,111 +1,111 @@
|
|
|
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 (_) 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.InstanceUserMethods = void 0;
|
|
40
|
-
var clientInstance_1 = require("./clientInstance");
|
|
41
|
-
var exception_1 = require("../models/exception");
|
|
42
|
-
var InstanceUserMethods = /** @class */ (function () {
|
|
43
|
-
function InstanceUserMethods(options) {
|
|
44
|
-
this._options = options;
|
|
45
|
-
this._clientInstance = new clientInstance_1.ClientInstance();
|
|
46
|
-
}
|
|
47
|
-
InstanceUserMethods.prototype.getUsers = function (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 = "user/list";
|
|
55
|
-
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
56
|
-
case 1:
|
|
57
|
-
resp = _a.sent();
|
|
58
|
-
return [2 /*return*/, resp.data];
|
|
59
|
-
case 2:
|
|
60
|
-
err_1 = _a.sent();
|
|
61
|
-
throw new exception_1.Exception("Unable to retreive users.", err_1);
|
|
62
|
-
case 3: return [2 /*return*/];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
InstanceUserMethods.prototype.saveUser = function (emailAddress, roles, guid, firstName, lastName) {
|
|
68
|
-
if (firstName === void 0) { firstName = null; }
|
|
69
|
-
if (lastName === void 0) { lastName = null; }
|
|
70
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var apiPath, resp, err_2;
|
|
72
|
-
return __generator(this, function (_a) {
|
|
73
|
-
switch (_a.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
_a.trys.push([0, 2, , 3]);
|
|
76
|
-
apiPath = "user/save?emailAddress="
|
|
77
|
-
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, roles)];
|
|
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 retreive users.", err_2);
|
|
84
|
-
case 3: return [2 /*return*/];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
InstanceUserMethods.prototype.deleteUser = function (userId, 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 = "user/delete/"
|
|
97
|
-
return [4 /*yield*/, this._clientInstance.executeDelete(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 delete the user for id: "
|
|
104
|
-
case 3: return [2 /*return*/];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
return InstanceUserMethods;
|
|
110
|
-
}());
|
|
111
|
-
exports.InstanceUserMethods = InstanceUserMethods;
|
|
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 (_) 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.InstanceUserMethods = void 0;
|
|
40
|
+
var clientInstance_1 = require("./clientInstance");
|
|
41
|
+
var exception_1 = require("../models/exception");
|
|
42
|
+
var InstanceUserMethods = /** @class */ (function () {
|
|
43
|
+
function InstanceUserMethods(options) {
|
|
44
|
+
this._options = options;
|
|
45
|
+
this._clientInstance = new clientInstance_1.ClientInstance(options);
|
|
46
|
+
}
|
|
47
|
+
InstanceUserMethods.prototype.getUsers = function (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 = "user/list";
|
|
55
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
56
|
+
case 1:
|
|
57
|
+
resp = _a.sent();
|
|
58
|
+
return [2 /*return*/, resp.data];
|
|
59
|
+
case 2:
|
|
60
|
+
err_1 = _a.sent();
|
|
61
|
+
throw new exception_1.Exception("Unable to retreive users.", err_1);
|
|
62
|
+
case 3: return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
InstanceUserMethods.prototype.saveUser = function (emailAddress, roles, guid, firstName, lastName) {
|
|
68
|
+
if (firstName === void 0) { firstName = null; }
|
|
69
|
+
if (lastName === void 0) { lastName = null; }
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var apiPath, resp, err_2;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0:
|
|
75
|
+
_a.trys.push([0, 2, , 3]);
|
|
76
|
+
apiPath = "user/save?emailAddress=" + emailAddress + "&firstName=" + firstName + "&lastName=" + lastName;
|
|
77
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, roles)];
|
|
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 retreive users.", err_2);
|
|
84
|
+
case 3: return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
InstanceUserMethods.prototype.deleteUser = function (userId, 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 = "user/delete/" + userId;
|
|
97
|
+
return [4 /*yield*/, this._clientInstance.executeDelete(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 delete the user for id: " + userId, err_3);
|
|
104
|
+
case 3: return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
return InstanceUserMethods;
|
|
110
|
+
}());
|
|
111
|
+
exports.InstanceUserMethods = InstanceUserMethods;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Options } from "../models/options";
|
|
2
|
-
import { ClientInstance } from "./clientInstance";
|
|
3
|
-
import { Model } from "../models/model";
|
|
4
|
-
export declare class ModelMethods {
|
|
5
|
-
_options: Options;
|
|
6
|
-
_clientInstance: ClientInstance;
|
|
7
|
-
constructor(options: Options);
|
|
8
|
-
getContentModel(id: number, guid: string): Promise<Model>;
|
|
9
|
-
getModelByReferenceName(referenceName: string, guid: string): Promise<Model>;
|
|
10
|
-
getContentModules(includeDefaults: boolean, guid: string, includeModules?: boolean): Promise<Model[]>;
|
|
11
|
-
getPageModules(includeDefault: boolean, guid: string): Promise<Model[]>;
|
|
12
|
-
saveModel(model: Model, guid: string): Promise<Model>;
|
|
13
|
-
deleteModel(id: number, guid: string): Promise<string>;
|
|
14
|
-
}
|
|
1
|
+
import { Options } from "../models/options";
|
|
2
|
+
import { ClientInstance } from "./clientInstance";
|
|
3
|
+
import { Model } from "../models/model";
|
|
4
|
+
export declare class ModelMethods {
|
|
5
|
+
_options: Options;
|
|
6
|
+
_clientInstance: ClientInstance;
|
|
7
|
+
constructor(options: Options);
|
|
8
|
+
getContentModel(id: number, guid: string): Promise<Model>;
|
|
9
|
+
getModelByReferenceName(referenceName: string, guid: string): Promise<Model>;
|
|
10
|
+
getContentModules(includeDefaults: boolean, guid: string, includeModules?: boolean): Promise<Model[]>;
|
|
11
|
+
getPageModules(includeDefault: boolean, guid: string): Promise<Model[]>;
|
|
12
|
+
saveModel(model: Model, guid: string): Promise<Model>;
|
|
13
|
+
deleteModel(id: number, guid: string): Promise<string>;
|
|
14
|
+
}
|
|
@@ -1,170 +1,170 @@
|
|
|
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 (_) 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.ModelMethods = void 0;
|
|
40
|
-
var clientInstance_1 = require("./clientInstance");
|
|
41
|
-
var exception_1 = require("../models/exception");
|
|
42
|
-
var ModelMethods = /** @class */ (function () {
|
|
43
|
-
function ModelMethods(options) {
|
|
44
|
-
this._options = options;
|
|
45
|
-
this._clientInstance = new clientInstance_1.ClientInstance();
|
|
46
|
-
}
|
|
47
|
-
ModelMethods.prototype.getContentModel = function (id, 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 = "model/"
|
|
55
|
-
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
56
|
-
case 1:
|
|
57
|
-
resp = _a.sent();
|
|
58
|
-
return [2 /*return*/, resp.data];
|
|
59
|
-
case 2:
|
|
60
|
-
err_1 = _a.sent();
|
|
61
|
-
throw new exception_1.Exception("Unable to retreive model for id: "
|
|
62
|
-
case 3: return [2 /*return*/];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
ModelMethods.prototype.getModelByReferenceName = function (referenceName, guid) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var apiPath, resp, err_2;
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
switch (_a.label) {
|
|
72
|
-
case 0:
|
|
73
|
-
_a.trys.push([0, 2, , 3]);
|
|
74
|
-
apiPath = "model/"
|
|
75
|
-
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
76
|
-
case 1:
|
|
77
|
-
resp = _a.sent();
|
|
78
|
-
return [2 /*return*/, resp.data];
|
|
79
|
-
case 2:
|
|
80
|
-
err_2 = _a.sent();
|
|
81
|
-
throw new exception_1.Exception("Unable to retreive model for referenceName: "
|
|
82
|
-
case 3: return [2 /*return*/];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
ModelMethods.prototype.getContentModules = function (includeDefaults, guid, includeModules) {
|
|
88
|
-
if (includeModules === void 0) { includeModules = false; }
|
|
89
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
var apiPath, resp, err_3;
|
|
91
|
-
return __generator(this, function (_a) {
|
|
92
|
-
switch (_a.label) {
|
|
93
|
-
case 0:
|
|
94
|
-
_a.trys.push([0, 2, , 3]);
|
|
95
|
-
apiPath = "model/list/"
|
|
96
|
-
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
97
|
-
case 1:
|
|
98
|
-
resp = _a.sent();
|
|
99
|
-
return [2 /*return*/, resp.data];
|
|
100
|
-
case 2:
|
|
101
|
-
err_3 = _a.sent();
|
|
102
|
-
throw new exception_1.Exception("Unable to retreive content modules.", err_3);
|
|
103
|
-
case 3: return [2 /*return*/];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
ModelMethods.prototype.getPageModules = function (includeDefault, guid) {
|
|
109
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var apiPath, resp, err_4;
|
|
111
|
-
return __generator(this, function (_a) {
|
|
112
|
-
switch (_a.label) {
|
|
113
|
-
case 0:
|
|
114
|
-
_a.trys.push([0, 2, , 3]);
|
|
115
|
-
apiPath = "model/list-page-modules/"
|
|
116
|
-
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
117
|
-
case 1:
|
|
118
|
-
resp = _a.sent();
|
|
119
|
-
return [2 /*return*/, resp.data];
|
|
120
|
-
case 2:
|
|
121
|
-
err_4 = _a.sent();
|
|
122
|
-
throw new exception_1.Exception("Unable to retreive page modules.", err_4);
|
|
123
|
-
case 3: return [2 /*return*/];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
ModelMethods.prototype.saveModel = function (model, guid) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
var apiPath, resp, err_5;
|
|
131
|
-
return __generator(this, function (_a) {
|
|
132
|
-
switch (_a.label) {
|
|
133
|
-
case 0:
|
|
134
|
-
_a.trys.push([0, 2, , 3]);
|
|
135
|
-
apiPath = "model";
|
|
136
|
-
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, model)];
|
|
137
|
-
case 1:
|
|
138
|
-
resp = _a.sent();
|
|
139
|
-
return [2 /*return*/, resp.data];
|
|
140
|
-
case 2:
|
|
141
|
-
err_5 = _a.sent();
|
|
142
|
-
throw new exception_1.Exception("Unable to save the model.", err_5);
|
|
143
|
-
case 3: return [2 /*return*/];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
ModelMethods.prototype.deleteModel = function (id, guid) {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var apiPath, resp, err_6;
|
|
151
|
-
return __generator(this, function (_a) {
|
|
152
|
-
switch (_a.label) {
|
|
153
|
-
case 0:
|
|
154
|
-
_a.trys.push([0, 2, , 3]);
|
|
155
|
-
apiPath = "model/"
|
|
156
|
-
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
|
|
157
|
-
case 1:
|
|
158
|
-
resp = _a.sent();
|
|
159
|
-
return [2 /*return*/, resp.data];
|
|
160
|
-
case 2:
|
|
161
|
-
err_6 = _a.sent();
|
|
162
|
-
throw new exception_1.Exception("Unable to delete the model", err_6);
|
|
163
|
-
case 3: return [2 /*return*/];
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
return ModelMethods;
|
|
169
|
-
}());
|
|
170
|
-
exports.ModelMethods = ModelMethods;
|
|
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 (_) 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.ModelMethods = void 0;
|
|
40
|
+
var clientInstance_1 = require("./clientInstance");
|
|
41
|
+
var exception_1 = require("../models/exception");
|
|
42
|
+
var ModelMethods = /** @class */ (function () {
|
|
43
|
+
function ModelMethods(options) {
|
|
44
|
+
this._options = options;
|
|
45
|
+
this._clientInstance = new clientInstance_1.ClientInstance(options);
|
|
46
|
+
}
|
|
47
|
+
ModelMethods.prototype.getContentModel = function (id, 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 = "model/" + id;
|
|
55
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
56
|
+
case 1:
|
|
57
|
+
resp = _a.sent();
|
|
58
|
+
return [2 /*return*/, resp.data];
|
|
59
|
+
case 2:
|
|
60
|
+
err_1 = _a.sent();
|
|
61
|
+
throw new exception_1.Exception("Unable to retreive model for id: " + id + ".", err_1);
|
|
62
|
+
case 3: return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
ModelMethods.prototype.getModelByReferenceName = function (referenceName, guid) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var apiPath, resp, err_2;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
_a.trys.push([0, 2, , 3]);
|
|
74
|
+
apiPath = "model/" + referenceName;
|
|
75
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
76
|
+
case 1:
|
|
77
|
+
resp = _a.sent();
|
|
78
|
+
return [2 /*return*/, resp.data];
|
|
79
|
+
case 2:
|
|
80
|
+
err_2 = _a.sent();
|
|
81
|
+
throw new exception_1.Exception("Unable to retreive model for referenceName: " + referenceName + ".", err_2);
|
|
82
|
+
case 3: return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
ModelMethods.prototype.getContentModules = function (includeDefaults, guid, includeModules) {
|
|
88
|
+
if (includeModules === void 0) { includeModules = false; }
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
var apiPath, resp, err_3;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
_a.trys.push([0, 2, , 3]);
|
|
95
|
+
apiPath = "model/list/" + includeDefaults + "?includeModules=" + includeModules;
|
|
96
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
97
|
+
case 1:
|
|
98
|
+
resp = _a.sent();
|
|
99
|
+
return [2 /*return*/, resp.data];
|
|
100
|
+
case 2:
|
|
101
|
+
err_3 = _a.sent();
|
|
102
|
+
throw new exception_1.Exception("Unable to retreive content modules.", err_3);
|
|
103
|
+
case 3: return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
ModelMethods.prototype.getPageModules = function (includeDefault, guid) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var apiPath, resp, err_4;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
_a.trys.push([0, 2, , 3]);
|
|
115
|
+
apiPath = "model/list-page-modules/" + includeDefault;
|
|
116
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
117
|
+
case 1:
|
|
118
|
+
resp = _a.sent();
|
|
119
|
+
return [2 /*return*/, resp.data];
|
|
120
|
+
case 2:
|
|
121
|
+
err_4 = _a.sent();
|
|
122
|
+
throw new exception_1.Exception("Unable to retreive page modules.", err_4);
|
|
123
|
+
case 3: return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
ModelMethods.prototype.saveModel = function (model, guid) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var apiPath, resp, err_5;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
_a.trys.push([0, 2, , 3]);
|
|
135
|
+
apiPath = "model";
|
|
136
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, model)];
|
|
137
|
+
case 1:
|
|
138
|
+
resp = _a.sent();
|
|
139
|
+
return [2 /*return*/, resp.data];
|
|
140
|
+
case 2:
|
|
141
|
+
err_5 = _a.sent();
|
|
142
|
+
throw new exception_1.Exception("Unable to save the model.", err_5);
|
|
143
|
+
case 3: return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
ModelMethods.prototype.deleteModel = function (id, guid) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
var apiPath, resp, err_6;
|
|
151
|
+
return __generator(this, function (_a) {
|
|
152
|
+
switch (_a.label) {
|
|
153
|
+
case 0:
|
|
154
|
+
_a.trys.push([0, 2, , 3]);
|
|
155
|
+
apiPath = "model/" + id;
|
|
156
|
+
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
|
|
157
|
+
case 1:
|
|
158
|
+
resp = _a.sent();
|
|
159
|
+
return [2 /*return*/, resp.data];
|
|
160
|
+
case 2:
|
|
161
|
+
err_6 = _a.sent();
|
|
162
|
+
throw new exception_1.Exception("Unable to delete the model", err_6);
|
|
163
|
+
case 3: return [2 /*return*/];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
return ModelMethods;
|
|
169
|
+
}());
|
|
170
|
+
exports.ModelMethods = ModelMethods;
|