Skip to content

Commit 6830da7

Browse files
committed
build(codegen): updating SDK
1 parent 0dd0029 commit 6830da7

File tree

470 files changed

+4821
-1119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

470 files changed

+4821
-1119
lines changed

changes.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,13 @@
404404

405405
**Import changes**
406406

407+
<details>
408+
<summary>Added Enum(s)</summary>
409+
410+
- added enum `product-selection` to type `ImportResourceType`
411+
</details>
412+
413+
407414
<details>
408415
<summary>Added Property(s)</summary>
409416

@@ -418,6 +425,14 @@
418425
</details>
419426

420427

428+
<details>
429+
<summary>Changed Property(s)</summary>
430+
431+
- :warning: changed property `country` of type `ExternalTaxRateDraft` from type `string` to `CountryCode`
432+
- :warning: changed property `value` of type `MoneySetField` from type `Money[]` to `TypedMoney[]`
433+
</details>
434+
435+
421436
<details>
422437
<summary>Removed Property(s)</summary>
423438

@@ -426,14 +441,37 @@
426441
</details>
427442

428443

444+
<details>
445+
<summary>Added Method(s)</summary>
446+
447+
- added method `$apiRoot->withProjectKeyValue()->productSelections()->importContainers()->withImportContainerKeyValue()->post()`
448+
</details>
449+
450+
429451
<details>
430452
<summary>Added Type(s)</summary>
431453

432454
- added type `StrategyEnum`
433455
- added type `RetentionPolicy`
434456
- added type `TimeToLiveConfig`
435457
- added type `TimeToLiveRetentionPolicy`
458+
- added type `ProductSelectionImportRequest`
436459
- added type `AttributeLevel`
460+
- added type `VariantSelectionType`
461+
- added type `VariantSelection`
462+
- added type `VariantExclusion`
463+
- added type `ProductSelectionAssignment`
464+
- added type `ProductSelectionMode`
465+
- added type `ProductSelectionImport`
466+
</details>
467+
468+
469+
<details>
470+
<summary>Added Resource(s)</summary>
471+
472+
- added resource `/{projectKey}/product-selections`
473+
- added resource `/{projectKey}/product-selections/import-containers`
474+
- added resource `/{projectKey}/product-selections/import-containers/{importContainerKey}`
437475
</details>
438476

439477
**History changes**

lib/commercetools-api/src/Models/Common/Asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface Asset extends JsonObject
2323
public const FIELD_KEY = 'key';
2424

2525
/**
26-
* <p>Unique identifier of the Asset.</p>
26+
* <p>Unique identifier of the Asset. Not required when importing Assets using the <a href="/import-export/import-resources">Import API</a>.</p>
2727
*
2828
2929
* @return null|string

lib/commercetools-api/src/Models/Common/AssetBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ final class AssetBuilder implements Builder
6565
private $key;
6666

6767
/**
68-
* <p>Unique identifier of the Asset.</p>
68+
* <p>Unique identifier of the Asset. Not required when importing Assets using the <a href="/import-export/import-resources">Import API</a>.</p>
6969
*
7070
7171
* @return null|string

lib/commercetools-api/src/Models/Common/AssetModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __construct(
8686
}
8787

8888
/**
89-
* <p>Unique identifier of the Asset.</p>
89+
* <p>Unique identifier of the Asset. Not required when importing Assets using the <a href="/import-export/import-resources">Import API</a>.</p>
9090
*
9191
*
9292
* @return null|string
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
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\Import\Test\Client\Resource;
10+
11+
use Commercetools\Base\JsonObject;
12+
use Commercetools\Client\ApiRequest;
13+
use Commercetools\Exception\ApiClientException;
14+
use Commercetools\Exception\ApiServerException;
15+
use Commercetools\Import\Client\ImportRequestBuilder;
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\Import\Client\Resource\ByProjectKeyProductSelectionsImportContainersByImportContainerKeyPost
25+
* @covers \Commercetools\Import\Client\Resource\ResourceByProjectKeyProductSelectionsImportContainersByImportContainerKey
26+
*/
27+
class ResourceByProjectKeyProductSelectionsImportContainersByImportContainerKeyTest 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 ImportRequestBuilder();
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 ImportRequestBuilder();
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 ImportRequestBuilder($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 ImportRequestBuilder($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+
'ByProjectKeyProductSelectionsImportContainersByImportContainerKeyPost' => [
94+
function (ImportRequestBuilder $builder): RequestInterface {
95+
return $builder
96+
->withProjectKeyValue("test_projectKey")
97+
->productSelections()
98+
->importContainers()
99+
->withImportContainerKeyValue("test_importContainerKey")
100+
->post(null);
101+
},
102+
'post',
103+
'test_projectKey/product-selections/import-containers/test_importContainerKey',
104+
]
105+
];
106+
}
107+
108+
public function getResources()
109+
{
110+
return [
111+
];
112+
}
113+
114+
public function getRequestBuilders()
115+
{
116+
return [
117+
'ByProjectKeyProductSelectionsImportContainersByImportContainerKeyPost' => [
118+
function (ImportRequestBuilder $builder): RequestInterface {
119+
return $builder
120+
->withProjectKeyValue("projectKey")
121+
->productSelections()
122+
->importContainers()
123+
->withImportContainerKeyValue("importContainerKey")
124+
->post(null);
125+
}
126+
]
127+
];
128+
}
129+
130+
public function getRequestBuilderResponses()
131+
{
132+
return [
133+
'ByProjectKeyProductSelectionsImportContainersByImportContainerKeyPost_201' => [
134+
function (ImportRequestBuilder $builder): RequestInterface {
135+
return $builder
136+
->withProjectKeyValue("projectKey")
137+
->productSelections()
138+
->importContainers()
139+
->withImportContainerKeyValue("importContainerKey")
140+
->post(null);
141+
},
142+
201
143+
],
144+
'ByProjectKeyProductSelectionsImportContainersByImportContainerKeyPost_400' => [
145+
function (ImportRequestBuilder $builder): RequestInterface {
146+
return $builder
147+
->withProjectKeyValue("projectKey")
148+
->productSelections()
149+
->importContainers()
150+
->withImportContainerKeyValue("importContainerKey")
151+
->post(null);
152+
},
153+
400
154+
],
155+
'ByProjectKeyProductSelectionsImportContainersByImportContainerKeyPost_599' => [
156+
function (ImportRequestBuilder $builder): RequestInterface {
157+
return $builder
158+
->withProjectKeyValue("projectKey")
159+
->productSelections()
160+
->importContainers()
161+
->withImportContainerKeyValue("importContainerKey")
162+
->post(null);
163+
},
164+
599
165+
]
166+
];
167+
}
168+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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\Import\Test\Client\Resource;
10+
11+
use Commercetools\Base\JsonObject;
12+
use Commercetools\Client\ApiRequest;
13+
use Commercetools\Exception\ApiClientException;
14+
use Commercetools\Exception\ApiServerException;
15+
use Commercetools\Import\Client\ImportRequestBuilder;
16+
use Commercetools\Import\Client\Resource\ResourceByProjectKeyProductSelectionsImportContainersByImportContainerKey;
17+
use GuzzleHttp\ClientInterface;
18+
use GuzzleHttp\Exception\ClientException;
19+
use GuzzleHttp\Exception\ServerException;
20+
use GuzzleHttp\Psr7\Response;
21+
use PHPUnit\Framework\TestCase;
22+
use Psr\Http\Message\RequestInterface;
23+
24+
/**
25+
* @covers \Commercetools\Import\Client\Resource\ResourceByProjectKeyProductSelectionsImportContainers
26+
*/
27+
class ResourceByProjectKeyProductSelectionsImportContainersTest extends TestCase
28+
{
29+
/**
30+
* @dataProvider getResources()
31+
*/
32+
public function testResources(callable $builderFunction, string $class, array $expectedArgs)
33+
{
34+
$builder = new ImportRequestBuilder();
35+
$resource = $builderFunction($builder);
36+
$this->assertInstanceOf($class, $resource);
37+
$this->assertEquals($expectedArgs, $resource->getArgs());
38+
}
39+
40+
41+
42+
43+
44+
45+
46+
public function getRequests()
47+
{
48+
return [
49+
];
50+
}
51+
52+
public function getResources()
53+
{
54+
return [
55+
'ResourceByProjectKeyProductSelectionsImportContainersByImportContainerKey' => [
56+
function (ImportRequestBuilder $builder): ResourceByProjectKeyProductSelectionsImportContainersByImportContainerKey {
57+
return $builder
58+
->withProjectKeyValue("test_projectKey")
59+
->productSelections()
60+
->importContainers()
61+
->withImportContainerKeyValue("test_importContainerKey");
62+
},
63+
ResourceByProjectKeyProductSelectionsImportContainersByImportContainerKey::class,
64+
['projectKey' => 'test_projectKey', 'importContainerKey' => 'test_importContainerKey'],
65+
'/{projectKey}/product-selections/import-containers/{importContainerKey}'
66+
]
67+
];
68+
}
69+
70+
public function getRequestBuilders()
71+
{
72+
return [
73+
];
74+
}
75+
76+
public function getRequestBuilderResponses()
77+
{
78+
return [
79+
];
80+
}
81+
}

0 commit comments

Comments
 (0)