Skip to content

Commit

Permalink
Merge pull request #287 from commercetools/gen-sdk-updates
Browse files Browse the repository at this point in the history
Update generated SDKs
  • Loading branch information
kodiakhq[bot] authored Dec 20, 2024
2 parents 9727d97 + 07f90e7 commit 4c5abdd
Show file tree
Hide file tree
Showing 40 changed files with 3,680 additions and 2 deletions.
14 changes: 14 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
<details>
<summary>Added Resource(s)</summary>

- added resource `/{projectKey}/business-units/search`
- added resource `/{projectKey}/business-units/search/indexing-status`
- added resource `/{projectKey}/channels/key={key}`
</details>


<details>
<summary>Added Method(s)</summary>

- added method `$apiRoot->withProjectKey()->businessUnits()->search()->post()`
- added method `$apiRoot->withProjectKey()->businessUnits()->search()->head()`
- added method `$apiRoot->withProjectKey()->businessUnits()->searchIndexingStatus()->get()`
- added method `$apiRoot->withProjectKey()->channels()->withKey()->get()`
- added method `$apiRoot->withProjectKey()->channels()->withKey()->head()`
- added method `$apiRoot->withProjectKey()->channels()->withKey()->post()`
Expand All @@ -20,6 +25,12 @@
<details>
<summary>Added Type(s)</summary>

- added type `BusinessUnitIndexingProgress`
- added type `BusinessUnitIndexingStatus`
- added type `BusinessUnitPagedSearchResponse`
- added type `BusinessUnitSearchIndexingStatusResponse`
- added type `BusinessUnitSearchRequest`
- added type `BusinessUnitSearchResult`
- added type `CartDiscountPatternTarget`
- added type `CountOnCustomLineItemUnits`
- added type `CountOnLineItemUnits`
Expand All @@ -30,6 +41,8 @@
- added type `ShoppingListLineItemAddedMessagePayload`
- added type `ShoppingListLineItemRemovedMessagePayload`
- added type `ShoppingListMessagePayload`
- added type `BusinessUnitSearchStatus`
- added type `ProjectChangeBusinessUnitSearchStatusAction`
</details>


Expand All @@ -49,6 +62,7 @@
- added property `custom` to type `CartSetCustomShippingMethodAction`
- added property `custom` to type `StagedOrderSetCustomShippingMethodAction`
- added property `custom` to type `StagedOrderSetShippingAddressAndCustomShippingMethodAction`
- added property `businessUnits` to type `SearchIndexingConfiguration`
</details>

**History changes**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
<?php

declare(strict_types=1);
/**
* This file has been auto generated
* Do not change it.
*/

namespace Commercetools\Api\Test\Client\Resource;

use Commercetools\Api\Client\ApiRequestBuilder;
use Commercetools\Base\JsonObject;
use Commercetools\Client\ApiRequest;
use Commercetools\Exception\ApiClientException;
use Commercetools\Exception\ApiServerException;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;

/**
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyBusinessUnitsSearchIndexingStatusGet
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyBusinessUnitsSearchIndexingStatus
*/
class ResourceByProjectKeyBusinessUnitsSearchIndexingStatusTest extends TestCase
{
/**
* @dataProvider getRequests()
*/
public function testBuilder(callable $builderFunction, string $method, string $relativeUri, string $body = null)
{
$builder = new ApiRequestBuilder();
$request = $builderFunction($builder);
$this->assertSame(strtolower($method), strtolower($request->getMethod()));
$this->assertSame($relativeUri, (string) $request->getUri());
if (!is_null($body)) {
$this->assertJsonStringEqualsJsonString($body, (string) $request->getBody());
} else {
$this->assertSame("", (string) $request->getBody());
}
}



/**
* @dataProvider getRequestBuilderResponses()
*/
public function testMapFromResponse(callable $builderFunction, $statusCode)
{
$builder = new ApiRequestBuilder();
$request = $builderFunction($builder);
$this->assertInstanceOf(ApiRequest::class, $request);

$response = new Response($statusCode, [], "{}");
$this->assertInstanceOf(JsonObject::class, $request->mapFromResponse($response));
}

/**
* @dataProvider getRequestBuilders()
*/
public function testExecuteClientException(callable $builderFunction)
{
$client = $this->createMock(ClientInterface::class);

$builder = new ApiRequestBuilder($client);
$request = $builderFunction($builder);
$client->method("send")->willThrowException(new ClientException("Oops!", $request, new Response(400)));

$this->expectException(ApiClientException::class);
$request->execute();
}

/**
* @dataProvider getRequestBuilders()
*/
public function testExecuteServerException(callable $builderFunction)
{
$client = $this->createMock(ClientInterface::class);

$builder = new ApiRequestBuilder($client);
$request = $builderFunction($builder);
$client->method("send")->willThrowException(new ServerException("Oops!", $request, new Response(500)));

$this->expectException(ApiServerException::class);
$request->execute();
}

public function getRequests()
{
return [
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("test_projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
'get',
'test_projectKey/business-units/search/indexing-status',
]
];
}

public function getResources()
{
return [
];
}

public function getRequestBuilders()
{
return [
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
}
]
];
}

public function getRequestBuilderResponses()
{
return [
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_200' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
200
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_400' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
400
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_401' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
401
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_403' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
403
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_404' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
404
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_500' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
500
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_502' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
502
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_503' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
503
],
'ByProjectKeyBusinessUnitsSearchIndexingStatusGet_599' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->businessUnits()
->searchIndexingStatus()
->get();
},
599
]
];
}
}
Loading

0 comments on commit 4c5abdd

Please sign in to comment.