@agility/management-sdk 0.1.3 → 0.1.7
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 +459 -395
- package/dist/apiClient.d.ts +19 -0
- package/dist/apiClient.js +24 -0
- package/dist/apiMethods/apiClient.d.ts +19 -0
- package/dist/apiMethods/apiClient.js +24 -0
- package/dist/apiMethods/assetMethods.d.ts +14 -14
- package/dist/apiMethods/assetMethods.js +172 -172
- package/dist/apiMethods/batchMethods.d.ts +11 -11
- package/dist/apiMethods/batchMethods.js +117 -117
- package/dist/apiMethods/clientInstance.d.ts +8 -8
- package/dist/apiMethods/clientInstance.js +156 -137
- 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 +13 -13
- package/dist/apiMethods/modelMethods.js +150 -150
- package/dist/apiMethods/pageMethods.d.ts +20 -20
- package/dist/apiMethods/pageMethods.js +323 -323
- 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 +14 -21
- package/dist/index.js +30 -33
- 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 +28 -26
- 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 -10
- package/dist/models/options.js +9 -28
- 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/dist/src/apiMethods/assetMethods.d.ts +14 -0
- package/dist/src/apiMethods/assetMethods.js +172 -0
- package/dist/src/apiMethods/batchMethods.d.ts +11 -0
- package/dist/src/apiMethods/batchMethods.js +117 -0
- package/dist/src/apiMethods/clientInstance.d.ts +8 -0
- package/dist/src/apiMethods/clientInstance.js +156 -0
- package/dist/src/apiMethods/containerMethods.d.ts +16 -0
- package/dist/src/apiMethods/containerMethods.js +189 -0
- package/dist/src/apiMethods/contentMethods.d.ts +20 -0
- package/dist/src/apiMethods/contentMethods.js +359 -0
- package/dist/src/apiMethods/instanceUserMethods.d.ts +13 -0
- package/dist/src/apiMethods/instanceUserMethods.js +111 -0
- package/dist/src/apiMethods/modelMethods.d.ts +13 -0
- package/dist/src/apiMethods/modelMethods.js +150 -0
- package/dist/src/apiMethods/pageMethods.d.ts +20 -0
- package/dist/src/apiMethods/pageMethods.js +323 -0
- package/dist/src/enums/batchOperationType.d.ts +19 -0
- package/dist/src/enums/batchOperationType.js +23 -0
- package/dist/src/enums/batchState..d.ts +7 -0
- package/dist/src/enums/batchState..js +11 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +30 -0
- package/dist/src/models/batch.d.ts +29 -0
- package/dist/src/models/batch.js +9 -0
- package/dist/src/models/batchItem.d.ts +13 -0
- package/dist/src/models/batchItem.js +9 -0
- package/dist/src/models/container.d.ts +47 -0
- package/dist/src/models/container.js +9 -0
- package/dist/src/models/contentItem.d.ts +37 -0
- package/dist/src/models/contentItem.js +33 -0
- package/dist/src/models/contentViewColumn.d.ts +8 -0
- package/dist/src/models/contentViewColumn.js +9 -0
- package/dist/src/models/exception.d.ts +4 -0
- package/dist/src/models/exception.js +28 -0
- package/dist/src/models/instanceRole.d.ts +7 -0
- package/dist/src/models/instanceRole.js +9 -0
- package/dist/src/models/instanceUser.d.ts +14 -0
- package/dist/src/models/instanceUser.js +9 -0
- package/dist/src/models/media.d.ts +30 -0
- package/dist/src/models/media.js +15 -0
- package/dist/src/models/model.d.ts +30 -0
- package/dist/src/models/model.js +15 -0
- package/dist/src/models/notification.d.ts +13 -0
- package/dist/src/models/notification.js +9 -0
- package/dist/src/models/options.d.ts +7 -0
- package/dist/src/models/options.js +9 -0
- package/dist/src/models/pageItem.d.ts +56 -0
- package/dist/src/models/pageItem.js +39 -0
- package/dist/src/models/sitemap.d.ts +20 -0
- package/dist/src/models/sitemap.js +15 -0
- package/dist/src/models/websiteUser.d.ts +22 -0
- package/dist/src/models/websiteUser.js +15 -0
- package/license.txt +20 -20
- package/package.json +39 -39
- package/tsconfig.json +14 -14
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ContentMethods } from "./apiMethods/contentMethods";
|
|
2
|
+
import { AssetMethods } from "./apiMethods/assetMethods";
|
|
3
|
+
import { BatchMethods } from "./apiMethods/batchMethods";
|
|
4
|
+
import { ContainerMethods } from "./apiMethods/containerMethods";
|
|
5
|
+
import { InstanceUserMethods } from "./apiMethods/instanceUserMethods";
|
|
6
|
+
import { ModelMethods } from "./apiMethods/modelMethods";
|
|
7
|
+
import { PageMethods } from "./apiMethods/pageMethods";
|
|
8
|
+
import { Options } from "./models/options";
|
|
9
|
+
export declare class ApiClient {
|
|
10
|
+
_options: Options;
|
|
11
|
+
contentMethods: ContentMethods;
|
|
12
|
+
assetMethods: AssetMethods;
|
|
13
|
+
batchMethods: BatchMethods;
|
|
14
|
+
containerMethods: ContainerMethods;
|
|
15
|
+
instanceUserMethods: InstanceUserMethods;
|
|
16
|
+
modelMethods: ModelMethods;
|
|
17
|
+
pageMethods: PageMethods;
|
|
18
|
+
constructor(options: Options);
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiClient = void 0;
|
|
4
|
+
var contentMethods_1 = require("./apiMethods/contentMethods");
|
|
5
|
+
var assetMethods_1 = require("./apiMethods/assetMethods");
|
|
6
|
+
var batchMethods_1 = require("./apiMethods/batchMethods");
|
|
7
|
+
var containerMethods_1 = require("./apiMethods/containerMethods");
|
|
8
|
+
var instanceUserMethods_1 = require("./apiMethods/instanceUserMethods");
|
|
9
|
+
var modelMethods_1 = require("./apiMethods/modelMethods");
|
|
10
|
+
var pageMethods_1 = require("./apiMethods/pageMethods");
|
|
11
|
+
var ApiClient = /** @class */ (function () {
|
|
12
|
+
function ApiClient(options) {
|
|
13
|
+
this._options = options;
|
|
14
|
+
this.contentMethods = new contentMethods_1.ContentMethods(this._options);
|
|
15
|
+
this.assetMethods = new assetMethods_1.AssetMethods(this._options);
|
|
16
|
+
this.batchMethods = new batchMethods_1.BatchMethods(this._options);
|
|
17
|
+
this.containerMethods = new containerMethods_1.ContainerMethods(this._options);
|
|
18
|
+
this.instanceUserMethods = new instanceUserMethods_1.InstanceUserMethods(this._options);
|
|
19
|
+
this.modelMethods = new modelMethods_1.ModelMethods(this._options);
|
|
20
|
+
this.pageMethods = new pageMethods_1.PageMethods(this._options);
|
|
21
|
+
}
|
|
22
|
+
return ApiClient;
|
|
23
|
+
}());
|
|
24
|
+
exports.ApiClient = ApiClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ContentMethods } from "./contentMethods";
|
|
2
|
+
import { AssetMethods } from "./assetMethods";
|
|
3
|
+
import { BatchMethods } from "./batchMethods";
|
|
4
|
+
import { ContainerMethods } from "./containerMethods";
|
|
5
|
+
import { InstanceUserMethods } from "./instanceUserMethods";
|
|
6
|
+
import { ModelMethods } from "./modelMethods";
|
|
7
|
+
import { PageMethods } from "./pageMethods";
|
|
8
|
+
import { Options } from "../models/options";
|
|
9
|
+
export declare class ApiClient {
|
|
10
|
+
_options: Options;
|
|
11
|
+
contentMethods: ContentMethods;
|
|
12
|
+
assetMethods: AssetMethods;
|
|
13
|
+
batchMethods: BatchMethods;
|
|
14
|
+
containerMethods: ContainerMethods;
|
|
15
|
+
instanceUserMethods: InstanceUserMethods;
|
|
16
|
+
modelMethods: ModelMethods;
|
|
17
|
+
pageMethods: PageMethods;
|
|
18
|
+
constructor(options: Options);
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiClient = void 0;
|
|
4
|
+
var contentMethods_1 = require("./contentMethods");
|
|
5
|
+
var assetMethods_1 = require("./assetMethods");
|
|
6
|
+
var batchMethods_1 = require("./batchMethods");
|
|
7
|
+
var containerMethods_1 = require("./containerMethods");
|
|
8
|
+
var instanceUserMethods_1 = require("./instanceUserMethods");
|
|
9
|
+
var modelMethods_1 = require("./modelMethods");
|
|
10
|
+
var pageMethods_1 = require("./pageMethods");
|
|
11
|
+
var ApiClient = /** @class */ (function () {
|
|
12
|
+
function ApiClient(options) {
|
|
13
|
+
this._options = options;
|
|
14
|
+
this.contentMethods = new contentMethods_1.ContentMethods(this._options);
|
|
15
|
+
this.assetMethods = new assetMethods_1.AssetMethods(this._options);
|
|
16
|
+
this.batchMethods = new batchMethods_1.BatchMethods(this._options);
|
|
17
|
+
this.containerMethods = new containerMethods_1.ContainerMethods(this._options);
|
|
18
|
+
this.instanceUserMethods = new instanceUserMethods_1.InstanceUserMethods(this._options);
|
|
19
|
+
this.modelMethods = new modelMethods_1.ModelMethods(this._options);
|
|
20
|
+
this.pageMethods = new pageMethods_1.PageMethods(this._options);
|
|
21
|
+
}
|
|
22
|
+
return ApiClient;
|
|
23
|
+
}());
|
|
24
|
+
exports.ApiClient = ApiClient;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Options } from "../models/options";
|
|
2
|
-
import { ClientInstance } from "./clientInstance";
|
|
3
|
-
import { AssetMediaList, Media } from "../models/media";
|
|
4
|
-
export declare class AssetMethods {
|
|
5
|
-
_options: Options;
|
|
6
|
-
_clientInstance: ClientInstance;
|
|
7
|
-
constructor(options: Options);
|
|
8
|
-
deleteFile(mediaID: number): Promise<string>;
|
|
9
|
-
moveFile(mediaID: number, newFolder: string): Promise<Media>;
|
|
10
|
-
getMediaList(pageSize: number, recordOffset: number): Promise<AssetMediaList>;
|
|
11
|
-
getAssetByID(mediaID: number): Promise<Media>;
|
|
12
|
-
getAssetByUrl(url: string): Promise<Media>;
|
|
13
|
-
upload(formData: FormData, agilityFolderPath: string, groupingID?: number): Promise<Media[]>;
|
|
14
|
-
}
|
|
1
|
+
import { Options } from "../models/options";
|
|
2
|
+
import { ClientInstance } from "./clientInstance";
|
|
3
|
+
import { AssetMediaList, Media } from "../models/media";
|
|
4
|
+
export declare class AssetMethods {
|
|
5
|
+
_options: Options;
|
|
6
|
+
_clientInstance: ClientInstance;
|
|
7
|
+
constructor(options: Options);
|
|
8
|
+
deleteFile(mediaID: number, guid: string): Promise<string>;
|
|
9
|
+
moveFile(mediaID: number, newFolder: string, guid: string): Promise<Media>;
|
|
10
|
+
getMediaList(pageSize: number, recordOffset: number, guid: string): Promise<AssetMediaList>;
|
|
11
|
+
getAssetByID(mediaID: number, guid: string): Promise<Media>;
|
|
12
|
+
getAssetByUrl(url: string, guid: string): Promise<Media>;
|
|
13
|
+
upload(formData: FormData, agilityFolderPath: string, guid: string, groupingID?: number): Promise<Media[]>;
|
|
14
|
+
}
|
|
@@ -1,172 +1,172 @@
|
|
|
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.AssetMethods = void 0;
|
|
40
|
-
var clientInstance_1 = require("./clientInstance");
|
|
41
|
-
var exception_1 = require("../models/exception");
|
|
42
|
-
var AssetMethods = /** @class */ (function () {
|
|
43
|
-
function AssetMethods(options) {
|
|
44
|
-
this._options = options;
|
|
45
|
-
this._clientInstance = new clientInstance_1.ClientInstance();
|
|
46
|
-
}
|
|
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/"
|
|
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: "
|
|
63
|
-
case 3: return [2 /*return*/];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
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/"
|
|
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: "
|
|
84
|
-
case 3: return [2 /*return*/];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
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="
|
|
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
|
-
});
|
|
107
|
-
});
|
|
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/"
|
|
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 "
|
|
124
|
-
case 3: return [2 /*return*/];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
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="
|
|
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 "
|
|
144
|
-
case 3: return [2 /*return*/];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
});
|
|
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="
|
|
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
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
return AssetMethods;
|
|
171
|
-
}());
|
|
172
|
-
exports.AssetMethods = AssetMethods;
|
|
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.AssetMethods = void 0;
|
|
40
|
+
var clientInstance_1 = require("./clientInstance");
|
|
41
|
+
var exception_1 = require("../models/exception");
|
|
42
|
+
var AssetMethods = /** @class */ (function () {
|
|
43
|
+
function AssetMethods(options) {
|
|
44
|
+
this._options = options;
|
|
45
|
+
this._clientInstance = new clientInstance_1.ClientInstance();
|
|
46
|
+
}
|
|
47
|
+
AssetMethods.prototype.deleteFile = function (mediaID, 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 = "asset/delete/".concat(mediaID);
|
|
55
|
+
return [4 /*yield*/, this._clientInstance.executeDelete(apiPath, guid, this._options.token)];
|
|
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: ".concat(mediaID), err_1);
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
AssetMethods.prototype.moveFile = function (mediaID, newFolder, guid) {
|
|
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/".concat(mediaID, "?newFolder=").concat(folder);
|
|
77
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, 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: ".concat(mediaID), err_2);
|
|
84
|
+
case 3: return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
AssetMethods.prototype.getMediaList = function (pageSize, recordOffset, 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 = "asset/list?pageSize=".concat(pageSize, "&recordOffset=").concat(recordOffset);
|
|
97
|
+
return [4 /*yield*/, this._clientInstance.executeGet(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 retrieve assets for the website.", err_3);
|
|
104
|
+
case 3: return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
AssetMethods.prototype.getAssetByID = function (mediaID, guid) {
|
|
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/".concat(mediaID);
|
|
117
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
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 ".concat(mediaID), err_4);
|
|
124
|
+
case 3: return [2 /*return*/];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
AssetMethods.prototype.getAssetByUrl = function (url, guid) {
|
|
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=".concat(url);
|
|
137
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
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 ".concat(url), err_5);
|
|
144
|
+
case 3: return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
AssetMethods.prototype.upload = function (formData, agilityFolderPath, guid, 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=".concat(agilityFolderPath, "&groupingID=").concat(groupingID);
|
|
158
|
+
return [4 /*yield*/, this._clientInstance.executePost(apiPath, guid, this._options.token, 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
|
+
});
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
return AssetMethods;
|
|
171
|
+
}());
|
|
172
|
+
exports.AssetMethods = AssetMethods;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Options } from "../models/options";
|
|
2
|
-
import { ClientInstance } from "./clientInstance";
|
|
3
|
-
import { Batch } from "../models/batch";
|
|
4
|
-
export declare class BatchMethods {
|
|
5
|
-
_options: Options;
|
|
6
|
-
_clientInstance: ClientInstance;
|
|
7
|
-
constructor(options: Options);
|
|
8
|
-
getBatch(batchID: number): Promise<Batch>;
|
|
9
|
-
Retry(method: Function): Promise<Batch>;
|
|
10
|
-
delay(ms: number): Promise<unknown>;
|
|
11
|
-
}
|
|
1
|
+
import { Options } from "../models/options";
|
|
2
|
+
import { ClientInstance } from "./clientInstance";
|
|
3
|
+
import { Batch } from "../models/batch";
|
|
4
|
+
export declare class BatchMethods {
|
|
5
|
+
_options: Options;
|
|
6
|
+
_clientInstance: ClientInstance;
|
|
7
|
+
constructor(options: Options);
|
|
8
|
+
getBatch(batchID: number, guid: string): Promise<Batch>;
|
|
9
|
+
Retry(method: Function): Promise<Batch>;
|
|
10
|
+
delay(ms: number): Promise<unknown>;
|
|
11
|
+
}
|