diff --git a/README.md b/README.md index 430e695..a5c29db 100644 --- a/README.md +++ b/README.md @@ -688,3 +688,17 @@ $ploi->statusPage(123)->incident()->perPage($amountPerPage)->page($pageNumber); // Delete incident $ploi->statusPage(123)->incident(123)->delete(); ``` + +### Webserver Templates + +Available methods for webserver templates: +```php +// List webserver templates +$ploi->webserverTemplates()->get(); + +// Paginate webserver templates +$ploi->webserverTemplates()->perPage($amountPerPage)->page($pageNumber); + +// Get webserver template +$ploi->webserverTemplates(123)->get(); +``` diff --git a/src/Ploi/Ploi.php b/src/Ploi/Ploi.php index e9672a4..613d161 100644 --- a/src/Ploi/Ploi.php +++ b/src/Ploi/Ploi.php @@ -12,6 +12,7 @@ use Ploi\Exceptions\Http\NotFound; use Ploi\Exceptions\Http\NotValid; use Ploi\Exceptions\Http\NotAllowed; +use Ploi\Resources\WebserverTemplate; use Psr\Http\Message\ResponseInterface; use Ploi\Exceptions\Http\TooManyAttempts; use Ploi\Exceptions\Http\Unauthenticated; @@ -169,4 +170,9 @@ public function user() { return new User($this); } + + public function webserverTemplates(?int $id = null): WebserverTemplate + { + return new WebserverTemplate($this, $id); + } } diff --git a/src/Ploi/Resources/WebserverTemplate.php b/src/Ploi/Resources/WebserverTemplate.php new file mode 100644 index 0000000..a04ddab --- /dev/null +++ b/src/Ploi/Resources/WebserverTemplate.php @@ -0,0 +1,34 @@ +setEndpoint($this->endpoint); + } + + public function get(?int $id = null): Response + { + if ($id) { + $this->setId($id); + } + + if ($this->getId()) { + $this->setEndpoint($this->getEndpoint() . '/' . $this->getId()); + } + + return $this->getPloi()->makeAPICall($this->getEndpoint()); + } +} \ No newline at end of file