@agility/management-sdk 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -303,6 +303,12 @@ This class is used to perform operations related to Models. The following are th
303
303
 
304
304
  Returns: An object of ```Model``` class.
305
305
 
306
+ ### GetModelByReferenceName
307
+ | Parameter | Type | Description |
308
+ | :-------- | :------- | :------------------------- |
309
+ | `referenceName` | `string` | The referenceName of the requested model.|
310
+ | `guid` | `string` | The guid of the requested model.|
311
+
306
312
  ### getContentModules
307
313
  | Parameter | Type | Description |
308
314
  | :-------- | :------- | :------------------------- |
@@ -52,13 +52,13 @@ var ClientInstance = /** @class */ (function () {
52
52
  else if (seperator[1] === 'u') {
53
53
  return "https://mgmt.aglty.io";
54
54
  }
55
- else if (seperator[1] === 'ca') {
55
+ else if (seperator[1] === 'c') {
56
56
  return "https://mgmt-ca.aglty.io";
57
57
  }
58
- else if (seperator[1] === 'eu') {
59
- return "https://mgmt-aus.aglty.io";
58
+ else if (seperator[1] === 'e') {
59
+ return "https://mgmt-eu.aglty.io";
60
60
  }
61
- else if (seperator[1] === 'aus') {
61
+ else if (seperator[1] === 'a') {
62
62
  return "https://mgmt-aus.aglty.io";
63
63
  }
64
64
  return "https://mgmt.aglty.io";
@@ -6,6 +6,7 @@ export declare class ModelMethods {
6
6
  _clientInstance: ClientInstance;
7
7
  constructor(options: Options);
8
8
  getContentModel(id: number, guid: string): Promise<Model>;
9
+ getModelByReferenceName(referenceName: string, guid: string): Promise<Model>;
9
10
  getContentModules(includeDefaults: boolean, guid: string, includeModules?: boolean): Promise<Model[]>;
10
11
  getPageModules(includeDefault: boolean, guid: string): Promise<Model[]>;
11
12
  saveModel(model: Model, guid: string): Promise<Model>;
@@ -64,10 +64,30 @@ var ModelMethods = /** @class */ (function () {
64
64
  });
65
65
  });
66
66
  };
67
+ ModelMethods.prototype.getModelByReferenceName = function (referenceName, guid) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var apiPath, resp, err_2;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ _a.trys.push([0, 2, , 3]);
74
+ apiPath = "model/".concat(referenceName);
75
+ return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
76
+ case 1:
77
+ resp = _a.sent();
78
+ return [2 /*return*/, resp.data];
79
+ case 2:
80
+ err_2 = _a.sent();
81
+ throw new exception_1.Exception("Unable to retreive model for referenceName: ".concat(referenceName, "."), err_2);
82
+ case 3: return [2 /*return*/];
83
+ }
84
+ });
85
+ });
86
+ };
67
87
  ModelMethods.prototype.getContentModules = function (includeDefaults, guid, includeModules) {
68
88
  if (includeModules === void 0) { includeModules = false; }
69
89
  return __awaiter(this, void 0, void 0, function () {
70
- var apiPath, resp, err_2;
90
+ var apiPath, resp, err_3;
71
91
  return __generator(this, function (_a) {
72
92
  switch (_a.label) {
73
93
  case 0:
@@ -78,8 +98,8 @@ var ModelMethods = /** @class */ (function () {
78
98
  resp = _a.sent();
79
99
  return [2 /*return*/, resp.data];
80
100
  case 2:
81
- err_2 = _a.sent();
82
- throw new exception_1.Exception("Unable to retreive content modules.", err_2);
101
+ err_3 = _a.sent();
102
+ throw new exception_1.Exception("Unable to retreive content modules.", err_3);
83
103
  case 3: return [2 /*return*/];
84
104
  }
85
105
  });
@@ -87,7 +107,7 @@ var ModelMethods = /** @class */ (function () {
87
107
  };
88
108
  ModelMethods.prototype.getPageModules = function (includeDefault, guid) {
89
109
  return __awaiter(this, void 0, void 0, function () {
90
- var apiPath, resp, err_3;
110
+ var apiPath, resp, err_4;
91
111
  return __generator(this, function (_a) {
92
112
  switch (_a.label) {
93
113
  case 0:
@@ -98,8 +118,8 @@ var ModelMethods = /** @class */ (function () {
98
118
  resp = _a.sent();
99
119
  return [2 /*return*/, resp.data];
100
120
  case 2:
101
- err_3 = _a.sent();
102
- throw new exception_1.Exception("Unable to retreive page modules.", err_3);
121
+ err_4 = _a.sent();
122
+ throw new exception_1.Exception("Unable to retreive page modules.", err_4);
103
123
  case 3: return [2 /*return*/];
104
124
  }
105
125
  });
@@ -107,7 +127,7 @@ var ModelMethods = /** @class */ (function () {
107
127
  };
108
128
  ModelMethods.prototype.saveModel = function (model, guid) {
109
129
  return __awaiter(this, void 0, void 0, function () {
110
- var apiPath, resp, err_4;
130
+ var apiPath, resp, err_5;
111
131
  return __generator(this, function (_a) {
112
132
  switch (_a.label) {
113
133
  case 0:
@@ -118,8 +138,8 @@ var ModelMethods = /** @class */ (function () {
118
138
  resp = _a.sent();
119
139
  return [2 /*return*/, resp.data];
120
140
  case 2:
121
- err_4 = _a.sent();
122
- throw new exception_1.Exception("Unable to save the model.", err_4);
141
+ err_5 = _a.sent();
142
+ throw new exception_1.Exception("Unable to save the model.", err_5);
123
143
  case 3: return [2 /*return*/];
124
144
  }
125
145
  });
@@ -127,7 +147,7 @@ var ModelMethods = /** @class */ (function () {
127
147
  };
128
148
  ModelMethods.prototype.deleteModel = function (id, guid) {
129
149
  return __awaiter(this, void 0, void 0, function () {
130
- var apiPath, resp, err_5;
150
+ var apiPath, resp, err_6;
131
151
  return __generator(this, function (_a) {
132
152
  switch (_a.label) {
133
153
  case 0:
@@ -138,8 +158,8 @@ var ModelMethods = /** @class */ (function () {
138
158
  resp = _a.sent();
139
159
  return [2 /*return*/, resp.data];
140
160
  case 2:
141
- err_5 = _a.sent();
142
- throw new exception_1.Exception("Unable to delete the model", err_5);
161
+ err_6 = _a.sent();
162
+ throw new exception_1.Exception("Unable to delete the model", err_6);
143
163
  case 3: return [2 /*return*/];
144
164
  }
145
165
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/management-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Agility CMS Tyescript SDK for Management API.",
5
5
  "repository": {
6
6
  "type": "git",