forked from typesense/typesense-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalyticsRuleV1.php
More file actions
46 lines (40 loc) · 1.06 KB
/
Copy pathAnalyticsRuleV1.php
File metadata and controls
46 lines (40 loc) · 1.06 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
<?php
namespace Typesense;
class AnalyticsRuleV1
{
private $ruleName;
private ApiCall $apiCall;
public function __construct(string $ruleName, ApiCall $apiCall)
{
$this->ruleName = $ruleName;
$this->apiCall = $apiCall;
}
/**
* Retrieve a legacy v1 analytics rule by name.
*
* @example
* $client->analyticsV1->rules()['rule-1']->retrieve()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
public function retrieve()
{
return $this->apiCall->get($this->endpointPath(), []);
}
/**
* Delete a legacy v1 analytics rule by name.
*
* @example
* $client->analyticsV1->rules()['rule-1']->delete()
*
* @see https://typesense.org/docs/29.0/api/analytics-query-suggestions.html
*/
public function delete()
{
return $this->apiCall->delete($this->endpointPath());
}
private function endpointPath()
{
return AnalyticsRulesV1::RESOURCE_PATH . '/' . encodeURIComponent($this->ruleName);
}
}