Create AbstractApi.php

This commit is contained in:
Tony Roy 2021-03-10 18:40:36 -04:00 committed by GitHub
commit a4f1ff7346
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

32
src/Api/AbstractApi.php Normal file
View file

@ -0,0 +1,32 @@
<?php
namespace wickedsoft\NetBox\Api;
use wickedsoft\NetBox\Client;
abstract class AbstractApi implements ApiInterface
{
/** @var \wickedsoft\NetBox\Client */
public $client;
/**
* AbstractApi constructor.
* @param \wickedsoft\NetBox\Client $client
*/
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* @param array $parameters
* @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException
*/
protected function post($parameters)
{
return $this->client->getHttpClient()->post(array_merge([
'api_key' => $this->client->getHttpClient()->getOptions()['key']
], $parameters));
}
}