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

66 lines
2.5 KiB
PHP
Raw Permalink Normal View History

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