42 public function __construct(
string $projectKey, $body =
null, array $headers = [], ?ClientInterface $client =
null)
44 $uri = str_replace([
'{projectKey}'], [self::encodePathParam($projectKey)],
'{projectKey}/variant-projections');
45 parent::__construct($client,
'HEAD', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
53 public function mapFromResponse(?ResponseInterface $response, ?
string $resultType =
null)
55 if (is_null($response)) {
58 if (is_null($resultType)) {
59 switch ($response->getStatusCode()) {
61 $resultType = ErrorResponseModel::class;
65 $resultType = ErrorResponseModel::class;
69 $resultType = ErrorResponseModel::class;
73 $resultType = ErrorResponseModel::class;
77 $resultType = ErrorResponseModel::class;
81 $resultType = ErrorResponseModel::class;
85 $resultType = JsonObjectModel::class;
100 public function execute(array $options = [], ?
string $resultType =
null)
103 $response = $this->
send($options);
104 }
catch (ServerException $e) {
105 $response = $e->getResponse();
106 $e = ExceptionFactory::createServerException($e, $this, $response, $this->
mapFromResponse($response, $resultType));
108 }
catch (ClientException $e) {
109 $response = $e->getResponse();
110 $e = ExceptionFactory::createClientException($e, $this, $response, $this->
mapFromResponse($response, $resultType));
123 public function executeAsync(array $options = [], ?
string $resultType =
null)
126 function (ResponseInterface $response) use ($resultType) {
129 function (RequestException $e) use ($resultType) {
130 $response = $e->getResponse();
131 if ($e instanceof ServerException) {
132 $e = ExceptionFactory::createServerException($e, $this, $response, $this->
mapFromResponse($response, $resultType));
134 if ($e instanceof ClientException) {
135 $e = ExceptionFactory::createClientException($e, $this, $response, $this->
mapFromResponse($response, $resultType));