api-builder.js 614 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.APIBuilder = void 0;
  4. const async_1 = require("../api/async");
  5. const sync_1 = require("../api/sync");
  6. class APIBuilder {
  7. root;
  8. options;
  9. constructor(root, options) {
  10. this.root = root;
  11. this.options = options;
  12. }
  13. withPromise() {
  14. return (0, async_1.promise)(this.root, this.options);
  15. }
  16. withCallback(cb) {
  17. (0, async_1.callback)(this.root, this.options, cb);
  18. }
  19. sync() {
  20. return (0, sync_1.sync)(this.root, this.options);
  21. }
  22. }
  23. exports.APIBuilder = APIBuilder;