@@ 4-77 (lines=74) @@ | ||
1 | <?php |
|
2 | namespace Datatrics\API\Modules; |
|
3 | ||
4 | class NextBestAction extends Base |
|
5 | { |
|
6 | /** |
|
7 | * Private constructor so only the client can create this |
|
8 | * @param string $apikey |
|
9 | * @param string $projectid |
|
10 | */ |
|
11 | public function __construct($apikey, $projectid) |
|
12 | { |
|
13 | parent::__construct($apikey, "/project/" . $projectid . "/nextbestaction"); |
|
14 | } |
|
15 | ||
16 | /** |
|
17 | * Get one or multiple nextbestactions |
|
18 | * @param string nextbestaction id, leave null for list of boxes |
|
19 | * @param object Containing query arguments |
|
20 | * @return object Result of the request |
|
21 | */ |
|
22 | public function Get($nextbestactionId = null, $args = array("limit" => 50)) |
|
23 | { |
|
24 | return $nextbestactionId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$nextbestactionId."?".http_build_query($args)); |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Create new nextbestaction |
|
29 | * @param object Containing all the information of a nextbestaction |
|
30 | * @return object Result of the request |
|
31 | */ |
|
32 | public function Create($nextbestaction) |
|
33 | { |
|
34 | return $this->request(self::HTTP_POST, "", $nextbestaction); |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * Create new nextbestaction |
|
39 | * @param id of the nextbestaction |
|
40 | * @param object Containing all the information of a nextbestaction |
|
41 | * @return object Result of the request |
|
42 | */ |
|
43 | public function Update($nextbestactionId, $nextbestaction) |
|
44 | { |
|
45 | return $this->request(self::HTTP_PUT, "/".$nextbestactionId, $nextbestaction); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * Delete a nextbestaction object by nextbestaction id |
|
50 | * @param string Id of the nextbestaction |
|
51 | * @return object Result of the request |
|
52 | */ |
|
53 | public function Delete($nextbestactionId) |
|
54 | { |
|
55 | return $this->request(self::HTTP_DELETE, "/".$nextbestactionId); |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * Delete a nextbestaction object by nextbestaction id |
|
60 | * @param string Id of the nextbestaction |
|
61 | * @return object Result of the request |
|
62 | */ |
|
63 | public function Schedule($nextbestactionId) |
|
64 | { |
|
65 | return $this->request(self::HTTP_PUT, "/".$nextbestactionId."/schedule"); |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * Delete a nextbestaction object by nextbestaction id |
|
70 | * @param string Id of the nextbestaction |
|
71 | * @return object Result of the request |
|
72 | */ |
|
73 | public function Assign($nextbestactionId) |
|
74 | { |
|
75 | return $this->request(self::HTTP_PUT, "/".$nextbestactionId."/assign"); |
|
76 | } |
|
77 | } |
|
78 |
@@ 4-76 (lines=73) @@ | ||
1 | <?php |
|
2 | namespace Datatrics\API\Modules; |
|
3 | ||
4 | class Project extends Base |
|
5 | { |
|
6 | /** |
|
7 | * Private constructor so only the client can create this |
|
8 | * @param string $apikey |
|
9 | */ |
|
10 | public function __construct($apikey) |
|
11 | { |
|
12 | parent::__construct($apikey, "/project"); |
|
13 | } |
|
14 | ||
15 | /** |
|
16 | * Get one or multiple projects |
|
17 | * @param string project id, leave null for list of boxes |
|
18 | * @param object Containing query arguments |
|
19 | * @return object Result of the request |
|
20 | */ |
|
21 | public function Get($projectId = null, $args = array("limit" => 50)) |
|
22 | { |
|
23 | return $projectId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$projectId."?".http_build_query($args)); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * Create new project |
|
28 | * @param object Containing all the information of a project |
|
29 | * @return object Result of the request |
|
30 | */ |
|
31 | public function Create($project) |
|
32 | { |
|
33 | return $this->request(self::HTTP_POST, "", $project); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * Create new project |
|
38 | * @param id of the project |
|
39 | * @param object Containing all the information of a project |
|
40 | * @return object Result of the request |
|
41 | */ |
|
42 | public function Update($projectId, $project) |
|
43 | { |
|
44 | return $this->request(self::HTTP_PUT, "/".$projectId, $project); |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * Delete a project object by project id |
|
49 | * @param string Id of the project |
|
50 | * @return object Result of the request |
|
51 | */ |
|
52 | public function Delete($projectId) |
|
53 | { |
|
54 | return $this->request(self::HTTP_DELETE, "/".$projectId); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Retrieve fields of a project object by project id |
|
59 | * @param string Id of the project |
|
60 | * @return object Result of the request |
|
61 | */ |
|
62 | public function Fields($projectId) |
|
63 | { |
|
64 | return $this->request(self::HTTP_GET, "/".$projectId."/fields"); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * Retrieve logs of a project object by project id |
|
69 | * @param string Id of the project |
|
70 | * @return object Result of the request |
|
71 | */ |
|
72 | public function Logs($projectId) |
|
73 | { |
|
74 | return $this->request(self::HTTP_GET, "/".$projectId."/logs"); |
|
75 | } |
|
76 | } |
|
77 |