diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..8b9c3be --- /dev/null +++ b/License.txt @@ -0,0 +1,19 @@ +Copyright (c) 2021 Ferdinand Kuhl + +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. diff --git a/README.md b/README.md index 69dc09e..d98051e 100644 --- a/README.md +++ b/README.md @@ -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`) diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4213ef0 --- /dev/null +++ b/composer.json @@ -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/"] + } + } +} diff --git a/generated/Authentication/AuthAPITokenAuthentication.php b/generated/Authentication/AuthAPITokenAuthentication.php new file mode 100644 index 0000000..9f8e452 --- /dev/null +++ b/generated/Authentication/AuthAPITokenAuthentication.php @@ -0,0 +1,21 @@ +{'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'; + } +} \ No newline at end of file diff --git a/generated/Client.php b/generated/Client.php new file mode 100644 index 0000000..26d6bc1 --- /dev/null +++ b/generated/Client.php @@ -0,0 +1,365 @@ +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.
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); + } +} \ No newline at end of file diff --git a/generated/Endpoint/BulkCreateRecords.php b/generated/Endpoint/BulkCreateRecords.php new file mode 100644 index 0000000..048a5e5 --- /dev/null +++ b/generated/Endpoint/BulkCreateRecords.php @@ -0,0 +1,68 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/BulkUpdateRecords.php b/generated/Endpoint/BulkUpdateRecords.php new file mode 100644 index 0000000..a924a6f --- /dev/null +++ b/generated/Endpoint/BulkUpdateRecords.php @@ -0,0 +1,76 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/CreatePrimaryServer.php b/generated/Endpoint/CreatePrimaryServer.php new file mode 100644 index 0000000..cee3414 --- /dev/null +++ b/generated/Endpoint/CreatePrimaryServer.php @@ -0,0 +1,64 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/CreateRecord.php b/generated/Endpoint/CreateRecord.php new file mode 100644 index 0000000..547747d --- /dev/null +++ b/generated/Endpoint/CreateRecord.php @@ -0,0 +1,68 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/CreateZone.php b/generated/Endpoint/CreateZone.php new file mode 100644 index 0000000..64f9bfb --- /dev/null +++ b/generated/Endpoint/CreateZone.php @@ -0,0 +1,64 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/DeletePrimaryServer.php b/generated/Endpoint/DeletePrimaryServer.php new file mode 100644 index 0000000..4fba590 --- /dev/null +++ b/generated/Endpoint/DeletePrimaryServer.php @@ -0,0 +1,62 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/DeleteRecord.php b/generated/Endpoint/DeleteRecord.php new file mode 100644 index 0000000..0ab615e --- /dev/null +++ b/generated/Endpoint/DeleteRecord.php @@ -0,0 +1,62 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/DeleteZone.php b/generated/Endpoint/DeleteZone.php new file mode 100644 index 0000000..cb27060 --- /dev/null +++ b/generated/Endpoint/DeleteZone.php @@ -0,0 +1,62 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/ExportZoneFile.php b/generated/Endpoint/ExportZoneFile.php new file mode 100644 index 0000000..6d62cf8 --- /dev/null +++ b/generated/Endpoint/ExportZoneFile.php @@ -0,0 +1,61 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/GetPrimaryServer.php b/generated/Endpoint/GetPrimaryServer.php new file mode 100644 index 0000000..0e430a0 --- /dev/null +++ b/generated/Endpoint/GetPrimaryServer.php @@ -0,0 +1,66 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/GetPrimaryServers.php b/generated/Endpoint/GetPrimaryServers.php new file mode 100644 index 0000000..a36cae9 --- /dev/null +++ b/generated/Endpoint/GetPrimaryServers.php @@ -0,0 +1,72 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/GetRecord.php b/generated/Endpoint/GetRecord.php new file mode 100644 index 0000000..305a537 --- /dev/null +++ b/generated/Endpoint/GetRecord.php @@ -0,0 +1,66 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/GetRecords.php b/generated/Endpoint/GetRecords.php new file mode 100644 index 0000000..a51c8b2 --- /dev/null +++ b/generated/Endpoint/GetRecords.php @@ -0,0 +1,72 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/GetZone.php b/generated/Endpoint/GetZone.php new file mode 100644 index 0000000..66cdea9 --- /dev/null +++ b/generated/Endpoint/GetZone.php @@ -0,0 +1,66 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/GetZones.php b/generated/Endpoint/GetZones.php new file mode 100644 index 0000000..0aa106f --- /dev/null +++ b/generated/Endpoint/GetZones.php @@ -0,0 +1,78 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/ImportZoneFilePlain.php b/generated/Endpoint/ImportZoneFilePlain.php new file mode 100644 index 0000000..b8be255 --- /dev/null +++ b/generated/Endpoint/ImportZoneFilePlain.php @@ -0,0 +1,67 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/UpdatePrimaryServer.php b/generated/Endpoint/UpdatePrimaryServer.php new file mode 100644 index 0000000..b62ec00 --- /dev/null +++ b/generated/Endpoint/UpdatePrimaryServer.php @@ -0,0 +1,79 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/UpdateRecord.php b/generated/Endpoint/UpdateRecord.php new file mode 100644 index 0000000..79e5a51 --- /dev/null +++ b/generated/Endpoint/UpdateRecord.php @@ -0,0 +1,79 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/UpdateZone.php b/generated/Endpoint/UpdateZone.php new file mode 100644 index 0000000..503b89f --- /dev/null +++ b/generated/Endpoint/UpdateZone.php @@ -0,0 +1,79 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Endpoint/ValidateZoneFilePlain.php b/generated/Endpoint/ValidateZoneFilePlain.php new file mode 100644 index 0000000..3b9ae8c --- /dev/null +++ b/generated/Endpoint/ValidateZoneFilePlain.php @@ -0,0 +1,68 @@ +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'); + } +} \ No newline at end of file diff --git a/generated/Exception/ApiException.php b/generated/Exception/ApiException.php new file mode 100644 index 0000000..30e9afa --- /dev/null +++ b/generated/Exception/ApiException.php @@ -0,0 +1,7 @@ +zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @return string|null + */ + public function getAddress() : ?string + { + return $this->address; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @param string|null $address + * + * @return self + */ + public function setAddress(?string $address) : self + { + $this->address = $address; + return $this; + } + /** + * Port number of the primary server + * + * @return int|null + */ + public function getPort() : ?int + { + return $this->port; + } + /** + * Port number of the primary server + * + * @param int|null $port + * + * @return self + */ + public function setPort(?int $port) : self + { + $this->port = $port; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/BaseRecord.php b/generated/Model/BaseRecord.php new file mode 100644 index 0000000..7e608d9 --- /dev/null +++ b/generated/Model/BaseRecord.php @@ -0,0 +1,142 @@ +zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Type of the record + * + * @return string|null + */ + public function getType() : ?string + { + return $this->type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/BaseRecordBulk.php b/generated/Model/BaseRecordBulk.php new file mode 100644 index 0000000..584fb6b --- /dev/null +++ b/generated/Model/BaseRecordBulk.php @@ -0,0 +1,169 @@ +id; + } + /** + * ID of record + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Type of the record + * + * @return string|null + */ + public function getType() : ?string + { + return $this->type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/BaseZone.php b/generated/Model/BaseZone.php new file mode 100644 index 0000000..7dbb5ad --- /dev/null +++ b/generated/Model/BaseZone.php @@ -0,0 +1,493 @@ +id; + } + /** + * ID of zone + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time zone was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time zone was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time zone was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time zone was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * + * + * @return string|null + */ + public function getLegacyDnsHost() : ?string + { + return $this->legacyDnsHost; + } + /** + * + * + * @param string|null $legacyDnsHost + * + * @return self + */ + public function setLegacyDnsHost(?string $legacyDnsHost) : self + { + $this->legacyDnsHost = $legacyDnsHost; + return $this; + } + /** + * + * + * @return string[]|null + */ + public function getLegacyNs() : ?array + { + return $this->legacyNs; + } + /** + * + * + * @param string[]|null $legacyNs + * + * @return self + */ + public function setLegacyNs(?array $legacyNs) : self + { + $this->legacyNs = $legacyNs; + return $this; + } + /** + * Name of zone + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of zone + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * + * + * @return string[]|null + */ + public function getNs() : ?array + { + return $this->ns; + } + /** + * + * + * @param string[]|null $ns + * + * @return self + */ + public function setNs(?array $ns) : self + { + $this->ns = $ns; + return $this; + } + /** + * Owner of zone + * + * @return string|null + */ + public function getOwner() : ?string + { + return $this->owner; + } + /** + * Owner of zone + * + * @param string|null $owner + * + * @return self + */ + public function setOwner(?string $owner) : self + { + $this->owner = $owner; + return $this; + } + /** + * + * + * @return bool|null + */ + public function getPaused() : ?bool + { + return $this->paused; + } + /** + * + * + * @param bool|null $paused + * + * @return self + */ + public function setPaused(?bool $paused) : self + { + $this->paused = $paused; + return $this; + } + /** + * Zone's permissions + * + * @return string|null + */ + public function getPermission() : ?string + { + return $this->permission; + } + /** + * Zone's permissions + * + * @param string|null $permission + * + * @return self + */ + public function setPermission(?string $permission) : self + { + $this->permission = $permission; + return $this; + } + /** + * + * + * @return string|null + */ + public function getProject() : ?string + { + return $this->project; + } + /** + * + * + * @param string|null $project + * + * @return self + */ + public function setProject(?string $project) : self + { + $this->project = $project; + return $this; + } + /** + * + * + * @return string|null + */ + public function getRegistrar() : ?string + { + return $this->registrar; + } + /** + * + * + * @param string|null $registrar + * + * @return self + */ + public function setRegistrar(?string $registrar) : self + { + $this->registrar = $registrar; + return $this; + } + /** + * Status of zone + * + * @return string|null + */ + public function getStatus() : ?string + { + return $this->status; + } + /** + * Status of zone + * + * @param string|null $status + * + * @return self + */ + public function setStatus(?string $status) : self + { + $this->status = $status; + return $this; + } + /** + * TTL of zone + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of zone + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } + /** + * Verification of zone + * + * @return \DateTime|null + */ + public function getVerified() : ?\DateTime + { + return $this->verified; + } + /** + * Verification of zone + * + * @param \DateTime|null $verified + * + * @return self + */ + public function setVerified(?\DateTime $verified) : self + { + $this->verified = $verified; + return $this; + } + /** + * Amount of records associated to this zone + * + * @return int|null + */ + public function getRecordsCount() : ?int + { + return $this->recordsCount; + } + /** + * Amount of records associated to this zone + * + * @param int|null $recordsCount + * + * @return self + */ + public function setRecordsCount(?int $recordsCount) : self + { + $this->recordsCount = $recordsCount; + return $this; + } + /** + * Indicates if a zone is a secondary DNS zone + * + * @return bool|null + */ + public function getIsSecondaryDns() : ?bool + { + return $this->isSecondaryDns; + } + /** + * Indicates if a zone is a secondary DNS zone + * + * @param bool|null $isSecondaryDns + * + * @return self + */ + public function setIsSecondaryDns(?bool $isSecondaryDns) : self + { + $this->isSecondaryDns = $isSecondaryDns; + return $this; + } + /** + * Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set + * + * @return BaseZoneTxtVerification|null + */ + public function getTxtVerification() : ?BaseZoneTxtVerification + { + return $this->txtVerification; + } + /** + * Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set + * + * @param BaseZoneTxtVerification|null $txtVerification + * + * @return self + */ + public function setTxtVerification(?BaseZoneTxtVerification $txtVerification) : self + { + $this->txtVerification = $txtVerification; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/BaseZoneTxtVerification.php b/generated/Model/BaseZoneTxtVerification.php new file mode 100644 index 0000000..971f8f6 --- /dev/null +++ b/generated/Model/BaseZoneTxtVerification.php @@ -0,0 +1,61 @@ +name; + } + /** + * Name of the TXT record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of the TXT record + * + * @return string|null + */ + public function getToken() : ?string + { + return $this->token; + } + /** + * Value of the TXT record + * + * @param string|null $token + * + * @return self + */ + public function setToken(?string $token) : self + { + $this->token = $token; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ExistingPrimaryServer.php b/generated/Model/ExistingPrimaryServer.php new file mode 100644 index 0000000..c74323f --- /dev/null +++ b/generated/Model/ExistingPrimaryServer.php @@ -0,0 +1,169 @@ +id; + } + /** + * ID of primary server + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time primary server was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time primary server was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time primary server was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time primary server was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @return string|null + */ + public function getAddress() : ?string + { + return $this->address; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @param string|null $address + * + * @return self + */ + public function setAddress(?string $address) : self + { + $this->address = $address; + return $this; + } + /** + * Port number of the primary server + * + * @return int|null + */ + public function getPort() : ?int + { + return $this->port; + } + /** + * Port number of the primary server + * + * @param int|null $port + * + * @return self + */ + public function setPort(?int $port) : self + { + $this->port = $port; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ExistingRecord.php b/generated/Model/ExistingRecord.php new file mode 100644 index 0000000..964daca --- /dev/null +++ b/generated/Model/ExistingRecord.php @@ -0,0 +1,223 @@ +id; + } + /** + * ID of record + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time record was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time record was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time record was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time record was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Type of the record + * + * @return string|null + */ + public function getType() : ?string + { + return $this->type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ExistingRecordBulk.php b/generated/Model/ExistingRecordBulk.php new file mode 100644 index 0000000..21ff30a --- /dev/null +++ b/generated/Model/ExistingRecordBulk.php @@ -0,0 +1,223 @@ +id; + } + /** + * ID of record + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time record was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time record was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time record was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time record was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Type of the record + * + * @return string|null + */ + public function getType() : ?string + { + return $this->type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/Meta.php b/generated/Model/Meta.php new file mode 100644 index 0000000..81ae51c --- /dev/null +++ b/generated/Model/Meta.php @@ -0,0 +1,34 @@ +pagination; + } + /** + * + * + * @param Pagination|null $pagination + * + * @return self + */ + public function setPagination(?Pagination $pagination) : self + { + $this->pagination = $pagination; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/Pagination.php b/generated/Model/Pagination.php new file mode 100644 index 0000000..7746375 --- /dev/null +++ b/generated/Model/Pagination.php @@ -0,0 +1,115 @@ +page; + } + /** + * This value represents the current page + * + * @param float|null $page + * + * @return self + */ + public function setPage(?float $page) : self + { + $this->page = $page; + return $this; + } + /** + * This value represents the number of entries that are returned per page + * + * @return float|null + */ + public function getPerPage() : ?float + { + return $this->perPage; + } + /** + * This value represents the number of entries that are returned per page + * + * @param float|null $perPage + * + * @return self + */ + public function setPerPage(?float $perPage) : self + { + $this->perPage = $perPage; + return $this; + } + /** + * This value represents the last page + * + * @return float|null + */ + public function getLastPage() : ?float + { + return $this->lastPage; + } + /** + * This value represents the last page + * + * @param float|null $lastPage + * + * @return self + */ + public function setLastPage(?float $lastPage) : self + { + $this->lastPage = $lastPage; + return $this; + } + /** + * This value represents the total number of entries + * + * @return float|null + */ + public function getTotalEntries() : ?float + { + return $this->totalEntries; + } + /** + * This value represents the total number of entries + * + * @param float|null $totalEntries + * + * @return self + */ + public function setTotalEntries(?float $totalEntries) : self + { + $this->totalEntries = $totalEntries; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/PrimaryServer.php b/generated/Model/PrimaryServer.php new file mode 100644 index 0000000..009f061 --- /dev/null +++ b/generated/Model/PrimaryServer.php @@ -0,0 +1,169 @@ +id; + } + /** + * ID of primary server + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time primary server was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time primary server was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time primary server was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time primary server was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @return string|null + */ + public function getAddress() : ?string + { + return $this->address; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @param string|null $address + * + * @return self + */ + public function setAddress(?string $address) : self + { + $this->address = $address; + return $this; + } + /** + * Port number of the primary server + * + * @return int|null + */ + public function getPort() : ?int + { + return $this->port; + } + /** + * Port number of the primary server + * + * @param int|null $port + * + * @return self + */ + public function setPort(?int $port) : self + { + $this->port = $port; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/PrimaryServerResponse.php b/generated/Model/PrimaryServerResponse.php new file mode 100644 index 0000000..ca1017f --- /dev/null +++ b/generated/Model/PrimaryServerResponse.php @@ -0,0 +1,169 @@ +port; + } + /** + * Port number of the primary server + * + * @param int|null $port + * + * @return self + */ + public function setPort(?int $port) : self + { + $this->port = $port; + return $this; + } + /** + * ID of primary server + * + * @return string|null + */ + public function getId() : ?string + { + return $this->id; + } + /** + * ID of primary server + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time primary server was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time primary server was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time primary server was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time primary server was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @return string|null + */ + public function getAddress() : ?string + { + return $this->address; + } + /** + * IPv4 or IPv6 address of the primary server + * + * @param string|null $address + * + * @return self + */ + public function setAddress(?string $address) : self + { + $this->address = $address; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/PrimaryServersGetResponse200.php b/generated/Model/PrimaryServersGetResponse200.php new file mode 100644 index 0000000..358dfa2 --- /dev/null +++ b/generated/Model/PrimaryServersGetResponse200.php @@ -0,0 +1,34 @@ +primaryServers; + } + /** + * + * + * @param PrimaryServerResponse[]|null $primaryServers + * + * @return self + */ + public function setPrimaryServers(?array $primaryServers) : self + { + $this->primaryServers = $primaryServers; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/PrimaryServersPostResponse201.php b/generated/Model/PrimaryServersPostResponse201.php new file mode 100644 index 0000000..db71c5f --- /dev/null +++ b/generated/Model/PrimaryServersPostResponse201.php @@ -0,0 +1,34 @@ +primaryServer; + } + /** + * + * + * @param PrimaryServerResponse|null $primaryServer + * + * @return self + */ + public function setPrimaryServer(?PrimaryServerResponse $primaryServer) : self + { + $this->primaryServer = $primaryServer; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/PrimaryServersPrimaryServerIDGetResponse200.php b/generated/Model/PrimaryServersPrimaryServerIDGetResponse200.php new file mode 100644 index 0000000..76d04d9 --- /dev/null +++ b/generated/Model/PrimaryServersPrimaryServerIDGetResponse200.php @@ -0,0 +1,34 @@ +primaryServer; + } + /** + * + * + * @param PrimaryServerResponse|null $primaryServer + * + * @return self + */ + public function setPrimaryServer(?PrimaryServerResponse $primaryServer) : self + { + $this->primaryServer = $primaryServer; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/PrimaryServersPrimaryServerIDPutResponse200.php b/generated/Model/PrimaryServersPrimaryServerIDPutResponse200.php new file mode 100644 index 0000000..7f7560f --- /dev/null +++ b/generated/Model/PrimaryServersPrimaryServerIDPutResponse200.php @@ -0,0 +1,34 @@ +primaryServer; + } + /** + * + * + * @param PrimaryServerResponse|null $primaryServer + * + * @return self + */ + public function setPrimaryServer(?PrimaryServerResponse $primaryServer) : self + { + $this->primaryServer = $primaryServer; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/Record.php b/generated/Model/Record.php new file mode 100644 index 0000000..9af9f58 --- /dev/null +++ b/generated/Model/Record.php @@ -0,0 +1,223 @@ +id; + } + /** + * ID of record + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time record was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time record was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time record was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time record was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Type of the record + * + * @return string|null + */ + public function getType() : ?string + { + return $this->type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordBulk.php b/generated/Model/RecordBulk.php new file mode 100644 index 0000000..3abeed5 --- /dev/null +++ b/generated/Model/RecordBulk.php @@ -0,0 +1,223 @@ +id; + } + /** + * ID of record + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time record was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time record was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time record was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time record was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Type of the record + * + * @return string|null + */ + public function getType() : ?string + { + return $this->type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordResponse.php b/generated/Model/RecordResponse.php new file mode 100644 index 0000000..af77353 --- /dev/null +++ b/generated/Model/RecordResponse.php @@ -0,0 +1,223 @@ +type; + } + /** + * Type of the record + * + * @param string|null $type + * + * @return self + */ + public function setType(?string $type) : self + { + $this->type = $type; + return $this; + } + /** + * ID of record + * + * @return string|null + */ + public function getId() : ?string + { + return $this->id; + } + /** + * ID of record + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time record was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time record was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time record was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time record was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * ID of zone this record is associated with + * + * @return string|null + */ + public function getZoneId() : ?string + { + return $this->zoneId; + } + /** + * ID of zone this record is associated with + * + * @param string|null $zoneId + * + * @return self + */ + public function setZoneId(?string $zoneId) : self + { + $this->zoneId = $zoneId; + return $this; + } + /** + * Name of record + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of record + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @return string|null + */ + public function getValue() : ?string + { + return $this->value; + } + /** + * Value of record (e.g. 127.0.0.1, 1.1.1.1) + * + * @param string|null $value + * + * @return self + */ + public function setValue(?string $value) : self + { + $this->value = $value; + return $this; + } + /** + * TTL of record + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of record + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsBulkPostBody.php b/generated/Model/RecordsBulkPostBody.php new file mode 100644 index 0000000..f16825b --- /dev/null +++ b/generated/Model/RecordsBulkPostBody.php @@ -0,0 +1,34 @@ +records; + } + /** + * + * + * @param Record[]|null $records + * + * @return self + */ + public function setRecords(?array $records) : self + { + $this->records = $records; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsBulkPostResponse200.php b/generated/Model/RecordsBulkPostResponse200.php new file mode 100644 index 0000000..36b56c2 --- /dev/null +++ b/generated/Model/RecordsBulkPostResponse200.php @@ -0,0 +1,88 @@ +records; + } + /** + * + * + * @param RecordResponse[]|null $records + * + * @return self + */ + public function setRecords(?array $records) : self + { + $this->records = $records; + return $this; + } + /** + * + * + * @return BaseRecord[]|null + */ + public function getValidRecords() : ?array + { + return $this->validRecords; + } + /** + * + * + * @param BaseRecord[]|null $validRecords + * + * @return self + */ + public function setValidRecords(?array $validRecords) : self + { + $this->validRecords = $validRecords; + return $this; + } + /** + * + * + * @return BaseRecord[]|null + */ + public function getInvalidRecords() : ?array + { + return $this->invalidRecords; + } + /** + * + * + * @param BaseRecord[]|null $invalidRecords + * + * @return self + */ + public function setInvalidRecords(?array $invalidRecords) : self + { + $this->invalidRecords = $invalidRecords; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsBulkPutBody.php b/generated/Model/RecordsBulkPutBody.php new file mode 100644 index 0000000..142be72 --- /dev/null +++ b/generated/Model/RecordsBulkPutBody.php @@ -0,0 +1,34 @@ +records; + } + /** + * + * + * @param RecordBulk[]|null $records + * + * @return self + */ + public function setRecords(?array $records) : self + { + $this->records = $records; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsBulkPutResponse200.php b/generated/Model/RecordsBulkPutResponse200.php new file mode 100644 index 0000000..e5ee2d3 --- /dev/null +++ b/generated/Model/RecordsBulkPutResponse200.php @@ -0,0 +1,61 @@ +records; + } + /** + * + * + * @param RecordResponse[]|null $records + * + * @return self + */ + public function setRecords(?array $records) : self + { + $this->records = $records; + return $this; + } + /** + * + * + * @return BaseRecord[]|null + */ + public function getFailedRecords() : ?array + { + return $this->failedRecords; + } + /** + * + * + * @param BaseRecord[]|null $failedRecords + * + * @return self + */ + public function setFailedRecords(?array $failedRecords) : self + { + $this->failedRecords = $failedRecords; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsGetResponse200.php b/generated/Model/RecordsGetResponse200.php new file mode 100644 index 0000000..e89952c --- /dev/null +++ b/generated/Model/RecordsGetResponse200.php @@ -0,0 +1,34 @@ +records; + } + /** + * + * + * @param RecordResponse[]|null $records + * + * @return self + */ + public function setRecords(?array $records) : self + { + $this->records = $records; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsPostResponse200.php b/generated/Model/RecordsPostResponse200.php new file mode 100644 index 0000000..9d9913f --- /dev/null +++ b/generated/Model/RecordsPostResponse200.php @@ -0,0 +1,34 @@ +record; + } + /** + * + * + * @param RecordResponse|null $record + * + * @return self + */ + public function setRecord(?RecordResponse $record) : self + { + $this->record = $record; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsRecordIDGetResponse200.php b/generated/Model/RecordsRecordIDGetResponse200.php new file mode 100644 index 0000000..21a908d --- /dev/null +++ b/generated/Model/RecordsRecordIDGetResponse200.php @@ -0,0 +1,34 @@ +record; + } + /** + * + * + * @param RecordResponse|null $record + * + * @return self + */ + public function setRecord(?RecordResponse $record) : self + { + $this->record = $record; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/RecordsRecordIDPutResponse200.php b/generated/Model/RecordsRecordIDPutResponse200.php new file mode 100644 index 0000000..4799e48 --- /dev/null +++ b/generated/Model/RecordsRecordIDPutResponse200.php @@ -0,0 +1,34 @@ +record; + } + /** + * + * + * @param RecordResponse|null $record + * + * @return self + */ + public function setRecord(?RecordResponse $record) : self + { + $this->record = $record; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/Zone.php b/generated/Model/Zone.php new file mode 100644 index 0000000..d399778 --- /dev/null +++ b/generated/Model/Zone.php @@ -0,0 +1,493 @@ +id; + } + /** + * ID of zone + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time zone was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time zone was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time zone was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time zone was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * + * + * @return string|null + */ + public function getLegacyDnsHost() : ?string + { + return $this->legacyDnsHost; + } + /** + * + * + * @param string|null $legacyDnsHost + * + * @return self + */ + public function setLegacyDnsHost(?string $legacyDnsHost) : self + { + $this->legacyDnsHost = $legacyDnsHost; + return $this; + } + /** + * + * + * @return string[]|null + */ + public function getLegacyNs() : ?array + { + return $this->legacyNs; + } + /** + * + * + * @param string[]|null $legacyNs + * + * @return self + */ + public function setLegacyNs(?array $legacyNs) : self + { + $this->legacyNs = $legacyNs; + return $this; + } + /** + * Name of zone + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of zone + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * + * + * @return string[]|null + */ + public function getNs() : ?array + { + return $this->ns; + } + /** + * + * + * @param string[]|null $ns + * + * @return self + */ + public function setNs(?array $ns) : self + { + $this->ns = $ns; + return $this; + } + /** + * Owner of zone + * + * @return string|null + */ + public function getOwner() : ?string + { + return $this->owner; + } + /** + * Owner of zone + * + * @param string|null $owner + * + * @return self + */ + public function setOwner(?string $owner) : self + { + $this->owner = $owner; + return $this; + } + /** + * + * + * @return bool|null + */ + public function getPaused() : ?bool + { + return $this->paused; + } + /** + * + * + * @param bool|null $paused + * + * @return self + */ + public function setPaused(?bool $paused) : self + { + $this->paused = $paused; + return $this; + } + /** + * Zone's permissions + * + * @return string|null + */ + public function getPermission() : ?string + { + return $this->permission; + } + /** + * Zone's permissions + * + * @param string|null $permission + * + * @return self + */ + public function setPermission(?string $permission) : self + { + $this->permission = $permission; + return $this; + } + /** + * + * + * @return string|null + */ + public function getProject() : ?string + { + return $this->project; + } + /** + * + * + * @param string|null $project + * + * @return self + */ + public function setProject(?string $project) : self + { + $this->project = $project; + return $this; + } + /** + * + * + * @return string|null + */ + public function getRegistrar() : ?string + { + return $this->registrar; + } + /** + * + * + * @param string|null $registrar + * + * @return self + */ + public function setRegistrar(?string $registrar) : self + { + $this->registrar = $registrar; + return $this; + } + /** + * Status of zone + * + * @return string|null + */ + public function getStatus() : ?string + { + return $this->status; + } + /** + * Status of zone + * + * @param string|null $status + * + * @return self + */ + public function setStatus(?string $status) : self + { + $this->status = $status; + return $this; + } + /** + * TTL of zone + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of zone + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } + /** + * Verification of zone + * + * @return \DateTime|null + */ + public function getVerified() : ?\DateTime + { + return $this->verified; + } + /** + * Verification of zone + * + * @param \DateTime|null $verified + * + * @return self + */ + public function setVerified(?\DateTime $verified) : self + { + $this->verified = $verified; + return $this; + } + /** + * Amount of records associated to this zone + * + * @return int|null + */ + public function getRecordsCount() : ?int + { + return $this->recordsCount; + } + /** + * Amount of records associated to this zone + * + * @param int|null $recordsCount + * + * @return self + */ + public function setRecordsCount(?int $recordsCount) : self + { + $this->recordsCount = $recordsCount; + return $this; + } + /** + * Indicates if a zone is a secondary DNS zone + * + * @return bool|null + */ + public function getIsSecondaryDns() : ?bool + { + return $this->isSecondaryDns; + } + /** + * Indicates if a zone is a secondary DNS zone + * + * @param bool|null $isSecondaryDns + * + * @return self + */ + public function setIsSecondaryDns(?bool $isSecondaryDns) : self + { + $this->isSecondaryDns = $isSecondaryDns; + return $this; + } + /** + * Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set + * + * @return BaseZoneTxtVerification|null + */ + public function getTxtVerification() : ?BaseZoneTxtVerification + { + return $this->txtVerification; + } + /** + * Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set + * + * @param BaseZoneTxtVerification|null $txtVerification + * + * @return self + */ + public function setTxtVerification(?BaseZoneTxtVerification $txtVerification) : self + { + $this->txtVerification = $txtVerification; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZoneResponse.php b/generated/Model/ZoneResponse.php new file mode 100644 index 0000000..d43a414 --- /dev/null +++ b/generated/Model/ZoneResponse.php @@ -0,0 +1,493 @@ +id; + } + /** + * ID of zone + * + * @param string|null $id + * + * @return self + */ + public function setId(?string $id) : self + { + $this->id = $id; + return $this; + } + /** + * Time zone was created + * + * @return \DateTime|null + */ + public function getCreated() : ?\DateTime + { + return $this->created; + } + /** + * Time zone was created + * + * @param \DateTime|null $created + * + * @return self + */ + public function setCreated(?\DateTime $created) : self + { + $this->created = $created; + return $this; + } + /** + * Time zone was last updated + * + * @return \DateTime|null + */ + public function getModified() : ?\DateTime + { + return $this->modified; + } + /** + * Time zone was last updated + * + * @param \DateTime|null $modified + * + * @return self + */ + public function setModified(?\DateTime $modified) : self + { + $this->modified = $modified; + return $this; + } + /** + * + * + * @return string|null + */ + public function getLegacyDnsHost() : ?string + { + return $this->legacyDnsHost; + } + /** + * + * + * @param string|null $legacyDnsHost + * + * @return self + */ + public function setLegacyDnsHost(?string $legacyDnsHost) : self + { + $this->legacyDnsHost = $legacyDnsHost; + return $this; + } + /** + * + * + * @return string[]|null + */ + public function getLegacyNs() : ?array + { + return $this->legacyNs; + } + /** + * + * + * @param string[]|null $legacyNs + * + * @return self + */ + public function setLegacyNs(?array $legacyNs) : self + { + $this->legacyNs = $legacyNs; + return $this; + } + /** + * Name of zone + * + * @return string|null + */ + public function getName() : ?string + { + return $this->name; + } + /** + * Name of zone + * + * @param string|null $name + * + * @return self + */ + public function setName(?string $name) : self + { + $this->name = $name; + return $this; + } + /** + * + * + * @return string[]|null + */ + public function getNs() : ?array + { + return $this->ns; + } + /** + * + * + * @param string[]|null $ns + * + * @return self + */ + public function setNs(?array $ns) : self + { + $this->ns = $ns; + return $this; + } + /** + * Owner of zone + * + * @return string|null + */ + public function getOwner() : ?string + { + return $this->owner; + } + /** + * Owner of zone + * + * @param string|null $owner + * + * @return self + */ + public function setOwner(?string $owner) : self + { + $this->owner = $owner; + return $this; + } + /** + * + * + * @return bool|null + */ + public function getPaused() : ?bool + { + return $this->paused; + } + /** + * + * + * @param bool|null $paused + * + * @return self + */ + public function setPaused(?bool $paused) : self + { + $this->paused = $paused; + return $this; + } + /** + * Zone's permissions + * + * @return string|null + */ + public function getPermission() : ?string + { + return $this->permission; + } + /** + * Zone's permissions + * + * @param string|null $permission + * + * @return self + */ + public function setPermission(?string $permission) : self + { + $this->permission = $permission; + return $this; + } + /** + * + * + * @return string|null + */ + public function getProject() : ?string + { + return $this->project; + } + /** + * + * + * @param string|null $project + * + * @return self + */ + public function setProject(?string $project) : self + { + $this->project = $project; + return $this; + } + /** + * + * + * @return string|null + */ + public function getRegistrar() : ?string + { + return $this->registrar; + } + /** + * + * + * @param string|null $registrar + * + * @return self + */ + public function setRegistrar(?string $registrar) : self + { + $this->registrar = $registrar; + return $this; + } + /** + * Status of zone + * + * @return string|null + */ + public function getStatus() : ?string + { + return $this->status; + } + /** + * Status of zone + * + * @param string|null $status + * + * @return self + */ + public function setStatus(?string $status) : self + { + $this->status = $status; + return $this; + } + /** + * TTL of zone + * + * @return int|null + */ + public function getTtl() : ?int + { + return $this->ttl; + } + /** + * TTL of zone + * + * @param int|null $ttl + * + * @return self + */ + public function setTtl(?int $ttl) : self + { + $this->ttl = $ttl; + return $this; + } + /** + * Verification of zone + * + * @return \DateTime|null + */ + public function getVerified() : ?\DateTime + { + return $this->verified; + } + /** + * Verification of zone + * + * @param \DateTime|null $verified + * + * @return self + */ + public function setVerified(?\DateTime $verified) : self + { + $this->verified = $verified; + return $this; + } + /** + * Amount of records associated to this zone + * + * @return int|null + */ + public function getRecordsCount() : ?int + { + return $this->recordsCount; + } + /** + * Amount of records associated to this zone + * + * @param int|null $recordsCount + * + * @return self + */ + public function setRecordsCount(?int $recordsCount) : self + { + $this->recordsCount = $recordsCount; + return $this; + } + /** + * Indicates if a zone is a secondary DNS zone + * + * @return bool|null + */ + public function getIsSecondaryDns() : ?bool + { + return $this->isSecondaryDns; + } + /** + * Indicates if a zone is a secondary DNS zone + * + * @param bool|null $isSecondaryDns + * + * @return self + */ + public function setIsSecondaryDns(?bool $isSecondaryDns) : self + { + $this->isSecondaryDns = $isSecondaryDns; + return $this; + } + /** + * Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set + * + * @return BaseZoneTxtVerification|null + */ + public function getTxtVerification() : ?BaseZoneTxtVerification + { + return $this->txtVerification; + } + /** + * Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set + * + * @param BaseZoneTxtVerification|null $txtVerification + * + * @return self + */ + public function setTxtVerification(?BaseZoneTxtVerification $txtVerification) : self + { + $this->txtVerification = $txtVerification; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZonesFileValidatePostResponse200.php b/generated/Model/ZonesFileValidatePostResponse200.php new file mode 100644 index 0000000..280471e --- /dev/null +++ b/generated/Model/ZonesFileValidatePostResponse200.php @@ -0,0 +1,61 @@ +parsedRecords; + } + /** + * + * + * @param float|null $parsedRecords + * + * @return self + */ + public function setParsedRecords(?float $parsedRecords) : self + { + $this->parsedRecords = $parsedRecords; + return $this; + } + /** + * + * + * @return RecordResponse[]|null + */ + public function getValidRecords() : ?array + { + return $this->validRecords; + } + /** + * + * + * @param RecordResponse[]|null $validRecords + * + * @return self + */ + public function setValidRecords(?array $validRecords) : self + { + $this->validRecords = $validRecords; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZonesGetResponse200.php b/generated/Model/ZonesGetResponse200.php new file mode 100644 index 0000000..409bed8 --- /dev/null +++ b/generated/Model/ZonesGetResponse200.php @@ -0,0 +1,61 @@ +zones; + } + /** + * + * + * @param ZoneResponse[]|null $zones + * + * @return self + */ + public function setZones(?array $zones) : self + { + $this->zones = $zones; + return $this; + } + /** + * + * + * @return Meta|null + */ + public function getMeta() : ?Meta + { + return $this->meta; + } + /** + * + * + * @param Meta|null $meta + * + * @return self + */ + public function setMeta(?Meta $meta) : self + { + $this->meta = $meta; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZonesPostResponse200.php b/generated/Model/ZonesPostResponse200.php new file mode 100644 index 0000000..9f6b58a --- /dev/null +++ b/generated/Model/ZonesPostResponse200.php @@ -0,0 +1,34 @@ +zone; + } + /** + * + * + * @param ZoneResponse|null $zone + * + * @return self + */ + public function setZone(?ZoneResponse $zone) : self + { + $this->zone = $zone; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZonesZoneIDGetResponse200.php b/generated/Model/ZonesZoneIDGetResponse200.php new file mode 100644 index 0000000..f69ef04 --- /dev/null +++ b/generated/Model/ZonesZoneIDGetResponse200.php @@ -0,0 +1,34 @@ +zone; + } + /** + * + * + * @param ZoneResponse|null $zone + * + * @return self + */ + public function setZone(?ZoneResponse $zone) : self + { + $this->zone = $zone; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZonesZoneIDImportPostResponse201.php b/generated/Model/ZonesZoneIDImportPostResponse201.php new file mode 100644 index 0000000..14c7b48 --- /dev/null +++ b/generated/Model/ZonesZoneIDImportPostResponse201.php @@ -0,0 +1,34 @@ +zone; + } + /** + * + * + * @param ZoneResponse|null $zone + * + * @return self + */ + public function setZone(?ZoneResponse $zone) : self + { + $this->zone = $zone; + return $this; + } +} \ No newline at end of file diff --git a/generated/Model/ZonesZoneIDPutResponse200.php b/generated/Model/ZonesZoneIDPutResponse200.php new file mode 100644 index 0000000..96470d4 --- /dev/null +++ b/generated/Model/ZonesZoneIDPutResponse200.php @@ -0,0 +1,34 @@ +zone; + } + /** + * + * + * @param ZoneResponse|null $zone + * + * @return self + */ + public function setZone(?ZoneResponse $zone) : self + { + $this->zone = $zone; + return $this; + } +} \ No newline at end of file diff --git a/generated/Normalizer/BasePrimaryServerNormalizer.php b/generated/Normalizer/BasePrimaryServerNormalizer.php new file mode 100644 index 0000000..19004c5 --- /dev/null +++ b/generated/Normalizer/BasePrimaryServerNormalizer.php @@ -0,0 +1,79 @@ +setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('address', $data) && $data['address'] !== null) { + $object->setAddress($data['address']); + } + elseif (\array_key_exists('address', $data) && $data['address'] === null) { + $object->setAddress(null); + } + if (\array_key_exists('port', $data) && $data['port'] !== null) { + $object->setPort($data['port']); + } + elseif (\array_key_exists('port', $data) && $data['port'] === null) { + $object->setPort(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if (null !== $object->getPort()) { + $data['port'] = $object->getPort(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/BaseRecordBulkNormalizer.php b/generated/Normalizer/BaseRecordBulkNormalizer.php new file mode 100644 index 0000000..2f4febf --- /dev/null +++ b/generated/Normalizer/BaseRecordBulkNormalizer.php @@ -0,0 +1,106 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('type', $data) && $data['type'] !== null) { + $object->setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/BaseRecordNormalizer.php b/generated/Normalizer/BaseRecordNormalizer.php new file mode 100644 index 0000000..63dd3d3 --- /dev/null +++ b/generated/Normalizer/BaseRecordNormalizer.php @@ -0,0 +1,97 @@ +setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('type', $data) && $data['type'] !== null) { + $object->setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/BaseZoneNormalizer.php b/generated/Normalizer/BaseZoneNormalizer.php new file mode 100644 index 0000000..4782782 --- /dev/null +++ b/generated/Normalizer/BaseZoneNormalizer.php @@ -0,0 +1,174 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('legacy_dns_host', $data) && $data['legacy_dns_host'] !== null) { + $object->setLegacyDnsHost($data['legacy_dns_host']); + } + elseif (\array_key_exists('legacy_dns_host', $data) && $data['legacy_dns_host'] === null) { + $object->setLegacyDnsHost(null); + } + if (\array_key_exists('legacy_ns', $data) && $data['legacy_ns'] !== null) { + $values = array(); + foreach ($data['legacy_ns'] as $value) { + $values[] = $value; + } + $object->setLegacyNs($values); + } + elseif (\array_key_exists('legacy_ns', $data) && $data['legacy_ns'] === null) { + $object->setLegacyNs(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('ns', $data) && $data['ns'] !== null) { + $values_1 = array(); + foreach ($data['ns'] as $value_1) { + $values_1[] = $value_1; + } + $object->setNs($values_1); + } + elseif (\array_key_exists('ns', $data) && $data['ns'] === null) { + $object->setNs(null); + } + if (\array_key_exists('owner', $data) && $data['owner'] !== null) { + $object->setOwner($data['owner']); + } + elseif (\array_key_exists('owner', $data) && $data['owner'] === null) { + $object->setOwner(null); + } + if (\array_key_exists('paused', $data) && $data['paused'] !== null) { + $object->setPaused($data['paused']); + } + elseif (\array_key_exists('paused', $data) && $data['paused'] === null) { + $object->setPaused(null); + } + if (\array_key_exists('permission', $data) && $data['permission'] !== null) { + $object->setPermission($data['permission']); + } + elseif (\array_key_exists('permission', $data) && $data['permission'] === null) { + $object->setPermission(null); + } + if (\array_key_exists('project', $data) && $data['project'] !== null) { + $object->setProject($data['project']); + } + elseif (\array_key_exists('project', $data) && $data['project'] === null) { + $object->setProject(null); + } + if (\array_key_exists('registrar', $data) && $data['registrar'] !== null) { + $object->setRegistrar($data['registrar']); + } + elseif (\array_key_exists('registrar', $data) && $data['registrar'] === null) { + $object->setRegistrar(null); + } + if (\array_key_exists('status', $data) && $data['status'] !== null) { + $object->setStatus($data['status']); + } + elseif (\array_key_exists('status', $data) && $data['status'] === null) { + $object->setStatus(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + if (\array_key_exists('verified', $data) && $data['verified'] !== null) { + $object->setVerified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['verified'])); + } + elseif (\array_key_exists('verified', $data) && $data['verified'] === null) { + $object->setVerified(null); + } + if (\array_key_exists('records_count', $data) && $data['records_count'] !== null) { + $object->setRecordsCount($data['records_count']); + } + elseif (\array_key_exists('records_count', $data) && $data['records_count'] === null) { + $object->setRecordsCount(null); + } + if (\array_key_exists('is_secondary_dns', $data) && $data['is_secondary_dns'] !== null) { + $object->setIsSecondaryDns($data['is_secondary_dns']); + } + elseif (\array_key_exists('is_secondary_dns', $data) && $data['is_secondary_dns'] === null) { + $object->setIsSecondaryDns(null); + } + if (\array_key_exists('txt_verification', $data) && $data['txt_verification'] !== null) { + $object->setTxtVerification($this->denormalizer->denormalize($data['txt_verification'], 'DigiComp\\HetznerDnsApi\\Model\\BaseZoneTxtVerification', 'json', $context)); + } + elseif (\array_key_exists('txt_verification', $data) && $data['txt_verification'] === null) { + $object->setTxtVerification(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/BaseZoneTxtVerificationNormalizer.php b/generated/Normalizer/BaseZoneTxtVerificationNormalizer.php new file mode 100644 index 0000000..0016880 --- /dev/null +++ b/generated/Normalizer/BaseZoneTxtVerificationNormalizer.php @@ -0,0 +1,64 @@ +setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('token', $data) && $data['token'] !== null) { + $object->setToken($data['token']); + } + elseif (\array_key_exists('token', $data) && $data['token'] === null) { + $object->setToken(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ExistingPrimaryServerNormalizer.php b/generated/Normalizer/ExistingPrimaryServerNormalizer.php new file mode 100644 index 0000000..5dad286 --- /dev/null +++ b/generated/Normalizer/ExistingPrimaryServerNormalizer.php @@ -0,0 +1,97 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('address', $data) && $data['address'] !== null) { + $object->setAddress($data['address']); + } + elseif (\array_key_exists('address', $data) && $data['address'] === null) { + $object->setAddress(null); + } + if (\array_key_exists('port', $data) && $data['port'] !== null) { + $object->setPort($data['port']); + } + elseif (\array_key_exists('port', $data) && $data['port'] === null) { + $object->setPort(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if (null !== $object->getPort()) { + $data['port'] = $object->getPort(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ExistingRecordBulkNormalizer.php b/generated/Normalizer/ExistingRecordBulkNormalizer.php new file mode 100644 index 0000000..d9e7b32 --- /dev/null +++ b/generated/Normalizer/ExistingRecordBulkNormalizer.php @@ -0,0 +1,118 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('type', $data) && $data['type'] !== null) { + $object->setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ExistingRecordNormalizer.php b/generated/Normalizer/ExistingRecordNormalizer.php new file mode 100644 index 0000000..a35b33d --- /dev/null +++ b/generated/Normalizer/ExistingRecordNormalizer.php @@ -0,0 +1,115 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('type', $data) && $data['type'] !== null) { + $object->setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/JaneObjectNormalizer.php b/generated/Normalizer/JaneObjectNormalizer.php new file mode 100644 index 0000000..ff837ff --- /dev/null +++ b/generated/Normalizer/JaneObjectNormalizer.php @@ -0,0 +1,56 @@ + 'DigiComp\\HetznerDnsApi\\Normalizer\\BaseRecordNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\ExistingRecord' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ExistingRecordNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\Record' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\BaseRecordBulk' => 'DigiComp\\HetznerDnsApi\\Normalizer\\BaseRecordBulkNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\ExistingRecordBulk' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ExistingRecordBulkNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordBulk' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordBulkNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordResponseNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\BasePrimaryServer' => 'DigiComp\\HetznerDnsApi\\Normalizer\\BasePrimaryServerNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\ExistingPrimaryServer' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ExistingPrimaryServerNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServer' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PrimaryServerNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServerResponse' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PrimaryServerResponseNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\BaseZone' => 'DigiComp\\HetznerDnsApi\\Normalizer\\BaseZoneNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\BaseZoneTxtVerification' => 'DigiComp\\HetznerDnsApi\\Normalizer\\BaseZoneTxtVerificationNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\Zone' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZoneNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZoneResponse' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZoneResponseNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\Meta' => 'DigiComp\\HetznerDnsApi\\Normalizer\\MetaNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\Pagination' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PaginationNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZonesGetResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZonesGetResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZonesPostResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZonesPostResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZonesZoneIDGetResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZonesZoneIDGetResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZonesZoneIDPutResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZonesZoneIDPutResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZonesZoneIDImportPostResponse201' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZonesZoneIDImportPostResponse201Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\ZonesFileValidatePostResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\ZonesFileValidatePostResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsGetResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsGetResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsPostResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsPostResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsRecordIDGetResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsRecordIDGetResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsRecordIDPutResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsRecordIDPutResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsBulkPostBody' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsBulkPostBodyNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsBulkPostResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsBulkPostResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsBulkPutBody' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsBulkPutBodyNormalizer', 'DigiComp\\HetznerDnsApi\\Model\\RecordsBulkPutResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\RecordsBulkPutResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersGetResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PrimaryServersGetResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersPostResponse201' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PrimaryServersPostResponse201Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersPrimaryServerIDGetResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PrimaryServersPrimaryServerIDGetResponse200Normalizer', 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServersPrimaryServerIDPutResponse200' => 'DigiComp\\HetznerDnsApi\\Normalizer\\PrimaryServersPrimaryServerIDPutResponse200Normalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\DigiComp\\HetznerDnsApi\\Runtime\\Normalizer\\ReferenceNormalizer'), $normalizersCache = array(); + public function supportsDenormalization($data, $type, $format = null) : bool + { + return array_key_exists($type, $this->normalizers); + } + public function supportsNormalization($data, $format = null) : bool + { + return is_object($data) && array_key_exists(get_class($data), $this->normalizers); + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $normalizerClass = $this->normalizers[get_class($object)]; + $normalizer = $this->getNormalizer($normalizerClass); + return $normalizer->normalize($object, $format, $context); + } + /** + * @return mixed + */ + public function denormalize($data, $class, $format = null, array $context = array()) + { + $denormalizerClass = $this->normalizers[$class]; + $denormalizer = $this->getNormalizer($denormalizerClass); + return $denormalizer->denormalize($data, $class, $format, $context); + } + private function getNormalizer(string $normalizerClass) + { + return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); + } + private function initNormalizer(string $normalizerClass) + { + $normalizer = new $normalizerClass(); + $normalizer->setNormalizer($this->normalizer); + $normalizer->setDenormalizer($this->denormalizer); + $this->normalizersCache[$normalizerClass] = $normalizer; + return $normalizer; + } +} \ No newline at end of file diff --git a/generated/Normalizer/MetaNormalizer.php b/generated/Normalizer/MetaNormalizer.php new file mode 100644 index 0000000..df3d7ab --- /dev/null +++ b/generated/Normalizer/MetaNormalizer.php @@ -0,0 +1,61 @@ +setPagination($this->denormalizer->denormalize($data['pagination'], 'DigiComp\\HetznerDnsApi\\Model\\Pagination', 'json', $context)); + } + elseif (\array_key_exists('pagination', $data) && $data['pagination'] === null) { + $object->setPagination(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPagination()) { + $data['pagination'] = $this->normalizer->normalize($object->getPagination(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PaginationNormalizer.php b/generated/Normalizer/PaginationNormalizer.php new file mode 100644 index 0000000..72d039c --- /dev/null +++ b/generated/Normalizer/PaginationNormalizer.php @@ -0,0 +1,100 @@ +setPage($data['page']); + } + elseif (\array_key_exists('page', $data) && $data['page'] === null) { + $object->setPage(null); + } + if (\array_key_exists('per_page', $data) && $data['per_page'] !== null) { + $object->setPerPage($data['per_page']); + } + elseif (\array_key_exists('per_page', $data) && $data['per_page'] === null) { + $object->setPerPage(null); + } + if (\array_key_exists('last_page', $data) && $data['last_page'] !== null) { + $object->setLastPage($data['last_page']); + } + elseif (\array_key_exists('last_page', $data) && $data['last_page'] === null) { + $object->setLastPage(null); + } + if (\array_key_exists('total_entries', $data) && $data['total_entries'] !== null) { + $object->setTotalEntries($data['total_entries']); + } + elseif (\array_key_exists('total_entries', $data) && $data['total_entries'] === null) { + $object->setTotalEntries(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPage()) { + $data['page'] = $object->getPage(); + } + if (null !== $object->getPerPage()) { + $data['per_page'] = $object->getPerPage(); + } + if (null !== $object->getLastPage()) { + $data['last_page'] = $object->getLastPage(); + } + if (null !== $object->getTotalEntries()) { + $data['total_entries'] = $object->getTotalEntries(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PrimaryServerNormalizer.php b/generated/Normalizer/PrimaryServerNormalizer.php new file mode 100644 index 0000000..31977b6 --- /dev/null +++ b/generated/Normalizer/PrimaryServerNormalizer.php @@ -0,0 +1,97 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('address', $data) && $data['address'] !== null) { + $object->setAddress($data['address']); + } + elseif (\array_key_exists('address', $data) && $data['address'] === null) { + $object->setAddress(null); + } + if (\array_key_exists('port', $data) && $data['port'] !== null) { + $object->setPort($data['port']); + } + elseif (\array_key_exists('port', $data) && $data['port'] === null) { + $object->setPort(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if (null !== $object->getPort()) { + $data['port'] = $object->getPort(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PrimaryServerResponseNormalizer.php b/generated/Normalizer/PrimaryServerResponseNormalizer.php new file mode 100644 index 0000000..9752e97 --- /dev/null +++ b/generated/Normalizer/PrimaryServerResponseNormalizer.php @@ -0,0 +1,97 @@ +setPort($data['port']); + } + elseif (\array_key_exists('port', $data) && $data['port'] === null) { + $object->setPort(null); + } + if (\array_key_exists('id', $data) && $data['id'] !== null) { + $object->setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('address', $data) && $data['address'] !== null) { + $object->setAddress($data['address']); + } + elseif (\array_key_exists('address', $data) && $data['address'] === null) { + $object->setAddress(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPort()) { + $data['port'] = $object->getPort(); + } + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PrimaryServersGetResponse200Normalizer.php b/generated/Normalizer/PrimaryServersGetResponse200Normalizer.php new file mode 100644 index 0000000..ecfc79f --- /dev/null +++ b/generated/Normalizer/PrimaryServersGetResponse200Normalizer.php @@ -0,0 +1,69 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServerResponse', 'json', $context); + } + $object->setPrimaryServers($values); + } + elseif (\array_key_exists('primary_servers', $data) && $data['primary_servers'] === null) { + $object->setPrimaryServers(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPrimaryServers()) { + $values = array(); + foreach ($object->getPrimaryServers() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['primary_servers'] = $values; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PrimaryServersPostResponse201Normalizer.php b/generated/Normalizer/PrimaryServersPostResponse201Normalizer.php new file mode 100644 index 0000000..fd38e95 --- /dev/null +++ b/generated/Normalizer/PrimaryServersPostResponse201Normalizer.php @@ -0,0 +1,61 @@ +setPrimaryServer($this->denormalizer->denormalize($data['primary_server'], 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServerResponse', 'json', $context)); + } + elseif (\array_key_exists('primary_server', $data) && $data['primary_server'] === null) { + $object->setPrimaryServer(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPrimaryServer()) { + $data['primary_server'] = $this->normalizer->normalize($object->getPrimaryServer(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PrimaryServersPrimaryServerIDGetResponse200Normalizer.php b/generated/Normalizer/PrimaryServersPrimaryServerIDGetResponse200Normalizer.php new file mode 100644 index 0000000..7d2c38f --- /dev/null +++ b/generated/Normalizer/PrimaryServersPrimaryServerIDGetResponse200Normalizer.php @@ -0,0 +1,61 @@ +setPrimaryServer($this->denormalizer->denormalize($data['primary_server'], 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServerResponse', 'json', $context)); + } + elseif (\array_key_exists('primary_server', $data) && $data['primary_server'] === null) { + $object->setPrimaryServer(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPrimaryServer()) { + $data['primary_server'] = $this->normalizer->normalize($object->getPrimaryServer(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/PrimaryServersPrimaryServerIDPutResponse200Normalizer.php b/generated/Normalizer/PrimaryServersPrimaryServerIDPutResponse200Normalizer.php new file mode 100644 index 0000000..8a4820a --- /dev/null +++ b/generated/Normalizer/PrimaryServersPrimaryServerIDPutResponse200Normalizer.php @@ -0,0 +1,61 @@ +setPrimaryServer($this->denormalizer->denormalize($data['primary_server'], 'DigiComp\\HetznerDnsApi\\Model\\PrimaryServerResponse', 'json', $context)); + } + elseif (\array_key_exists('primary_server', $data) && $data['primary_server'] === null) { + $object->setPrimaryServer(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getPrimaryServer()) { + $data['primary_server'] = $this->normalizer->normalize($object->getPrimaryServer(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordBulkNormalizer.php b/generated/Normalizer/RecordBulkNormalizer.php new file mode 100644 index 0000000..61f158a --- /dev/null +++ b/generated/Normalizer/RecordBulkNormalizer.php @@ -0,0 +1,118 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('type', $data) && $data['type'] !== null) { + $object->setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordNormalizer.php b/generated/Normalizer/RecordNormalizer.php new file mode 100644 index 0000000..e8dca26 --- /dev/null +++ b/generated/Normalizer/RecordNormalizer.php @@ -0,0 +1,115 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('type', $data) && $data['type'] !== null) { + $object->setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordResponseNormalizer.php b/generated/Normalizer/RecordResponseNormalizer.php new file mode 100644 index 0000000..64c40e4 --- /dev/null +++ b/generated/Normalizer/RecordResponseNormalizer.php @@ -0,0 +1,115 @@ +setType($data['type']); + } + elseif (\array_key_exists('type', $data) && $data['type'] === null) { + $object->setType(null); + } + if (\array_key_exists('id', $data) && $data['id'] !== null) { + $object->setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('zone_id', $data) && $data['zone_id'] !== null) { + $object->setZoneId($data['zone_id']); + } + elseif (\array_key_exists('zone_id', $data) && $data['zone_id'] === null) { + $object->setZoneId(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('value', $data) && $data['value'] !== null) { + $object->setValue($data['value']); + } + elseif (\array_key_exists('value', $data) && $data['value'] === null) { + $object->setValue(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getType()) { + $data['type'] = $object->getType(); + } + if (null !== $object->getZoneId()) { + $data['zone_id'] = $object->getZoneId(); + } + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getValue()) { + $data['value'] = $object->getValue(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsBulkPostBodyNormalizer.php b/generated/Normalizer/RecordsBulkPostBodyNormalizer.php new file mode 100644 index 0000000..8afe121 --- /dev/null +++ b/generated/Normalizer/RecordsBulkPostBodyNormalizer.php @@ -0,0 +1,69 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\Record', 'json', $context); + } + $object->setRecords($values); + } + elseif (\array_key_exists('records', $data) && $data['records'] === null) { + $object->setRecords(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecords()) { + $values = array(); + foreach ($object->getRecords() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['records'] = $values; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsBulkPostResponse200Normalizer.php b/generated/Normalizer/RecordsBulkPostResponse200Normalizer.php new file mode 100644 index 0000000..6eb8d14 --- /dev/null +++ b/generated/Normalizer/RecordsBulkPostResponse200Normalizer.php @@ -0,0 +1,103 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context); + } + $object->setRecords($values); + } + elseif (\array_key_exists('records', $data) && $data['records'] === null) { + $object->setRecords(null); + } + if (\array_key_exists('valid_records', $data) && $data['valid_records'] !== null) { + $values_1 = array(); + foreach ($data['valid_records'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'DigiComp\\HetznerDnsApi\\Model\\BaseRecord', 'json', $context); + } + $object->setValidRecords($values_1); + } + elseif (\array_key_exists('valid_records', $data) && $data['valid_records'] === null) { + $object->setValidRecords(null); + } + if (\array_key_exists('invalid_records', $data) && $data['invalid_records'] !== null) { + $values_2 = array(); + foreach ($data['invalid_records'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, 'DigiComp\\HetznerDnsApi\\Model\\BaseRecord', 'json', $context); + } + $object->setInvalidRecords($values_2); + } + elseif (\array_key_exists('invalid_records', $data) && $data['invalid_records'] === null) { + $object->setInvalidRecords(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecords()) { + $values = array(); + foreach ($object->getRecords() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['records'] = $values; + } + if (null !== $object->getValidRecords()) { + $values_1 = array(); + foreach ($object->getValidRecords() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['valid_records'] = $values_1; + } + if (null !== $object->getInvalidRecords()) { + $values_2 = array(); + foreach ($object->getInvalidRecords() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); + } + $data['invalid_records'] = $values_2; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsBulkPutBodyNormalizer.php b/generated/Normalizer/RecordsBulkPutBodyNormalizer.php new file mode 100644 index 0000000..157d26f --- /dev/null +++ b/generated/Normalizer/RecordsBulkPutBodyNormalizer.php @@ -0,0 +1,69 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\RecordBulk', 'json', $context); + } + $object->setRecords($values); + } + elseif (\array_key_exists('records', $data) && $data['records'] === null) { + $object->setRecords(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecords()) { + $values = array(); + foreach ($object->getRecords() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['records'] = $values; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsBulkPutResponse200Normalizer.php b/generated/Normalizer/RecordsBulkPutResponse200Normalizer.php new file mode 100644 index 0000000..e7db103 --- /dev/null +++ b/generated/Normalizer/RecordsBulkPutResponse200Normalizer.php @@ -0,0 +1,86 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context); + } + $object->setRecords($values); + } + elseif (\array_key_exists('records', $data) && $data['records'] === null) { + $object->setRecords(null); + } + if (\array_key_exists('failed_records', $data) && $data['failed_records'] !== null) { + $values_1 = array(); + foreach ($data['failed_records'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'DigiComp\\HetznerDnsApi\\Model\\BaseRecord', 'json', $context); + } + $object->setFailedRecords($values_1); + } + elseif (\array_key_exists('failed_records', $data) && $data['failed_records'] === null) { + $object->setFailedRecords(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecords()) { + $values = array(); + foreach ($object->getRecords() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['records'] = $values; + } + if (null !== $object->getFailedRecords()) { + $values_1 = array(); + foreach ($object->getFailedRecords() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['failed_records'] = $values_1; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsGetResponse200Normalizer.php b/generated/Normalizer/RecordsGetResponse200Normalizer.php new file mode 100644 index 0000000..87b4855 --- /dev/null +++ b/generated/Normalizer/RecordsGetResponse200Normalizer.php @@ -0,0 +1,69 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context); + } + $object->setRecords($values); + } + elseif (\array_key_exists('records', $data) && $data['records'] === null) { + $object->setRecords(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecords()) { + $values = array(); + foreach ($object->getRecords() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['records'] = $values; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsPostResponse200Normalizer.php b/generated/Normalizer/RecordsPostResponse200Normalizer.php new file mode 100644 index 0000000..9e16c32 --- /dev/null +++ b/generated/Normalizer/RecordsPostResponse200Normalizer.php @@ -0,0 +1,61 @@ +setRecord($this->denormalizer->denormalize($data['record'], 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context)); + } + elseif (\array_key_exists('record', $data) && $data['record'] === null) { + $object->setRecord(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecord()) { + $data['record'] = $this->normalizer->normalize($object->getRecord(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsRecordIDGetResponse200Normalizer.php b/generated/Normalizer/RecordsRecordIDGetResponse200Normalizer.php new file mode 100644 index 0000000..6049345 --- /dev/null +++ b/generated/Normalizer/RecordsRecordIDGetResponse200Normalizer.php @@ -0,0 +1,61 @@ +setRecord($this->denormalizer->denormalize($data['record'], 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context)); + } + elseif (\array_key_exists('record', $data) && $data['record'] === null) { + $object->setRecord(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecord()) { + $data['record'] = $this->normalizer->normalize($object->getRecord(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/RecordsRecordIDPutResponse200Normalizer.php b/generated/Normalizer/RecordsRecordIDPutResponse200Normalizer.php new file mode 100644 index 0000000..e616f4b --- /dev/null +++ b/generated/Normalizer/RecordsRecordIDPutResponse200Normalizer.php @@ -0,0 +1,61 @@ +setRecord($this->denormalizer->denormalize($data['record'], 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context)); + } + elseif (\array_key_exists('record', $data) && $data['record'] === null) { + $object->setRecord(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getRecord()) { + $data['record'] = $this->normalizer->normalize($object->getRecord(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZoneNormalizer.php b/generated/Normalizer/ZoneNormalizer.php new file mode 100644 index 0000000..485aa16 --- /dev/null +++ b/generated/Normalizer/ZoneNormalizer.php @@ -0,0 +1,174 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('legacy_dns_host', $data) && $data['legacy_dns_host'] !== null) { + $object->setLegacyDnsHost($data['legacy_dns_host']); + } + elseif (\array_key_exists('legacy_dns_host', $data) && $data['legacy_dns_host'] === null) { + $object->setLegacyDnsHost(null); + } + if (\array_key_exists('legacy_ns', $data) && $data['legacy_ns'] !== null) { + $values = array(); + foreach ($data['legacy_ns'] as $value) { + $values[] = $value; + } + $object->setLegacyNs($values); + } + elseif (\array_key_exists('legacy_ns', $data) && $data['legacy_ns'] === null) { + $object->setLegacyNs(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('ns', $data) && $data['ns'] !== null) { + $values_1 = array(); + foreach ($data['ns'] as $value_1) { + $values_1[] = $value_1; + } + $object->setNs($values_1); + } + elseif (\array_key_exists('ns', $data) && $data['ns'] === null) { + $object->setNs(null); + } + if (\array_key_exists('owner', $data) && $data['owner'] !== null) { + $object->setOwner($data['owner']); + } + elseif (\array_key_exists('owner', $data) && $data['owner'] === null) { + $object->setOwner(null); + } + if (\array_key_exists('paused', $data) && $data['paused'] !== null) { + $object->setPaused($data['paused']); + } + elseif (\array_key_exists('paused', $data) && $data['paused'] === null) { + $object->setPaused(null); + } + if (\array_key_exists('permission', $data) && $data['permission'] !== null) { + $object->setPermission($data['permission']); + } + elseif (\array_key_exists('permission', $data) && $data['permission'] === null) { + $object->setPermission(null); + } + if (\array_key_exists('project', $data) && $data['project'] !== null) { + $object->setProject($data['project']); + } + elseif (\array_key_exists('project', $data) && $data['project'] === null) { + $object->setProject(null); + } + if (\array_key_exists('registrar', $data) && $data['registrar'] !== null) { + $object->setRegistrar($data['registrar']); + } + elseif (\array_key_exists('registrar', $data) && $data['registrar'] === null) { + $object->setRegistrar(null); + } + if (\array_key_exists('status', $data) && $data['status'] !== null) { + $object->setStatus($data['status']); + } + elseif (\array_key_exists('status', $data) && $data['status'] === null) { + $object->setStatus(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + if (\array_key_exists('verified', $data) && $data['verified'] !== null) { + $object->setVerified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['verified'])); + } + elseif (\array_key_exists('verified', $data) && $data['verified'] === null) { + $object->setVerified(null); + } + if (\array_key_exists('records_count', $data) && $data['records_count'] !== null) { + $object->setRecordsCount($data['records_count']); + } + elseif (\array_key_exists('records_count', $data) && $data['records_count'] === null) { + $object->setRecordsCount(null); + } + if (\array_key_exists('is_secondary_dns', $data) && $data['is_secondary_dns'] !== null) { + $object->setIsSecondaryDns($data['is_secondary_dns']); + } + elseif (\array_key_exists('is_secondary_dns', $data) && $data['is_secondary_dns'] === null) { + $object->setIsSecondaryDns(null); + } + if (\array_key_exists('txt_verification', $data) && $data['txt_verification'] !== null) { + $object->setTxtVerification($this->denormalizer->denormalize($data['txt_verification'], 'DigiComp\\HetznerDnsApi\\Model\\BaseZoneTxtVerification', 'json', $context)); + } + elseif (\array_key_exists('txt_verification', $data) && $data['txt_verification'] === null) { + $object->setTxtVerification(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZoneResponseNormalizer.php b/generated/Normalizer/ZoneResponseNormalizer.php new file mode 100644 index 0000000..a71a64a --- /dev/null +++ b/generated/Normalizer/ZoneResponseNormalizer.php @@ -0,0 +1,174 @@ +setId($data['id']); + } + elseif (\array_key_exists('id', $data) && $data['id'] === null) { + $object->setId(null); + } + if (\array_key_exists('created', $data) && $data['created'] !== null) { + $object->setCreated(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['created'])); + } + elseif (\array_key_exists('created', $data) && $data['created'] === null) { + $object->setCreated(null); + } + if (\array_key_exists('modified', $data) && $data['modified'] !== null) { + $object->setModified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['modified'])); + } + elseif (\array_key_exists('modified', $data) && $data['modified'] === null) { + $object->setModified(null); + } + if (\array_key_exists('legacy_dns_host', $data) && $data['legacy_dns_host'] !== null) { + $object->setLegacyDnsHost($data['legacy_dns_host']); + } + elseif (\array_key_exists('legacy_dns_host', $data) && $data['legacy_dns_host'] === null) { + $object->setLegacyDnsHost(null); + } + if (\array_key_exists('legacy_ns', $data) && $data['legacy_ns'] !== null) { + $values = array(); + foreach ($data['legacy_ns'] as $value) { + $values[] = $value; + } + $object->setLegacyNs($values); + } + elseif (\array_key_exists('legacy_ns', $data) && $data['legacy_ns'] === null) { + $object->setLegacyNs(null); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } + elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('ns', $data) && $data['ns'] !== null) { + $values_1 = array(); + foreach ($data['ns'] as $value_1) { + $values_1[] = $value_1; + } + $object->setNs($values_1); + } + elseif (\array_key_exists('ns', $data) && $data['ns'] === null) { + $object->setNs(null); + } + if (\array_key_exists('owner', $data) && $data['owner'] !== null) { + $object->setOwner($data['owner']); + } + elseif (\array_key_exists('owner', $data) && $data['owner'] === null) { + $object->setOwner(null); + } + if (\array_key_exists('paused', $data) && $data['paused'] !== null) { + $object->setPaused($data['paused']); + } + elseif (\array_key_exists('paused', $data) && $data['paused'] === null) { + $object->setPaused(null); + } + if (\array_key_exists('permission', $data) && $data['permission'] !== null) { + $object->setPermission($data['permission']); + } + elseif (\array_key_exists('permission', $data) && $data['permission'] === null) { + $object->setPermission(null); + } + if (\array_key_exists('project', $data) && $data['project'] !== null) { + $object->setProject($data['project']); + } + elseif (\array_key_exists('project', $data) && $data['project'] === null) { + $object->setProject(null); + } + if (\array_key_exists('registrar', $data) && $data['registrar'] !== null) { + $object->setRegistrar($data['registrar']); + } + elseif (\array_key_exists('registrar', $data) && $data['registrar'] === null) { + $object->setRegistrar(null); + } + if (\array_key_exists('status', $data) && $data['status'] !== null) { + $object->setStatus($data['status']); + } + elseif (\array_key_exists('status', $data) && $data['status'] === null) { + $object->setStatus(null); + } + if (\array_key_exists('ttl', $data) && $data['ttl'] !== null) { + $object->setTtl($data['ttl']); + } + elseif (\array_key_exists('ttl', $data) && $data['ttl'] === null) { + $object->setTtl(null); + } + if (\array_key_exists('verified', $data) && $data['verified'] !== null) { + $object->setVerified(\DateTime::createFromFormat('Y-m-d H:m:i O T', $data['verified'])); + } + elseif (\array_key_exists('verified', $data) && $data['verified'] === null) { + $object->setVerified(null); + } + if (\array_key_exists('records_count', $data) && $data['records_count'] !== null) { + $object->setRecordsCount($data['records_count']); + } + elseif (\array_key_exists('records_count', $data) && $data['records_count'] === null) { + $object->setRecordsCount(null); + } + if (\array_key_exists('is_secondary_dns', $data) && $data['is_secondary_dns'] !== null) { + $object->setIsSecondaryDns($data['is_secondary_dns']); + } + elseif (\array_key_exists('is_secondary_dns', $data) && $data['is_secondary_dns'] === null) { + $object->setIsSecondaryDns(null); + } + if (\array_key_exists('txt_verification', $data) && $data['txt_verification'] !== null) { + $object->setTxtVerification($this->denormalizer->denormalize($data['txt_verification'], 'DigiComp\\HetznerDnsApi\\Model\\BaseZoneTxtVerification', 'json', $context)); + } + elseif (\array_key_exists('txt_verification', $data) && $data['txt_verification'] === null) { + $object->setTxtVerification(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if (null !== $object->getTtl()) { + $data['ttl'] = $object->getTtl(); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZonesFileValidatePostResponse200Normalizer.php b/generated/Normalizer/ZonesFileValidatePostResponse200Normalizer.php new file mode 100644 index 0000000..51e4225 --- /dev/null +++ b/generated/Normalizer/ZonesFileValidatePostResponse200Normalizer.php @@ -0,0 +1,81 @@ +setParsedRecords($data['parsed_records']); + } + elseif (\array_key_exists('parsed_records', $data) && $data['parsed_records'] === null) { + $object->setParsedRecords(null); + } + if (\array_key_exists('valid_records', $data) && $data['valid_records'] !== null) { + $values = array(); + foreach ($data['valid_records'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\RecordResponse', 'json', $context); + } + $object->setValidRecords($values); + } + elseif (\array_key_exists('valid_records', $data) && $data['valid_records'] === null) { + $object->setValidRecords(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getParsedRecords()) { + $data['parsed_records'] = $object->getParsedRecords(); + } + if (null !== $object->getValidRecords()) { + $values = array(); + foreach ($object->getValidRecords() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['valid_records'] = $values; + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZonesGetResponse200Normalizer.php b/generated/Normalizer/ZonesGetResponse200Normalizer.php new file mode 100644 index 0000000..7bdf76a --- /dev/null +++ b/generated/Normalizer/ZonesGetResponse200Normalizer.php @@ -0,0 +1,78 @@ +denormalizer->denormalize($value, 'DigiComp\\HetznerDnsApi\\Model\\ZoneResponse', 'json', $context); + } + $object->setZones($values); + } + elseif (\array_key_exists('zones', $data) && $data['zones'] === null) { + $object->setZones(null); + } + if (\array_key_exists('meta', $data) && $data['meta'] !== null) { + $object->setMeta($this->denormalizer->denormalize($data['meta'], 'DigiComp\\HetznerDnsApi\\Model\\Meta', 'json', $context)); + } + elseif (\array_key_exists('meta', $data) && $data['meta'] === null) { + $object->setMeta(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZones()) { + $values = array(); + foreach ($object->getZones() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['zones'] = $values; + } + if (null !== $object->getMeta()) { + $data['meta'] = $this->normalizer->normalize($object->getMeta(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZonesPostResponse200Normalizer.php b/generated/Normalizer/ZonesPostResponse200Normalizer.php new file mode 100644 index 0000000..2f2ba56 --- /dev/null +++ b/generated/Normalizer/ZonesPostResponse200Normalizer.php @@ -0,0 +1,61 @@ +setZone($this->denormalizer->denormalize($data['zone'], 'DigiComp\\HetznerDnsApi\\Model\\ZoneResponse', 'json', $context)); + } + elseif (\array_key_exists('zone', $data) && $data['zone'] === null) { + $object->setZone(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZone()) { + $data['zone'] = $this->normalizer->normalize($object->getZone(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZonesZoneIDGetResponse200Normalizer.php b/generated/Normalizer/ZonesZoneIDGetResponse200Normalizer.php new file mode 100644 index 0000000..3e42f2d --- /dev/null +++ b/generated/Normalizer/ZonesZoneIDGetResponse200Normalizer.php @@ -0,0 +1,61 @@ +setZone($this->denormalizer->denormalize($data['zone'], 'DigiComp\\HetznerDnsApi\\Model\\ZoneResponse', 'json', $context)); + } + elseif (\array_key_exists('zone', $data) && $data['zone'] === null) { + $object->setZone(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZone()) { + $data['zone'] = $this->normalizer->normalize($object->getZone(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZonesZoneIDImportPostResponse201Normalizer.php b/generated/Normalizer/ZonesZoneIDImportPostResponse201Normalizer.php new file mode 100644 index 0000000..515b61e --- /dev/null +++ b/generated/Normalizer/ZonesZoneIDImportPostResponse201Normalizer.php @@ -0,0 +1,61 @@ +setZone($this->denormalizer->denormalize($data['zone'], 'DigiComp\\HetznerDnsApi\\Model\\ZoneResponse', 'json', $context)); + } + elseif (\array_key_exists('zone', $data) && $data['zone'] === null) { + $object->setZone(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZone()) { + $data['zone'] = $this->normalizer->normalize($object->getZone(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Normalizer/ZonesZoneIDPutResponse200Normalizer.php b/generated/Normalizer/ZonesZoneIDPutResponse200Normalizer.php new file mode 100644 index 0000000..8667392 --- /dev/null +++ b/generated/Normalizer/ZonesZoneIDPutResponse200Normalizer.php @@ -0,0 +1,61 @@ +setZone($this->denormalizer->denormalize($data['zone'], 'DigiComp\\HetznerDnsApi\\Model\\ZoneResponse', 'json', $context)); + } + elseif (\array_key_exists('zone', $data) && $data['zone'] === null) { + $object->setZone(null); + } + return $object; + } + /** + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = array()) + { + $data = array(); + if (null !== $object->getZone()) { + $data['zone'] = $this->normalizer->normalize($object->getZone(), 'json', $context); + } + return $data; + } +} \ No newline at end of file diff --git a/generated/Runtime/Client/BaseEndpoint.php b/generated/Runtime/Client/BaseEndpoint.php new file mode 100644 index 0000000..dd17037 --- /dev/null +++ b/generated/Runtime/Client/BaseEndpoint.php @@ -0,0 +1,65 @@ +getQueryOptionsResolver()->resolve($this->queryParameters); + $optionsResolved = array_map(function ($value) { + return null !== $value ? $value : ''; + }, $optionsResolved); + return http_build_query($optionsResolved, '', '&', PHP_QUERY_RFC3986); + } + public function getHeaders(array $baseHeaders = []) : array + { + return array_merge($this->getExtraHeaders(), $baseHeaders, $this->getHeadersOptionsResolver()->resolve($this->headerParameters)); + } + protected function getQueryOptionsResolver() : OptionsResolver + { + return new OptionsResolver(); + } + protected function getHeadersOptionsResolver() : OptionsResolver + { + return new OptionsResolver(); + } + // ---------------------------------------------------------------------------------------------------- + // Used for OpenApi2 compatibility + protected function getFormBody() : array + { + return [['Content-Type' => ['application/x-www-form-urlencoded']], http_build_query($this->getFormOptionsResolver()->resolve($this->formParameters))]; + } + protected function getMultipartBody($streamFactory = null) : array + { + $bodyBuilder = new MultipartStreamBuilder($streamFactory); + $formParameters = $this->getFormOptionsResolver()->resolve($this->formParameters); + foreach ($formParameters as $key => $value) { + $bodyBuilder->addResource($key, $value); + } + return [['Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '"')]], $bodyBuilder->build()]; + } + protected function getFormOptionsResolver() : OptionsResolver + { + return new OptionsResolver(); + } + protected function getSerializedBody(SerializerInterface $serializer) : array + { + return [['Content-Type' => ['application/json']], $serializer->serialize($this->body, 'json')]; + } +} \ No newline at end of file diff --git a/generated/Runtime/Client/Client.php b/generated/Runtime/Client/Client.php new file mode 100644 index 0000000..810575e --- /dev/null +++ b/generated/Runtime/Client/Client.php @@ -0,0 +1,82 @@ +httpClient = $httpClient; + $this->requestFactory = $requestFactory; + $this->serializer = $serializer; + $this->streamFactory = $streamFactory; + } + public function executeEndpoint(Endpoint $endpoint, string $fetch = self::FETCH_OBJECT) + { + if (self::FETCH_RESPONSE === $fetch) { + trigger_deprecation('jane-php/open-api-common', '7.3', 'Using %s::%s method with $fetch parameter equals to response is deprecated, use %s::%s instead.', __CLASS__, __METHOD__, __CLASS__, 'executeRawEndpoint'); + return $this->executeRawEndpoint($endpoint); + } + return $endpoint->parseResponse($this->processEndpoint($endpoint), $this->serializer, $fetch); + } + public function executeRawEndpoint(Endpoint $endpoint) : ResponseInterface + { + return $this->processEndpoint($endpoint); + } + private function processEndpoint(Endpoint $endpoint) : ResponseInterface + { + [$bodyHeaders, $body] = $endpoint->getBody($this->serializer, $this->streamFactory); + $queryString = $endpoint->getQueryString(); + $uriGlue = false === strpos($endpoint->getUri(), '?') ? '?' : '&'; + $uri = $queryString !== '' ? $endpoint->getUri() . $uriGlue . $queryString : $endpoint->getUri(); + $request = $this->requestFactory->createRequest($endpoint->getMethod(), $uri); + if ($body) { + if ($body instanceof StreamInterface) { + $request = $request->withBody($body); + } elseif (is_resource($body)) { + $request = $request->withBody($this->streamFactory->createStreamFromResource($body)); + } elseif (strlen($body) <= 4000 && @file_exists($body)) { + // more than 4096 chars will trigger an error + $request = $request->withBody($this->streamFactory->createStreamFromFile($body)); + } else { + $request = $request->withBody($this->streamFactory->createStream($body)); + } + } + foreach ($endpoint->getHeaders($bodyHeaders) as $name => $value) { + $request = $request->withHeader($name, $value); + } + if (count($endpoint->getAuthenticationScopes()) > 0) { + $scopes = []; + foreach ($endpoint->getAuthenticationScopes() as $scope) { + $scopes[] = $scope; + } + $request = $request->withHeader(AuthenticationRegistry::SCOPES_HEADER, $scopes); + } + return $this->httpClient->sendRequest($request); + } +} \ No newline at end of file diff --git a/generated/Runtime/Client/CustomQueryResolver.php b/generated/Runtime/Client/CustomQueryResolver.php new file mode 100644 index 0000000..b0e263b --- /dev/null +++ b/generated/Runtime/Client/CustomQueryResolver.php @@ -0,0 +1,9 @@ +hasHeader('Content-Type') ? current($response->getHeader('Content-Type')) : null; + return $this->transformResponseBody((string) $response->getBody(), $response->getStatusCode(), $serializer, $contentType); + } +} \ No newline at end of file diff --git a/generated/Runtime/Normalizer/CheckArray.php b/generated/Runtime/Normalizer/CheckArray.php new file mode 100644 index 0000000..39104de --- /dev/null +++ b/generated/Runtime/Normalizer/CheckArray.php @@ -0,0 +1,13 @@ +getReferenceUri(); + return $ref; + } + /** + * {@inheritdoc} + */ + public function supportsNormalization($data, $format = null) : bool + { + return $data instanceof Reference; + } +} \ No newline at end of file diff --git a/hetzner-dns-api-modified.json b/hetzner-dns-api-modified.json new file mode 100644 index 0000000..b1d2bd0 --- /dev/null +++ b/hetzner-dns-api-modified.json @@ -0,0 +1,1893 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Hetzner DNS Public API", + "description": "This is the public documentation Hetzner's DNS API.", + "contact": { + "name": "Hetzner Online GmbH", + "email": "support@hetzner.com" + }, + "version": "1.1.1", + "x-logo": { + "url": "https://www.hetzner.com/themes/hetzner/images/logo/hetzner-logo.svg", + "altText": "Hetzner" + } + }, + "servers": [ + { + "url": "https://dns.hetzner.com/api/v1" + } + ], + "tags": [ + { + "name": "Zones", + "description": "A secondary zone can be created, by adding a primary server before adding any records." + }, + { + "name": "Records", + "description": "" + }, + { + "name": "Primary Servers", + "description": "Primary servers can only be added to a zone, if no records were added to it, yet. By adding a primary server to a newly created zone, it automatically becomes a secondary zone." + } + ], + "security": [{"Auth-API-Token": []}], + "paths": { + "/zones": { + "get": { + "tags": [ + "Zones" + ], + "summary": "Get All Zones", + "description": "Returns paginated zones associated with the user. Limited to 100 zones per request.", + "operationId": "GetZones", + "parameters": [ + { + "name": "name", + "in": "query", + "description": "Full name of a zone. Will return an array with one or no results", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "string", + "example": "example.com" + } + }, + { + "name": "search_name", + "in": "query", + "description": "Partial name of a zone. Will return a maximum of 100 zones that contain the searched string", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "string", + "example": "example" + } + }, + { + "name": "per_page", + "in": "query", + "description": "Number of zones to be shown per page. Returns 100 by default", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "number", + "default": 100.0, + "maximum": 100.0 + } + }, + { + "name": "page", + "in": "query", + "description": "A page parameter specifies the page to fetch.
The number of the first page is 1", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "integer", + "minimum": 1, + "default": 1 + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "zones": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ZoneResponse" + } + }, + "meta": { + "$ref": "#/components/schemas/Meta" + } + } + } + } + } + }, + "400": { + "description": "Pagination selectors are mutually exclusive" + }, + "401": { + "description": "Unauthorized" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Zones\n# Returns all zones associated with the user.\ncurl \"https://dns.hetzner.com/api/v1/zones\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetZones() {\n\t// Get Zones (GET https://dns.hetzner.com/api/v1/zones)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " 'example.com',\n 'ttl' => 86400\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Create Zone\n # POST https://dns.hetzner.com/api/v1/zones\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/zones\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"name\": \"example.com\",\n \"ttl\": 86400\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + } + }, + "/zones/{ZoneID}": { + "get": { + "tags": [ + "Zones" + ], + "summary": "Get Zone", + "description": "Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.", + "operationId": "GetZone", + "parameters": [ + { + "name": "ZoneID", + "in": "path", + "description": "ID of zone to get", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "zone": { + "$ref": "#/components/schemas/ZoneResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Zone\n# Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.\ncurl \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -H 'Content-Type: application/json; charset=utf-8'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetZone() {\n\t// Get Zone (GET https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " 'example.com',\n 'ttl' => 86400\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Update Zone\n # PUT https://dns.hetzner.com/api/v1/zones/{ZoneID}\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"name\": \"example.com\",\n \"ttl\": 86400\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Zones" + ], + "summary": "Delete Zone", + "description": "Deletes a zone.", + "operationId": "DeleteZone", + "parameters": [ + { + "name": "ZoneID", + "in": "path", + "description": "ID of zone to be deleted", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Delete Zone\n# Deletes a zone.\ncurl -X \"DELETE\" \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendDeleteZone() {\n\t// Delete Zone (DELETE https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"DELETE\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": "The number of the first page is 1", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "number", + "minimum": 1, + "default": 1 + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecordResponse" + } + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Records\n# Returns all records associated with user.\ncurl \"https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetRecords() {\n\t// Get Records (GET https://dns.hetzner.com/api/v1/records?zone_id={ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\tparseFormErr := req.ParseForm()\n\tif parseFormErr != nil {\n\t fmt.Println(parseFormErr) \n\t}\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " '1.1.1.1',\n 'ttl' => 86400,\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => '1'\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Create Record\n # POST https://dns.hetzner.com/api/v1/records\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/records\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"value\": \"1.1.1.1\",\n \"ttl\": 86400,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"1\"\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + } + }, + "/records/{RecordID}": { + "get": { + "tags": [ + "Records" + ], + "summary": "Get Record", + "description": "Returns information about a single record.", + "operationId": "GetRecord", + "parameters": [ + { + "name": "RecordID", + "in": "path", + "description": "ID of record to get", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "record": { + "$ref": "#/components/schemas/RecordResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Record\n# Returns information about a single record.\ncurl \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetRecord() {\n\t// Get Record (GET https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " '1.1.1.2',\n 'ttl' => 0,\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => 'oH7shFebR6nLPgTnmvNjM8'\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Update Record\n # PUT https://dns.hetzner.com/api/v1/records/{RecordID}\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/records/{RecordID}\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"value\": \"1.1.1.2\",\n \"ttl\": 0,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Records" + ], + "summary": "Delete Record", + "description": "Deletes a record.", + "operationId": "DeleteRecord", + "parameters": [ + { + "name": "RecordID", + "in": "path", + "description": "ID of record to delete", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Delete Record\n# Deletes a record.\ncurl -X \"DELETE\" \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendDeleteRecord() {\n\t// Delete Record (DELETE https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"DELETE\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " [\n [\n 'value' => '81.169.145.141',\n 'type' => 'A',\n 'name' => 'autoconfig',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:5800::1141',\n 'type' => 'AAAA',\n 'name' => 'autoconfig',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => 'www',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => 'cloud',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => 'cloud',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.97',\n 'type' => 'A',\n 'name' => 'smtpin',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:50f0::1097',\n 'type' => 'AAAA',\n 'name' => 'smtpin',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20b:43:6653::506',\n 'type' => 'AAAA',\n 'name' => 'shades06',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '85.214.0.236',\n 'type' => 'A',\n 'name' => 'shades06',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '10 smtpin',\n 'type' => 'MX',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.146.21',\n 'type' => 'A',\n 'name' => 'docks11',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:930:6653::d11',\n 'type' => 'AAAA',\n 'name' => 'docks11',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ]\n ]\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Bulk Create Records\n # POST https://dns.hetzner.com/api/v1/records/bulk\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/records/bulk\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"records\": [\n {\n \"value\": \"81.169.145.141\",\n \"type\": \"A\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:5800::1141\",\n \"type\": \"AAAA\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.97\",\n \"type\": \"A\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:50f0::1097\",\n \"type\": \"AAAA\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20b:43:6653::506\",\n \"type\": \"AAAA\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"85.214.0.236\",\n \"type\": \"A\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"10 smtpin\",\n \"type\": \"MX\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.146.21\",\n \"type\": \"A\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:930:6653::d11\",\n \"type\": \"AAAA\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n }\n ]\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + }, + "put": { + "tags": [ + "Records" + ], + "summary": "Bulk Update Records", + "description": "Update several records at once.", + "operationId": "BulkUpdateRecords", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecordBulk" + } + } + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecordResponse" + } + }, + "failed_records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BaseRecord" + } + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + }, + "409": { + "description": "Conflict" + }, + "422": { + "description": "Unprocessable entity" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Bulk Update Records\n# Update several records at once.\ncurl -X \"PUT\" \"https://dns.hetzner.com/api/v1/records/bulk\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"records\": [\n {\n \"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n },\n {\n \"id\": \"uuK5PKsmfvi7853g5wXfRa\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"mail\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"L5RawAt6pJrdhFacynLrVg\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n }\n ]\n}'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendBulkUpdateRecords() {\n\t// Bulk Update Records (PUT https://dns.hetzner.com/api/v1/records/bulk)\n\n\tjson := []byte(`{\"records\": [{\"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"type\": \"AAAA\",\"name\": \"www\",\"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"},{\"id\": \"uuK5PKsmfvi7853g5wXfRa\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"mail\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"},{\"id\": \"L5RawAt6pJrdhFacynLrVg\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"cloud\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"},{\"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"@\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"}]}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"PUT\", \"https://dns.hetzner.com/api/v1/records/bulk\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " [\n [\n 'id' => 'mnsQmZmXXmWh5MpFeT67ZZ',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'type' => 'AAAA',\n 'name' => 'www',\n 'zone_id' => 'oH7shFebR6nLPgTnmvNjM8'\n ],\n [\n 'id' => 'uuK5PKsmfvi7853g5wXfRa',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => 'mail',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ],\n [\n 'id' => 'L5RawAt6pJrdhFacynLrVg',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => 'cloud',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ],\n [\n 'id' => 'HD3FZLUoxZQ2GpDCxPGEjY',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => '@',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ]\n ]\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Bulk Update Records\n # PUT https://dns.hetzner.com/api/v1/records/bulk\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/records/bulk\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"records\": [\n {\n \"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n },\n {\n \"id\": \"uuK5PKsmfvi7853g5wXfRa\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"mail\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"L5RawAt6pJrdhFacynLrVg\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n }\n ]\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + } + }, + "/primary_servers": { + "get": { + "tags": [ + "Primary Servers" + ], + "summary": "Get All Primary Servers", + "description": "Returns all primary servers associated with user. Primary servers can also be filtered by zone_id.", + "operationId": "GetPrimaryServers", + "parameters": [ + { + "name": "zone_id", + "in": "query", + "description": "ID of zone", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_servers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + } + }, + "post": { + "tags": [ + "Primary Servers" + ], + "summary": "Create Primary Server", + "description": "Creates a new primary server.", + "operationId": "CreatePrimaryServer", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrimaryServer" + } + } + }, + "required": false + }, + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_server": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "406": { + "description": "Not acceptable" + }, + "422": { + "description": "Unprocessable entity" + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/primary_servers/{PrimaryServerID}": { + "get": { + "tags": [ + "Primary Servers" + ], + "summary": "Get Primary Server", + "description": "Returns an object containing all information of a primary server. Primary Server to get is identified by 'PrimaryServerID'.", + "operationId": "GetPrimaryServer", + "parameters": [ + { + "name": "PrimaryServerID", + "in": "path", + "description": "ID of primary server to get", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_server": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + } + }, + "put": { + "tags": [ + "Primary Servers" + ], + "summary": "Update Primary Server", + "description": "Updates a primary server.", + "operationId": "UpdatePrimaryServer", + "parameters": [ + { + "name": "PrimaryServerID", + "in": "path", + "description": "ID of primaryServer to update", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrimaryServer" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_server": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + }, + "409": { + "description": "Conflict" + }, + "422": { + "description": "Unprocessable entity" + } + }, + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Primary Servers" + ], + "summary": "Delete Primary Server", + "description": "Deletes a primary server.", + "operationId": "DeletePrimaryServer", + "parameters": [ + { + "name": "PrimaryServerID", + "in": "path", + "description": "ID of primary server to be deleted", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + } + } + } + }, + "components": { + "securitySchemes": { + "Auth-API-Token": { + "description": "You can create an API token in the DNS console.", + "type": "apiKey", + "name": "Auth-API-Token", + "in": "header" + } + }, + "schemas": { + "BaseRecord": { + "properties": { + "zone_id": { + "type": "string", + "description": "ID of zone this record is associated with" + }, + "type": { + "$ref": "#/components/schemas/RecordTypeCreatable" + }, + "name": { + "type": "string", + "description": "Name of record" + }, + "value": { + "type": "string", + "description": "Value of record (e.g. 127.0.0.1, 1.1.1.1)" + }, + "ttl": { + "type": "integer", + "description": "TTL of record", + "format": "uint64" + } + } + }, + "ExistingRecord": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseRecord" + } + ], + "properties": { + "id": { + "type": "string", + "description": "ID of record", + "readOnly": true + }, + "created": { + "type": "string", + "description": "Time record was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time record was last updated", + "readOnly": true, + "format": "date-time" + } + } + }, + "Record": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ExistingRecord" + } + ], + "required": [ + "name", + "type", + "value", + "zone_id" + ] + }, + "BaseRecordBulk": { + "properties": { + "id": { + "type": "string", + "description": "ID of record" + }, + "zone_id": { + "type": "string", + "description": "ID of zone this record is associated with" + }, + "type": { + "$ref": "#/components/schemas/RecordTypeCreatable" + }, + "name": { + "type": "string", + "description": "Name of record" + }, + "value": { + "type": "string", + "description": "Value of record (e.g. 127.0.0.1, 1.1.1.1)" + }, + "ttl": { + "type": "integer", + "description": "TTL of record", + "format": "uint64" + } + } + }, + "ExistingRecordBulk": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseRecordBulk" + } + ], + "properties": { + "id": { + "type": "string", + "description": "ID of record", + "readOnly": false + }, + "created": { + "type": "string", + "description": "Time record was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time record was last updated", + "readOnly": true, + "format": "date-time" + } + } + }, + "RecordBulk": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ExistingRecordBulk" + } + ], + "required": [ + "id", + "name", + "type", + "value", + "zone_id" + ] + }, + "RecordResponse": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/RecordType" + } + }, + "allOf": [ + { + "$ref": "#/components/schemas/ExistingRecord" + } + ] + }, + "BasePrimaryServer": { + "properties": { + "zone_id": { + "type": "string", + "description": "ID of zone this record is associated with" + }, + "address": { + "type": "string", + "description": "IPv4 or IPv6 address of the primary server" + }, + "port": { + "type": "integer", + "description": "Port number of the primary server", + "minimum": 1, + "maximum": 65535 + } + } + }, + "ExistingPrimaryServer": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BasePrimaryServer" + } + ], + "properties": { + "id": { + "type": "string", + "description": "ID of primary server", + "readOnly": true + }, + "created": { + "type": "string", + "description": "Time primary server was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time primary server was last updated", + "readOnly": true, + "format": "date-time" + } + } + }, + "PrimaryServer": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ExistingPrimaryServer" + } + ], + "required": [ + "id", + "address", + "port", + "zone_id" + ] + }, + "PrimaryServerResponse": { + "type": "object", + "properties": { + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + } + }, + "allOf": [ + { + "$ref": "#/components/schemas/ExistingPrimaryServer" + } + ] + }, + "BaseZone": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of zone", + "readOnly": true + }, + "created": { + "type": "string", + "description": "Time zone was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time zone was last updated", + "readOnly": true, + "format": "date-time" + }, + "legacy_dns_host": { + "type": "string", + "readOnly": true + }, + "legacy_ns": { + "type": "array", + "readOnly": true, + "items": { + "type": "string" + } + }, + "name": { + "type": "string", + "description": "Name of zone" + }, + "ns": { + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "owner": { + "type": "string", + "description": "Owner of zone", + "readOnly": true + }, + "paused": { + "type": "boolean", + "readOnly": true + }, + "permission": { + "type": "string", + "description": "Zone's permissions", + "readOnly": true + }, + "project": { + "type": "string", + "readOnly": true + }, + "registrar": { + "type": "string", + "readOnly": true + }, + "status": { + "type": "string", + "description": "Status of zone", + "enum": [ + "verified", + "failed", + "pending" + ], + "readOnly": true + }, + "ttl": { + "type": "integer", + "description": "TTL of zone", + "format": "uint64" + }, + "verified": { + "type": "string", + "description": "Verification of zone", + "readOnly": true, + "format": "date-time" + }, + "records_count": { + "type": "integer", + "description": "Amount of records associated to this zone", + "readOnly": true, + "format": "uint64" + }, + "is_secondary_dns": { + "type": "boolean", + "description": "Indicates if a zone is a secondary DNS zone", + "readOnly": true + }, + "txt_verification": { + "type": "object", + "description": "Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set", + "readOnly": true, + "properties": { + "name": { + "type": "string", + "description": "Name of the TXT record", + "readOnly": true + }, + "token": { + "type": "string", + "description": "Value of the TXT record", + "readOnly": true + } + } + } + } + }, + "Zone": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseZone" + } + ], + "required": [ + "name" + ] + }, + "ZoneResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseZone" + } + ] + }, + "RecordTypeCreatable": { + "type": "string", + "enum": [ + "A", + "AAAA", + "NS", + "MX", + "CNAME", + "RP", + "TXT", + "SOA", + "HINFO", + "SRV", + "DANE", + "TLSA", + "DS", + "CAA" + ], + "description": "Type of the record" + }, + "RecordType": { + "type": "string", + "enum": [ + "A", + "AAAA", + "PTR", + "NS", + "MX", + "CNAME", + "RP", + "TXT", + "SOA", + "HINFO", + "SRV", + "DANE", + "TLSA", + "DS", + "CAA" + ], + "description": "Type of the record" + }, + "Meta": { + "type": "object", + "description": "", + "properties": { + "pagination": { + "$ref": "#/components/schemas/Pagination" + } + } + }, + "Pagination": { + "type": "object", + "description": "", + "properties": { + "page": { + "type": "number", + "description": "This value represents the current page", + "minimum": 1 + }, + "per_page": { + "type": "number", + "description": "This value represents the number of entries that are returned per page", + "minimum": 1 + }, + "last_page": { + "type": "number", + "description": "This value represents the last page", + "minimum": 1 + }, + "total_entries": { + "type": "number", + "description": "This value represents the total number of entries" + } + } + } + } + } +} diff --git a/hetzner-dns-api.json b/hetzner-dns-api.json new file mode 100644 index 0000000..a095144 --- /dev/null +++ b/hetzner-dns-api.json @@ -0,0 +1,2012 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Hetzner DNS Public API", + "description": "This is the public documentation Hetzner's DNS API.", + "contact": { + "name": "Hetzner Online GmbH", + "email": "support@hetzner.com" + }, + "version": "1.1.1", + "x-logo": { + "url": "https://www.hetzner.com/themes/hetzner/images/logo/hetzner-logo.svg", + "altText": "Hetzner" + } + }, + "servers": [ + { + "url": "https://dns.hetzner.com/api/v1" + } + ], + "tags": [ + { + "name": "Zones", + "description": "A secondary zone can be created, by adding a primary server before adding any records." + }, + { + "name": "Records", + "description": "" + }, + { + "name": "Primary Servers", + "description": "Primary servers can only be added to a zone, if no records were added to it, yet. By adding a primary server to a newly created zone, it automatically becomes a secondary zone." + } + ], + "paths": { + "/zones": { + "parameters": [ + { + "name": "Auth-API-Token", + "in": "header", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "get": { + "tags": [ + "Zones" + ], + "summary": "Get All Zones", + "description": "Returns paginated zones associated with the user. Limited to 100 zones per request.", + "operationId": "GetZones", + "parameters": [ + { + "name": "name", + "in": "query", + "description": "Full name of a zone. Will return an array with one or no results", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "string", + "example": "example.com" + } + }, + { + "name": "search_name", + "in": "query", + "description": "Partial name of a zone. Will return a maximum of 100 zones that contain the searched string", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "string", + "example": "example" + } + }, + { + "name": "per_page", + "in": "query", + "description": "Number of zones to be shown per page. Returns 100 by default", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "number", + "default": 100, + "maximum": 100 + } + }, + { + "name": "page", + "in": "query", + "description": "A page parameter specifies the page to fetch.
The number of the first page is 1", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "number", + "minimum": 1, + "default": 1 + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "zones": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ZoneResponse" + } + }, + "meta": { + "$ref": "#/components/schemas/Meta" + } + } + } + } + } + }, + "400": { + "description": "Pagination selectors are mutually exclusive" + }, + "401": { + "description": "Unauthorized" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Zones\n# Returns all zones associated with the user.\ncurl \"https://dns.hetzner.com/api/v1/zones\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetZones() {\n\t// Get Zones (GET https://dns.hetzner.com/api/v1/zones)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " 'example.com',\n 'ttl' => 86400\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Create Zone\n # POST https://dns.hetzner.com/api/v1/zones\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/zones\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"name\": \"example.com\",\n \"ttl\": 86400\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + } + }, + "/zones/{ZoneID}": { + "parameters": [ + { + "name": "Auth-API-Token", + "in": "header", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "get": { + "tags": [ + "Zones" + ], + "summary": "Get Zone", + "description": "Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.", + "operationId": "GetZone", + "parameters": [ + { + "name": "ZoneID", + "in": "path", + "description": "ID of zone to get", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "zone": { + "$ref": "#/components/schemas/ZoneResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Zone\n# Returns an object containing all information about a zone. Zone to get is identified by 'ZoneID'.\ncurl \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -H 'Content-Type: application/json; charset=utf-8'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetZone() {\n\t// Get Zone (GET https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " 'example.com',\n 'ttl' => 86400\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Update Zone\n # PUT https://dns.hetzner.com/api/v1/zones/{ZoneID}\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/zones/{ZoneID}\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"name\": \"example.com\",\n \"ttl\": 86400\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Zones" + ], + "summary": "Delete Zone", + "description": "Deletes a zone.", + "operationId": "DeleteZone", + "parameters": [ + { + "name": "ZoneID", + "in": "path", + "description": "ID of zone to be deleted", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Delete Zone\n# Deletes a zone.\ncurl -X \"DELETE\" \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendDeleteZone() {\n\t// Delete Zone (DELETE https://dns.hetzner.com/api/v1/zones/{ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"DELETE\", \"https://dns.hetzner.com/api/v1/zones/{ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": "The number of the first page is 1", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "number", + "minimum": 1, + "default": 1 + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecordResponse" + } + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Records\n# Returns all records associated with user.\ncurl \"https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetRecords() {\n\t// Get Records (GET https://dns.hetzner.com/api/v1/records?zone_id={ZoneID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/records?zone_id={ZoneID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\tparseFormErr := req.ParseForm()\n\tif parseFormErr != nil {\n\t fmt.Println(parseFormErr) \n\t}\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " '1.1.1.1',\n 'ttl' => 86400,\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => '1'\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Create Record\n # POST https://dns.hetzner.com/api/v1/records\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/records\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"value\": \"1.1.1.1\",\n \"ttl\": 86400,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"1\"\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + } + }, + "/records/{RecordID}": { + "parameters": [ + { + "name": "Auth-API-Token", + "in": "header", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "get": { + "tags": [ + "Records" + ], + "summary": "Get Record", + "description": "Returns information about a single record.", + "operationId": "GetRecord", + "parameters": [ + { + "name": "RecordID", + "in": "path", + "description": "ID of record to get", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "record": { + "$ref": "#/components/schemas/RecordResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Get Record\n# Returns information about a single record.\ncurl \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendGetRecord() {\n\t// Get Record (GET https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " '1.1.1.2',\n 'ttl' => 0,\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => 'oH7shFebR6nLPgTnmvNjM8'\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Update Record\n # PUT https://dns.hetzner.com/api/v1/records/{RecordID}\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/records/{RecordID}\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"value\": \"1.1.1.2\",\n \"ttl\": 0,\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Records" + ], + "summary": "Delete Record", + "description": "Deletes a record.", + "operationId": "DeleteRecord", + "parameters": [ + { + "name": "RecordID", + "in": "path", + "description": "ID of record to delete", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Delete Record\n# Deletes a record.\ncurl -X \"DELETE\" \"https://dns.hetzner.com/api/v1/records/{RecordID}\" \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n)\n\nfunc sendDeleteRecord() {\n\t// Delete Record (DELETE https://dns.hetzner.com/api/v1/records/{RecordID})\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"DELETE\", \"https://dns.hetzner.com/api/v1/records/{RecordID}\", nil)\n\n\t// Headers\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " [\n [\n 'value' => '81.169.145.141',\n 'type' => 'A',\n 'name' => 'autoconfig',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:5800::1141',\n 'type' => 'AAAA',\n 'name' => 'autoconfig',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => 'www',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => 'www',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => 'cloud',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => 'cloud',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.105',\n 'type' => 'A',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:1105::',\n 'type' => 'AAAA',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.145.97',\n 'type' => 'A',\n 'name' => 'smtpin',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:202:50f0::1097',\n 'type' => 'AAAA',\n 'name' => 'smtpin',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20b:43:6653::506',\n 'type' => 'AAAA',\n 'name' => 'shades06',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '85.214.0.236',\n 'type' => 'A',\n 'name' => 'shades06',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '10 smtpin',\n 'type' => 'MX',\n 'name' => '@',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '81.169.146.21',\n 'type' => 'A',\n 'name' => 'docks11',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ],\n [\n 'value' => '2a01:238:20a:930:6653::d11',\n 'type' => 'AAAA',\n 'name' => 'docks11',\n 'zone_id' => 'LXmSv4RsTcmYtugtyVWExG'\n ]\n ]\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Bulk Create Records\n # POST https://dns.hetzner.com/api/v1/records/bulk\n\n try:\n response = requests.post(\n url=\"https://dns.hetzner.com/api/v1/records/bulk\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"records\": [\n {\n \"value\": \"81.169.145.141\",\n \"type\": \"A\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:5800::1141\",\n \"type\": \"AAAA\",\n \"name\": \"autoconfig\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.105\",\n \"type\": \"A\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:1105::\",\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.145.97\",\n \"type\": \"A\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:202:50f0::1097\",\n \"type\": \"AAAA\",\n \"name\": \"smtpin\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20b:43:6653::506\",\n \"type\": \"AAAA\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"85.214.0.236\",\n \"type\": \"A\",\n \"name\": \"shades06\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"10 smtpin\",\n \"type\": \"MX\",\n \"name\": \"@\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"81.169.146.21\",\n \"type\": \"A\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n },\n {\n \"value\": \"2a01:238:20a:930:6653::d11\",\n \"type\": \"AAAA\",\n \"name\": \"docks11\",\n \"zone_id\": \"LXmSv4RsTcmYtugtyVWExG\"\n }\n ]\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + }, + "put": { + "tags": [ + "Records" + ], + "summary": "Bulk Update Records", + "description": "Update several records at once.", + "operationId": "BulkUpdateRecords", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecordBulk" + } + } + } + } + } + }, + "required": false + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecordResponse" + } + }, + "failed_records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BaseRecord" + } + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + }, + "409": { + "description": "Conflict" + }, + "422": { + "description": "Unprocessable entity" + } + }, + "x-code-samples": [ + { + "lang": "cURL", + "source": "## Bulk Update Records\n# Update several records at once.\ncurl -X \"PUT\" \"https://dns.hetzner.com/api/v1/records/bulk\" \\\n -H 'Content-Type: application/json' \\\n -H 'Auth-API-Token: LlGoDUQ39S6akqoav5meAsv5OIpeywhj' \\\n -d $'{\n \"records\": [\n {\n \"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n },\n {\n \"id\": \"uuK5PKsmfvi7853g5wXfRa\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"mail\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"L5RawAt6pJrdhFacynLrVg\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n }\n ]\n}'\n" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"bytes\"\n)\n\nfunc sendBulkUpdateRecords() {\n\t// Bulk Update Records (PUT https://dns.hetzner.com/api/v1/records/bulk)\n\n\tjson := []byte(`{\"records\": [{\"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"type\": \"AAAA\",\"name\": \"www\",\"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"},{\"id\": \"uuK5PKsmfvi7853g5wXfRa\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"mail\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"},{\"id\": \"L5RawAt6pJrdhFacynLrVg\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"cloud\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"},{\"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\"value\": \"2a01:4f8:d0a:11f5::2\",\"ttl\": 60,\"type\": \"AAAA\",\"name\": \"@\",\"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"}]}`)\n\tbody := bytes.NewBuffer(json)\n\n\t// Create client\n\tclient := &http.Client{}\n\n\t// Create request\n\treq, err := http.NewRequest(\"PUT\", \"https://dns.hetzner.com/api/v1/records/bulk\", body)\n\n\t// Headers\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Auth-API-Token\", \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\")\n\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\t\n\tif err != nil {\n\t\tfmt.Println(\"Failure : \", err)\n\t}\n\n\t// Read Response Body\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Display Results\n\tfmt.Println(\"response Status : \", resp.Status)\n\tfmt.Println(\"response Headers : \", resp.Header)\n\tfmt.Println(\"response Body : \", string(respBody))\n}\n\n\n" + }, + { + "lang": "PHP (cURL)", + "source": " [\n [\n 'id' => 'mnsQmZmXXmWh5MpFeT67ZZ',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'type' => 'AAAA',\n 'name' => 'www',\n 'zone_id' => 'oH7shFebR6nLPgTnmvNjM8'\n ],\n [\n 'id' => 'uuK5PKsmfvi7853g5wXfRa',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => 'mail',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ],\n [\n 'id' => 'L5RawAt6pJrdhFacynLrVg',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => 'cloud',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ],\n [\n 'id' => 'HD3FZLUoxZQ2GpDCxPGEjY',\n 'value' => '2a01:4f8:d0a:11f5::2',\n 'ttl' => 60,\n 'type' => 'AAAA',\n 'name' => '@',\n 'zone_id' => '6hYQBACMFjqWg6VKPfnvgD'\n ]\n ]\n]; \n$body = json_encode($json_array);\n\n// set body\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\n// send the request and save response to $response\n$response = curl_exec($ch);\n\n// stop if fails\nif (!$response) {\n die('Error: \"' . curl_error($ch) . '\" - Code: ' . curl_errno($ch));\n}\n\necho 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;\necho 'Response Body: ' . $response . PHP_EOL;\n\n// close curl resource to free up system resources \ncurl_close($ch);\n\n\n" + }, + { + "lang": "Python", + "source": "# Install the Python Requests library:\n# `pip install requests`\n\nimport requests\nimport json\n\n\ndef send_request():\n # Bulk Update Records\n # PUT https://dns.hetzner.com/api/v1/records/bulk\n\n try:\n response = requests.put(\n url=\"https://dns.hetzner.com/api/v1/records/bulk\",\n headers={\n \"Content-Type\": \"application/json\",\n \"Auth-API-Token\": \"LlGoDUQ39S6akqoav5meAsv5OIpeywhj\",\n },\n data=json.dumps({\n \"records\": [\n {\n \"id\": \"mnsQmZmXXmWh5MpFeT67ZZ\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"type\": \"AAAA\",\n \"name\": \"www\",\n \"zone_id\": \"oH7shFebR6nLPgTnmvNjM8\"\n },\n {\n \"id\": \"uuK5PKsmfvi7853g5wXfRa\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"mail\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"L5RawAt6pJrdhFacynLrVg\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"cloud\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n },\n {\n \"id\": \"HD3FZLUoxZQ2GpDCxPGEjY\",\n \"value\": \"2a01:4f8:d0a:11f5::2\",\n \"ttl\": 60,\n \"type\": \"AAAA\",\n \"name\": \"@\",\n \"zone_id\": \"6hYQBACMFjqWg6VKPfnvgD\"\n }\n ]\n })\n )\n print('Response HTTP Status Code: {status_code}'.format(\n status_code=response.status_code))\n print('Response HTTP Response Body: {content}'.format(\n content=response.content))\n except requests.exceptions.RequestException:\n print('HTTP Request failed')\n\n\n" + } + ], + "x-codegen-request-body-name": "body" + } + }, + "/primary_servers": { + "parameters": [ + { + "name": "Auth-API-Token", + "in": "header", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "get": { + "tags": [ + "Primary Servers" + ], + "summary": "Get All Primary Servers", + "description": "Returns all primary servers associated with user. Primary servers can also be filtered by zone_id.", + "operationId": "GetPrimaryServers", + "parameters": [ + { + "name": "zone_id", + "in": "query", + "description": "ID of zone", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_servers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + } + }, + "post": { + "tags": [ + "Primary Servers" + ], + "summary": "Create Primary Server", + "description": "Creates a new primary server.", + "operationId": "CreatePrimaryServer", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrimaryServer" + } + } + }, + "required": false + }, + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_server": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "406": { + "description": "Not acceptable" + }, + "422": { + "description": "Unprocessable entity" + } + }, + "x-codegen-request-body-name": "body" + } + }, + "/primary_servers/{PrimaryServerID}": { + "parameters": [ + { + "name": "Auth-API-Token", + "in": "header", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "get": { + "tags": [ + "Primary Servers" + ], + "summary": "Get Primary Server", + "description": "Returns an object containing all information of a primary server. Primary Server to get is identified by 'PrimaryServerID'.", + "operationId": "GetPrimaryServer", + "parameters": [ + { + "name": "PrimaryServerID", + "in": "path", + "description": "ID of primary server to get", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_server": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + } + }, + "put": { + "tags": [ + "Primary Servers" + ], + "summary": "Update Primary Server", + "description": "Updates a primary server.", + "operationId": "UpdatePrimaryServer", + "parameters": [ + { + "name": "PrimaryServerID", + "in": "path", + "description": "ID of primaryServer to update", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PrimaryServer" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "primary_server": { + "$ref": "#/components/schemas/PrimaryServerResponse" + } + } + } + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + }, + "409": { + "description": "Conflict" + }, + "422": { + "description": "Unprocessable entity" + } + }, + "x-codegen-request-body-name": "body" + }, + "delete": { + "tags": [ + "Primary Servers" + ], + "summary": "Delete Primary Server", + "description": "Deletes a primary server.", + "operationId": "DeletePrimaryServer", + "parameters": [ + { + "name": "PrimaryServerID", + "in": "path", + "description": "ID of primary server to be deleted", + "required": true, + "style": "simple", + "explode": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "406": { + "description": "Not acceptable" + } + } + } + } + }, + "components": { + "securitySchemes": { + "Auth-API-Token": { + "description": "You can create an API token in the DNS console.", + "type": "apiKey", + "name": "Auth-API-Token", + "in": "header" + } + }, + "schemas": { + "BaseRecord": { + "properties": { + "zone_id": { + "type": "string", + "description": "ID of zone this record is associated with" + }, + "type": { + "$ref": "#/components/schemas/RecordTypeCreatable" + }, + "name": { + "type": "string", + "description": "Name of record" + }, + "value": { + "type": "string", + "description": "Value of record (e.g. 127.0.0.1, 1.1.1.1)" + }, + "ttl": { + "type": "integer", + "description": "TTL of record", + "format": "uint64" + } + } + }, + "ExistingRecord": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseRecord" + } + ], + "properties": { + "id": { + "type": "string", + "description": "ID of record", + "readOnly": true + }, + "created": { + "type": "string", + "description": "Time record was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time record was last updated", + "readOnly": true, + "format": "date-time" + } + } + }, + "Record": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ExistingRecord" + } + ], + "required": [ + "name", + "type", + "value", + "zone_id" + ] + }, + "BaseRecordBulk": { + "properties": { + "id": { + "type": "string", + "description": "ID of record" + }, + "zone_id": { + "type": "string", + "description": "ID of zone this record is associated with" + }, + "type": { + "$ref": "#/components/schemas/RecordTypeCreatable" + }, + "name": { + "type": "string", + "description": "Name of record" + }, + "value": { + "type": "string", + "description": "Value of record (e.g. 127.0.0.1, 1.1.1.1)" + }, + "ttl": { + "type": "integer", + "description": "TTL of record", + "format": "uint64" + } + } + }, + "ExistingRecordBulk": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseRecordBulk" + } + ], + "properties": { + "id": { + "type": "string", + "description": "ID of record", + "readOnly": false + }, + "created": { + "type": "string", + "description": "Time record was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time record was last updated", + "readOnly": true, + "format": "date-time" + } + } + }, + "RecordBulk": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ExistingRecordBulk" + } + ], + "required": [ + "id", + "name", + "type", + "value", + "zone_id" + ] + }, + "RecordResponse": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/RecordType" + } + }, + "allOf": [ + { + "$ref": "#/components/schemas/ExistingRecord" + } + ] + }, + "BasePrimaryServer": { + "properties": { + "zone_id": { + "type": "string", + "description": "ID of zone this record is associated with" + }, + "address": { + "type": "string", + "description": "IPv4 or IPv6 address of the primary server" + }, + "port": { + "type": "integer", + "description": "Port number of the primary server", + "minimum": 1, + "maximum": 65535 + } + } + }, + "ExistingPrimaryServer": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BasePrimaryServer" + } + ], + "properties": { + "id": { + "type": "string", + "description": "ID of primary server", + "readOnly": true + }, + "created": { + "type": "string", + "description": "Time primary server was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time primary server was last updated", + "readOnly": true, + "format": "date-time" + } + } + }, + "PrimaryServer": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ExistingPrimaryServer" + } + ], + "required": [ + "id", + "address", + "port", + "zone_id" + ] + }, + "PrimaryServerResponse": { + "type": "object", + "properties": { + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + } + }, + "allOf": [ + { + "$ref": "#/components/schemas/ExistingPrimaryServer" + } + ] + }, + "BaseZone": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of zone", + "readOnly": true + }, + "created": { + "type": "string", + "description": "Time zone was created", + "readOnly": true, + "format": "date-time" + }, + "modified": { + "type": "string", + "description": "Time zone was last updated", + "readOnly": true, + "format": "date-time" + }, + "legacy_dns_host": { + "type": "string", + "readOnly": true + }, + "legacy_ns": { + "type": "array", + "readOnly": true, + "items": { + "type": "string" + } + }, + "name": { + "type": "string", + "description": "Name of zone" + }, + "ns": { + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "owner": { + "type": "string", + "description": "Owner of zone", + "readOnly": true + }, + "paused": { + "type": "boolean", + "readOnly": true + }, + "permission": { + "type": "string", + "description": "Zone's permissions", + "readOnly": true + }, + "project": { + "type": "string", + "readOnly": true + }, + "registrar": { + "type": "string", + "readOnly": true + }, + "status": { + "type": "string", + "description": "Status of zone", + "enum": [ + "verified", + "failed", + "pending" + ], + "readOnly": true + }, + "ttl": { + "type": "integer", + "description": "TTL of zone", + "format": "uint64" + }, + "verified": { + "type": "string", + "description": "Verification of zone", + "readOnly": true, + "format": "date-time" + }, + "records_count": { + "type": "integer", + "description": "Amount of records associated to this zone", + "readOnly": true, + "format": "uint64" + }, + "is_secondary_dns": { + "type": "boolean", + "description": "Indicates if a zone is a secondary DNS zone", + "readOnly": true + }, + "txt_verification": { + "type": "object", + "description": "Shape of the TXT record that has to be set to verify a zone. If name and token are empty, no TXT record needs to be set", + "readOnly": true, + "properties": { + "name": { + "type": "string", + "description": "Name of the TXT record", + "readOnly": true + }, + "token": { + "type": "string", + "description": "Value of the TXT record", + "readOnly": true + } + } + } + } + }, + "Zone": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseZone" + } + ], + "required": [ + "name" + ] + }, + "ZoneResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/BaseZone" + } + ] + }, + "RecordTypeCreatable": { + "type": "string", + "enum": [ + "A", + "AAAA", + "NS", + "MX", + "CNAME", + "RP", + "TXT", + "SOA", + "HINFO", + "SRV", + "DANE", + "TLSA", + "DS", + "CAA" + ], + "description": "Type of the record" + }, + "RecordType": { + "type": "string", + "enum": [ + "A", + "AAAA", + "PTR", + "NS", + "MX", + "CNAME", + "RP", + "TXT", + "SOA", + "HINFO", + "SRV", + "DANE", + "TLSA", + "DS", + "CAA" + ], + "description": "Type of the record" + }, + "Meta": { + "type": "object", + "description": "", + "properties": { + "pagination": { + "$ref": "#/components/schemas/Pagination" + } + } + }, + "Pagination": { + "type": "object", + "description": "", + "properties": { + "page": { + "type": "number", + "description": "This value represents the current page", + "minimum": 1 + }, + "per_page": { + "type": "number", + "description": "This value represents the number of entries that are returned per page", + "minimum": 1 + }, + "last_page": { + "type": "number", + "description": "This value represents the last page", + "minimum": 1 + }, + "total_entries": { + "type": "number", + "description": "This value represents the total number of entries" + } + } + } + } + } +} diff --git a/jane-configuration.php b/jane-configuration.php new file mode 100644 index 0000000..ac48391 --- /dev/null +++ b/jane-configuration.php @@ -0,0 +1,9 @@ + __DIR__ . '/hetzner-dns-api-modified.json', + 'namespace' => 'DigiComp\HetznerDnsApi', + 'directory' => __DIR__ . '/generated', + 'date-format' => 'Y-m-d H:m:i O T', + 'strict' => false, +]; diff --git a/src/RewriteHetznerDatesPlugin.php b/src/RewriteHetznerDatesPlugin.php new file mode 100644 index 0000000..4277231 --- /dev/null +++ b/src/RewriteHetznerDatesPlugin.php @@ -0,0 +1,52 @@ +contentStreamFactory = $contentStreamFactory; + } + + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + return $next($request)->then(function (ResponseInterface $response) use ($request) { + $oldContent = $response->getBody()->getContents(); + $newContent = Preg::replace( + '~(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\.\d+ (\+\d{4} \w+)( [^"]*)?~m', + '\\1 \\2', + $oldContent + ); + $newContent = Preg::replace('~"verified":""~', '"verified":null', $newContent); + $newBody = $this->contentStreamFactory->createStream($newContent); + + return $response->withBody($newBody); + }); + } +}