hetzner-dns-api/generated/Endpoint/GetZones.php

78 lines
No EOL
3.3 KiB
PHP

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