Skip to content

Commit 4c5abdd

Browse files
Merge pull request #287 from commercetools/gen-sdk-updates
Update generated SDKs
2 parents 9727d97 + 07f90e7 commit 4c5abdd

File tree

40 files changed

+3680
-2
lines changed

40 files changed

+3680
-2
lines changed

changes.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
<details>
44
<summary>Added Resource(s)</summary>
55

6+
- added resource `/{projectKey}/business-units/search`
7+
- added resource `/{projectKey}/business-units/search/indexing-status`
68
- added resource `/{projectKey}/channels/key={key}`
79
</details>
810

911

1012
<details>
1113
<summary>Added Method(s)</summary>
1214

15+
- added method `$apiRoot->withProjectKey()->businessUnits()->search()->post()`
16+
- added method `$apiRoot->withProjectKey()->businessUnits()->search()->head()`
17+
- added method `$apiRoot->withProjectKey()->businessUnits()->searchIndexingStatus()->get()`
1318
- added method `$apiRoot->withProjectKey()->channels()->withKey()->get()`
1419
- added method `$apiRoot->withProjectKey()->channels()->withKey()->head()`
1520
- added method `$apiRoot->withProjectKey()->channels()->withKey()->post()`
@@ -20,6 +25,12 @@
2025
<details>
2126
<summary>Added Type(s)</summary>
2227

28+
- added type `BusinessUnitIndexingProgress`
29+
- added type `BusinessUnitIndexingStatus`
30+
- added type `BusinessUnitPagedSearchResponse`
31+
- added type `BusinessUnitSearchIndexingStatusResponse`
32+
- added type `BusinessUnitSearchRequest`
33+
- added type `BusinessUnitSearchResult`
2334
- added type `CartDiscountPatternTarget`
2435
- added type `CountOnCustomLineItemUnits`
2536
- added type `CountOnLineItemUnits`
@@ -30,6 +41,8 @@
3041
- added type `ShoppingListLineItemAddedMessagePayload`
3142
- added type `ShoppingListLineItemRemovedMessagePayload`
3243
- added type `ShoppingListMessagePayload`
44+
- added type `BusinessUnitSearchStatus`
45+
- added type `ProjectChangeBusinessUnitSearchStatusAction`
3346
</details>
3447

3548

@@ -49,6 +62,7 @@
4962
- added property `custom` to type `CartSetCustomShippingMethodAction`
5063
- added property `custom` to type `StagedOrderSetCustomShippingMethodAction`
5164
- added property `custom` to type `StagedOrderSetShippingAddressAndCustomShippingMethodAction`
65+
- added property `businessUnits` to type `SearchIndexingConfiguration`
5266
</details>
5367

5468
**History changes**
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
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\Test\Client\Resource;
10+
11+
use Commercetools\Api\Client\ApiRequestBuilder;
12+
use Commercetools\Base\JsonObject;
13+
use Commercetools\Client\ApiRequest;
14+
use Commercetools\Exception\ApiClientException;
15+
use Commercetools\Exception\ApiServerException;
16+
use GuzzleHttp\ClientInterface;
17+
use GuzzleHttp\Exception\ClientException;
18+
use GuzzleHttp\Exception\ServerException;
19+
use GuzzleHttp\Psr7\Response;
20+
use PHPUnit\Framework\TestCase;
21+
use Psr\Http\Message\RequestInterface;
22+
23+
/**
24+
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyBusinessUnitsSearchIndexingStatusGet
25+
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyBusinessUnitsSearchIndexingStatus
26+
*/
27+
class ResourceByProjectKeyBusinessUnitsSearchIndexingStatusTest extends TestCase
28+
{
29+
/**
30+
* @dataProvider getRequests()
31+
*/
32+
public function testBuilder(callable $builderFunction, string $method, string $relativeUri, string $body = null)
33+
{
34+
$builder = new ApiRequestBuilder();
35+
$request = $builderFunction($builder);
36+
$this->assertSame(strtolower($method), strtolower($request->getMethod()));
37+
$this->assertSame($relativeUri, (string) $request->getUri());
38+
if (!is_null($body)) {
39+
$this->assertJsonStringEqualsJsonString($body, (string) $request->getBody());
40+
} else {
41+
$this->assertSame("", (string) $request->getBody());
42+
}
43+
}
44+
45+
46+
47+
/**
48+
* @dataProvider getRequestBuilderResponses()
49+
*/
50+
public function testMapFromResponse(callable $builderFunction, $statusCode)
51+
{
52+
$builder = new ApiRequestBuilder();
53+
$request = $builderFunction($builder);
54+
$this->assertInstanceOf(ApiRequest::class, $request);
55+
56+
$response = new Response($statusCode, [], "{}");
57+
$this->assertInstanceOf(JsonObject::class, $request->mapFromResponse($response));
58+
}
59+
60+
/**
61+
* @dataProvider getRequestBuilders()
62+
*/
63+
public function testExecuteClientException(callable $builderFunction)
64+
{
65+
$client = $this->createMock(ClientInterface::class);
66+
67+
$builder = new ApiRequestBuilder($client);
68+
$request = $builderFunction($builder);
69+
$client->method("send")->willThrowException(new ClientException("Oops!", $request, new Response(400)));
70+
71+
$this->expectException(ApiClientException::class);
72+
$request->execute();
73+
}
74+
75+
/**
76+
* @dataProvider getRequestBuilders()
77+
*/
78+
public function testExecuteServerException(callable $builderFunction)
79+
{
80+
$client = $this->createMock(ClientInterface::class);
81+
82+
$builder = new ApiRequestBuilder($client);
83+
$request = $builderFunction($builder);
84+
$client->method("send")->willThrowException(new ServerException("Oops!", $request, new Response(500)));
85+
86+
$this->expectException(ApiServerException::class);
87+
$request->execute();
88+
}
89+
90+
public function getRequests()
91+
{
92+
return [
93+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet' => [
94+
function (ApiRequestBuilder $builder): RequestInterface {
95+
return $builder
96+
->withProjectKey("test_projectKey")
97+
->businessUnits()
98+
->searchIndexingStatus()
99+
->get();
100+
},
101+
'get',
102+
'test_projectKey/business-units/search/indexing-status',
103+
]
104+
];
105+
}
106+
107+
public function getResources()
108+
{
109+
return [
110+
];
111+
}
112+
113+
public function getRequestBuilders()
114+
{
115+
return [
116+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet' => [
117+
function (ApiRequestBuilder $builder): RequestInterface {
118+
return $builder
119+
->withProjectKey("projectKey")
120+
->businessUnits()
121+
->searchIndexingStatus()
122+
->get();
123+
}
124+
]
125+
];
126+
}
127+
128+
public function getRequestBuilderResponses()
129+
{
130+
return [
131+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_200' => [
132+
function (ApiRequestBuilder $builder): RequestInterface {
133+
return $builder
134+
->withProjectKey("projectKey")
135+
->businessUnits()
136+
->searchIndexingStatus()
137+
->get();
138+
},
139+
200
140+
],
141+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_400' => [
142+
function (ApiRequestBuilder $builder): RequestInterface {
143+
return $builder
144+
->withProjectKey("projectKey")
145+
->businessUnits()
146+
->searchIndexingStatus()
147+
->get();
148+
},
149+
400
150+
],
151+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_401' => [
152+
function (ApiRequestBuilder $builder): RequestInterface {
153+
return $builder
154+
->withProjectKey("projectKey")
155+
->businessUnits()
156+
->searchIndexingStatus()
157+
->get();
158+
},
159+
401
160+
],
161+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_403' => [
162+
function (ApiRequestBuilder $builder): RequestInterface {
163+
return $builder
164+
->withProjectKey("projectKey")
165+
->businessUnits()
166+
->searchIndexingStatus()
167+
->get();
168+
},
169+
403
170+
],
171+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_404' => [
172+
function (ApiRequestBuilder $builder): RequestInterface {
173+
return $builder
174+
->withProjectKey("projectKey")
175+
->businessUnits()
176+
->searchIndexingStatus()
177+
->get();
178+
},
179+
404
180+
],
181+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_500' => [
182+
function (ApiRequestBuilder $builder): RequestInterface {
183+
return $builder
184+
->withProjectKey("projectKey")
185+
->businessUnits()
186+
->searchIndexingStatus()
187+
->get();
188+
},
189+
500
190+
],
191+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_502' => [
192+
function (ApiRequestBuilder $builder): RequestInterface {
193+
return $builder
194+
->withProjectKey("projectKey")
195+
->businessUnits()
196+
->searchIndexingStatus()
197+
->get();
198+
},
199+
502
200+
],
201+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_503' => [
202+
function (ApiRequestBuilder $builder): RequestInterface {
203+
return $builder
204+
->withProjectKey("projectKey")
205+
->businessUnits()
206+
->searchIndexingStatus()
207+
->get();
208+
},
209+
503
210+
],
211+
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_599' => [
212+
function (ApiRequestBuilder $builder): RequestInterface {
213+
return $builder
214+
->withProjectKey("projectKey")
215+
->businessUnits()
216+
->searchIndexingStatus()
217+
->get();
218+
},
219+
599
220+
]
221+
];
222+
}
223+
}

0 commit comments

Comments
 (0)