@mozaic-io/mozaic-sdk-node
Version:
The Mozaic Node SDK enables you to pay your creators easily via the Mozaic API.
21 lines (20 loc) • 918 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseList = void 0;
class BaseList {
/**
* Converts a paged data response from the API into an SDK friendly format.
* @param source The API response that contains paging information about the list
* @param data The actual list items returned from the API.
*/
constructor(source, data) {
var _a, _b, _c;
if (data === undefined)
throw new Error("Data element was undefined, unable to copy the data from the API to the list. Check the map function on the API result handler.");
this.data = data;
this.count = (_a = source.count) !== null && _a !== void 0 ? _a : 0;
this.page = (_b = source.page) !== null && _b !== void 0 ? _b : 0;
this.totalCount = (_c = source.total_count) !== null && _c !== void 0 ? _c : 0;
}
}
exports.BaseList = BaseList;