1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Starweb\Api\Generated\Endpoint; |
4
|
|
|
|
5
|
|
|
class DeletePricelist extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7HttplugEndpoint |
6
|
|
|
{ |
7
|
|
|
protected $pricelistId; |
8
|
|
|
/** |
9
|
|
|
* Delete a pricelist permanently. The master pricelist can not be deleted and will return an error `403` |
10
|
|
|
* |
11
|
|
|
* @param int $pricelistId The pricelist id |
12
|
|
|
*/ |
13
|
|
|
public function __construct(int $pricelistId) |
14
|
|
|
{ |
15
|
|
|
$this->pricelistId = $pricelistId; |
16
|
|
|
} |
17
|
|
|
use \Jane\OpenApiRuntime\Client\Psr7HttplugEndpointTrait; |
18
|
|
|
public function getMethod() : string |
19
|
|
|
{ |
20
|
|
|
return 'DELETE'; |
21
|
|
|
} |
22
|
|
|
public function getUri() : string |
23
|
|
|
{ |
24
|
|
|
return str_replace(array('{pricelistId}'), array($this->pricelistId), '/pricelists/{pricelistId}'); |
25
|
|
|
} |
26
|
|
|
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, \Http\Message\StreamFactory $streamFactory = null) : array |
27
|
|
|
{ |
28
|
|
|
return array(array(), null); |
29
|
|
|
} |
30
|
|
|
public function getExtraHeaders() : array |
31
|
|
|
{ |
32
|
|
|
return array('Accept' => array('application/json')); |
33
|
|
|
} |
34
|
|
|
/** |
35
|
|
|
* {@inheritdoc} |
36
|
|
|
* |
37
|
|
|
* @throws \Starweb\Api\Generated\Exception\DeletePricelistNotFoundException |
38
|
|
|
* @throws \Starweb\Api\Generated\Exception\DeletePricelistForbiddenException |
39
|
|
|
* |
40
|
|
|
* @return null |
41
|
|
|
*/ |
42
|
|
|
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) |
43
|
|
|
{ |
44
|
|
|
if (204 === $status) { |
45
|
|
|
return null; |
46
|
|
|
} |
47
|
|
|
if (404 === $status && 'application/json' === $contentType) { |
48
|
|
|
throw new \Starweb\Api\Generated\Exception\DeletePricelistNotFoundException($serializer->deserialize($body, 'Starweb\\Api\\Generated\\Model\\ErrorModel', 'json')); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
if (403 === $status && 'application/json' === $contentType) { |
51
|
|
|
throw new \Starweb\Api\Generated\Exception\DeletePricelistForbiddenException($serializer->deserialize($body, 'Starweb\\Api\\Generated\\Model\\ErrorModel', 'json')); |
|
|
|
|
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
} |