50 public function __construct(
string $projectKey, $body =
null, array $headers = [], ?ClientInterface $client =
null)
52 $uri = str_replace([
'{projectKey}'], [self::encodePathParam($projectKey)],
'{projectKey}/variant-projections');
53 parent::__construct($client,
'GET', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
61 public function mapFromResponse(?ResponseInterface $response, ?
string $resultType =
null)
63 if (is_null($response)) {
66 if (is_null($resultType)) {
67 switch ($response->getStatusCode()) {
69 $resultType = VariantProjectionPagedQueryResponseModel::class;
73 $resultType = ErrorResponseModel::class;
77 $resultType = ErrorResponseModel::class;
81 $resultType = ErrorResponseModel::class;
85 $resultType = ErrorResponseModel::class;
89 $resultType = ErrorResponseModel::class;
93 $resultType = ErrorResponseModel::class;
97 $resultType = JsonObjectModel::class;
112 public function execute(array $options = [], ?
string $resultType =
null)
115 $response = $this->
send($options);
116 }
catch (ServerException $e) {
117 $response = $e->getResponse();
118 $e = ExceptionFactory::createServerException($e, $this, $response, $this->
mapFromResponse($response, $resultType));
120 }
catch (ClientException $e) {
121 $response = $e->getResponse();
122 $e = ExceptionFactory::createClientException($e, $this, $response, $this->
mapFromResponse($response, $resultType));
135 public function executeAsync(array $options = [], ?
string $resultType =
null)
138 function (ResponseInterface $response) use ($resultType) {
141 function (RequestException $e) use ($resultType) {
142 $response = $e->getResponse();
143 if ($e instanceof ServerException) {
144 $e = ExceptionFactory::createServerException($e, $this, $response, $this->
mapFromResponse($response, $resultType));
146 if ($e instanceof ClientException) {
147 $e = ExceptionFactory::createClientException($e, $this, $response, $this->
mapFromResponse($response, $resultType));