@flatfile/safe-api
Version:
Flatfile Safe API client with streaming capabilities
26 lines (25 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSpacesExtension = getSpacesExtension;
const spaces_1 = require("../streaming/spaces");
function getSpacesExtension(client) {
// Get the prototype that contains the base space methods
const basePrototype = Object.getPrototypeOf(client).constructor.prototype.spaces;
// Create a new object with the base spaces prototype
const originalSpaces = Object.create(basePrototype);
// Add our enhanced methods
return Object.assign(originalSpaces, {
get: async (spaceId, options) => {
const request = new spaces_1.GetSpaceRequest(spaceId, options);
return request.execute();
},
list: async (opts, options) => {
const request = new spaces_1.ListSpacesRequest(opts, options);
return request.execute();
},
update: async (spaceId, data, options) => {
const request = new spaces_1.UpdateSpaceRequest(spaceId, data, options);
return request.execute();
}
});
}