@apigames/sdk-core 1.0.8 → 1.0.9
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.
|
@@ -108,16 +108,18 @@ class ResourceObject {
|
|
|
108
108
|
const queryOptions = {};
|
|
109
109
|
const payload = this.GetInsertPayload();
|
|
110
110
|
const response = yield this._container.restClient.Post(queryUri, payload, queryHeaders, queryOptions);
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
if ((0, json_1.hasProperty)(response, 'data') && (0, json_1.hasProperty)(response.data, 'data')
|
|
112
|
+
&& (0, json_1.isObject)(response.data.data) && (0, json_1.hasProperty)(response.data.data, 'id')
|
|
113
|
+
&& (0, json_1.isString)(response.data.data.id) && (0, json_1.hasProperty)(response.data.data, 'links')
|
|
114
|
+
&& (0, json_1.isObject)(response.data.data.links) && (0, json_1.hasProperty)(response.data.data.links, 'self')
|
|
115
|
+
&& (0, json_1.isString)(response.data.data.links.self)) {
|
|
116
|
+
this.id = response.data.data.id;
|
|
117
|
+
this._uri = response.data.data.links.self;
|
|
114
118
|
}
|
|
115
|
-
|
|
116
|
-
throw new __1.SDKException('
|
|
117
|
-
+ '
|
|
119
|
+
else {
|
|
120
|
+
throw new __1.SDKException('SAVE-FAILED', 'The save operation was unable to retrieve the identifier '
|
|
121
|
+
+ 'of the resource created by the API.');
|
|
118
122
|
}
|
|
119
|
-
this.id = this.GetHeaderValue(response.headers, 'x-api-resource-id');
|
|
120
|
-
this._uri = this.GetHeaderValue(response.headers, 'location');
|
|
121
123
|
this._mode = ResourceObjectMode.ExistingDocument;
|
|
122
124
|
});
|
|
123
125
|
}
|