Clean & reformat code

This commit is contained in:
Pierre Lannoy 2024-02-12 11:28:56 +01:00
commit 5180bf1d38
Signed by: Pierre Lannoy
GPG key ID: D27231EF87D53F31
88 changed files with 4317 additions and 4408 deletions

View file

@ -5,72 +5,71 @@ namespace Hosterra\NetBox\Api;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Client; use Hosterra\NetBox\Client;
abstract class AbstractApi implements ApiInterface abstract class AbstractApi implements ApiInterface {
{
/** @var Client */ /** @var Client */
public $client; public $client;
/** /**
* AbstractApi constructor. * AbstractApi constructor.
*
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client) public function __construct( Client $client ) {
{
$this->client = $client; $this->client = $client;
} }
/** /**
* @param $path * @param $path
* @param array $parameters * @param array $parameters
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
protected function get($path, array $parameters) protected function get( $path, array $parameters ) {
{ return $this->client->getHttpClient()->get( $path, $parameters );
return $this->client->getHttpClient()->get($path, $parameters);
} }
/** /**
* @param $path * @param $path
* @param array $parameters * @param array $parameters
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
protected function post($path, array $parameters): array protected function post( $path, array $parameters ): array {
{ return $this->client->getHttpClient()->post( $path, $parameters );
return $this->client->getHttpClient()->post($path, $parameters);
} }
/** /**
* @param $path * @param $path
* @param array $parameters * @param array $parameters
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
protected function put($path, array $parameters): array protected function put( $path, array $parameters ): array {
{ return $this->client->getHttpClient()->put( $path, $parameters );
return $this->client->getHttpClient()->put($path, $parameters);
} }
/** /**
* @param $path * @param $path
* @param array $parameters * @param array $parameters
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
protected function patch($path, array $parameters): array protected function patch( $path, array $parameters ): array {
{ return $this->client->getHttpClient()->patch( $path, $parameters );
return $this->client->getHttpClient()->patch($path, $parameters);
} }
/** /**
* @param $path * @param $path
* @param array $parameters * @param array $parameters
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
protected function delete($path, array $parameters): bool protected function delete( $path, array $parameters ): bool {
{ return $this->client->getHttpClient()->delete( $path, $parameters );
return $this->client->getHttpClient()->delete($path, $parameters);
} }
} }

View file

@ -2,7 +2,6 @@
namespace Hosterra\NetBox\Api; namespace Hosterra\NetBox\Api;
interface ApiInterface interface ApiInterface {
{
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Circuits;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class CircuitTerminations extends AbstractApi class CircuitTerminations extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/circuits/circuit-terminations/", $params );
return $this->post("/circuits/circuit-terminations/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/circuits/circuit-terminations/" . $id . "/", $params );
return $this->delete("/circuits/circuit-terminations/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/circuits/circuit-terminations/" . $id . "/", $params );
return $this->put("/circuits/circuit-terminations/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/circuits/circuit-terminations/" . $id . "/", $params );
return $this->patch("/circuits/circuit-terminations/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/circuits/circuit-terminations/", $params );
return $this->get("/circuits/circuit-terminations/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/circuits/circuit-terminations/" . $id . "/", $params );
return $this->get("/circuits/circuit-terminations/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Circuits;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class CircuitTypes extends AbstractApi class CircuitTypes extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/circuits/circuit-types/", $params );
return $this->post("/circuits/circuit-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/circuits/circuit-types/" . $id . "/", $params );
return $this->delete("/circuits/circuit-types/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/circuits/circuit-types/" . $id . "/", $params );
return $this->put("/circuits/circuit-types/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/circuits/circuit-types/" . $id . "/", $params );
return $this->patch("/circuits/circuit-types/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/circuits/circuit-types/", $params );
return $this->get("/circuits/circuit-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/circuits/circuit-types/" . $id . "/", $params );
return $this->get("/circuits/circuit-types/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Circuits;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Circuits extends AbstractApi class Circuits extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/circuits/circuits/", $params );
return $this->post("/circuits/circuits/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/circuits/circuits/" . $id . "/", $params );
return $this->delete("/circuits/circuits/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/circuits/circuits/" . $id . "/", $params );
return $this->put("/circuits/circuits/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/circuits/circuits/" . $id . "/", $params );
return $this->patch("/circuits/circuits/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/circuits/circuits/", $params );
return $this->get("/circuits/circuits/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/circuits/circuits/" . $id . "/", $params );
return $this->get("/circuits/circuits/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Circuits;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Providers extends AbstractApi class Providers extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/circuits/providers/", $params );
return $this->post("/circuits/providers/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/circuits/providers/" . $id . "/", $params );
return $this->delete("/circuits/providers/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/circuits/providers/" . $id . "/", $params );
return $this->put("/circuits/providers/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/circuits/providers/" . $id . "/", $params );
return $this->patch("/circuits/providers/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/circuits/providers/", $params );
return $this->get("/circuits/providers/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/circuits/providers/" . $id . "/", $params );
return $this->get("/circuits/providers/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Cables extends AbstractApi class Cables extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/cables/", $params );
return $this->post("/dcim/cables/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/cables/" . $id . "/", $params );
return $this->delete("/dcim/cables/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/cables/" . $id . "/", $params );
return $this->put("/dcim/cables/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/cables/", $params );
return $this->get("/dcim/cables/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/cables/" . $id . "/", $params );
return $this->get("/dcim/cables/" . $id . "/", $params);
} }
} }

View file

@ -5,15 +5,14 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConnectedDevices extends AbstractApi class ConnectedDevices extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/connected-device/", $params );
return $this->get("/dcim/connected-device/", $params);
} }
} }

View file

@ -5,15 +5,14 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConsoleConnections extends AbstractApi class ConsoleConnections extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/console-connections/", $params );
return $this->get("/dcim/console-connections/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConsolePortTemplates extends AbstractApi class ConsolePortTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/console-port-templates/", $params );
return $this->post("/dcim/console-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/console-port-templates/" . $id . "/", $params );
return $this->delete("/dcim/console-port-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/console-port-templates/" . $id . "/", $params );
return $this->put("/dcim/console-port-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/console-port-templates/", $params );
return $this->get("/dcim/console-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/console-port-templates/" . $id . "/", $params );
return $this->get("/dcim/console-port-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConsolePorts extends AbstractApi class ConsolePorts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/console-ports/", $params );
return $this->post("/dcim/console-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/console-ports/" . $id . "/", $params );
return $this->delete("/dcim/console-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/console-ports/" . $id . "/", $params );
return $this->put("/dcim/console-ports/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/console-ports/", $params );
return $this->get("/dcim/console-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/console-ports/" . $id . "/", $params );
return $this->get("/dcim/console-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function trace(int $id, array $params = []) public function trace( int $id, array $params = [] ) {
{ return $this->get( "/dcim/console-ports/" . $id . "/trace/", $params );
return $this->get("/dcim/console-ports/" . $id . "/trace/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConsoleServerPortTemplates extends AbstractApi class ConsoleServerPortTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/console-server-port-templates/", $params );
return $this->post("/dcim/console-server-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/console-server-port-templates/" . $id . "/", $params );
return $this->delete("/dcim/console-server-port-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/console-server-port-templates/" . $id . "/", $params );
return $this->put("/dcim/console-server-port-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/console-server-port-templates/", $params );
return $this->get("/dcim/console-server-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/console-server-port-templates/" . $id . "/", $params );
return $this->get("/dcim/console-server-port-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConsoleServerPorts extends AbstractApi class ConsoleServerPorts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/console-server-ports/", $params );
return $this->post("/dcim/console-server-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/console-server-ports/" . $id . "/", $params );
return $this->delete("/dcim/console-server-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/console-server-ports/" . $id . "/", $params );
return $this->put("/dcim/console-server-ports/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/console-server-ports/", $params );
return $this->get("/dcim/console-server-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/console-server-ports/" . $id . "/", $params );
return $this->get("/dcim/console-server-ports/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class DeviceBayTemplates extends AbstractApi class DeviceBayTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/device-bay-templates/", $params );
return $this->post("/dcim/device-bay-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/device-bay-templates/" . $id . "/", $params );
return $this->delete("/dcim/device-bay-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/device-bay-templates/" . $id . "/", $params );
return $this->put("/dcim/device-bay-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/device-bay-templates/", $params );
return $this->get("/dcim/device-bay-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/device-bay-templates/" . $id . "/", $params );
return $this->get("/dcim/device-bay-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class DeviceBays extends AbstractApi class DeviceBays extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/device-bays/", $params );
return $this->post("/dcim/device-bays/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/device-bays/" . $id . "/", $params );
return $this->delete("/dcim/device-bays/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/device-bays/" . $id . "/", $params );
return $this->put("/dcim/device-bays/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/device-bays/", $params );
return $this->get("/dcim/device-bays/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/device-bays/" . $id . "/", $params );
return $this->get("/dcim/device-bays/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class DeviceRoles extends AbstractApi class DeviceRoles extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/device-roles/", $params );
return $this->post("/dcim/device-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/device-roles/" . $id . "/", $params );
return $this->delete("/dcim/device-roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/device-roles/" . $id . "/", $params );
return $this->put("/dcim/device-roles/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/device-roles/", $params );
return $this->get("/dcim/device-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/device-roles/" . $id . "/", $params );
return $this->get("/dcim/device-roles/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class DeviceTypes extends AbstractApi class DeviceTypes extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/device-types/", $params );
return $this->post("/dcim/device-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/device-types/" . $id . "/", $params );
return $this->delete("/dcim/device-types/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/device-types/" . $id . "/", $params );
return $this->put("/dcim/device-types/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/device-types/", $params );
return $this->get("/dcim/device-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/device-types/" . $id . "/", $params );
return $this->get("/dcim/device-types/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Devices extends AbstractApi class Devices extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/devices/", $params );
return $this->post("/dcim/devices/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/devices/" . $id . "/", $params );
return $this->delete("/dcim/devices/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/devices/" . $id . "/", $params );
return $this->put("/dcim/devices/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/devices/", $params );
return $this->get("/dcim/devices/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/devices/" . $id . "/", $params );
return $this->get("/dcim/devices/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function napalm(int $id, array $params = []) public function napalm( int $id, array $params = [] ) {
{ return $this->get( "/dcim/devices/" . $id . "/napalm/", $params );
return $this->get("/dcim/devices/" . $id . "/napalm/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class FrontPortTemplates extends AbstractApi class FrontPortTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/front-port-templates/", $params );
return $this->post("/dcim/front-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/front-port-templates/" . $id . "/", $params );
return $this->delete("/dcim/front-port-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/front-port-templates/" . $id . "/", $params );
return $this->put("/dcim/front-port-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/front-port-templates/", $params );
return $this->get("/dcim/front-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/front-port-templates/" . $id . "/", $params );
return $this->get("/dcim/front-port-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class FrontPorts extends AbstractApi class FrontPorts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/front-ports/", $params );
return $this->post("/dcim/front-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/front-ports/" . $id . "/", $params );
return $this->delete("/dcim/front-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/front-ports/" . $id . "/", $params );
return $this->put("/dcim/front-ports/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/front-ports/", $params );
return $this->get("/dcim/front-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/front-ports/" . $id . "/", $params );
return $this->get("/dcim/front-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function paths(int $id, array $params = []) public function paths( int $id, array $params = [] ) {
{ return $this->get( "/dcim/front-ports/" . $id . "/paths/", $params );
return $this->get("/dcim/front-ports/" . $id . "/paths/", $params);
} }
} }

View file

@ -5,15 +5,14 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class InterfaceConnections extends AbstractApi class InterfaceConnections extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/interface-connections/", $params );
return $this->get("/dcim/interface-connections/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class InterfaceTemplates extends AbstractApi class InterfaceTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/interface-templates/", $params );
return $this->post("/dcim/interface-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/interface-templates/" . $id . "/", $params );
return $this->delete("/dcim/interface-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/interface-templates/" . $id . "/", $params );
return $this->put("/dcim/interface-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/interface-templates/", $params );
return $this->get("/dcim/interface-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/interface-templates/" . $id . "/", $params );
return $this->get("/dcim/interface-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Interfaces extends AbstractApi class Interfaces extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/interfaces/", $params );
return $this->post("/dcim/interfaces/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/interfaces/" . $id . "/", $params );
return $this->delete("/dcim/interfaces/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/interfaces/" . $id . "/", $params );
return $this->put("/dcim/interfaces/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/interfaces/", $params );
return $this->get("/dcim/interfaces/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/interfaces/" . $id . "/", $params );
return $this->get("/dcim/interfaces/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function trace(int $id, array $params = []) public function trace( int $id, array $params = [] ) {
{ return $this->get( "/dcim/interfaces/" . $id . "/trace/", $params );
return $this->get("/dcim/interfaces/" . $id . "/trace/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class InventoryItems extends AbstractApi class InventoryItems extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/inventory-items/", $params );
return $this->post("/dcim/inventory-items/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/inventory-items/" . $id . "/", $params );
return $this->delete("/dcim/inventory-items/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/inventory-items/" . $id . "/", $params );
return $this->put("/dcim/inventory-items/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/inventory-items/", $params );
return $this->get("/dcim/inventory-items/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/inventory-items/" . $id . "/", $params );
return $this->get("/dcim/inventory-items/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Manufacturers extends AbstractApi class Manufacturers extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/manufacturers/", $params );
return $this->post("/dcim/manufacturers/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/manufacturers/" . $id . "/", $params );
return $this->delete("/dcim/manufacturers/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/manufacturers/" . $id . "/", $params );
return $this->put("/dcim/manufacturers/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/manufacturers/", $params );
return $this->get("/dcim/manufacturers/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/manufacturers/" . $id . "/", $params );
return $this->get("/dcim/manufacturers/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ModuleBays extends AbstractApi class ModuleBays extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/module-bays/", $params );
return $this->post("/dcim/module-bays/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/module-bays/" . $id . "/", $params );
return $this->delete("/dcim/module-bays/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/module-bays/" . $id . "/", $params );
return $this->put("/dcim/module-bays/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/dcim/module-bays/" . $id . "/", $params );
return $this->patch("/dcim/module-bays/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/module-bays/", $params );
return $this->get("/dcim/module-bays/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/module-bays/" . $id . "/", $params );
return $this->get("/dcim/module-bays/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Modules extends AbstractApi class Modules extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/modules/", $params );
return $this->post("/dcim/modules/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/modules/" . $id . "/", $params );
return $this->delete("/dcim/modules/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/modules/" . $id . "/", $params );
return $this->put("/dcim/modules/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/dcim/modules/" . $id . "/", $params );
return $this->patch("/dcim/modules/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/modules/", $params );
return $this->get("/dcim/modules/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/modules/" . $id . "/", $params );
return $this->get("/dcim/modules/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Platforms extends AbstractApi class Platforms extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/platforms/", $params );
return $this->post("/dcim/platforms/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/platforms/" . $id . "/", $params );
return $this->delete("/dcim/platforms/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/platforms/" . $id . "/", $params );
return $this->put("/dcim/platforms/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/platforms/", $params );
return $this->get("/dcim/platforms/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/platforms/" . $id . "/", $params );
return $this->get("/dcim/platforms/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class PowerFeeds extends AbstractApi class PowerFeeds extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/power-feeds/", $params );
return $this->post("/dcim/power-feeds/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/power-feeds/" . $id . "/", $params );
return $this->delete("/dcim/power-feeds/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/power-feeds/" . $id . "/", $params );
return $this->put("/dcim/power-feeds/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/power-feeds/", $params );
return $this->get("/dcim/power-feeds/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-feeds/" . $id . "/", $params );
return $this->get("/dcim/power-feeds/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function trace(int $id, array $params = []) public function trace( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-feeds/" . $id . "/trace/", $params );
return $this->get("/dcim/power-feeds/" . $id . "/trace/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class PowerOutletTemplates extends AbstractApi class PowerOutletTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/power-outlet-templates/", $params );
return $this->post("/dcim/power-outlet-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/power-outlet-templates/" . $id . "/", $params );
return $this->delete("/dcim/power-outlet-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/power-outlet-templates/" . $id . "/", $params );
return $this->put("/dcim/power-outlet-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/power-outlet-templates/", $params );
return $this->get("/dcim/power-outlet-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-outlet-templates/" . $id . "/", $params );
return $this->get("/dcim/power-outlet-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class PowerOutlets extends AbstractApi class PowerOutlets extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/power-outlets/", $params );
return $this->post("/dcim/power-outlets/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/power-outlets/" . $id . "/", $params );
return $this->delete("/dcim/power-outlets/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/power-outlets/" . $id . "/", $params );
return $this->put("/dcim/power-outlets/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/power-outlets/", $params );
return $this->get("/dcim/power-outlets/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-outlets/" . $id . "/", $params );
return $this->get("/dcim/power-outlets/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function trace(int $id, array $params = []) public function trace( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-outlets/" . $id . "/trace/", $params );
return $this->get("/dcim/power-outlets/" . $id . "/trace/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class PowerPanels extends AbstractApi class PowerPanels extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/power-panels/", $params );
return $this->post("/dcim/power-panels/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/power-panels/" . $id . "/", $params );
return $this->delete("/dcim/power-panels/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/power-panels/" . $id . "/", $params );
return $this->put("/dcim/power-panels/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/power-panels/", $params );
return $this->get("/dcim/power-panels/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-panels/" . $id . "/", $params );
return $this->get("/dcim/power-panels/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class PowerPortTemplates extends AbstractApi class PowerPortTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/power-port-templates/", $params );
return $this->post("/dcim/power-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/power-port-templates/" . $id . "/", $params );
return $this->delete("/dcim/power-port-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/power-port-templates/" . $id . "/", $params );
return $this->put("/dcim/power-port-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/power-port-templates/", $params );
return $this->get("/dcim/power-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-port-templates/" . $id . "/", $params );
return $this->get("/dcim/power-port-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class PowerPorts extends AbstractApi class PowerPorts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/power-ports/", $params );
return $this->post("/dcim/power-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/power-ports/" . $id . "/", $params );
return $this->delete("/dcim/power-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/power-ports/" . $id . "/", $params );
return $this->put("/dcim/power-ports/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/power-ports/", $params );
return $this->get("/dcim/power-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-ports/" . $id . "/", $params );
return $this->get("/dcim/power-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function trace(int $id, array $params = []) public function trace( int $id, array $params = [] ) {
{ return $this->get( "/dcim/power-ports/" . $id . "/trace/", $params );
return $this->get("/dcim/power-ports/" . $id . "/trace/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class RackGroups extends AbstractApi class RackGroups extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/rack-groups/", $params );
return $this->post("/dcim/rack-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/rack-groups/" . $id . "/", $params );
return $this->delete("/dcim/rack-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/rack-groups/" . $id . "/", $params );
return $this->put("/dcim/rack-groups/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/rack-groups/", $params );
return $this->get("/dcim/rack-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/rack-groups/" . $id . "/", $params );
return $this->get("/dcim/rack-groups/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class RackReservations extends AbstractApi class RackReservations extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/rack-reservations/", $params );
return $this->post("/dcim/rack-reservations/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/rack-reservations/" . $id . "/", $params );
return $this->delete("/dcim/rack-reservations/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/rack-reservations/" . $id . "/", $params );
return $this->put("/dcim/rack-reservations/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/rack-reservations/", $params );
return $this->get("/dcim/rack-reservations/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/rack-reservations/" . $id . "/", $params );
return $this->get("/dcim/rack-reservations/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class RackRoles extends AbstractApi class RackRoles extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/rack-roles/", $params );
return $this->post("/dcim/rack-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/rack-roles/" . $id . "/", $params );
return $this->delete("/dcim/rack-roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/rack-roles/" . $id . "/", $params );
return $this->put("/dcim/rack-roles/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/rack-roles/", $params );
return $this->get("/dcim/rack-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/rack-roles/" . $id . "/", $params );
return $this->get("/dcim/rack-roles/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Racks extends AbstractApi class Racks extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/racks/", $params );
return $this->post("/dcim/racks/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/racks/" . $id . "/", $params );
return $this->delete("/dcim/racks/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/racks/" . $id . "/", $params );
return $this->put("/dcim/racks/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/racks/", $params );
return $this->get("/dcim/racks/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/racks/" . $id . "/", $params );
return $this->get("/dcim/racks/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function elevation(int $id, array $params = []) public function elevation( int $id, array $params = [] ) {
{ return $this->get( "/dcim/racks/" . $id . "/elevation/", $params );
return $this->get("/dcim/racks/" . $id . "/elevation/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class RearPortTemplates extends AbstractApi class RearPortTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/rear-port-templates/", $params );
return $this->post("/dcim/rear-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/rear-port-templates/" . $id . "/", $params );
return $this->delete("/dcim/rear-port-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/rear-port-templates/" . $id . "/", $params );
return $this->put("/dcim/rear-port-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/rear-port-templates/", $params );
return $this->get("/dcim/rear-port-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/rear-port-templates/" . $id . "/", $params );
return $this->get("/dcim/rear-port-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class RearPorts extends AbstractApi class RearPorts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/rear-ports/", $params );
return $this->post("/dcim/rear-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/rear-ports/" . $id . "/", $params );
return $this->delete("/dcim/rear-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/rear-ports/" . $id . "/", $params );
return $this->put("/dcim/rear-ports/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/rear-ports/", $params );
return $this->get("/dcim/rear-ports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/rear-ports/" . $id . "/", $params );
return $this->get("/dcim/rear-ports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function paths(int $id, array $params = []) public function paths( int $id, array $params = [] ) {
{ return $this->get( "/dcim/rear-ports/" . $id . "/paths/", $params );
return $this->get("/dcim/rear-ports/" . $id . "/paths/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Regions extends AbstractApi class Regions extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/regions/", $params );
return $this->post("/dcim/regions/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/regions/" . $id . "/", $params );
return $this->delete("/dcim/regions/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/regions/" . $id . "/", $params );
return $this->put("/dcim/regions/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/regions/", $params );
return $this->get("/dcim/regions/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/regions/" . $id . "/", $params );
return $this->get("/dcim/regions/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Sites extends AbstractApi class Sites extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/sites/", $params );
return $this->post("/dcim/sites/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/sites/" . $id . "/", $params );
return $this->delete("/dcim/sites/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/sites/" . $id . "/", $params );
return $this->put("/dcim/sites/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/sites/", $params );
return $this->get("/dcim/sites/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/sites/" . $id . "/", $params );
return $this->get("/dcim/sites/" . $id . "/", $params);
} }
} }

View file

@ -5,58 +5,57 @@ namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class VirtualChassis extends AbstractApi class VirtualChassis extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/dcim/virtual-chassis/", $params );
return $this->post("/dcim/virtual-chassis/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/dcim/virtual-chassis/" . $id . "/", $params );
return $this->delete("/dcim/virtual-chassis/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/dcim/virtual-chassis/" . $id . "/", $params );
return $this->put("/dcim/virtual-chassis/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/dcim/virtual-chassis/", $params );
return $this->get("/dcim/virtual-chassis/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/dcim/virtual-chassis/" . $id . "/", $params );
return $this->get("/dcim/virtual-chassis/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ConfigContexts extends AbstractApi class ConfigContexts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/extras/config-contexts/", $params );
return $this->post("/extras/config-contexts/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/extras/config-contexts/" . $id . "/", $params );
return $this->delete("/extras/config-contexts/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/extras/config-contexts/" . $id . "/", $params );
return $this->put("/extras/config-contexts/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/extras/config-contexts/" . $id . "/", $params );
return $this->patch("/extras/config-contexts/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/config-contexts/", $params );
return $this->get("/extras/config-contexts/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/config-contexts/" . $id . "/", $params );
return $this->get("/extras/config-contexts/" . $id . "/", $params);
} }
} }

View file

@ -5,26 +5,25 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ContentTypes extends AbstractApi class ContentTypes extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/content-types/", $params );
return $this->get("/extras/content-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/content-types/" . $id . "/", $params );
return $this->get("/extras/content-types/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class CustomFields extends AbstractApi class CustomFields extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/extras/custom-fields/", $params );
return $this->post("/extras/custom-fields/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/extras/custom-fields/" . $id . "/", $params );
return $this->delete("/extras/custom-fields/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/extras/custom-fields/" . $id . "/", $params );
return $this->put("/extras/custom-fields/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/extras/custom-fields/" . $id . "/", $params );
return $this->patch("/extras/custom-fields/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/custom-fields/", $params );
return $this->get("/extras/custom-fields/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/custom-fields/" . $id . "/", $params );
return $this->get("/extras/custom-fields/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ExportTemplates extends AbstractApi class ExportTemplates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/extras/export-templates/", $params );
return $this->post("/extras/export-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/extras/export-templates/" . $id . "/", $params );
return $this->delete("/extras/export-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/extras/export-templates/" . $id . "/", $params );
return $this->put("/extras/export-templates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/extras/export-templates/" . $id . "/", $params );
return $this->patch("/extras/export-templates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/export-templates/", $params );
return $this->get("/extras/export-templates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/export-templates/" . $id . "/", $params );
return $this->get("/extras/export-templates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ImageAttachments extends AbstractApi class ImageAttachments extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/extras/image-attachments/", $params );
return $this->post("/extras/image-attachments/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/extras/image-attachments/" . $id . "/", $params );
return $this->delete("/extras/image-attachments/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/extras/image-attachments/" . $id . "/", $params );
return $this->put("/extras/image-attachments/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/extras/image-attachments/" . $id . "/", $params );
return $this->patch("/extras/image-attachments/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/image-attachments/", $params );
return $this->get("/extras/image-attachments/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/image-attachments/" . $id . "/", $params );
return $this->get("/extras/image-attachments/" . $id . "/", $params);
} }
} }

View file

@ -5,26 +5,25 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class JobResults extends AbstractApi class JobResults extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/job-results/", $params );
return $this->get("/extras/job-results/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/job-results/" . $id . "/", $params );
return $this->get("/extras/job-results/" . $id . "/", $params);
} }
} }

View file

@ -5,26 +5,25 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ObjectChanges extends AbstractApi class ObjectChanges extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/object-changes/", $params );
return $this->get("/extras/object-changes/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/object-changes/" . $id . "/", $params );
return $this->get("/extras/object-changes/" . $id . "/", $params);
} }
} }

View file

@ -5,37 +5,36 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Reports extends AbstractApi class Reports extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/reports/", $params );
return $this->get("/extras/reports/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/reports/" . $id . "/", $params );
return $this->get("/extras/reports/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function run(int $id, array $params = []): array public function run( int $id, array $params = [] ): array {
{ return $this->post( "/extras/reports/" . $id . "/run/", $params );
return $this->post("/extras/reports/" . $id . "/run/", $params);
} }
} }

View file

@ -5,26 +5,25 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Scripts extends AbstractApi class Scripts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/scripts/", $params );
return $this->get("/extras/scripts/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/scripts/" . $id . "/", $params );
return $this->get("/extras/scripts/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Extras;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Tags extends AbstractApi class Tags extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/extras/tags/", $params );
return $this->post("/extras/tags/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/extras/tags/" . $id . "/", $params );
return $this->delete("/extras/tags/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/extras/tags/" . $id . "/", $params );
return $this->put("/extras/tags/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/extras/tags/" . $id . "/", $params );
return $this->patch("/extras/tags/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/extras/tags/", $params );
return $this->get("/extras/tags/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/extras/tags/" . $id . "/", $params );
return $this->get("/extras/tags/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Aggregates extends AbstractApi class Aggregates extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/aggregates/", $params );
return $this->post("/ipam/aggregates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/aggregates/" . $id . "/", $params );
return $this->delete("/ipam/aggregates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/aggregates/" . $id . "/", $params );
return $this->put("/ipam/aggregates/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/aggregates/" . $id . "/", $params );
return $this->patch("/ipam/aggregates/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/aggregates/", $params );
return $this->get("/ipam/aggregates/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/aggregates/" . $id . "/", $params );
return $this->get("/ipam/aggregates/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Asns extends AbstractApi class Asns extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/asns/", $params );
return $this->post("/ipam/asns/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/asns/" . $id . "/", $params );
return $this->delete("/ipam/asns/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/asns/" . $id . "/", $params );
return $this->put("/ipam/asns/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/asns/" . $id . "/", $params );
return $this->patch("/ipam/asns/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/asns/", $params );
return $this->get("/ipam/asns/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/asns/" . $id . "/", $params );
return $this->get("/ipam/asns/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class IpAddresses extends AbstractApi class IpAddresses extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/ip-addresses/", $params );
return $this->post("/ipam/ip-addresses/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/ip-addresses/" . $id . "/", $params );
return $this->delete("/ipam/ip-addresses/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/ip-addresses/" . $id . "/", $params );
return $this->put("/ipam/ip-addresses/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/ip-addresses/" . $id . "/", $params );
return $this->patch("/ipam/ip-addresses/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/ip-addresses/", $params );
return $this->get("/ipam/ip-addresses/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/ip-addresses/" . $id . "/", $params );
return $this->get("/ipam/ip-addresses/" . $id . "/", $params);
} }
} }

View file

@ -5,113 +5,112 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Prefixes extends AbstractApi class Prefixes extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/prefixes/", $params );
return $this->post("/ipam/prefixes/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/prefixes/" . $id . "/", $params );
return $this->delete("/ipam/prefixes/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/prefixes/" . $id . "/", $params );
return $this->put("/ipam/prefixes/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/prefixes/" . $id . "/", $params );
return $this->patch("/ipam/prefixes/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/prefixes/", $params );
return $this->get("/ipam/prefixes/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/prefixes/" . $id . "/", $params );
return $this->get("/ipam/prefixes/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function showAvailableIps(int $id, array $params = []) public function showAvailableIps( int $id, array $params = [] ) {
{ return $this->get( "/ipam/prefixes/" . $id . "/available-ips/", $params );
return $this->get("/ipam/prefixes/" . $id . "/available-ips/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function addAvailableIps(int $id, array $params = []): array public function addAvailableIps( int $id, array $params = [] ): array {
{ return $this->post( "/ipam/prefixes/" . $id . "/available-ips/", $params );
return $this->post("/ipam/prefixes/" . $id . "/available-ips/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function showAvailable(int $id, array $params = []) public function showAvailable( int $id, array $params = [] ) {
{ return $this->get( "/ipam/prefixes/" . $id . "/available-prefixes/", $params );
return $this->get("/ipam/prefixes/" . $id . "/available-prefixes/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function addAvailable(int $id, array $params = []): array public function addAvailable( int $id, array $params = [] ): array {
{ return $this->post( "/ipam/prefixes/" . $id . "/available-prefixes/", $params );
return $this->post("/ipam/prefixes/" . $id . "/available-prefixes/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Rirs extends AbstractApi class Rirs extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/rirs/", $params );
return $this->post("/ipam/rirs/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/rirs/" . $id . "/", $params );
return $this->delete("/ipam/rirs/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/rirs/" . $id . "/", $params );
return $this->put("/ipam/rirs/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/rirs/" . $id . "/", $params );
return $this->patch("/ipam/rirs/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/rirs/", $params );
return $this->get("/ipam/rirs/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/rirs/" . $id . "/", $params );
return $this->get("/ipam/rirs/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Roles extends AbstractApi class Roles extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/roles/", $params );
return $this->post("/ipam/roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/roles/" . $id . "/", $params );
return $this->delete("/ipam/roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/roles/" . $id . "/", $params );
return $this->put("/ipam/roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/roles/" . $id . "/", $params );
return $this->patch("/ipam/roles/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/roles/", $params );
return $this->get("/ipam/roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/roles/" . $id . "/", $params );
return $this->get("/ipam/roles/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class RouteTargets extends AbstractApi class RouteTargets extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/route-targets/", $params );
return $this->post("/ipam/route-targets/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/route-targets/" . $id . "/", $params );
return $this->delete("/ipam/route-targets/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/route-targets/" . $id . "/", $params );
return $this->put("/ipam/route-targets/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/route-targets/" . $id . "/", $params );
return $this->patch("/ipam/route-targets/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/route-targets/", $params );
return $this->get("/ipam/route-targets/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/route-targets/" . $id . "/", $params );
return $this->get("/ipam/route-targets/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Services extends AbstractApi class Services extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/services/", $params );
return $this->post("/ipam/services/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/services/" . $id . "/", $params );
return $this->delete("/ipam/services/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/services/" . $id . "/", $params );
return $this->put("/ipam/services/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/services/" . $id . "/", $params );
return $this->patch("/ipam/services/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/services/", $params );
return $this->get("/ipam/services/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/services/" . $id . "/", $params );
return $this->get("/ipam/services/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class VlanGroups extends AbstractApi class VlanGroups extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/vlan-groups/", $params );
return $this->post("/ipam/vlan-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/vlan-groups/" . $id . "/", $params );
return $this->delete("/ipam/vlan-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/vlan-groups/" . $id . "/", $params );
return $this->put("/ipam/vlan-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/vlan-groups/" . $id . "/", $params );
return $this->patch("/ipam/vlan-groups/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/vlan-groups/", $params );
return $this->get("/ipam/vlan-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/vlan-groups/" . $id . "/", $params );
return $this->get("/ipam/vlan-groups/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Vlans extends AbstractApi class Vlans extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/vlans/", $params );
return $this->post("/ipam/vlans/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/vlans/" . $id . "/", $params );
return $this->delete("/ipam/vlans/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/vlans/" . $id . "/", $params );
return $this->put("/ipam/vlans/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/vlans/" . $id . "/", $params );
return $this->patch("/ipam/vlans/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/vlans/", $params );
return $this->get("/ipam/vlans/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/vlans/" . $id . "/", $params );
return $this->get("/ipam/vlans/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\IPAM;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Vrfs extends AbstractApi class Vrfs extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/ipam/vrfs/", $params );
return $this->post("/ipam/vrfs/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/ipam/vrfs/" . $id . "/", $params );
return $this->delete("/ipam/vrfs/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/ipam/vrfs/" . $id . "/", $params );
return $this->put("/ipam/vrfs/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/ipam/vrfs/" . $id . "/", $params );
return $this->patch("/ipam/vrfs/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/ipam/vrfs/", $params );
return $this->get("/ipam/vrfs/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/ipam/vrfs/" . $id . "/", $params );
return $this->get("/ipam/vrfs/" . $id . "/", $params);
} }
} }

View file

@ -5,15 +5,14 @@ namespace Hosterra\NetBox\Api\Secrets;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class KeyGen extends AbstractApi class KeyGen extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/secrets/generate-rsa-key-pair/", $params );
return $this->get("/secrets/generate-rsa-key-pair/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Secrets;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class SecretRoles extends AbstractApi class SecretRoles extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/secrets/secret-roles/", $params );
return $this->post("/secrets/secret-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/secrets/secret-roles/" . $id . "/", $params );
return $this->delete("/secrets/secret-roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/secrets/secret-roles/" . $id . "/", $params );
return $this->put("/secrets/secret-roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/secrets/secret-roles/" . $id . "/", $params );
return $this->patch("/secrets/secret-roles/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/secrets/secret-roles/", $params );
return $this->get("/secrets/secret-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/secrets/secret-roles/" . $id . "/", $params );
return $this->get("/secrets/secret-roles/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Secrets;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Secrets extends AbstractApi class Secrets extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/secrets/secrets/", $params );
return $this->post("/secrets/secrets/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/secrets/secrets/" . $id . "/", $params );
return $this->delete("/secrets/secrets/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/secrets/secrets/" . $id . "/", $params );
return $this->put("/secrets/secrets/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/secrets/secrets/" . $id . "/", $params );
return $this->patch("/secrets/secrets/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/secrets/secrets/", $params );
return $this->get("/secrets/secrets/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/secrets/secrets/" . $id . "/", $params );
return $this->get("/secrets/secrets/" . $id . "/", $params);
} }
} }

View file

@ -5,15 +5,14 @@ namespace Hosterra\NetBox\Api\Secrets;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Session extends AbstractApi class Session extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []): array public function list( array $params = [] ): array {
{ return $this->post( "/secrets/get-session-key/", $params );
return $this->post("/secrets/get-session-key/", $params);
} }
} }

View file

@ -4,15 +4,14 @@ namespace Hosterra\NetBox\Api;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
class Status extends AbstractApi class Status extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(array $params = []) public function show( array $params = [] ) {
{ return $this->get( "/status/", $params );
return $this->get("/status/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ContactAssignments extends AbstractApi class ContactAssignments extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/tenancy/contact-assignments/", $params );
return $this->post("/tenancy/contact-assignments/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/tenancy/contact-assignments/" . $id . "/", $params );
return $this->delete("/tenancy/contact-assignments/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/tenancy/contact-assignments/" . $id . "/", $params );
return $this->put("/tenancy/contact-assignments/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/tenancy/contact-assignments/" . $id . "/", $params );
return $this->patch("/tenancy/contact-assignments/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/tenancy/contact-assignments/", $params );
return $this->get("/tenancy/contact-assignments/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/tenancy/contact-assignments/" . $id . "/", $params );
return $this->get("/tenancy/contact-assignments/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ContactGroups extends AbstractApi class ContactGroups extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/tenancy/contact-groups/", $params );
return $this->post("/tenancy/contact-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/tenancy/contact-groups/" . $id . "/", $params );
return $this->delete("/tenancy/contact-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/tenancy/contact-groups/" . $id . "/", $params );
return $this->put("/tenancy/contact-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/tenancy/contact-groups/" . $id . "/", $params );
return $this->patch("/tenancy/contact-groups/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/tenancy/contact-groups/", $params );
return $this->get("/tenancy/contact-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/tenancy/contact-groups/" . $id . "/", $params );
return $this->get("/tenancy/contact-groups/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ContactRoles extends AbstractApi class ContactRoles extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/tenancy/contact-roles/", $params );
return $this->post("/tenancy/contact-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/tenancy/contact-roles/" . $id . "/", $params );
return $this->delete("/tenancy/contact-roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/tenancy/contact-roles/" . $id . "/", $params );
return $this->put("/tenancy/contact-roles/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/tenancy/contact-roles/" . $id . "/", $params );
return $this->patch("/tenancy/contact-roles/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/tenancy/contact-roles/", $params );
return $this->get("/tenancy/contact-roles/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/tenancy/contact-roles/" . $id . "/", $params );
return $this->get("/tenancy/contact-roles/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Contacts extends AbstractApi class Contacts extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/tenancy/contacts/", $params );
return $this->post("/tenancy/contacts/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/tenancy/contacts/" . $id . "/", $params );
return $this->delete("/tenancy/contacts/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/tenancy/contacts/" . $id . "/", $params );
return $this->put("/tenancy/contacts/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/tenancy/contacts/" . $id . "/", $params );
return $this->patch("/tenancy/contacts/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/tenancy/contacts/", $params );
return $this->get("/tenancy/contacts/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/tenancy/contacts/" . $id . "/", $params );
return $this->get("/tenancy/contacts/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class TenantGroups extends AbstractApi class TenantGroups extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/tenancy/tenant-groups/", $params );
return $this->post("/tenancy/tenant-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/tenancy/tenant-groups/" . $id . "/", $params );
return $this->delete("/tenancy/tenant-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/tenancy/tenant-groups/" . $id . "/", $params );
return $this->put("/tenancy/tenant-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/tenancy/tenant-groups/" . $id . "/", $params );
return $this->patch("/tenancy/tenant-groups/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/tenancy/tenant-groups/", $params );
return $this->get("/tenancy/tenant-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/tenancy/tenant-groups/" . $id . "/", $params );
return $this->get("/tenancy/tenant-groups/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Tenants extends AbstractApi class Tenants extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/tenancy/tenants/", $params );
return $this->post("/tenancy/tenants/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/tenancy/tenants/" . $id . "/", $params );
return $this->delete("/tenancy/tenants/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/tenancy/tenants/" . $id . "/", $params );
return $this->put("/tenancy/tenants/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/tenancy/tenants/" . $id . "/", $params );
return $this->patch("/tenancy/tenants/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/tenancy/tenants/", $params );
return $this->get("/tenancy/tenants/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/tenancy/tenants/" . $id . "/", $params );
return $this->get("/tenancy/tenants/" . $id . "/", $params);
} }
} }

View file

@ -5,15 +5,14 @@ namespace Hosterra\NetBox\Api\Users;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Config extends AbstractApi class Config extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/users/users/", $params );
return $this->get("/users/users/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Users;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Groups extends AbstractApi class Groups extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/users/groups/", $params );
return $this->post("/users/groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/users/groups/" . $id . "/", $params );
return $this->delete("/users/groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/users/groups/" . $id . "/", $params );
return $this->put("/users/groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/users/groups/" . $id . "/", $params );
return $this->patch("/users/groups/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/users/groups/", $params );
return $this->get("/users/groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/users/groups/" . $id . "/", $params );
return $this->get("/users/groups/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Users;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Permissions extends AbstractApi class Permissions extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/users/permissions/", $params );
return $this->post("/users/permissions/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/users/permissions/" . $id . "/", $params );
return $this->delete("/users/permissions/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/users/permissions/" . $id . "/", $params );
return $this->put("/users/permissions/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/users/permissions/" . $id . "/", $params );
return $this->patch("/users/permissions/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/users/permissions/", $params );
return $this->get("/users/permissions/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/users/permissions/" . $id . "/", $params );
return $this->get("/users/permissions/" . $id . "/", $params);
} }
} }

View file

@ -5,81 +5,80 @@ namespace Hosterra\NetBox\Api\Users;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Users extends AbstractApi class Users extends AbstractApi {
{
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function checkLogin(int $id, array $params = []) public function checkLogin( int $id, array $params = [] ) {
{ return $this->get( "/users/users/" . $id . "/", $params );
return $this->get("/users/users/" . $id . "/", $params);
//return $this->post(array_merge(['controller' => 'debtor', 'action' => 'checkLogin'], $params)); //return $this->post(array_merge(['controller' => 'debtor', 'action' => 'checkLogin'], $params));
} }
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/users/users/", $params );
return $this->post("/users/users/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/users/users/" . $id . "/", $params );
return $this->delete("/users/users/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/users/users/" . $id . "/", $params );
return $this->put("/users/users/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/users/users/" . $id . "/", $params );
return $this->patch("/users/users/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/users/users/", $params );
return $this->get("/users/users/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/users/users/" . $id . "/", $params );
return $this->get("/users/users/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Virtualization;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ClusterGroups extends AbstractApi class ClusterGroups extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/virtualization/cluster-groups/", $params );
return $this->post("/virtualization/cluster-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/virtualization/cluster-groups/" . $id . "/", $params );
return $this->delete("/virtualization/cluster-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/virtualization/cluster-groups/" . $id . "/", $params );
return $this->put("/virtualization/cluster-groups/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/virtualization/cluster-groups/" . $id . "/", $params );
return $this->patch("/virtualization/cluster-groups/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/virtualization/cluster-groups/", $params );
return $this->get("/virtualization/cluster-groups/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/virtualization/cluster-groups/" . $id . "/", $params );
return $this->get("/virtualization/cluster-groups/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Virtualization;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class ClusterTypes extends AbstractApi class ClusterTypes extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/virtualization/cluster-types/", $params );
return $this->post("/virtualization/cluster-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/virtualization/cluster-types/" . $id . "/", $params );
return $this->delete("/virtualization/cluster-types/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/virtualization/cluster-types/" . $id . "/", $params );
return $this->put("/virtualization/cluster-types/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/virtualization/cluster-types/" . $id . "/", $params );
return $this->patch("/virtualization/cluster-types/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/virtualization/cluster-types/", $params );
return $this->get("/virtualization/cluster-types/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/virtualization/cluster-types/" . $id . "/", $params );
return $this->get("/virtualization/cluster-types/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Virtualization;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Clusters extends AbstractApi class Clusters extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/virtualization/clusters/", $params );
return $this->post("/virtualization/clusters/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/virtualization/clusters/" . $id . "/", $params );
return $this->delete("/virtualization/clusters/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/virtualization/clusters/" . $id . "/", $params );
return $this->put("/virtualization/clusters/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/virtualization/clusters/" . $id . "/", $params );
return $this->patch("/virtualization/clusters/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/virtualization/clusters/", $params );
return $this->get("/virtualization/clusters/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/virtualization/clusters/" . $id . "/", $params );
return $this->get("/virtualization/clusters/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Virtualization;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class Interfaces extends AbstractApi class Interfaces extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/virtualization/interfaces/", $params );
return $this->post("/virtualization/interfaces/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/virtualization/interfaces/" . $id . "/", $params );
return $this->delete("/virtualization/interfaces/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/virtualization/interfaces/" . $id . "/", $params );
return $this->put("/virtualization/interfaces/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/virtualization/interfaces/" . $id . "/", $params );
return $this->patch("/virtualization/interfaces/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/virtualization/interfaces/", $params );
return $this->get("/virtualization/interfaces/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/virtualization/interfaces/" . $id . "/", $params );
return $this->get("/virtualization/interfaces/" . $id . "/", $params);
} }
} }

View file

@ -5,69 +5,68 @@ namespace Hosterra\NetBox\Api\Virtualization;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi; use Hosterra\NetBox\Api\AbstractApi;
class VirtualMachines extends AbstractApi class VirtualMachines extends AbstractApi {
{
/** /**
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function add(array $params = []): array public function add( array $params = [] ): array {
{ return $this->post( "/virtualization/virtual-machines/", $params );
return $this->post("/virtualization/virtual-machines/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function remove(int $id, array $params = []): bool public function remove( int $id, array $params = [] ): bool {
{ return $this->delete( "/virtualization/virtual-machines/" . $id . "/", $params );
return $this->delete("/virtualization/virtual-machines/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function edit(int $id, array $params = []): array public function edit( int $id, array $params = [] ): array {
{ return $this->put( "/virtualization/virtual-machines/" . $id . "/", $params );
return $this->put("/virtualization/virtual-machines/" . $id . "/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function update(int $id, array $params = []): array public function update( int $id, array $params = [] ): array {
{ return $this->patch( "/virtualization/virtual-machines/" . $id . "/", $params );
return $this->patch("/virtualization/virtual-machines/" . $id . "/", $params);
} }
/** /**
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function list(array $params = []) public function list( array $params = [] ) {
{ return $this->get( "/virtualization/virtual-machines/", $params );
return $this->get("/virtualization/virtual-machines/", $params);
} }
/** /**
* @param int $id * @param int $id
* @param array $params * @param array $params
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function show(int $id, array $params = []) public function show( int $id, array $params = [] ) {
{ return $this->get( "/virtualization/virtual-machines/" . $id . "/", $params );
return $this->get("/virtualization/virtual-machines/" . $id . "/", $params);
} }
} }

View file

@ -7,8 +7,7 @@ use InvalidArgumentException;
use Hosterra\NetBox\HttpClient\HttpClient; use Hosterra\NetBox\HttpClient\HttpClient;
use RuntimeException; use RuntimeException;
class Client class Client {
{
const VERSION = '3.0.0'; const VERSION = '3.0.0';
/** @var array */ /** @var array */
@ -118,15 +117,14 @@ class Client
/** @var array */ /** @var array */
protected $options = []; protected $options = [];
public function __construct() public function __construct() {
{ if ( strlen( getenv( 'NETBOX_API' ) ) === 0 || strlen( getenv( 'NETBOX_API_KEY' ) ) === 0 ) {
if (strlen(getenv('NETBOX_API')) === 0 || strlen(getenv('NETBOX_API_KEY')) === 0) {
throw new RuntimeException( throw new RuntimeException(
sprintf( sprintf(
'Environment Variables not found (NETBOX_API, NETBOX_API_KEY): "%s" "redacted(%s(%s))"', 'Environment Variables not found (NETBOX_API, NETBOX_API_KEY): "%s" "redacted(%s(%s))"',
getenv('NETBOX_API'), getenv( 'NETBOX_API' ),
gettype(getenv('NETBOX_API_KEY')), gettype( getenv( 'NETBOX_API_KEY' ) ),
strlen(getenv('NETBOX_API_KEY')) strlen( getenv( 'NETBOX_API_KEY' ) )
), ),
1653901216 1653901216
); );
@ -136,40 +134,39 @@ class Client
/** /**
* @param $method * @param $method
* @param $args * @param $args
*
* @return mixed * @return mixed
*/ */
public function __call($method, $args) public function __call( $method, $args ) {
{
try { try {
return $this->api($method); return $this->api( $method );
} catch (InvalidArgumentException $e) { } catch ( InvalidArgumentException $e ) {
throw new BadMethodCallException(sprintf('Undefined method called: "%s"', $method)); throw new BadMethodCallException( sprintf( 'Undefined method called: "%s"', $method ) );
} }
} }
/** /**
* @param $name * @param $name
*
* @return mixed * @return mixed
*/ */
public function api($name) public function api( $name ) {
{ if ( ! isset( $this->classes[ $name ] ) ) {
if (!isset($this->classes[$name])) { throw new InvalidArgumentException( sprintf( 'Undefined method called: "%s"', $name ) );
throw new InvalidArgumentException(sprintf('Undefined method called: "%s"', $name));
} }
$class = '\\Hosterra\\NetBox\\Api\\' . $this->classes[$name]; $class = '\\Hosterra\\NetBox\\Api\\' . $this->classes[ $name ];
return new $class($this); return new $class( $this );
} }
/** /**
* @return HttpClient * @return HttpClient
*/ */
public function getHttpClient(): HttpClient public function getHttpClient(): HttpClient {
{ if ( ! isset( $this->httpClient ) ) {
if (!isset($this->httpClient)) {
$this->httpClient = new HttpClient(); $this->httpClient = new HttpClient();
} }
$this->httpClient->setOptions($this->getOptions()); $this->httpClient->setOptions( $this->getOptions() );
return $this->httpClient; return $this->httpClient;
} }
@ -177,16 +174,14 @@ class Client
/** /**
* @return array * @return array
*/ */
public function getOptions(): array public function getOptions(): array {
{
return $this->options; return $this->options;
} }
/** /**
* @param array $options * @param array $options
*/ */
public function setOptions(array $options) public function setOptions( array $options ) {
{
$this->options = $options; $this->options = $options;
} }
} }

View file

@ -2,7 +2,6 @@
namespace Hosterra\NetBox; namespace Hosterra\NetBox;
interface ClientInterface interface ClientInterface {
{
} }

View file

@ -6,8 +6,7 @@ use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\RequestOptions; use GuzzleHttp\RequestOptions;
class HttpClient implements HttpClientInterface class HttpClient implements HttpClientInterface {
{
/** @var Client */ /** @var Client */
protected $client; protected $client;
@ -17,11 +16,10 @@ class HttpClient implements HttpClientInterface
/** /**
* @return Client * @return Client
*/ */
public function getClient(): Client public function getClient(): Client {
{ if ( ! isset( $this->client ) ) {
if (!isset($this->client)) { $this->client = new Client( [
$this->client = new Client([ 'base_uri' => getenv( 'NETBOX_API' ),
'base_uri' => getenv('NETBOX_API'),
RequestOptions::TIMEOUT => 180, RequestOptions::TIMEOUT => 180,
RequestOptions::COOKIES => true, RequestOptions::COOKIES => true,
RequestOptions::CONNECT_TIMEOUT => 180, RequestOptions::CONNECT_TIMEOUT => 180,
@ -29,9 +27,9 @@ class HttpClient implements HttpClientInterface
RequestOptions::HEADERS => [ RequestOptions::HEADERS => [
'Accept' => 'application/json', 'Accept' => 'application/json',
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Authorization' => sprintf("Token %s", getenv('NETBOX_API_KEY')), 'Authorization' => sprintf( "Token %s", getenv( 'NETBOX_API_KEY' ) ),
] ]
]); ] );
return $this->client; return $this->client;
} }
@ -41,10 +39,10 @@ class HttpClient implements HttpClientInterface
/** /**
* @param Client $client * @param Client $client
*
* @return Client * @return Client
*/ */
public function setClient(Client $client): Client public function setClient( Client $client ): Client {
{
$this->client = $client; $this->client = $client;
return $this->client; return $this->client;
@ -53,90 +51,90 @@ class HttpClient implements HttpClientInterface
/** /**
* @param string $path * @param string $path
* @param array $query * @param array $query
*
* @return mixed * @return mixed
* @throws GuzzleException * @throws GuzzleException
*/ */
public function get(string $path = "", array $query = []): array public function get( string $path = "", array $query = [] ): array {
{
$response = $this->getClient()->request( $response = $this->getClient()->request(
'GET', 'GET',
getenv('NETBOX_API') . $path, getenv( 'NETBOX_API' ) . $path,
[ [
'query' => $query 'query' => $query
] ]
); );
return json_decode($response->getBody()->getContents(), true); return json_decode( $response->getBody()->getContents(), true );
} }
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function post(string $path = "", array $body = []): array public function post( string $path = "", array $body = [] ): array {
{
$response = $this->getClient()->request( $response = $this->getClient()->request(
'POST', 'POST',
getenv('NETBOX_API') . $path, getenv( 'NETBOX_API' ) . $path,
[ [
'json' => $body 'json' => $body
] ]
); );
return json_decode($response->getBody()->getContents(), true); return json_decode( $response->getBody()->getContents(), true );
} }
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function put(string $path = "", array $body = []): array public function put( string $path = "", array $body = [] ): array {
{
$response = $this->getClient()->request( $response = $this->getClient()->request(
'PUT', 'PUT',
getenv('NETBOX_API') . $path, getenv( 'NETBOX_API' ) . $path,
[ [
'json' => $body 'json' => $body
] ]
); );
return json_decode($response->getBody()->getContents(), true); return json_decode( $response->getBody()->getContents(), true );
} }
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return array * @return array
* @throws GuzzleException * @throws GuzzleException
*/ */
public function patch(string $path = "", array $body = []): array public function patch( string $path = "", array $body = [] ): array {
{
$response = $this->getClient()->request( $response = $this->getClient()->request(
'PATCH', 'PATCH',
getenv('NETBOX_API') . $path, getenv( 'NETBOX_API' ) . $path,
[ [
'json' => $body 'json' => $body
] ]
); );
return json_decode($response->getBody()->getContents(), true); return json_decode( $response->getBody()->getContents(), true );
} }
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return bool * @return bool
* @throws GuzzleException * @throws GuzzleException
*/ */
public function delete(string $path = "", array $body = []): ?bool public function delete( string $path = "", array $body = [] ): ?bool {
{
$response = $this->getClient()->request( $response = $this->getClient()->request(
'DELETE', 'DELETE',
getenv('NETBOX_API') . $path, getenv( 'NETBOX_API' ) . $path,
[ [
'json' => $body 'json' => $body
] ]
@ -148,16 +146,14 @@ class HttpClient implements HttpClientInterface
/** /**
* @return array * @return array
*/ */
public function getOptions(): array public function getOptions(): array {
{
return $this->options; return $this->options;
} }
/** /**
* @param array $options * @param array $options
*/ */
public function setOptions(array $options) public function setOptions( array $options ) {
{ $this->options = array_merge( $this->options, $options );
$this->options = array_merge($this->options, $options);
} }
} }

View file

@ -2,8 +2,7 @@
namespace Hosterra\NetBox\HttpClient; namespace Hosterra\NetBox\HttpClient;
interface HttpClientInterface interface HttpClientInterface {
{
/** /**
* @return array * @return array
*/ */
@ -12,33 +11,37 @@ interface HttpClientInterface
/** /**
* @param string $path * @param string $path
* @param array $query * @param array $query
*
* @return array * @return array
*/ */
public function get(string $path = "", array $query = []): array; public function get( string $path = "", array $query = [] ): array;
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return array * @return array
*/ */
public function post(string $path = "", array $body = []): array; public function post( string $path = "", array $body = [] ): array;
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return array * @return array
*/ */
public function put(string $path = "", array $body = []): array; public function put( string $path = "", array $body = [] ): array;
/** /**
* @param string $path * @param string $path
* @param array $body * @param array $body
*
* @return bool * @return bool
*/ */
public function delete(string $path = "", array $body = []): ?bool; public function delete( string $path = "", array $body = [] ): ?bool;
/** /**
* @param array $options * @param array $options
*/ */
public function setOptions(array $options); public function setOptions( array $options );
} }