@agility/management-sdk 0.1.7 → 0.1.9
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
CHANGED
|
@@ -303,6 +303,12 @@ This class is used to perform operations related to Models. The following are th
|
|
|
303
303
|
|
|
304
304
|
Returns: An object of ```Model``` class.
|
|
305
305
|
|
|
306
|
+
### GetModelByReferenceName
|
|
307
|
+
| Parameter | Type | Description |
|
|
308
|
+
| :-------- | :------- | :------------------------- |
|
|
309
|
+
| `referenceName` | `string` | The referenceName of the requested model.|
|
|
310
|
+
| `guid` | `string` | The guid of the requested model.|
|
|
311
|
+
|
|
306
312
|
### getContentModules
|
|
307
313
|
| Parameter | Type | Description |
|
|
308
314
|
| :-------- | :------- | :------------------------- |
|
|
@@ -11,4 +11,5 @@ export declare class AssetMethods {
|
|
|
11
11
|
getAssetByID(mediaID: number, guid: string): Promise<Media>;
|
|
12
12
|
getAssetByUrl(url: string, guid: string): Promise<Media>;
|
|
13
13
|
upload(formData: FormData, agilityFolderPath: string, guid: string, groupingID?: number): Promise<Media[]>;
|
|
14
|
+
createFolder(originKey: string, guid: string): Promise<Media>;
|
|
14
15
|
}
|
|
@@ -167,6 +167,26 @@ var AssetMethods = /** @class */ (function () {
|
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
169
|
};
|
|
170
|
+
AssetMethods.prototype.createFolder = function (originKey, guid) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
+
var apiPath, resp, err_7;
|
|
173
|
+
return __generator(this, function (_a) {
|
|
174
|
+
switch (_a.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
_a.trys.push([0, 2, , 3]);
|
|
177
|
+
apiPath = "asset/folder?originKey=".concat(originKey);
|
|
178
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, null)];
|
|
179
|
+
case 1:
|
|
180
|
+
resp = _a.sent();
|
|
181
|
+
return [2 /*return*/, resp.data];
|
|
182
|
+
case 2:
|
|
183
|
+
err_7 = _a.sent();
|
|
184
|
+
throw new exception_1.Exception('Unable to create folder.', err_7);
|
|
185
|
+
case 3: return [2 /*return*/];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
170
190
|
return AssetMethods;
|
|
171
191
|
}());
|
|
172
192
|
exports.AssetMethods = AssetMethods;
|
|
@@ -52,13 +52,13 @@ var ClientInstance = /** @class */ (function () {
|
|
|
52
52
|
else if (seperator[1] === 'u') {
|
|
53
53
|
return "https://mgmt.aglty.io";
|
|
54
54
|
}
|
|
55
|
-
else if (seperator[1] === '
|
|
55
|
+
else if (seperator[1] === 'c') {
|
|
56
56
|
return "https://mgmt-ca.aglty.io";
|
|
57
57
|
}
|
|
58
|
-
else if (seperator[1] === '
|
|
59
|
-
return "https://mgmt-
|
|
58
|
+
else if (seperator[1] === 'e') {
|
|
59
|
+
return "https://mgmt-eu.aglty.io";
|
|
60
60
|
}
|
|
61
|
-
else if (seperator[1] === '
|
|
61
|
+
else if (seperator[1] === 'a') {
|
|
62
62
|
return "https://mgmt-aus.aglty.io";
|
|
63
63
|
}
|
|
64
64
|
return "https://mgmt.aglty.io";
|
|
@@ -6,6 +6,7 @@ export declare class ModelMethods {
|
|
|
6
6
|
_clientInstance: ClientInstance;
|
|
7
7
|
constructor(options: Options);
|
|
8
8
|
getContentModel(id: number, guid: string): Promise<Model>;
|
|
9
|
+
getModelByReferenceName(referenceName: string, guid: string): Promise<Model>;
|
|
9
10
|
getContentModules(includeDefaults: boolean, guid: string, includeModules?: boolean): Promise<Model[]>;
|
|
10
11
|
getPageModules(includeDefault: boolean, guid: string): Promise<Model[]>;
|
|
11
12
|
saveModel(model: Model, guid: string): Promise<Model>;
|
|
@@ -64,10 +64,30 @@ var ModelMethods = /** @class */ (function () {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
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/".concat(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: ".concat(referenceName, "."), err_2);
|
|
82
|
+
case 3: return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
67
87
|
ModelMethods.prototype.getContentModules = function (includeDefaults, guid, includeModules) {
|
|
68
88
|
if (includeModules === void 0) { includeModules = false; }
|
|
69
89
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
var apiPath, resp,
|
|
90
|
+
var apiPath, resp, err_3;
|
|
71
91
|
return __generator(this, function (_a) {
|
|
72
92
|
switch (_a.label) {
|
|
73
93
|
case 0:
|
|
@@ -78,8 +98,8 @@ var ModelMethods = /** @class */ (function () {
|
|
|
78
98
|
resp = _a.sent();
|
|
79
99
|
return [2 /*return*/, resp.data];
|
|
80
100
|
case 2:
|
|
81
|
-
|
|
82
|
-
throw new exception_1.Exception("Unable to retreive content modules.",
|
|
101
|
+
err_3 = _a.sent();
|
|
102
|
+
throw new exception_1.Exception("Unable to retreive content modules.", err_3);
|
|
83
103
|
case 3: return [2 /*return*/];
|
|
84
104
|
}
|
|
85
105
|
});
|
|
@@ -87,7 +107,7 @@ var ModelMethods = /** @class */ (function () {
|
|
|
87
107
|
};
|
|
88
108
|
ModelMethods.prototype.getPageModules = function (includeDefault, guid) {
|
|
89
109
|
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
var apiPath, resp,
|
|
110
|
+
var apiPath, resp, err_4;
|
|
91
111
|
return __generator(this, function (_a) {
|
|
92
112
|
switch (_a.label) {
|
|
93
113
|
case 0:
|
|
@@ -98,8 +118,8 @@ var ModelMethods = /** @class */ (function () {
|
|
|
98
118
|
resp = _a.sent();
|
|
99
119
|
return [2 /*return*/, resp.data];
|
|
100
120
|
case 2:
|
|
101
|
-
|
|
102
|
-
throw new exception_1.Exception("Unable to retreive page modules.",
|
|
121
|
+
err_4 = _a.sent();
|
|
122
|
+
throw new exception_1.Exception("Unable to retreive page modules.", err_4);
|
|
103
123
|
case 3: return [2 /*return*/];
|
|
104
124
|
}
|
|
105
125
|
});
|
|
@@ -107,7 +127,7 @@ var ModelMethods = /** @class */ (function () {
|
|
|
107
127
|
};
|
|
108
128
|
ModelMethods.prototype.saveModel = function (model, guid) {
|
|
109
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var apiPath, resp,
|
|
130
|
+
var apiPath, resp, err_5;
|
|
111
131
|
return __generator(this, function (_a) {
|
|
112
132
|
switch (_a.label) {
|
|
113
133
|
case 0:
|
|
@@ -118,8 +138,8 @@ var ModelMethods = /** @class */ (function () {
|
|
|
118
138
|
resp = _a.sent();
|
|
119
139
|
return [2 /*return*/, resp.data];
|
|
120
140
|
case 2:
|
|
121
|
-
|
|
122
|
-
throw new exception_1.Exception("Unable to save the model.",
|
|
141
|
+
err_5 = _a.sent();
|
|
142
|
+
throw new exception_1.Exception("Unable to save the model.", err_5);
|
|
123
143
|
case 3: return [2 /*return*/];
|
|
124
144
|
}
|
|
125
145
|
});
|
|
@@ -127,7 +147,7 @@ var ModelMethods = /** @class */ (function () {
|
|
|
127
147
|
};
|
|
128
148
|
ModelMethods.prototype.deleteModel = function (id, guid) {
|
|
129
149
|
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
var apiPath, resp,
|
|
150
|
+
var apiPath, resp, err_6;
|
|
131
151
|
return __generator(this, function (_a) {
|
|
132
152
|
switch (_a.label) {
|
|
133
153
|
case 0:
|
|
@@ -138,8 +158,8 @@ var ModelMethods = /** @class */ (function () {
|
|
|
138
158
|
resp = _a.sent();
|
|
139
159
|
return [2 /*return*/, resp.data];
|
|
140
160
|
case 2:
|
|
141
|
-
|
|
142
|
-
throw new exception_1.Exception("Unable to delete the model",
|
|
161
|
+
err_6 = _a.sent();
|
|
162
|
+
throw new exception_1.Exception("Unable to delete the model", err_6);
|
|
143
163
|
case 3: return [2 /*return*/];
|
|
144
164
|
}
|
|
145
165
|
});
|