@cloudize/sdk-core 23.2.3 → 23.2.5
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.
|
@@ -54,4 +54,5 @@ export default class ResourceContainer implements IResourceContainer {
|
|
|
54
54
|
Include(include: ResourceIncludeOption): IResourceContainer;
|
|
55
55
|
PageOffset(pageOffset: number, pageSize: number): IResourceContainer;
|
|
56
56
|
PageNumber(pageNumber: number, pageSize: number): IResourceContainer;
|
|
57
|
+
toJSON(): any;
|
|
57
58
|
}
|
|
@@ -318,5 +318,20 @@ class ResourceContainer {
|
|
|
318
318
|
this._queryParams.pagination.size = pageSize;
|
|
319
319
|
return this;
|
|
320
320
|
}
|
|
321
|
+
toJSON() {
|
|
322
|
+
if ((0, json_1.isDefined)(this.data)) {
|
|
323
|
+
if ((0, __1.isResourceObject)(this.data))
|
|
324
|
+
return this.data.toJSON();
|
|
325
|
+
if ((0, json_1.isArrayOfObjects)(this.data)) {
|
|
326
|
+
const payload = [];
|
|
327
|
+
for (const resource of this.data) {
|
|
328
|
+
if ((0, __1.isResourceObject)(resource))
|
|
329
|
+
payload.push(resource.toJSON);
|
|
330
|
+
}
|
|
331
|
+
return payload;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return undefined;
|
|
335
|
+
}
|
|
321
336
|
}
|
|
322
337
|
exports.default = ResourceContainer;
|
|
@@ -251,6 +251,21 @@ class ResourceObject {
|
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
+
toJSON() {
|
|
255
|
+
const obj = {
|
|
256
|
+
type: this.type,
|
|
257
|
+
};
|
|
258
|
+
if ((0, json_1.isDefined)(this.id))
|
|
259
|
+
obj.id = this.id;
|
|
260
|
+
if ((0, json_1.isDefined)(this.attributes)) {
|
|
261
|
+
obj.attributes = this.SerializeAttributesPayload(undefined, this.attributes);
|
|
262
|
+
}
|
|
263
|
+
if ((0, json_1.isDefined)(this.relationships)) {
|
|
264
|
+
obj.data.relationships = this.SerializeRelationshipsPayload(undefined, this.relationships);
|
|
265
|
+
}
|
|
266
|
+
(0, json_1.redactUndefinedValues)(obj);
|
|
267
|
+
return obj;
|
|
268
|
+
}
|
|
254
269
|
get type() {
|
|
255
270
|
throw new Error('Method or Property not implemented.');
|
|
256
271
|
}
|