First generated API

This commit is contained in:
Ferdinand Kuhl 2023-01-05 12:55:52 +01:00
parent 722b1870a8
commit 2e7ca4b555
198 changed files with 14675 additions and 1 deletions

19
License.txt Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2021 Ferdinand Kuhl <f.kuhl@digital-competence.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,2 +1,18 @@
# hetzner-dns-api
# A PHP Client for the Hetzner DNS API
[Hetzner](https://dns.hetzner.com) is a hosting provider, which offers a REST API for their DNS service.
This SDK has been generated with [JanePHP](https://github.com/janephp/janephp) using the provided API [documentation](https://dns.hetzner.com/api-docs/).
The generated client has been modified to throw exceptions in case of an error answer.
## Installation
You will need a PSR-18 compatible client implementation. We used [symfony/http-client](https://github.com/symfony/http-client).
Most probably your framework already has some client instantiated, you just can pass to the Openapi client.
## Notes
1. As the DateFormat from Hetzner is not consistent (sometimes it shows microseconds, sometimes not, and in verified fields there is even more trailing information) you might want to add the HetznerDatesPlugin to your HTTP-Client. It's job is to replace all date strings with a consistent form (you'll loose the microseconds fractions from DateTimes, which have one)
2. The original hetzner OpenAPI specification mentions the Auth-API-Token as header parameter of each request, instead of applying the security scheme globally. To have a more sophisticated client, this has been rewritten. (Diff `hetzner-dns-api.json` with `hetzner-dns-api-modified.json`)

20
composer.json Normal file
View file

@ -0,0 +1,20 @@
{
"name": "digicomp/hetzner-dns-api",
"type": "library",
"description": "Openprovider API built by JanePHP",
"require": {
"composer/pcre": "^3.0.0",
"php": "^7.4 | ^8.0",
"psr/http-client": "^1.0.1",
"jane-php/open-api-runtime": "7.3"
},
"license": "MIT",
"require-dev": {
"jane-php/open-api-3": "^7.3"
},
"autoload": {
"psr-4": {
"DigiComp\\HetznerDnsApi\\": ["generated/", "src/"]
}
}
}

View file

@ -0,0 +1,21 @@
<?php
namespace DigiComp\HetznerDnsApi\Authentication;
class AuthAPITokenAuthentication implements \Jane\Component\OpenApiRuntime\Client\AuthenticationPlugin
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->{'apiKey'} = $apiKey;
}
public function authentication(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\RequestInterface
{
$request = $request->withHeader('Auth-API-Token', $this->{'apiKey'});
return $request;
}
public function getScope() : string
{
return 'Auth-API-Token';
}
}

365
generated/Client.php Normal file
View file

@ -0,0 +1,365 @@
<?php
namespace DigiComp\HetznerDnsApi;
class Client extends \DigiComp\HetznerDnsApi\Runtime\Client\Client
{
/**
* Returns paginated zones associated with the user. Limited to 100 zones per request.
*
* @param array $queryParameters {
* @var string $name Full name of a zone. Will return an array with one or no results
* @var string $search_name Partial name of a zone. Will return a maximum of 100 zones that contain the searched string
* @var float $per_page Number of zones to be shown per page. Returns 100 by default
* @var int $page A page parameter specifies the page to fetch.<br />The number of the first page is 1
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\GetZonesBadRequestException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZonesUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZonesNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getZones(array $queryParameters = array(), string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\GetZones($queryParameters), $fetch);
}
/**
* Creates a new zone.
*
* @param null|\DigiComp\HetznerDnsApi\Model\Zone $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\CreateZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateZoneNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateZoneUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesPostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function createZone(?\DigiComp\HetznerDnsApi\Model\Zone $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\CreateZone($requestBody), $fetch);
}
/**
* Deletes a zone.
*
* @param string $zoneID ID of zone to be deleted
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotAcceptableException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function deleteZone(string $zoneID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\DeleteZone($zoneID), $fetch);
}
/**
* Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.
*
* @param string $zoneID ID of zone to get
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesZoneIDGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getZone(string $zoneID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\GetZone($zoneID), $fetch);
}
/**
* Updates a zone.
*
* @param string $zoneID ID of zone to update
* @param null|\DigiComp\HetznerDnsApi\Model\Zone $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesZoneIDPutResponse200|\Psr\Http\Message\ResponseInterface
*/
public function updateZone(string $zoneID, ?\DigiComp\HetznerDnsApi\Model\Zone $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\UpdateZone($zoneID, $requestBody), $fetch);
}
/**
* Import a zone file in text/plain format.
*
* @param string $zoneID ID of zone to be imported
* @param null|string $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesZoneIDImportPostResponse201|\Psr\Http\Message\ResponseInterface
*/
public function importZoneFilePlain(string $zoneID, ?string $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\ImportZoneFilePlain($zoneID, $requestBody), $fetch);
}
/**
* Export a zone file.
*
* @param string $zoneID ID of zone to be exported
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileUnprocessableEntityException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function exportZoneFile(string $zoneID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\ExportZoneFile($zoneID), $fetch);
}
/**
* Validate a zone file in text/plain format.
*
* @param null|string $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesFileValidatePostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function validateZoneFilePlain(?string $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\ValidateZoneFilePlain($requestBody), $fetch);
}
/**
* Returns all records associated with user.
*
* @param array $queryParameters {
* @var string $zone_id ID of zone
* @var float $per_page Number of records to be shown per page. Returns all by default
* @var float $page A page parameter specifies the page to fetch.<br />The number of the first page is 1
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordsUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordsNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getRecords(array $queryParameters = array(), string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\GetRecords($queryParameters), $fetch);
}
/**
* Creates a new record.
*
* @param null|\DigiComp\HetznerDnsApi\Model\Record $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsPostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function createRecord(?\DigiComp\HetznerDnsApi\Model\Record $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\CreateRecord($requestBody), $fetch);
}
/**
* Deletes a record.
*
* @param string $recordID ID of record to delete
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordNotAcceptableException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function deleteRecord(string $recordID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\DeleteRecord($recordID), $fetch);
}
/**
* Returns information about a single record.
*
* @param string $recordID ID of record to get
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsRecordIDGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getRecord(string $recordID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\GetRecord($recordID), $fetch);
}
/**
* Updates a record.
*
* @param string $recordID ID of record to be updated
* @param null|\DigiComp\HetznerDnsApi\Model\Record $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsRecordIDPutResponse200|\Psr\Http\Message\ResponseInterface
*/
public function updateRecord(string $recordID, ?\DigiComp\HetznerDnsApi\Model\Record $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\UpdateRecord($recordID, $requestBody), $fetch);
}
/**
* Create several records at once.
*
* @param null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPostBody $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function bulkCreateRecords(?\DigiComp\HetznerDnsApi\Model\RecordsBulkPostBody $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\BulkCreateRecords($requestBody), $fetch);
}
/**
* Update several records at once.
*
* @param null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPutBody $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPutResponse200|\Psr\Http\Message\ResponseInterface
*/
public function bulkUpdateRecords(?\DigiComp\HetznerDnsApi\Model\RecordsBulkPutBody $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\BulkUpdateRecords($requestBody), $fetch);
}
/**
* Returns all primary servers associated with user. Primary servers can also be filtered by zone_id.
*
* @param array $queryParameters {
* @var string $zone_id ID of zone
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getPrimaryServers(array $queryParameters = array(), string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\GetPrimaryServers($queryParameters), $fetch);
}
/**
* Creates a new primary server.
*
* @param null|\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersPostResponse201|\Psr\Http\Message\ResponseInterface
*/
public function createPrimaryServer(?\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\CreatePrimaryServer($requestBody), $fetch);
}
/**
* Deletes a primary server.
*
* @param string $primaryServerID ID of primary server to be deleted
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotAcceptableException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function deletePrimaryServer(string $primaryServerID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\DeletePrimaryServer($primaryServerID), $fetch);
}
/**
* Returns an object containing all information of a primary server. Primary Server to get is identified by 'PrimaryServerID'.
*
* @param string $primaryServerID ID of primary server to get
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersPrimaryServerIDGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function getPrimaryServer(string $primaryServerID, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\GetPrimaryServer($primaryServerID), $fetch);
}
/**
* Updates a primary server.
*
* @param string $primaryServerID ID of primaryServer to update
* @param null|\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersPrimaryServerIDPutResponse200|\Psr\Http\Message\ResponseInterface
*/
public function updatePrimaryServer(string $primaryServerID, ?\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody = null, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \DigiComp\HetznerDnsApi\Endpoint\UpdatePrimaryServer($primaryServerID, $requestBody), $fetch);
}
public static function create($httpClient = null, array $additionalPlugins = array(), array $additionalNormalizers = array())
{
if (null === $httpClient) {
$httpClient = \Http\Discovery\Psr18ClientDiscovery::find();
$plugins = array();
$uri = \Http\Discovery\Psr17FactoryDiscovery::findUrlFactory()->createUri('https://dns.hetzner.com/api/v1');
$plugins[] = new \Http\Client\Common\Plugin\AddHostPlugin($uri);
$plugins[] = new \Http\Client\Common\Plugin\AddPathPlugin($uri);
if (count($additionalPlugins) > 0) {
$plugins = array_merge($plugins, $additionalPlugins);
}
$httpClient = new \Http\Client\Common\PluginClient($httpClient, $plugins);
}
$requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();
$streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory();
$normalizers = array(new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \DigiComp\HetznerDnsApi\Normalizer\JaneObjectNormalizer());
if (count($additionalNormalizers) > 0) {
$normalizers = array_merge($normalizers, $additionalNormalizers);
}
$serializer = new \Symfony\Component\Serializer\Serializer($normalizers, array(new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(array('json_decode_associative' => true)))));
return new static($httpClient, $requestFactory, $serializer, $streamFactory);
}
}

View file

@ -0,0 +1,68 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class BulkCreateRecords extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Create several records at once.
*
* @param null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPostBody $requestBody
*/
public function __construct(?\DigiComp\HetznerDnsApi\Model\RecordsBulkPostBody $requestBody = null)
{
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return '/records/bulk';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\RecordsBulkPostBody) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPostResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\RecordsBulkPostResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsForbiddenException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsNotAcceptableException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkCreateRecordsUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,76 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class BulkUpdateRecords extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Update several records at once.
*
* @param null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPutBody $requestBody
*/
public function __construct(?\DigiComp\HetznerDnsApi\Model\RecordsBulkPutBody $requestBody = null)
{
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'PUT';
}
public function getUri() : string
{
return '/records/bulk';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\RecordsBulkPutBody) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsBulkPutResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\RecordsBulkPutResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsNotAcceptableException();
}
if (409 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsConflictException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\BulkUpdateRecordsUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,64 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class CreatePrimaryServer extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Creates a new primary server.
*
* @param null|\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody
*/
public function __construct(?\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody = null)
{
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return '/primary_servers';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\PrimaryServer) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersPostResponse201
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (201 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersPostResponse201', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerUnauthorizedException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerNotAcceptableException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreatePrimaryServerUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,68 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class CreateRecord extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Creates a new record.
*
* @param null|\DigiComp\HetznerDnsApi\Model\Record $requestBody
*/
public function __construct(?\DigiComp\HetznerDnsApi\Model\Record $requestBody = null)
{
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return '/records';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\Record) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateRecordUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsPostResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\RecordsPostResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateRecordUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateRecordForbiddenException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateRecordNotAcceptableException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateRecordUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,64 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class CreateZone extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Creates a new zone.
*
* @param null|\DigiComp\HetznerDnsApi\Model\Zone $requestBody
*/
public function __construct(?\DigiComp\HetznerDnsApi\Model\Zone $requestBody = null)
{
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return '/zones';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\Zone) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\CreateZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateZoneNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\CreateZoneUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesPostResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\ZonesPostResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateZoneUnauthorizedException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateZoneNotAcceptableException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\CreateZoneUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,62 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class DeletePrimaryServer extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $PrimaryServerID;
/**
* Deletes a primary server.
*
* @param string $primaryServerID ID of primary server to be deleted
*/
public function __construct(string $primaryServerID)
{
$this->PrimaryServerID = $primaryServerID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'DELETE';
}
public function getUri() : string
{
return str_replace(array('{PrimaryServerID}'), array($this->PrimaryServerID), '/primary_servers/{PrimaryServerID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotAcceptableException
*
* @return null
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (200 === $status) {
return null;
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeletePrimaryServerNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,62 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class DeleteRecord extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $RecordID;
/**
* Deletes a record.
*
* @param string $recordID ID of record to delete
*/
public function __construct(string $recordID)
{
$this->RecordID = $recordID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'DELETE';
}
public function getUri() : string
{
return str_replace(array('{RecordID}'), array($this->RecordID), '/records/{RecordID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteRecordNotAcceptableException
*
* @return null
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (200 === $status) {
return null;
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteRecordUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteRecordForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteRecordNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteRecordNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,62 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class DeleteZone extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $ZoneID;
/**
* Deletes a zone.
*
* @param string $zoneID ID of zone to be deleted
*/
public function __construct(string $zoneID)
{
$this->ZoneID = $zoneID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'DELETE';
}
public function getUri() : string
{
return str_replace(array('{ZoneID}'), array($this->ZoneID), '/zones/{ZoneID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotAcceptableException
*
* @return null
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (200 === $status) {
return null;
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\DeleteZoneNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,61 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class ExportZoneFile extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $ZoneID;
/**
* Export a zone file.
*
* @param string $zoneID ID of zone to be exported
*/
public function __construct(string $zoneID)
{
$this->ZoneID = $zoneID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return str_replace(array('{ZoneID}'), array($this->ZoneID), '/zones/{ZoneID}/export');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\ExportZoneFileUnprocessableEntityException
*
* @return null
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (200 === $status) {
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ExportZoneFileUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ExportZoneFileForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ExportZoneFileNotFoundException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ExportZoneFileUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,66 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class GetPrimaryServer extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $PrimaryServerID;
/**
* Returns an object containing all information of a primary server. Primary Server to get is identified by 'PrimaryServerID'.
*
* @param string $primaryServerID ID of primary server to get
*/
public function __construct(string $primaryServerID)
{
$this->PrimaryServerID = $primaryServerID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return str_replace(array('{PrimaryServerID}'), array($this->PrimaryServerID), '/primary_servers/{PrimaryServerID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersPrimaryServerIDGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersPrimaryServerIDGetResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServerNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,72 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class GetPrimaryServers extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Returns all primary servers associated with user. Primary servers can also be filtered by zone_id.
*
* @param array $queryParameters {
* @var string $zone_id ID of zone
* }
*/
public function __construct(array $queryParameters = array())
{
$this->queryParameters = $queryParameters;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return '/primary_servers';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
protected function getQueryOptionsResolver() : \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(array('zone_id'));
$optionsResolver->setRequired(array());
$optionsResolver->setDefaults(array());
$optionsResolver->setAllowedTypes('zone_id', array('string'));
return $optionsResolver;
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersGetResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersUnauthorizedException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetPrimaryServersNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,66 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class GetRecord extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $RecordID;
/**
* Returns information about a single record.
*
* @param string $recordID ID of record to get
*/
public function __construct(string $recordID)
{
$this->RecordID = $recordID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return str_replace(array('{RecordID}'), array($this->RecordID), '/records/{RecordID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsRecordIDGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\RecordsRecordIDGetResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetRecordUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetRecordForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetRecordNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetRecordNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,72 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class GetRecords extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Returns all records associated with user.
*
* @param array $queryParameters {
* @var string $zone_id ID of zone
* @var float $per_page Number of records to be shown per page. Returns all by default
* @var float $page A page parameter specifies the page to fetch.<br />The number of the first page is 1
* }
*/
public function __construct(array $queryParameters = array())
{
$this->queryParameters = $queryParameters;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return '/records';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
protected function getQueryOptionsResolver() : \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(array('zone_id', 'per_page', 'page'));
$optionsResolver->setRequired(array());
$optionsResolver->setDefaults(array('page' => 1));
$optionsResolver->setAllowedTypes('zone_id', array('string'));
$optionsResolver->setAllowedTypes('per_page', array('float'));
$optionsResolver->setAllowedTypes('page', array('float'));
return $optionsResolver;
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordsUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetRecordsNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\RecordsGetResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetRecordsUnauthorizedException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetRecordsNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,66 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class GetZone extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $ZoneID;
/**
* Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.
*
* @param string $zoneID ID of zone to get
*/
public function __construct(string $zoneID)
{
$this->ZoneID = $zoneID;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return str_replace(array('{ZoneID}'), array($this->ZoneID), '/zones/{ZoneID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZoneNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesZoneIDGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\ZonesZoneIDGetResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZoneUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZoneForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZoneNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZoneNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,78 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class GetZones extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Returns paginated zones associated with the user. Limited to 100 zones per request.
*
* @param array $queryParameters {
* @var string $name Full name of a zone. Will return an array with one or no results
* @var string $search_name Partial name of a zone. Will return a maximum of 100 zones that contain the searched string
* @var float $per_page Number of zones to be shown per page. Returns 100 by default
* @var int $page A page parameter specifies the page to fetch.<br />The number of the first page is 1
* }
*/
public function __construct(array $queryParameters = array())
{
$this->queryParameters = $queryParameters;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return '/zones';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
protected function getQueryOptionsResolver() : \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(array('name', 'search_name', 'per_page', 'page'));
$optionsResolver->setRequired(array());
$optionsResolver->setDefaults(array('per_page' => 100.0, 'page' => 1));
$optionsResolver->setAllowedTypes('name', array('string'));
$optionsResolver->setAllowedTypes('search_name', array('string'));
$optionsResolver->setAllowedTypes('per_page', array('float'));
$optionsResolver->setAllowedTypes('page', array('int'));
return $optionsResolver;
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\GetZonesBadRequestException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZonesUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\GetZonesNotAcceptableException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesGetResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\ZonesGetResponse200', 'json');
}
if (400 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZonesBadRequestException();
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZonesUnauthorizedException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\GetZonesNotAcceptableException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,67 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class ImportZoneFilePlain extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $ZoneID;
/**
* Import a zone file in text/plain format.
*
* @param string $zoneID ID of zone to be imported
* @param null|string $requestBody
*/
public function __construct(string $zoneID, ?string $requestBody = null)
{
$this->ZoneID = $zoneID;
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return str_replace(array('{ZoneID}'), array($this->ZoneID), '/zones/{ZoneID}/import');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if (is_string($this->body)) {
return array(array('Content-Type' => array('text/plain')), $this->body);
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesZoneIDImportPostResponse201
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (201 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\ZonesZoneIDImportPostResponse201', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainUnauthorizedException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainNotAcceptableException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ImportZoneFilePlainUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,79 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class UpdatePrimaryServer extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $PrimaryServerID;
/**
* Updates a primary server.
*
* @param string $primaryServerID ID of primaryServer to update
* @param null|\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody
*/
public function __construct(string $primaryServerID, ?\DigiComp\HetznerDnsApi\Model\PrimaryServer $requestBody = null)
{
$this->PrimaryServerID = $primaryServerID;
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'PUT';
}
public function getUri() : string
{
return str_replace(array('{PrimaryServerID}'), array($this->PrimaryServerID), '/primary_servers/{PrimaryServerID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\PrimaryServer) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\PrimaryServersPrimaryServerIDPutResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersPrimaryServerIDPutResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerNotAcceptableException();
}
if (409 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerConflictException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdatePrimaryServerUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,79 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class UpdateRecord extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $RecordID;
/**
* Updates a record.
*
* @param string $recordID ID of record to be updated
* @param null|\DigiComp\HetznerDnsApi\Model\Record $requestBody
*/
public function __construct(string $recordID, ?\DigiComp\HetznerDnsApi\Model\Record $requestBody = null)
{
$this->RecordID = $recordID;
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'PUT';
}
public function getUri() : string
{
return str_replace(array('{RecordID}'), array($this->RecordID), '/records/{RecordID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\Record) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateRecordUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\RecordsRecordIDPutResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\RecordsRecordIDPutResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateRecordUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateRecordForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateRecordNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateRecordNotAcceptableException();
}
if (409 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateRecordConflictException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateRecordUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,79 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class UpdateZone extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
protected $ZoneID;
/**
* Updates a zone.
*
* @param string $zoneID ID of zone to update
* @param null|\DigiComp\HetznerDnsApi\Model\Zone $requestBody
*/
public function __construct(string $zoneID, ?\DigiComp\HetznerDnsApi\Model\Zone $requestBody = null)
{
$this->ZoneID = $zoneID;
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'PUT';
}
public function getUri() : string
{
return str_replace(array('{ZoneID}'), array($this->ZoneID), '/zones/{ZoneID}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if ($this->body instanceof \DigiComp\HetznerDnsApi\Model\Zone) {
return array(array('Content-Type' => array('application/json')), $serializer->serialize($this->body, 'json'));
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneNotAcceptableException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneConflictException
* @throws \DigiComp\HetznerDnsApi\Exception\UpdateZoneUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesZoneIDPutResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\ZonesZoneIDPutResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateZoneUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateZoneForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateZoneNotFoundException();
}
if (406 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateZoneNotAcceptableException();
}
if (409 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateZoneConflictException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\UpdateZoneUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,68 @@
<?php
namespace DigiComp\HetznerDnsApi\Endpoint;
class ValidateZoneFilePlain extends \DigiComp\HetznerDnsApi\Runtime\Client\BaseEndpoint implements \DigiComp\HetznerDnsApi\Runtime\Client\Endpoint
{
/**
* Validate a zone file in text/plain format.
*
* @param null|string $requestBody
*/
public function __construct(?string $requestBody = null)
{
$this->body = $requestBody;
}
use \DigiComp\HetznerDnsApi\Runtime\Client\EndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return '/zones/file/validate';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
if (is_string($this->body)) {
return array(array('Content-Type' => array('text/plain')), $this->body);
}
return array(array(), null);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainUnauthorizedException
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainForbiddenException
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainNotFoundException
* @throws \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainUnprocessableEntityException
*
* @return null|\DigiComp\HetznerDnsApi\Model\ZonesFileValidatePostResponse200
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'DigiComp\\HetznerDnsApi\\Model\\ZonesFileValidatePostResponse200', 'json');
}
if (401 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainUnauthorizedException();
}
if (403 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainForbiddenException();
}
if (404 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainNotFoundException();
}
if (422 === $status) {
throw new \DigiComp\HetznerDnsApi\Exception\ValidateZoneFilePlainUnprocessableEntityException();
}
}
public function getAuthenticationScopes() : array
{
return array('Auth-API-Token');
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
interface ApiException extends \Throwable
{
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BadRequestException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 400);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkCreateRecordsForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkCreateRecordsNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkCreateRecordsUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkCreateRecordsUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkUpdateRecordsConflictException extends ConflictException
{
public function __construct()
{
parent::__construct('Conflict');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkUpdateRecordsForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkUpdateRecordsNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkUpdateRecordsNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkUpdateRecordsUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class BulkUpdateRecordsUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
interface ClientException extends ApiException
{
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ConflictException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 409);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreatePrimaryServerNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreatePrimaryServerUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreatePrimaryServerUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateRecordForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateRecordNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateRecordUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateRecordUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateZoneNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateZoneUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class CreateZoneUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeletePrimaryServerForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeletePrimaryServerNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeletePrimaryServerNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeletePrimaryServerUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteRecordForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteRecordNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteRecordNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteRecordUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteZoneForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteZoneNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteZoneNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class DeleteZoneUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ExportZoneFileForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ExportZoneFileNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ExportZoneFileUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ExportZoneFileUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ForbiddenException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 403);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServerForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServerNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServerNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServerUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServersNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServersNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetPrimaryServersUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetRecordForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetRecordNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetRecordNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetRecordUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetRecordsNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetRecordsUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZoneForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZoneNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZoneNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZoneUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZonesBadRequestException extends BadRequestException
{
public function __construct()
{
parent::__construct('Pagination selectors are mutually exclusive');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZonesNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class GetZonesUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ImportZoneFilePlainNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ImportZoneFilePlainUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class ImportZoneFilePlainUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class NotAcceptableException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 406);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class NotFoundException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 404);
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
interface ServerException extends ApiException
{
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UnauthorizedException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 401);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UnprocessableEntityException extends \RuntimeException implements ClientException
{
public function __construct(string $message)
{
parent::__construct($message, 422);
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UpdatePrimaryServerConflictException extends ConflictException
{
public function __construct()
{
parent::__construct('Conflict');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UpdatePrimaryServerForbiddenException extends ForbiddenException
{
public function __construct()
{
parent::__construct('Forbidden');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UpdatePrimaryServerNotAcceptableException extends NotAcceptableException
{
public function __construct()
{
parent::__construct('Not acceptable');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UpdatePrimaryServerNotFoundException extends NotFoundException
{
public function __construct()
{
parent::__construct('Not found');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UpdatePrimaryServerUnauthorizedException extends UnauthorizedException
{
public function __construct()
{
parent::__construct('Unauthorized');
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace DigiComp\HetznerDnsApi\Exception;
class UpdatePrimaryServerUnprocessableEntityException extends UnprocessableEntityException
{
public function __construct()
{
parent::__construct('Unprocessable entity');
}
}

Some files were not shown because too many files have changed in this diff Show more