Skip to content

Commit e2b02a4

Browse files
committed
build(codegen): updating SDK
1 parent d6fb6e6 commit e2b02a4

File tree

63 files changed

+5538
-21
lines changed

Some content is hidden

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

63 files changed

+5538
-21
lines changed

changes.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,56 +567,74 @@
567567
<details>
568568
<summary>Added Type(s)</summary>
569569

570+
- added type `AssociateRoleKeyReference`
571+
- added type `BusinessUnitKeyReference`
570572
- added type `StrategyEnum`
571573
- added type `RetentionPolicy`
572574
- added type `TimeToLiveConfig`
573575
- added type `TimeToLiveRetentionPolicy`
574576
- added type `ProductSelectionImportRequest`
575-
- added type `AttributeLevel`
577+
- added type `BusinessUnitImportRequest`
578+
- added type `AssociateRoleInheritanceMode`
579+
- added type `BusinessUnitStatus`
580+
- added type `BusinessUnitAssociateMode`
581+
- added type `BusinessUnitApprovalRuleMode`
582+
- added type `BusinessUnitStoreMode`
583+
- added type `BusinessUnitType`
584+
- added type `AssociateRoleAssignmentDraft`
585+
- added type `AssociateDraft`
586+
- added type `BusinessUnitImport`
587+
- added type `CompanyBusinessUnitImport`
588+
- added type `DivisionBusinessUnitImport`
576589
- added type `VariantSelectionType`
577590
- added type `VariantSelection`
578591
- added type `VariantExclusion`
579592
- added type `ProductSelectionAssignment`
580593
- added type `ProductSelectionMode`
581594
- added type `ProductSelectionImport`
595+
- added type `AttributeLevel`
582596
</details>
583597

584598

585599
<details>
586600
<summary>Added Method(s)</summary>
587601

588602
- added method `$apiRoot->withProjectKeyValue()->productSelections()->importContainers()->withImportContainerKeyValue()->post()`
603+
- added method `$apiRoot->withProjectKeyValue()->businessUnits()->importContainers()->withImportContainerKeyValue()->post()`
589604
</details>
590605

591606

592607
<details>
593608
<summary>Added Resource(s)</summary>
594609

595610
- added resource `/{projectKey}/product-selections`
611+
- added resource `/{projectKey}/business-units`
596612
- added resource `/{projectKey}/product-selections/import-containers`
597613
- added resource `/{projectKey}/product-selections/import-containers/{importContainerKey}`
614+
- added resource `/{projectKey}/business-units/import-containers`
615+
- added resource `/{projectKey}/business-units/import-containers/{importContainerKey}`
598616
</details>
599617

600618

601619
<details>
602620
<summary>Changed Property(s)</summary>
603621

604-
- :warning: changed property `country` of type `ExternalTaxRateDraft` from type `string` to `CountryCode`
605622
- :warning: changed property `value` of type `MoneySetField` from type `Money[]` to `TypedMoney[]`
623+
- :warning: changed property `country` of type `ExternalTaxRateDraft` from type `string` to `CountryCode`
606624
</details>
607625

608626

609627
<details>
610628
<summary>Added Property(s)</summary>
611629

630+
- added property `/^[a-zA-Z]{2,3}(?:-[a-zA-Z]{4})?(?:-(?:[a-zA-Z]{2}|\d{3}))?$/` to type `LocalizedString`
612631
- added property `retentionPolicy` to type `ImportContainer`
613632
- added property `expiresAt` to type `ImportContainer`
614633
- added property `retentionPolicy` to type `ImportContainerDraft`
634+
- added property `attributes` to type `ProductDraftImport`
615635
- added property `/^[a-zA-Z]{2,3}(?:-[a-zA-Z]{4})?(?:-(?:[a-zA-Z]{2}|\d{3}))?$/` to type `SearchKeywords`
616636
- added property `attributes` to type `ProductImport`
617-
- added property `attributes` to type `ProductDraftImport`
618637
- added property `level` to type `AttributeDefinition`
619-
- added property `/^[a-zA-Z]{2,3}(?:-[a-zA-Z]{4})?(?:-(?:[a-zA-Z]{2}|\d{3}))?$/` to type `LocalizedString`
620638
</details>
621639

622640

@@ -631,7 +649,10 @@
631649
<details>
632650
<summary>Added Enum(s)</summary>
633651

652+
- added enum `business-unit` to type `ImportResourceType`
634653
- added enum `product-selection` to type `ImportResourceType`
654+
- added enum `associate-role` to type `ReferenceType`
655+
- added enum `business-unit` to type `ReferenceType`
635656
</details>
636657

637658
**History changes**
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\ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost
25+
* @covers \Commercetools\Import\Client\Resource\ResourceByProjectKeyBusinessUnitsImportContainersByImportContainerKey
26+
*/
27+
class ResourceByProjectKeyBusinessUnitsImportContainersByImportContainerKeyTest 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+
'ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost' => [
94+
function (ImportRequestBuilder $builder): RequestInterface {
95+
return $builder
96+
->withProjectKeyValue("test_projectKey")
97+
->businessUnits()
98+
->importContainers()
99+
->withImportContainerKeyValue("test_importContainerKey")
100+
->post(null);
101+
},
102+
'post',
103+
'test_projectKey/business-units/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+
'ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost' => [
118+
function (ImportRequestBuilder $builder): RequestInterface {
119+
return $builder
120+
->withProjectKeyValue("projectKey")
121+
->businessUnits()
122+
->importContainers()
123+
->withImportContainerKeyValue("importContainerKey")
124+
->post(null);
125+
}
126+
]
127+
];
128+
}
129+
130+
public function getRequestBuilderResponses()
131+
{
132+
return [
133+
'ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost_201' => [
134+
function (ImportRequestBuilder $builder): RequestInterface {
135+
return $builder
136+
->withProjectKeyValue("projectKey")
137+
->businessUnits()
138+
->importContainers()
139+
->withImportContainerKeyValue("importContainerKey")
140+
->post(null);
141+
},
142+
201
143+
],
144+
'ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost_400' => [
145+
function (ImportRequestBuilder $builder): RequestInterface {
146+
return $builder
147+
->withProjectKeyValue("projectKey")
148+
->businessUnits()
149+
->importContainers()
150+
->withImportContainerKeyValue("importContainerKey")
151+
->post(null);
152+
},
153+
400
154+
],
155+
'ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost_599' => [
156+
function (ImportRequestBuilder $builder): RequestInterface {
157+
return $builder
158+
->withProjectKeyValue("projectKey")
159+
->businessUnits()
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\ResourceByProjectKeyBusinessUnitsImportContainersByImportContainerKey;
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\ResourceByProjectKeyBusinessUnitsImportContainers
26+
*/
27+
class ResourceByProjectKeyBusinessUnitsImportContainersTest 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+
'ResourceByProjectKeyBusinessUnitsImportContainersByImportContainerKey' => [
56+
function (ImportRequestBuilder $builder): ResourceByProjectKeyBusinessUnitsImportContainersByImportContainerKey {
57+
return $builder
58+
->withProjectKeyValue("test_projectKey")
59+
->businessUnits()
60+
->importContainers()
61+
->withImportContainerKeyValue("test_importContainerKey");
62+
},
63+
ResourceByProjectKeyBusinessUnitsImportContainersByImportContainerKey::class,
64+
['projectKey' => 'test_projectKey', 'importContainerKey' => 'test_importContainerKey'],
65+
'/{projectKey}/business-units/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)