Create AbstractApi.php
This commit is contained in:
parent
3557ffd2e2
commit
a4f1ff7346
1 changed files with 32 additions and 0 deletions
32
src/Api/AbstractApi.php
Normal file
32
src/Api/AbstractApi.php
Normal 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));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue