@@ 4-36 (lines=33) @@ | ||
1 | <?php |
|
2 | namespace Datatrics\API\Modules; |
|
3 | ||
4 | class Link 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 . "/link"); |
|
14 | } |
|
15 | ||
16 | /** |
|
17 | * retreive a link |
|
18 | * @param int link id |
|
19 | * @return object Result of the request |
|
20 | */ |
|
21 | public function Get($linkId) |
|
22 | { |
|
23 | return $this->request(self::HTTP_GET, "/".$linkId); |
|
24 | } |
|
25 | ||
26 | ||
27 | /** |
|
28 | * retreive a link |
|
29 | * @param int link id |
|
30 | * @return object Result of the request |
|
31 | */ |
|
32 | public function Create($link) |
|
33 | { |
|
34 | return $this->request(self::HTTP_POST, "", $link); |
|
35 | } |
|
36 | } |
|
37 |
@@ 4-36 (lines=33) @@ | ||
1 | <?php |
|
2 | namespace Datatrics\API\Modules; |
|
3 | ||
4 | class Theme 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 . "/theme"); |
|
14 | } |
|
15 | ||
16 | /** |
|
17 | * Get the project theme |
|
18 | * @param string template 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() |
|
23 | { |
|
24 | $this->request(self::HTTP_GET, ""); |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Update a theme |
|
29 | * @param object Containing all the information of a template |
|
30 | * @return object Result of the request |
|
31 | */ |
|
32 | public function Update($template) |
|
33 | { |
|
34 | return $this->request(self::HTTP_PUT, "", $template); |
|
35 | } |
|
36 | } |
|
37 |
@@ 4-27 (lines=24) @@ | ||
1 | <?php |
|
2 | namespace Datatrics\API\Modules; |
|
3 | ||
4 | class Webhook 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 . "/webhook"); |
|
14 | } |
|
15 | ||
16 | /** |
|
17 | * Trigger a Datatrics webhooke |
|
18 | * @param string channel |
|
19 | * @param string type |
|
20 | * @param object Containing payload data |
|
21 | * @return object Result of the request |
|
22 | */ |
|
23 | public function Send($channel, $type, $webhook) |
|
24 | { |
|
25 | return $this->request(self::HTTP_POST, "/".$channel."/$type", $webhook); |
|
26 | } |
|
27 | } |
|
28 |