@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.
30 lines • 1.05 kB
JavaScript
import API from './APICore.js';
import { Environment } from './Endpoints.js';
import { ResponseHandlers } from './handlers/index.js';
import PlatformResources from './resources/PlatformResources.js';
export class PlatformClient extends PlatformResources {
options;
static Handlers = ResponseHandlers;
static Environment = Environment;
constructor(options) {
super();
this.options = options;
this.API = new API(options);
this.ServerlessAPI = new API(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();
}
}
export default PlatformClient;
//# sourceMappingURL=PlatformClient.js.map