UNPKG

@amplience/dc-cli

Version:
25 lines (24 loc) 755 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResourceList = void 0; const ApiResource_1 = require("../api/model/ApiResource"); class ResourceList extends ApiResource_1.ApiResource { constructor(resourceType, data) { super(data); this.resourceType = resourceType; } getItems() { if (!this.items) { this.items = this.data.map(x => this.client.parse(x, this.resourceType)); } return this.items; } toJSON() { const result = super.toJSON(); result.data = this.getItems().map(item => item.toJSON()); delete result.resourceType; delete result.items; return result; } } exports.ResourceList = ResourceList;