@coveo/platform-client
Version:
The main goal of this package is to provide an easy to configure and straightforward way of querying Coveo Cloud APIs using JavaScript.
35 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlatformClient = void 0;
const tslib_1 = require("tslib");
const APICore_js_1 = tslib_1.__importDefault(require("./APICore.js"));
const Endpoints_js_1 = require("./Endpoints.js");
const index_js_1 = require("./handlers/index.js");
const PlatformResources_js_1 = tslib_1.__importDefault(require("./resources/PlatformResources.js"));
class PlatformClient extends PlatformResources_js_1.default {
options;
static Handlers = index_js_1.ResponseHandlers;
static Environment = Endpoints_js_1.Environment;
constructor(options) {
super();
this.options = options;
this.API = new APICore_js_1.default(options);
this.ServerlessAPI = new APICore_js_1.default(options, true);
this.registerAll();
}
withFeatures(...features) {
const EnhancedClient = this.constructor;
const enhancedOptions = features.reduce((current, feature) => feature(current), this.options);
return new EnhancedClient(enhancedOptions);
}
async initialize() {
return this.API.checkToken();
}
abortPendingGetRequests() {
this.API.abortGetRequests();
this.ServerlessAPI.abortGetRequests();
}
}
exports.PlatformClient = PlatformClient;
exports.default = PlatformClient;
//# sourceMappingURL=PlatformClient.js.map