-
-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathAnalyticsRuleV1.js
More file actions
46 lines (46 loc) · 1.67 KB
/
Copy pathAnalyticsRuleV1.js
File metadata and controls
46 lines (46 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var AnalyticsRulesV1_1 = tslib_1.__importDefault(require("./AnalyticsRulesV1"));
var AnalyticsRuleV1 = /** @class */ (function () {
function AnalyticsRuleV1(name, apiCall) {
this.name = name;
this.apiCall = apiCall;
}
/**
* Retrieve a legacy v1 analytics rule by name.
*
* @example
* await client.analyticsV1.rules("rule-1").retrieve()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
AnalyticsRuleV1.prototype.retrieve = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, this.apiCall.get(this.endpointPath())];
});
});
};
/**
* Delete a legacy v1 analytics rule by name.
*
* @example
* await client.analyticsV1.rules("rule-1").delete()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
AnalyticsRuleV1.prototype.delete = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, this.apiCall.delete(this.endpointPath())];
});
});
};
AnalyticsRuleV1.prototype.endpointPath = function () {
return "".concat(AnalyticsRulesV1_1.default.RESOURCEPATH, "/").concat(encodeURIComponent(this.name));
};
return AnalyticsRuleV1;
}());
exports.default = AnalyticsRuleV1;
//# sourceMappingURL=AnalyticsRuleV1.js.map