UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

18 lines 906 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenericAPIFn = void 0; const GenericAPIFn = (url, method, _this) => { return async (data, options = {}) => { var _a; options.withAuthentication = (_a = options.withAuthentication) !== null && _a !== void 0 ? _a : true; const httpAdapter = _this.getHttpAdapter(); const payload = Object.assign(Object.assign({}, options), { headers: Object.assign({ Accept: "application/json", "Content-Type": "application/json", "Cache-Control": "no-cache" }, options === null || options === void 0 ? void 0 : options.headers), method, url, data }); const response = await httpAdapter.request(payload, _this); const responseData = response.data; return responseData; }; }; exports.GenericAPIFn = GenericAPIFn; //# sourceMappingURL=GenericAPIFn.js.map