@agility/management-sdk 0.1.1 → 0.1.2

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.
Files changed (56) hide show
  1. package/README.md +395 -395
  2. package/dist/apiMethods/assetMethods.d.ts +14 -14
  3. package/dist/apiMethods/assetMethods.js +95 -95
  4. package/dist/apiMethods/batchMethods.d.ts +11 -11
  5. package/dist/apiMethods/batchMethods.js +65 -65
  6. package/dist/apiMethods/clientInstance.d.ts +8 -8
  7. package/dist/apiMethods/clientInstance.js +77 -77
  8. package/dist/apiMethods/containerMethods.d.ts +16 -16
  9. package/dist/apiMethods/containerMethods.js +105 -105
  10. package/dist/apiMethods/contentMethods.d.ts +20 -20
  11. package/dist/apiMethods/contentMethods.js +175 -175
  12. package/dist/apiMethods/instanceUserMethods.d.ts +13 -13
  13. package/dist/apiMethods/instanceUserMethods.js +57 -57
  14. package/dist/apiMethods/modelMethods.d.ts +13 -13
  15. package/dist/apiMethods/modelMethods.js +81 -81
  16. package/dist/apiMethods/pageMethods.d.ts +20 -20
  17. package/dist/apiMethods/pageMethods.js +159 -159
  18. package/dist/enums/batchOperationType.d.ts +19 -19
  19. package/dist/enums/batchOperationType.js +23 -23
  20. package/dist/enums/batchState..d.ts +7 -7
  21. package/dist/enums/batchState..js +11 -11
  22. package/dist/index.d.ts +21 -21
  23. package/dist/index.js +33 -37
  24. package/dist/models/batch.d.ts +29 -29
  25. package/dist/models/batch.js +6 -6
  26. package/dist/models/batchItem.d.ts +13 -13
  27. package/dist/models/batchItem.js +6 -6
  28. package/dist/models/container.d.ts +47 -47
  29. package/dist/models/container.js +6 -6
  30. package/dist/models/contentItem.d.ts +37 -37
  31. package/dist/models/contentItem.js +18 -18
  32. package/dist/models/contentViewColumn.d.ts +8 -8
  33. package/dist/models/contentViewColumn.js +6 -6
  34. package/dist/models/exception.d.ts +4 -4
  35. package/dist/models/exception.js +10 -10
  36. package/dist/models/instanceRole.d.ts +7 -7
  37. package/dist/models/instanceRole.js +6 -6
  38. package/dist/models/instanceUser.d.ts +14 -14
  39. package/dist/models/instanceUser.js +6 -6
  40. package/dist/models/media.d.ts +30 -30
  41. package/dist/models/media.js +9 -9
  42. package/dist/models/model.d.ts +30 -30
  43. package/dist/models/model.js +9 -9
  44. package/dist/models/notification.d.ts +13 -13
  45. package/dist/models/notification.js +6 -6
  46. package/dist/models/options.d.ts +10 -10
  47. package/dist/models/options.js +25 -25
  48. package/dist/models/pageItem.d.ts +56 -56
  49. package/dist/models/pageItem.js +21 -21
  50. package/dist/models/sitemap.d.ts +20 -20
  51. package/dist/models/sitemap.js +9 -9
  52. package/dist/models/websiteUser.d.ts +22 -22
  53. package/dist/models/websiteUser.js +9 -9
  54. package/license.txt +20 -20
  55. package/package.json +39 -39
  56. package/tsconfig.json +14 -14
@@ -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): 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,95 +1,95 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AssetMethods = void 0;
13
- const clientInstance_1 = require("./clientInstance");
14
- const exception_1 = require("../models/exception");
15
- class AssetMethods {
16
- constructor(options) {
17
- this._options = options;
18
- this._clientInstance = new clientInstance_1.ClientInstance();
19
- }
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
- }
31
- });
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
- }
44
- });
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
- }
56
- });
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
- }
68
- });
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
- }
80
- });
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
- }
92
- });
93
- }
94
- }
95
- 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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AssetMethods = void 0;
13
+ const clientInstance_1 = require("./clientInstance");
14
+ const exception_1 = require("../models/exception");
15
+ class AssetMethods {
16
+ constructor(options) {
17
+ this._options = options;
18
+ this._clientInstance = new clientInstance_1.ClientInstance();
19
+ }
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
+ }
31
+ });
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
+ }
44
+ });
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
+ }
56
+ });
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
+ }
68
+ });
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
+ }
80
+ });
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
+ }
92
+ });
93
+ }
94
+ }
95
+ 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): Promise<Batch>;
9
+ Retry(method: Function): Promise<Batch>;
10
+ delay(ms: number): Promise<unknown>;
11
+ }
@@ -1,65 +1,65 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- 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) {
18
- this._options = options;
19
- this._clientInstance = new clientInstance_1.ClientInstance();
20
- }
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
- }
31
- });
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 {
46
- --retryCount;
47
- if (--retryCount <= 0) {
48
- throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
49
- }
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.');
55
- }
56
- }
57
- });
58
- }
59
- delay(ms) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- return new Promise(resolve => setTimeout(resolve, ms));
62
- });
63
- }
64
- }
65
- exports.BatchMethods = BatchMethods;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ 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) {
18
+ this._options = options;
19
+ this._clientInstance = new clientInstance_1.ClientInstance();
20
+ }
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
+ }
31
+ });
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 {
46
+ --retryCount;
47
+ if (--retryCount <= 0) {
48
+ throw new Error('Timeout exceeded but operation still in progress. Please check the Batches page in the Agility Content Manager app.');
49
+ }
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.');
55
+ }
56
+ }
57
+ });
58
+ }
59
+ delay(ms) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ return new Promise(resolve => setTimeout(resolve, ms));
62
+ });
63
+ }
64
+ }
65
+ exports.BatchMethods = BatchMethods;
@@ -1,8 +1,8 @@
1
- import { AxiosInstance } from 'axios';
2
- import { Options } from "../models/options";
3
- export declare class ClientInstance {
4
- getInstance(options: Options): AxiosInstance;
5
- executeGet(apiPath: string, options: Options): Promise<import("axios").AxiosResponse<any, any>>;
6
- executeDelete(apiPath: string, options: Options): Promise<import("axios").AxiosResponse<any, any>>;
7
- executePost(apiPath: string, options: Options, data: any): Promise<import("axios").AxiosResponse<any, any>>;
8
- }
1
+ import { AxiosInstance } from 'axios';
2
+ import { Options } from "../models/options";
3
+ export declare class ClientInstance {
4
+ getInstance(options: Options): AxiosInstance;
5
+ executeGet(apiPath: string, options: Options): Promise<import("axios").AxiosResponse<any, any>>;
6
+ executeDelete(apiPath: string, options: Options): Promise<import("axios").AxiosResponse<any, any>>;
7
+ executePost(apiPath: string, options: Options, data: any): Promise<import("axios").AxiosResponse<any, any>>;
8
+ }
@@ -1,77 +1,77 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- 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}`
22
- });
23
- 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
- }
40
- });
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
- }
57
- });
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
- }
74
- });
75
- }
76
- }
77
- exports.ClientInstance = ClientInstance;
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ 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}`
22
+ });
23
+ 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
+ }
40
+ });
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
+ }
57
+ });
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
+ }
74
+ });
75
+ }
76
+ }
77
+ exports.ClientInstance = ClientInstance;
@@ -1,16 +1,16 @@
1
- import { Options } from "../models/options";
2
- import { ClientInstance } from "./clientInstance";
3
- import { Container } from "../models/container";
4
- import { Notification } from "../models/notification";
5
- export declare class ContainerMethods {
6
- _options: Options;
7
- _clientInstance: ClientInstance;
8
- constructor(options: Options);
9
- getContainerByID(id: number): Promise<Container>;
10
- getContainerByReferenceName(referenceName: string): Promise<Container>;
11
- getContainerSecurity(id: number): Promise<Container>;
12
- getContainerList(): Promise<Container[]>;
13
- getNotificationList(id: number): Promise<Notification[]>;
14
- saveContainer(container: Container): Promise<Container>;
15
- deleteContainer(id: number): Promise<string>;
16
- }
1
+ import { Options } from "../models/options";
2
+ import { ClientInstance } from "./clientInstance";
3
+ import { Container } from "../models/container";
4
+ import { Notification } from "../models/notification";
5
+ export declare class ContainerMethods {
6
+ _options: Options;
7
+ _clientInstance: ClientInstance;
8
+ constructor(options: Options);
9
+ getContainerByID(id: number): Promise<Container>;
10
+ getContainerByReferenceName(referenceName: string): Promise<Container>;
11
+ getContainerSecurity(id: number): Promise<Container>;
12
+ getContainerList(): Promise<Container[]>;
13
+ getNotificationList(id: number): Promise<Notification[]>;
14
+ saveContainer(container: Container): Promise<Container>;
15
+ deleteContainer(id: number): Promise<string>;
16
+ }