2021-03-12 17:20:32 -04:00
|
|
|
<?php
|
|
|
|
|
|
2022-05-31 12:56:36 +02:00
|
|
|
namespace port389\NetBox\Api\Tenancy;
|
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;
|
2021-03-13 15:02:50 -04:00
|
|
|
|
2021-03-12 23:37:51 -04:00
|
|
|
class Tenants 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
|
|
|
{
|
2021-03-12 23:37:51 -04:00
|
|
|
return $this->post("/tenancy/tenants/", $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("/tenancy/tenants/" . $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("/tenancy/tenants/" . $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
|
|
|
{
|
2021-03-12 23:37:51 -04:00
|
|
|
return $this->get("/tenancy/tenants/", $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("/tenancy/tenants/" . $id . "/", $params);
|
2021-03-12 17:20:32 -04:00
|
|
|
}
|
|
|
|
|
}
|