netbox-php/src/Api/Secrets/SecretRoles.php

73 lines
1.6 KiB
PHP
Raw Normal View History

2021-03-12 17:20:32 -04:00
<?php
2022-05-31 12:56:36 +02:00
namespace port389\NetBox\Api\Secrets;
2021-03-12 17:20:32 -04:00
2022-05-31 12:56:36 +02:00
use GuzzleHttp\Exception\GuzzleException;
use port389\NetBox\Api\AbstractApi;
class SecretRoles extends AbstractApi
2021-03-12 17:20:32 -04:00
{
/**
2022-05-31 12:56:36 +02:00
* @param array $params
* @return array
* @throws GuzzleException
2021-03-12 17:20:32 -04:00
*/
2022-05-31 12:56:36 +02:00
public function add(array $params = []): array
2021-03-12 17:20:32 -04:00
{
return $this->post("/secrets/secret-roles/", $params);
2021-03-12 17:20:32 -04:00
}
/**
2022-05-31 12:56:36 +02:00
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
2021-03-12 17:20:32 -04:00
*/
2022-05-31 12:56:36 +02:00
public function remove(int $id, array $params = []): bool
2021-03-12 17:20:32 -04:00
{
2022-05-31 12:56:36 +02:00
return $this->delete("/secrets/secret-roles/" . $id . "/", $params);
2021-03-12 17:20:32 -04:00
}
/**
2022-05-31 12:56:36 +02:00
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
2021-03-12 17:20:32 -04:00
*/
2022-05-31 12:56:36 +02:00
public function edit(int $id, array $params = []): array
2021-03-12 17:20:32 -04:00
{
2022-05-31 12:56:36 +02:00
return $this->put("/secrets/secret-roles/" . $id . "/", $params);
2021-03-12 17:20:32 -04:00
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/secrets/secret-roles/" . $id . "/", $params);
}
2021-03-12 17:20:32 -04:00
/**
2022-05-31 12:56:36 +02:00
* @param array $params
2021-03-12 17:20:32 -04:00
* @return mixed
2022-05-31 12:56:36 +02:00
* @throws GuzzleException
2021-03-12 17:20:32 -04:00
*/
2022-05-31 12:56:36 +02:00
public function list(array $params = [])
2021-03-12 17:20:32 -04:00
{
return $this->get("/secrets/secret-roles/", $params);
2021-03-12 17:20:32 -04:00
}
/**
2022-05-31 12:56:36 +02:00
* @param int $id
* @param array $params
2021-03-12 17:20:32 -04:00
* @return mixed
2022-05-31 12:56:36 +02:00
* @throws GuzzleException
2021-03-12 17:20:32 -04:00
*/
2022-05-31 12:56:36 +02:00
public function show(int $id, array $params = [])
2021-03-12 17:20:32 -04:00
{
2022-05-31 12:56:36 +02:00
return $this->get("/secrets/secret-roles/" . $id . "/", $params);
2021-03-12 17:20:32 -04:00
}
}