forked from typesense/typesense-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalyticsRule.php
More file actions
51 lines (44 loc) · 1.08 KB
/
AnalyticsRule.php
File metadata and controls
51 lines (44 loc) · 1.08 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
47
48
49
50
51
<?php
namespace Typesense;
class AnalyticsRule
{
private string $ruleName;
private ApiCall $apiCall;
public function __construct(string $ruleName, ApiCall $apiCall)
{
$this->ruleName = $ruleName;
$this->apiCall = $apiCall;
}
/**
* Retrieve a specific analytics rule
*
* @return array Response from the API
*/
public function retrieve()
{
return $this->apiCall->get($this->endpointPath(), []);
}
/**
* Delete a specific analytics rule
*
* @return array Response from the API
*/
public function delete()
{
return $this->apiCall->delete($this->endpointPath());
}
/**
* Update a specific analytics rule
*
* @param array $params Rule parameters
* @return array Response from the API
*/
public function update(array $params)
{
return $this->apiCall->put($this->endpointPath(), $params);
}
private function endpointPath()
{
return AnalyticsRules::RESOURCE_PATH . '/' . encodeURIComponent($this->ruleName);
}
}