hetzner-dns-api/generated/Client.php

365 lines
20 KiB
PHP
Raw Permalink Normal View History

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