Skip to content

Commit d92c97d

Browse files
committed
build(codegen): updating SDK
1 parent 93bafe7 commit d92c97d

File tree

6 files changed

+291
-0
lines changed

6 files changed

+291
-0
lines changed

changes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
- added enum `product-tailoring` to type `ResourceTypeId`
4343
</details>
4444

45+
46+
<details>
47+
<summary>Added Method(s)</summary>
48+
49+
- added method `$apiRoot->withProjectKey()->productTailoring()->head()`
50+
</details>
51+
4552
**Import changes**
4653

4754
<details>

lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductTailoringTest.php

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
/**
2626
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyProductTailoringGet
27+
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyProductTailoringHead
2728
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyProductTailoringPost
2829
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyProductTailoring
2930
*/
@@ -189,6 +190,27 @@ function (ApiRequestBuilder $builder): RequestInterface {
189190
'get',
190191
'test_projectKey/product-tailoring',
191192
],
193+
'ByProjectKeyProductTailoringHead_withWhere' => [
194+
function (ApiRequestBuilder $builder): RequestInterface {
195+
return $builder
196+
->withProjectKey('test_projectKey')
197+
->productTailoring()
198+
->head()
199+
->withWhere('where');
200+
},
201+
'head',
202+
'test_projectKey/product-tailoring?where=where',
203+
],
204+
'ByProjectKeyProductTailoringHead' => [
205+
function (ApiRequestBuilder $builder): RequestInterface {
206+
return $builder
207+
->withProjectKey("test_projectKey")
208+
->productTailoring()
209+
->head();
210+
},
211+
'head',
212+
'test_projectKey/product-tailoring',
213+
],
192214
'ByProjectKeyProductTailoringPost_withExpand' => [
193215
function (ApiRequestBuilder $builder): RequestInterface {
194216
return $builder
@@ -252,6 +274,14 @@ function (ApiRequestBuilder $builder): RequestInterface {
252274
->get();
253275
}
254276
],
277+
'ByProjectKeyProductTailoringHead' => [
278+
function (ApiRequestBuilder $builder): RequestInterface {
279+
return $builder
280+
->withProjectKey("projectKey")
281+
->productTailoring()
282+
->head();
283+
}
284+
],
255285
'ByProjectKeyProductTailoringPost' => [
256286
function (ApiRequestBuilder $builder): RequestInterface {
257287
return $builder
@@ -347,6 +377,87 @@ function (ApiRequestBuilder $builder): RequestInterface {
347377
},
348378
599
349379
],
380+
'ByProjectKeyProductTailoringHead_200' => [
381+
function (ApiRequestBuilder $builder): RequestInterface {
382+
return $builder
383+
->withProjectKey("projectKey")
384+
->productTailoring()
385+
->head();
386+
},
387+
200
388+
],
389+
'ByProjectKeyProductTailoringHead_404' => [
390+
function (ApiRequestBuilder $builder): RequestInterface {
391+
return $builder
392+
->withProjectKey("projectKey")
393+
->productTailoring()
394+
->head();
395+
},
396+
404
397+
],
398+
'ByProjectKeyProductTailoringHead_400' => [
399+
function (ApiRequestBuilder $builder): RequestInterface {
400+
return $builder
401+
->withProjectKey("projectKey")
402+
->productTailoring()
403+
->head();
404+
},
405+
400
406+
],
407+
'ByProjectKeyProductTailoringHead_401' => [
408+
function (ApiRequestBuilder $builder): RequestInterface {
409+
return $builder
410+
->withProjectKey("projectKey")
411+
->productTailoring()
412+
->head();
413+
},
414+
401
415+
],
416+
'ByProjectKeyProductTailoringHead_403' => [
417+
function (ApiRequestBuilder $builder): RequestInterface {
418+
return $builder
419+
->withProjectKey("projectKey")
420+
->productTailoring()
421+
->head();
422+
},
423+
403
424+
],
425+
'ByProjectKeyProductTailoringHead_500' => [
426+
function (ApiRequestBuilder $builder): RequestInterface {
427+
return $builder
428+
->withProjectKey("projectKey")
429+
->productTailoring()
430+
->head();
431+
},
432+
500
433+
],
434+
'ByProjectKeyProductTailoringHead_502' => [
435+
function (ApiRequestBuilder $builder): RequestInterface {
436+
return $builder
437+
->withProjectKey("projectKey")
438+
->productTailoring()
439+
->head();
440+
},
441+
502
442+
],
443+
'ByProjectKeyProductTailoringHead_503' => [
444+
function (ApiRequestBuilder $builder): RequestInterface {
445+
return $builder
446+
->withProjectKey("projectKey")
447+
->productTailoring()
448+
->head();
449+
},
450+
503
451+
],
452+
'ByProjectKeyProductTailoringHead_599' => [
453+
function (ApiRequestBuilder $builder): RequestInterface {
454+
return $builder
455+
->withProjectKey("projectKey")
456+
->productTailoring()
457+
->head();
458+
},
459+
599
460+
],
350461
'ByProjectKeyProductTailoringPost_201' => [
351462
function (ApiRequestBuilder $builder): RequestInterface {
352463
return $builder

lib/commercetools-api/docs/RequestBuilder.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8771,6 +8771,20 @@ $request = $builder
87718771
->productTailoring()
87728772
->get();
87738773
```
8774+
## `withProjectKey("projectKey")->productTailoring()->head()`
8775+
8776+
Checks if a ProductTailoring exists for a given Query Predicate. Returns a `200 OK` status if any ProductTailoring match the Query Predicate or a `404 Not Found` otherwise.
8777+
8778+
### Example
8779+
```php
8780+
use Commercetools\Api\Client\ApiRequestBuilder;
8781+
8782+
$builder = new ApiRequestBuilder();
8783+
$request = $builder
8784+
->withProjectKey("projectKey")
8785+
->productTailoring()
8786+
->head();
8787+
```
87748788
## `withProjectKey("projectKey")->productTailoring()->post(null)`
87758789

87768790
Generates the [ProductTailoringCreated](ctp:api:type:ProductTailoringCreatedMessage) Message.
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\Api\Client\Resource;
10+
11+
use Commercetools\Api\Models\Error\ErrorResponse;
12+
use Commercetools\Api\Models\Error\ErrorResponseModel;
13+
use Commercetools\Base\JsonObject;
14+
use Commercetools\Base\JsonObjectModel;
15+
use Commercetools\Client\ApiRequest;
16+
use Commercetools\Exception\ApiClientException;
17+
use Commercetools\Exception\ApiServerException;
18+
use Commercetools\Exception\ExceptionFactory;
19+
use Commercetools\Exception\InvalidArgumentException;
20+
use GuzzleHttp\ClientInterface;
21+
use GuzzleHttp\Exception\ClientException;
22+
use GuzzleHttp\Exception\RequestException;
23+
use GuzzleHttp\Exception\ServerException;
24+
use GuzzleHttp\Promise\PromiseInterface;
25+
26+
use Psr\Http\Message\ResponseInterface;
27+
28+
/**
29+
30+
* @psalm-suppress PropertyNotSetInConstructor
31+
* @template-implements Errorable<ByProjectKeyProductTailoringHead>
32+
* @template-implements Deprecatable200<ByProjectKeyProductTailoringHead>
33+
*/
34+
class ByProjectKeyProductTailoringHead extends ApiRequest implements Errorable, Deprecatable200
35+
{
36+
/**
37+
* @param ?object|array|string $body
38+
* @psalm-param array<string, scalar|scalar[]> $headers
39+
*/
40+
public function __construct(string $projectKey, $body = null, array $headers = [], ClientInterface $client = null)
41+
{
42+
$uri = str_replace(['{projectKey}'], [$projectKey], '{projectKey}/product-tailoring');
43+
parent::__construct($client, 'HEAD', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
44+
}
45+
46+
/**
47+
* @template T of JsonObject
48+
* @psalm-param ?class-string<T> $resultType
49+
* @return ErrorResponse|JsonObject|T|null
50+
*/
51+
public function mapFromResponse(?ResponseInterface $response, string $resultType = null)
52+
{
53+
if (is_null($response)) {
54+
return null;
55+
}
56+
if (is_null($resultType)) {
57+
switch ($response->getStatusCode()) {
58+
case '400':
59+
$resultType = ErrorResponseModel::class;
60+
61+
break;
62+
case '401':
63+
$resultType = ErrorResponseModel::class;
64+
65+
break;
66+
case '403':
67+
$resultType = ErrorResponseModel::class;
68+
69+
break;
70+
case '500':
71+
$resultType = ErrorResponseModel::class;
72+
73+
break;
74+
case '502':
75+
$resultType = ErrorResponseModel::class;
76+
77+
break;
78+
case '503':
79+
$resultType = ErrorResponseModel::class;
80+
81+
break;
82+
default:
83+
$resultType = JsonObjectModel::class;
84+
85+
break;
86+
}
87+
}
88+
89+
return $resultType::of($this->responseData($response));
90+
}
91+
92+
/**
93+
* @template T of JsonObject
94+
* @psalm-param ?class-string<T> $resultType
95+
*
96+
* @return null|T|ErrorResponse|JsonObject
97+
*/
98+
public function execute(array $options = [], string $resultType = null)
99+
{
100+
try {
101+
$response = $this->send($options);
102+
} catch (ServerException $e) {
103+
$response = $e->getResponse();
104+
$e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
105+
throw $e;
106+
} catch (ClientException $e) {
107+
$response = $e->getResponse();
108+
$e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
109+
throw $e;
110+
}
111+
112+
return $this->mapFromResponse($response, $resultType);
113+
}
114+
115+
/**
116+
* @template T of JsonObject
117+
* @psalm-param ?class-string<T> $resultType
118+
*
119+
* @return PromiseInterface
120+
*/
121+
public function executeAsync(array $options = [], string $resultType = null)
122+
{
123+
return $this->sendAsync($options)->then(
124+
function (ResponseInterface $response) use ($resultType) {
125+
return $this->mapFromResponse($response, $resultType);
126+
},
127+
function (RequestException $e) use ($resultType) {
128+
$response = $e->getResponse();
129+
if ($e instanceof ServerException) {
130+
$e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
131+
}
132+
if ($e instanceof ClientException) {
133+
$e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
134+
}
135+
throw $e;
136+
}
137+
);
138+
}
139+
140+
/**
141+
*
142+
* @psalm-param scalar|scalar[] $where
143+
*/
144+
public function withWhere($where): ByProjectKeyProductTailoringHead
145+
{
146+
return $this->withQueryParam('where', $where);
147+
}
148+
}

lib/commercetools-api/src/Client/Resource/ResourceByProjectKeyProductTailoring.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ public function get($body = null, array $headers = []): ByProjectKeyProductTailo
5959

6060
return new ByProjectKeyProductTailoringGet($args['projectKey'], $body, $headers, $this->getClient());
6161
}
62+
/**
63+
* @psalm-param ?object|array|string $body
64+
* @psalm-param array<string, scalar|scalar[]> $headers
65+
*/
66+
public function head($body = null, array $headers = []): ByProjectKeyProductTailoringHead
67+
{
68+
$args = $this->getArgs();
69+
70+
return new ByProjectKeyProductTailoringHead($args['projectKey'], $body, $headers, $this->getClient());
71+
}
6272
/**
6373
* @psalm-param ?ProductTailoringDraft $body
6474
* @psalm-param array<string, scalar|scalar[]> $headers

references.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,4 @@ c77ec902f368c2c31505fcb65a835ce148350077
308308
e985f4b7aa55610705ee49bd3eb645c2fd03eb6c
309309
7b61d389a7b8bd5dac2d780c6b6fbea0b881400c
310310
3bde1efd0d5dbff77065d355e9d00e8a0e8f466a
311+
c27603f949e869148570ebb8bd3ec6db34a985b7

0 commit comments

Comments
 (0)