@agility/management-sdk 0.1.2 → 0.1.3

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.
@@ -8,88 +8,165 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
+ };
11
38
  Object.defineProperty(exports, "__esModule", { value: true });
12
39
  exports.AssetMethods = void 0;
13
- const clientInstance_1 = require("./clientInstance");
14
- const exception_1 = require("../models/exception");
15
- class AssetMethods {
16
- constructor(options) {
40
+ var clientInstance_1 = require("./clientInstance");
41
+ var exception_1 = require("../models/exception");
42
+ var AssetMethods = /** @class */ (function () {
43
+ function AssetMethods(options) {
17
44
  this._options = options;
18
45
  this._clientInstance = new clientInstance_1.ClientInstance();
19
46
  }
20
- deleteFile(mediaID) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- try {
23
- let apiPath = `asset/delete/${mediaID}`;
24
- const resp = yield this._clientInstance.executeDelete(apiPath, this._options);
25
- ;
26
- return resp.data;
27
- }
28
- catch (err) {
29
- throw new exception_1.Exception(`Unable to delete the media for mediaID: ${mediaID}`, err);
30
- }
47
+ AssetMethods.prototype.deleteFile = function (mediaID) {
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var apiPath, resp, err_1;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0:
53
+ _a.trys.push([0, 2, , 3]);
54
+ apiPath = "asset/delete/" + mediaID;
55
+ return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, this._options)];
56
+ case 1:
57
+ resp = _a.sent();
58
+ ;
59
+ return [2 /*return*/, resp.data];
60
+ case 2:
61
+ err_1 = _a.sent();
62
+ throw new exception_1.Exception("Unable to delete the media for mediaID: " + mediaID, err_1);
63
+ case 3: return [2 /*return*/];
64
+ }
65
+ });
31
66
  });
32
- }
33
- moveFile(mediaID, newFolder) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- try {
36
- let folder = encodeURIComponent(newFolder);
37
- let apiPath = `asset/move/${mediaID}?newFolder=${folder}`;
38
- const resp = yield this._clientInstance.executePost(apiPath, this._options, null);
39
- return resp.data;
40
- }
41
- catch (err) {
42
- throw new exception_1.Exception(`Unable to move the media for mediaID: ${mediaID}`, err);
43
- }
67
+ };
68
+ AssetMethods.prototype.moveFile = function (mediaID, newFolder) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var folder, apiPath, resp, err_2;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0:
74
+ _a.trys.push([0, 2, , 3]);
75
+ folder = encodeURIComponent(newFolder);
76
+ apiPath = "asset/move/" + mediaID + "?newFolder=" + folder;
77
+ return [4 /*yield*/, this._clientInstance.executePost(apiPath, this._options, null)];
78
+ case 1:
79
+ resp = _a.sent();
80
+ return [2 /*return*/, resp.data];
81
+ case 2:
82
+ err_2 = _a.sent();
83
+ throw new exception_1.Exception("Unable to move the media for mediaID: " + mediaID, err_2);
84
+ case 3: return [2 /*return*/];
85
+ }
86
+ });
44
87
  });
45
- }
46
- getMediaList(pageSize, recordOffset) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- try {
49
- let apiPath = `asset/list?pageSize=${pageSize}&recordOffset=${recordOffset}`;
50
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
51
- return resp.data;
52
- }
53
- catch (err) {
54
- throw new exception_1.Exception(`Unable to retrieve assets for the website.`, err);
55
- }
88
+ };
89
+ AssetMethods.prototype.getMediaList = function (pageSize, recordOffset) {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var apiPath, resp, err_3;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0:
95
+ _a.trys.push([0, 2, , 3]);
96
+ apiPath = "asset/list?pageSize=" + pageSize + "&recordOffset=" + recordOffset;
97
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
98
+ case 1:
99
+ resp = _a.sent();
100
+ return [2 /*return*/, resp.data];
101
+ case 2:
102
+ err_3 = _a.sent();
103
+ throw new exception_1.Exception("Unable to retrieve assets for the website.", err_3);
104
+ case 3: return [2 /*return*/];
105
+ }
106
+ });
56
107
  });
57
- }
58
- getAssetByID(mediaID) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- try {
61
- let apiPath = `asset/${mediaID}`;
62
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
63
- return resp.data;
64
- }
65
- catch (err) {
66
- throw new exception_1.Exception(`Unable to retrieve asset for mediaID ${mediaID}`, err);
67
- }
108
+ };
109
+ AssetMethods.prototype.getAssetByID = function (mediaID) {
110
+ return __awaiter(this, void 0, void 0, function () {
111
+ var apiPath, resp, err_4;
112
+ return __generator(this, function (_a) {
113
+ switch (_a.label) {
114
+ case 0:
115
+ _a.trys.push([0, 2, , 3]);
116
+ apiPath = "asset/" + mediaID;
117
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
118
+ case 1:
119
+ resp = _a.sent();
120
+ return [2 /*return*/, resp.data];
121
+ case 2:
122
+ err_4 = _a.sent();
123
+ throw new exception_1.Exception("Unable to retrieve asset for mediaID " + mediaID, err_4);
124
+ case 3: return [2 /*return*/];
125
+ }
126
+ });
68
127
  });
69
- }
70
- getAssetByUrl(url) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- try {
73
- let apiPath = `asset?url=${url}`;
74
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
75
- return resp.data;
76
- }
77
- catch (err) {
78
- throw new exception_1.Exception(`Unable to retrieve asset for url ${url}`, err);
79
- }
128
+ };
129
+ AssetMethods.prototype.getAssetByUrl = function (url) {
130
+ return __awaiter(this, void 0, void 0, function () {
131
+ var apiPath, resp, err_5;
132
+ return __generator(this, function (_a) {
133
+ switch (_a.label) {
134
+ case 0:
135
+ _a.trys.push([0, 2, , 3]);
136
+ apiPath = "asset?url=" + url;
137
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
138
+ case 1:
139
+ resp = _a.sent();
140
+ return [2 /*return*/, resp.data];
141
+ case 2:
142
+ err_5 = _a.sent();
143
+ throw new exception_1.Exception("Unable to retrieve asset for url " + url, err_5);
144
+ case 3: return [2 /*return*/];
145
+ }
146
+ });
80
147
  });
81
- }
82
- upload(formData, agilityFolderPath, groupingID = -1) {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- try {
85
- let apiPath = `asset/upload?folderPath=${agilityFolderPath}&groupingID=${groupingID}`;
86
- const resp = yield this._clientInstance.executePost(apiPath, this._options, formData);
87
- return resp.data;
88
- }
89
- catch (err) {
90
- throw new exception_1.Exception(`Unable to upload media.`, err);
91
- }
148
+ };
149
+ AssetMethods.prototype.upload = function (formData, agilityFolderPath, groupingID) {
150
+ if (groupingID === void 0) { groupingID = -1; }
151
+ return __awaiter(this, void 0, void 0, function () {
152
+ var apiPath, resp, err_6;
153
+ return __generator(this, function (_a) {
154
+ switch (_a.label) {
155
+ case 0:
156
+ _a.trys.push([0, 2, , 3]);
157
+ apiPath = "asset/upload?folderPath=" + agilityFolderPath + "&groupingID=" + groupingID;
158
+ return [4 /*yield*/, this._clientInstance.executePost(apiPath, this._options, formData)];
159
+ case 1:
160
+ resp = _a.sent();
161
+ return [2 /*return*/, resp.data];
162
+ case 2:
163
+ err_6 = _a.sent();
164
+ throw new exception_1.Exception("Unable to upload media.", err_6);
165
+ case 3: return [2 /*return*/];
166
+ }
167
+ });
92
168
  });
93
- }
94
- }
169
+ };
170
+ return AssetMethods;
171
+ }());
95
172
  exports.AssetMethods = AssetMethods;
@@ -8,58 +8,110 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
+ };
11
38
  Object.defineProperty(exports, "__esModule", { value: true });
12
39
  exports.BatchMethods = void 0;
13
- const clientInstance_1 = require("./clientInstance");
14
- const batchState_1 = require("../enums/batchState.");
15
- const exception_1 = require("../models/exception");
16
- class BatchMethods {
17
- constructor(options) {
40
+ var clientInstance_1 = require("./clientInstance");
41
+ var batchState_1 = require("../enums/batchState.");
42
+ var exception_1 = require("../models/exception");
43
+ var BatchMethods = /** @class */ (function () {
44
+ function BatchMethods(options) {
18
45
  this._options = options;
19
46
  this._clientInstance = new clientInstance_1.ClientInstance();
20
47
  }
21
- getBatch(batchID) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- try {
24
- let apiPath = `batch/${batchID}`;
25
- const resp = yield this._clientInstance.executeGet(apiPath, this._options);
26
- return resp.data;
27
- }
28
- catch (err) {
29
- throw new exception_1.Exception(`Unable to retreive the batch for id: ${batchID}`, err);
30
- }
48
+ BatchMethods.prototype.getBatch = function (batchID) {
49
+ return __awaiter(this, void 0, void 0, function () {
50
+ var apiPath, resp, err_1;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0:
54
+ _a.trys.push([0, 2, , 3]);
55
+ apiPath = "batch/" + batchID;
56
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, this._options)];
57
+ case 1:
58
+ resp = _a.sent();
59
+ return [2 /*return*/, resp.data];
60
+ case 2:
61
+ err_1 = _a.sent();
62
+ throw new exception_1.Exception("Unable to retreive the batch for id: " + batchID, err_1);
63
+ case 3: return [2 /*return*/];
64
+ }
65
+ });
31
66
  });
32
- }
33
- Retry(method) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- let retryCount = this._options.retryCount;
36
- let duration = this._options.duration;
37
- if (retryCount <= 0)
38
- throw new Error('Number of retries has been exhausted.');
39
- while (true) {
40
- try {
41
- let batch = yield method();
42
- if (batch.batchState === batchState_1.BatchState.Processed) {
43
- return batch;
44
- }
45
- else {
67
+ };
68
+ BatchMethods.prototype.Retry = function (method) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var retryCount, duration, batch, err_2;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0:
74
+ retryCount = this._options.retryCount;
75
+ duration = this._options.duration;
76
+ if (retryCount <= 0)
77
+ throw new Error('Number of retries has been exhausted.');
78
+ _a.label = 1;
79
+ case 1:
80
+ if (!true) return [3 /*break*/, 9];
81
+ _a.label = 2;
82
+ case 2:
83
+ _a.trys.push([2, 7, , 8]);
84
+ return [4 /*yield*/, method()];
85
+ case 3:
86
+ batch = _a.sent();
87
+ if (!(batch.batchState === batchState_1.BatchState.Processed)) return [3 /*break*/, 4];
88
+ return [2 /*return*/, batch];
89
+ case 4:
46
90
  --retryCount;
47
91
  if (--retryCount <= 0) {
48
92
  throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
49
93
  }
50
- yield this.delay(duration);
51
- }
52
- }
53
- catch (err) {
54
- throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
94
+ return [4 /*yield*/, this.delay(duration)];
95
+ case 5:
96
+ _a.sent();
97
+ _a.label = 6;
98
+ case 6: return [3 /*break*/, 8];
99
+ case 7:
100
+ err_2 = _a.sent();
101
+ throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
102
+ case 8: return [3 /*break*/, 1];
103
+ case 9: return [2 /*return*/];
55
104
  }
56
- }
105
+ });
57
106
  });
58
- }
59
- delay(ms) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- return new Promise(resolve => setTimeout(resolve, ms));
107
+ };
108
+ BatchMethods.prototype.delay = function (ms) {
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ return __generator(this, function (_a) {
111
+ return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
112
+ });
62
113
  });
63
- }
64
- }
114
+ };
115
+ return BatchMethods;
116
+ }());
65
117
  exports.BatchMethods = BatchMethods;
@@ -8,70 +8,130 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
+ };
11
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
40
  };
14
41
  Object.defineProperty(exports, "__esModule", { value: true });
15
42
  exports.ClientInstance = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- class ClientInstance {
18
- getInstance(options) {
19
- let baseUrl = options.determineBaseUrl(options.guid);
20
- let instance = axios_1.default.create({
21
- baseURL: `${baseUrl}/api/v1/instance/${options.guid}`
43
+ var axios_1 = __importDefault(require("axios"));
44
+ var ClientInstance = /** @class */ (function () {
45
+ function ClientInstance() {
46
+ }
47
+ ClientInstance.prototype.getInstance = function (options) {
48
+ var baseUrl = options.determineBaseUrl(options.guid);
49
+ var instance = axios_1.default.create({
50
+ baseURL: baseUrl + "/api/v1/instance/" + options.guid
22
51
  });
23
52
  return instance;
24
- }
25
- executeGet(apiPath, options) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- let instance = this.getInstance(options);
28
- try {
29
- const resp = yield instance.get(apiPath, {
30
- headers: {
31
- 'Authorization': `Bearer ${options.token}`,
32
- 'Cache-Control': 'no-cache'
33
- }
34
- });
35
- return resp;
36
- }
37
- catch (err) {
38
- throw err;
39
- }
53
+ };
54
+ ClientInstance.prototype.executeGet = function (apiPath, options) {
55
+ return __awaiter(this, void 0, void 0, function () {
56
+ var instance, resp, err_1;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0:
60
+ instance = this.getInstance(options);
61
+ _a.label = 1;
62
+ case 1:
63
+ _a.trys.push([1, 3, , 4]);
64
+ return [4 /*yield*/, instance.get(apiPath, {
65
+ headers: {
66
+ 'Authorization': "Bearer " + options.token,
67
+ 'Cache-Control': 'no-cache'
68
+ }
69
+ })];
70
+ case 2:
71
+ resp = _a.sent();
72
+ return [2 /*return*/, resp];
73
+ case 3:
74
+ err_1 = _a.sent();
75
+ throw err_1;
76
+ case 4: return [2 /*return*/];
77
+ }
78
+ });
40
79
  });
41
- }
42
- executeDelete(apiPath, options) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- let instance = this.getInstance(options);
45
- try {
46
- const resp = yield instance.delete(apiPath, {
47
- headers: {
48
- 'Authorization': `Bearer ${options.token}`,
49
- 'Cache-Control': 'no-cache'
50
- }
51
- });
52
- return resp;
53
- }
54
- catch (err) {
55
- throw err;
56
- }
80
+ };
81
+ ClientInstance.prototype.executeDelete = function (apiPath, options) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var instance, resp, err_2;
84
+ return __generator(this, function (_a) {
85
+ switch (_a.label) {
86
+ case 0:
87
+ instance = this.getInstance(options);
88
+ _a.label = 1;
89
+ case 1:
90
+ _a.trys.push([1, 3, , 4]);
91
+ return [4 /*yield*/, instance.delete(apiPath, {
92
+ headers: {
93
+ 'Authorization': "Bearer " + options.token,
94
+ 'Cache-Control': 'no-cache'
95
+ }
96
+ })];
97
+ case 2:
98
+ resp = _a.sent();
99
+ return [2 /*return*/, resp];
100
+ case 3:
101
+ err_2 = _a.sent();
102
+ throw err_2;
103
+ case 4: return [2 /*return*/];
104
+ }
105
+ });
57
106
  });
58
- }
59
- executePost(apiPath, options, data) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- let instance = this.getInstance(options);
62
- try {
63
- const resp = yield instance.post(apiPath, data, {
64
- headers: {
65
- 'Authorization': `Bearer ${options.token}`,
66
- 'Cache-Control': 'no-cache'
67
- }
68
- });
69
- return resp;
70
- }
71
- catch (err) {
72
- throw err;
73
- }
107
+ };
108
+ ClientInstance.prototype.executePost = function (apiPath, options, data) {
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ var instance, resp, err_3;
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0:
114
+ instance = this.getInstance(options);
115
+ _a.label = 1;
116
+ case 1:
117
+ _a.trys.push([1, 3, , 4]);
118
+ return [4 /*yield*/, instance.post(apiPath, data, {
119
+ headers: {
120
+ 'Authorization': "Bearer " + options.token,
121
+ 'Cache-Control': 'no-cache'
122
+ }
123
+ })];
124
+ case 2:
125
+ resp = _a.sent();
126
+ return [2 /*return*/, resp];
127
+ case 3:
128
+ err_3 = _a.sent();
129
+ throw err_3;
130
+ case 4: return [2 /*return*/];
131
+ }
132
+ });
74
133
  });
75
- }
76
- }
134
+ };
135
+ return ClientInstance;
136
+ }());
77
137
  exports.ClientInstance = ClientInstance;