| @@ 4-56 (lines=53) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Bucket 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 . "/bucket"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple buckets |
|
| 18 | * @param string bucket 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($bucketId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $bucketId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$bucketId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create new bucket |
|
| 29 | * @param object Containing all the information of a bucket |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Create($bucket) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_POST, "", $bucket); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Delete a bucket object by bucket id |
|
| 39 | * @param string Id of the bucket |
|
| 40 | * @return object Result of the request |
|
| 41 | */ |
|
| 42 | public function Delete($bucketId) |
|
| 43 | { |
|
| 44 | return $this->request(self::HTTP_DELETE, "/".$bucketId); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * List fields of a bucket |
|
| 49 | * @param string Id of the bucket |
|
| 50 | * @return object Result of the request |
|
| 51 | */ |
|
| 52 | public function Fields($bucketId) |
|
| 53 | { |
|
| 54 | return $this->request(self::HTTP_GET, "/".$bucketId."/fields"); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 4-57 (lines=54) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Channel 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 . "/channel"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple channels |
|
| 18 | * @param string channel 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($channelId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $channelId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$channelId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create new channel |
|
| 29 | * @param object Containing all the information of a channel |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Create($channel) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_POST, "", $channel); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Update a channel |
|
| 39 | * @param string channel id |
|
| 40 | * @param object Containing all the information of a channel |
|
| 41 | * @return object Result of the request |
|
| 42 | */ |
|
| 43 | public function Update($channelId, $channel) |
|
| 44 | { |
|
| 45 | return $this->request(self::HTTP_PUT, "/".$channelId, $channel); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Delete a channel object by channel id |
|
| 50 | * @param string Id of the channel |
|
| 51 | * @return object Result of the request |
|
| 52 | */ |
|
| 53 | public function Delete($channelId) |
|
| 54 | { |
|
| 55 | return $this->request(self::HTTP_DELETE, "/".$channelId); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 4-57 (lines=54) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Goal 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 . "/goal"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple goals |
|
| 18 | * @param string goal 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($goalId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $goalId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$goalId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create new goal |
|
| 29 | * @param object Containing all the information of a goal |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Create($goal) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_POST, "", $goal); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Create new goal |
|
| 39 | * @param id of the goal |
|
| 40 | * @param object Containing all the information of a goal |
|
| 41 | * @return object Result of the request |
|
| 42 | */ |
|
| 43 | public function Update($goalId, $goal) |
|
| 44 | { |
|
| 45 | return $this->request(self::HTTP_PUT, "/".$goalId, $goal); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Delete a goal object by goal id |
|
| 50 | * @param string Id of the goal |
|
| 51 | * @return object Result of the request |
|
| 52 | */ |
|
| 53 | public function Delete($goalId) |
|
| 54 | { |
|
| 55 | return $this->request(self::HTTP_DELETE, "/".$goalId); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 4-57 (lines=54) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Journey 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 . "/journey"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple journeys |
|
| 18 | * @param string journey 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($journeyId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $journeyId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$journeyId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create new journey |
|
| 29 | * @param object Containing all the information of a journey |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Create($journey) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_POST, "", $journey); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Create new journey |
|
| 39 | * @param id of the journey |
|
| 40 | * @param object Containing all the information of a journey |
|
| 41 | * @return object Result of the request |
|
| 42 | */ |
|
| 43 | public function Update($journeyId, $journey) |
|
| 44 | { |
|
| 45 | return $this->request(self::HTTP_PUT, "/".$journeyId, $journey); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Delete a journey object by journey id |
|
| 50 | * @param string Id of the journey |
|
| 51 | * @return object Result of the request |
|
| 52 | */ |
|
| 53 | public function Delete($journeyId) |
|
| 54 | { |
|
| 55 | return $this->request(self::HTTP_DELETE, "/".$journeyId); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 4-57 (lines=54) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Template 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 . "/template"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple templates |
|
| 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($templateId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $templateId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$templateId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create new template |
|
| 29 | * @param object Containing all the information of a template |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Create($template) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_POST, "", $template); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Create new template |
|
| 39 | * @param id of the template |
|
| 40 | * @param object Containing all the information of a template |
|
| 41 | * @return object Result of the request |
|
| 42 | */ |
|
| 43 | public function Update($templateId, $template) |
|
| 44 | { |
|
| 45 | return $this->request(self::HTTP_PUT, "/".$templateId, $template); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Delete a template object by template id |
|
| 50 | * @param string Id of the template |
|
| 51 | * @return object Result of the request |
|
| 52 | */ |
|
| 53 | public function Delete($templateId) |
|
| 54 | { |
|
| 55 | return $this->request(self::HTTP_DELETE, "/".$templateId); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 4-67 (lines=64) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Tric 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 . "/tric"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple trics |
|
| 18 | * @param string tric 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($tricId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $tricId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$tricId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create new tric |
|
| 29 | * @param object Containing all the information of a tric |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Create($tric) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_POST, "", $tric); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Create new tric |
|
| 39 | * @param id of the tric |
|
| 40 | * @param object Containing all the information of a tric |
|
| 41 | * @return object Result of the request |
|
| 42 | */ |
|
| 43 | public function Update($tricId, $tric) |
|
| 44 | { |
|
| 45 | return $this->request(self::HTTP_PUT, "/".$tricId, $tric); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Delete a tric object by tric id |
|
| 50 | * @param string Id of the tric |
|
| 51 | * @return object Result of the request |
|
| 52 | */ |
|
| 53 | public function Delete($tricId) |
|
| 54 | { |
|
| 55 | return $this->request(self::HTTP_DELETE, "/".$tricId); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Delete a tric object by tric id |
|
| 60 | * @param string Id of the tric |
|
| 61 | * @return object Result of the request |
|
| 62 | */ |
|
| 63 | public function Do($tricId) |
|
| 64 | { |
|
| 65 | return $this->request(self::HTTP_GET, "/".$tricId); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 4-56 (lines=53) @@ | ||
| 1 | <?php |
|
| 2 | namespace Datatrics\API\Modules; |
|
| 3 | ||
| 4 | class Trigger 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 . "/trigger"); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Get one or multiple triggers |
|
| 18 | * @param string trigger 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($triggerId = null, $args = array("limit" => 50)) |
|
| 23 | { |
|
| 24 | return $triggerId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$triggerId."?".http_build_query($args)); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Delete a trigger object by trigger id |
|
| 29 | * @param string Id of the trigger |
|
| 30 | * @return object Result of the request |
|
| 31 | */ |
|
| 32 | public function Delete($triggerId) |
|
| 33 | { |
|
| 34 | return $this->request(self::HTTP_DELETE, "/".$triggerId); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Activate a trigger |
|
| 39 | * @param object Containing all the information of a trigger |
|
| 40 | * @return object Result of the request |
|
| 41 | */ |
|
| 42 | public function Activate($triggerId) |
|
| 43 | { |
|
| 44 | return $this->request(self::HTTP_PUT, "/".$triggerId."/activate"); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Deactivate a trigger |
|
| 49 | * @param id of the trigger |
|
| 50 | * @return object Result of the request |
|
| 51 | */ |
|
| 52 | public function Deactivate($triggerId) |
|
| 53 | { |
|
| 54 | return $this->request(self::HTTP_PUT, "/".$triggerId."/deactivate"); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||