@agility/management-sdk 0.1.8 → 0.1.10

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
@@ -23,10 +23,10 @@ import * as index from "./index";
23
23
  //initialize the Options Class
24
24
  let options = new index.Options();
25
25
 
26
+ options.token = "<<Provide Auth Token>>"
26
27
  //Initialize the APIClient Class
27
28
  let apiClient = new index.ApiClient(options);
28
29
 
29
- let token = "<<Provide Auth Token>>";
30
30
  let guid = "<<Provide the Guid of the Website>>";
31
31
  let locale = "<<Provide the locale of the Website>>"; //Example: en-us
32
32
 
@@ -51,6 +51,14 @@ This class is used to perform operations related to Assets. The following are th
51
51
 
52
52
  Returns: A collection of ```Media``` class Object.
53
53
 
54
+ ### createFolder
55
+ | Parameter | Type | Description |
56
+ | :-------- | :------- | :------------------------- |
57
+ | `originKey` | `string` | The origin key of the requested folder. |
58
+ | `guid` | `string` | Current website guid.|
59
+
60
+ Returns: A collection of ```Media``` class Object.
61
+
54
62
  ### deleteFile
55
63
  | Parameter | Type | Description |
56
64
  | :-------- | :------- | :------------------------- |
@@ -77,6 +85,55 @@ Returns: An object of ```Media``` class with the new location of the file.
77
85
 
78
86
  Returns: An object of ```AssetMediaList``` class.
79
87
 
88
+ ### getGalleryById
89
+ | Parameter | Type | Description |
90
+ | :-------- | :------- | :------------------------- |
91
+ | `guid` | `string` | Current website guid.|
92
+ | `id` | `number` | The ID of the requested gallery.|
93
+
94
+ Returns: An object of ```assetMediaGrouping``` class.
95
+
96
+ ### getGalleryByName
97
+ | Parameter | Type | Description |
98
+ | :-------- | :------- | :------------------------- |
99
+ | `guid` | `string` | Current website guid.|
100
+ | `galleryName` | `string` | The name of the requested gallery.|
101
+
102
+ Returns: An object of ```assetMediaGrouping``` class.
103
+
104
+ ### getDefaultContainer
105
+ | Parameter | Type | Description |
106
+ | :-------- | :------- | :------------------------- |
107
+ | `guid` | `string` | Current website guid.|
108
+
109
+ Returns: An object of ```assetContainer``` class.
110
+
111
+ ### getGalleries
112
+ | Parameter | Type | Description |
113
+ | :-------- | :------- | :------------------------- |
114
+ | `guid` | `string` | Current website guid.|
115
+ | `search` | `string` | String to search a specific gallery item.|
116
+ | `pageSize` | `number` | The pageSize on which the galleries needs to be selected.|
117
+ | `rowIndex` | `number` | The rowIndex value for the resultant record set.|
118
+
119
+ Returns: An object of ```assetGalleries``` class.
120
+
121
+ ### saveGallery
122
+ | Parameter | Type | Description |
123
+ | :-------- | :------- | :------------------------- |
124
+ | `guid` | `string` | Current website guid.|
125
+ | `gallery` | `assetMediaGrouping` | Object of AssetMediaGrouping class.|
126
+
127
+ Returns: An object of ```assetMediaGrouping``` class.
128
+
129
+ ### deleteGallery
130
+ | Parameter | Type | Description |
131
+ | :-------- | :------- | :------------------------- |
132
+ | `guid` | `string` | Current website guid.|
133
+ | `id` | `number` | The id of the gallery to be deleted.|
134
+
135
+ A ```string``` response if the gallery has been deleted.
136
+
80
137
  ### getAssetByID
81
138
  | Parameter | Type | Description |
82
139
  | :-------- | :------- | :------------------------- |
@@ -1,6 +1,9 @@
1
1
  import { Options } from "../models/options";
2
2
  import { ClientInstance } from "./clientInstance";
3
3
  import { AssetMediaList, Media } from "../models/media";
4
+ import { assetGalleries } from "../models/assetGalleries";
5
+ import { assetMediaGrouping } from "../models/assetMediaGrouping";
6
+ import { assetContainer } from "../models/assetContainer";
4
7
  export declare class AssetMethods {
5
8
  _options: Options;
6
9
  _clientInstance: ClientInstance;
@@ -8,7 +11,14 @@ export declare class AssetMethods {
8
11
  deleteFile(mediaID: number, guid: string): Promise<string>;
9
12
  moveFile(mediaID: number, newFolder: string, guid: string): Promise<Media>;
10
13
  getMediaList(pageSize: number, recordOffset: number, guid: string): Promise<AssetMediaList>;
14
+ getGalleries(guid: string, search?: string, pageSize?: number, rowIndex?: number): Promise<assetGalleries>;
15
+ getGalleryById(guid: string, id: number): Promise<assetMediaGrouping>;
16
+ getGalleryByName(guid: string, galleryName: string): Promise<assetMediaGrouping>;
17
+ getDefaultContainer(guid: string): Promise<assetContainer>;
18
+ saveGallery(guid: string, gallery: assetMediaGrouping): Promise<assetMediaGrouping>;
19
+ deleteGallery(guid: string, id: number): Promise<string>;
11
20
  getAssetByID(mediaID: number, guid: string): Promise<Media>;
12
21
  getAssetByUrl(url: string, guid: string): Promise<Media>;
13
22
  upload(formData: FormData, agilityFolderPath: string, guid: string, groupingID?: number): Promise<Media[]>;
23
+ createFolder(originKey: string, guid: string): Promise<Media>;
14
24
  }
@@ -106,41 +106,164 @@ var AssetMethods = /** @class */ (function () {
106
106
  });
107
107
  });
108
108
  };
109
- AssetMethods.prototype.getAssetByID = function (mediaID, guid) {
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; }
110
113
  return __awaiter(this, void 0, void 0, function () {
111
114
  var apiPath, resp, err_4;
112
115
  return __generator(this, function (_a) {
113
116
  switch (_a.label) {
114
117
  case 0:
115
118
  _a.trys.push([0, 2, , 3]);
116
- apiPath = "asset/".concat(mediaID);
119
+ apiPath = "asset/galleries?search=".concat(search, "&pageSize=").concat(pageSize, "&rowIndex=").concat(rowIndex);
117
120
  return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
118
121
  case 1:
119
122
  resp = _a.sent();
120
123
  return [2 /*return*/, resp.data];
121
124
  case 2:
122
125
  err_4 = _a.sent();
123
- throw new exception_1.Exception("Unable to retrieve asset for mediaID ".concat(mediaID), err_4);
126
+ throw new exception_1.Exception("Unable to retrieve galleries for the website.", err_4);
124
127
  case 3: return [2 /*return*/];
125
128
  }
126
129
  });
127
130
  });
128
131
  };
129
- AssetMethods.prototype.getAssetByUrl = function (url, guid) {
132
+ AssetMethods.prototype.getGalleryById = function (guid, id) {
130
133
  return __awaiter(this, void 0, void 0, function () {
131
134
  var apiPath, resp, err_5;
132
135
  return __generator(this, function (_a) {
133
136
  switch (_a.label) {
134
137
  case 0:
135
138
  _a.trys.push([0, 2, , 3]);
136
- apiPath = "asset?url=".concat(url);
139
+ apiPath = "/asset/gallery/".concat(id);
137
140
  return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
138
141
  case 1:
139
142
  resp = _a.sent();
140
143
  return [2 /*return*/, resp.data];
141
144
  case 2:
142
145
  err_5 = _a.sent();
143
- throw new exception_1.Exception("Unable to retrieve asset for url ".concat(url), err_5);
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);
144
267
  case 3: return [2 /*return*/];
145
268
  }
146
269
  });
@@ -149,7 +272,7 @@ var AssetMethods = /** @class */ (function () {
149
272
  AssetMethods.prototype.upload = function (formData, agilityFolderPath, guid, groupingID) {
150
273
  if (groupingID === void 0) { groupingID = -1; }
151
274
  return __awaiter(this, void 0, void 0, function () {
152
- var apiPath, resp, err_6;
275
+ var apiPath, resp, err_12;
153
276
  return __generator(this, function (_a) {
154
277
  switch (_a.label) {
155
278
  case 0:
@@ -160,8 +283,28 @@ var AssetMethods = /** @class */ (function () {
160
283
  resp = _a.sent();
161
284
  return [2 /*return*/, resp.data];
162
285
  case 2:
163
- err_6 = _a.sent();
164
- throw new exception_1.Exception("Unable to upload media.", err_6);
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);
165
308
  case 3: return [2 /*return*/];
166
309
  }
167
310
  });
@@ -0,0 +1,3 @@
1
+ export declare enum AssetGroupingType {
2
+ Gallery = 1
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssetGroupingType = void 0;
4
+ var AssetGroupingType;
5
+ (function (AssetGroupingType) {
6
+ AssetGroupingType[AssetGroupingType["Gallery"] = 1] = "Gallery";
7
+ })(AssetGroupingType = exports.AssetGroupingType || (exports.AssetGroupingType = {}));
package/dist/index.d.ts CHANGED
@@ -11,4 +11,9 @@ export * from "./models/model";
11
11
  export * from "./models/notification";
12
12
  export * from "./models/pageItem";
13
13
  export * from "./models/sitemap";
14
+ export * from "./models/websiteUser";
15
+ export * from "./models/assetContainer";
16
+ export * from "./models/assetGalleries";
17
+ export * from "./models/assetMediaGrouping";
18
+ export * from "./models/assetMediaGroupingMetaData";
14
19
  export * from "./apiClient";
package/dist/index.js CHANGED
@@ -27,4 +27,9 @@ __exportStar(require("./models/model"), exports);
27
27
  __exportStar(require("./models/notification"), exports);
28
28
  __exportStar(require("./models/pageItem"), exports);
29
29
  __exportStar(require("./models/sitemap"), exports);
30
+ __exportStar(require("./models/websiteUser"), exports);
31
+ __exportStar(require("./models/assetContainer"), exports);
32
+ __exportStar(require("./models/assetGalleries"), exports);
33
+ __exportStar(require("./models/assetMediaGrouping"), exports);
34
+ __exportStar(require("./models/assetMediaGroupingMetaData"), exports);
30
35
  __exportStar(require("./apiClient"), exports);
@@ -0,0 +1,7 @@
1
+ export declare class assetContainer {
2
+ containerID: number | null;
3
+ isDefault: boolean;
4
+ containerName: string | null;
5
+ originUrl: string | null;
6
+ edgeUrl: string | null;
7
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assetContainer = void 0;
4
+ var assetContainer = /** @class */ (function () {
5
+ function assetContainer() {
6
+ }
7
+ return assetContainer;
8
+ }());
9
+ exports.assetContainer = assetContainer;
@@ -0,0 +1,5 @@
1
+ import { assetMediaGrouping } from "./assetMediaGrouping";
2
+ export declare class assetGalleries {
3
+ totalCount: number | null;
4
+ assetMediaGroupings: (assetMediaGrouping | null)[];
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assetGalleries = void 0;
4
+ var assetGalleries = /** @class */ (function () {
5
+ function assetGalleries() {
6
+ }
7
+ return assetGalleries;
8
+ }());
9
+ exports.assetGalleries = assetGalleries;
@@ -0,0 +1,17 @@
1
+ import { AssetGroupingType } from "../enums/assetGroupingType";
2
+ import { assetMediaGroupingMetaData } from "./assetMediaGroupingMetaData";
3
+ export declare class assetMediaGrouping {
4
+ mediaGroupingID: number | null;
5
+ groupingType: AssetGroupingType | null;
6
+ groupingTypeID: number | null;
7
+ name: string | null;
8
+ description: string | null;
9
+ modifiedBy: number | null;
10
+ modifiedByName: string | null;
11
+ modifiedOn: string | null;
12
+ isDeleted: boolean;
13
+ isFolder: boolean;
14
+ metaData: {
15
+ [key: string]: assetMediaGroupingMetaData;
16
+ };
17
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assetMediaGrouping = void 0;
4
+ var assetMediaGrouping = /** @class */ (function () {
5
+ function assetMediaGrouping() {
6
+ }
7
+ return assetMediaGrouping;
8
+ }());
9
+ exports.assetMediaGrouping = assetMediaGrouping;
@@ -0,0 +1,4 @@
1
+ export declare class assetMediaGroupingMetaData {
2
+ key: string;
3
+ value: string;
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assetMediaGroupingMetaData = void 0;
4
+ var assetMediaGroupingMetaData = /** @class */ (function () {
5
+ function assetMediaGroupingMetaData() {
6
+ }
7
+ return assetMediaGroupingMetaData;
8
+ }());
9
+ exports.assetMediaGroupingMetaData = assetMediaGroupingMetaData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/management-sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Agility CMS Tyescript SDK for Management API.",
5
5
  "repository": {
6
6
  "type": "git",