Skip to content

Commit

Permalink
build(codegen): updating SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
ct-sdks[bot] committed Oct 18, 2024
1 parent 93bafe7 commit d92c97d
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 0 deletions.
7 changes: 7 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
- added enum `product-tailoring` to type `ResourceTypeId`
</details>


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

- added method `$apiRoot->withProjectKey()->productTailoring()->head()`
</details>

**Import changes**

<details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/**
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyProductTailoringGet
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyProductTailoringHead
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyProductTailoringPost
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyProductTailoring
*/
Expand Down Expand Up @@ -189,6 +190,27 @@ function (ApiRequestBuilder $builder): RequestInterface {
'get',
'test_projectKey/product-tailoring',
],
'ByProjectKeyProductTailoringHead_withWhere' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productTailoring()
->head()
->withWhere('where');
},
'head',
'test_projectKey/product-tailoring?where=where',
],
'ByProjectKeyProductTailoringHead' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("test_projectKey")
->productTailoring()
->head();
},
'head',
'test_projectKey/product-tailoring',
],
'ByProjectKeyProductTailoringPost_withExpand' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down Expand Up @@ -252,6 +274,14 @@ function (ApiRequestBuilder $builder): RequestInterface {
->get();
}
],
'ByProjectKeyProductTailoringHead' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
}
],
'ByProjectKeyProductTailoringPost' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down Expand Up @@ -347,6 +377,87 @@ function (ApiRequestBuilder $builder): RequestInterface {
},
599
],
'ByProjectKeyProductTailoringHead_200' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
200
],
'ByProjectKeyProductTailoringHead_404' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
404
],
'ByProjectKeyProductTailoringHead_400' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
400
],
'ByProjectKeyProductTailoringHead_401' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
401
],
'ByProjectKeyProductTailoringHead_403' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
403
],
'ByProjectKeyProductTailoringHead_500' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
500
],
'ByProjectKeyProductTailoringHead_502' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
502
],
'ByProjectKeyProductTailoringHead_503' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
503
],
'ByProjectKeyProductTailoringHead_599' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
},
599
],
'ByProjectKeyProductTailoringPost_201' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down
14 changes: 14 additions & 0 deletions lib/commercetools-api/docs/RequestBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -8771,6 +8771,20 @@ $request = $builder
->productTailoring()
->get();
```
## `withProjectKey("projectKey")->productTailoring()->head()`

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.

### Example
```php
use Commercetools\Api\Client\ApiRequestBuilder;

$builder = new ApiRequestBuilder();
$request = $builder
->withProjectKey("projectKey")
->productTailoring()
->head();
```
## `withProjectKey("projectKey")->productTailoring()->post(null)`

Generates the [ProductTailoringCreated](ctp:api:type:ProductTailoringCreatedMessage) Message.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?php

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

namespace Commercetools\Api\Client\Resource;

use Commercetools\Api\Models\Error\ErrorResponse;
use Commercetools\Api\Models\Error\ErrorResponseModel;
use Commercetools\Base\JsonObject;
use Commercetools\Base\JsonObjectModel;
use Commercetools\Client\ApiRequest;
use Commercetools\Exception\ApiClientException;
use Commercetools\Exception\ApiServerException;
use Commercetools\Exception\ExceptionFactory;
use Commercetools\Exception\InvalidArgumentException;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Promise\PromiseInterface;

use Psr\Http\Message\ResponseInterface;

/**
* @psalm-suppress PropertyNotSetInConstructor
* @template-implements Errorable<ByProjectKeyProductTailoringHead>
* @template-implements Deprecatable200<ByProjectKeyProductTailoringHead>
*/
class ByProjectKeyProductTailoringHead extends ApiRequest implements Errorable, Deprecatable200
{
/**
* @param ?object|array|string $body
* @psalm-param array<string, scalar|scalar[]> $headers
*/
public function __construct(string $projectKey, $body = null, array $headers = [], ClientInterface $client = null)
{
$uri = str_replace(['{projectKey}'], [$projectKey], '{projectKey}/product-tailoring');
parent::__construct($client, 'HEAD', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
}

/**
* @template T of JsonObject
* @psalm-param ?class-string<T> $resultType
* @return ErrorResponse|JsonObject|T|null
*/
public function mapFromResponse(?ResponseInterface $response, string $resultType = null)
{
if (is_null($response)) {
return null;
}
if (is_null($resultType)) {
switch ($response->getStatusCode()) {
case '400':
$resultType = ErrorResponseModel::class;

break;
case '401':
$resultType = ErrorResponseModel::class;

break;
case '403':
$resultType = ErrorResponseModel::class;

break;
case '500':
$resultType = ErrorResponseModel::class;

break;
case '502':
$resultType = ErrorResponseModel::class;

break;
case '503':
$resultType = ErrorResponseModel::class;

break;
default:
$resultType = JsonObjectModel::class;

break;
}
}

return $resultType::of($this->responseData($response));
}

/**
* @template T of JsonObject
* @psalm-param ?class-string<T> $resultType
*
* @return null|T|ErrorResponse|JsonObject
*/
public function execute(array $options = [], string $resultType = null)
{
try {
$response = $this->send($options);
} catch (ServerException $e) {
$response = $e->getResponse();
$e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
throw $e;
} catch (ClientException $e) {
$response = $e->getResponse();
$e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
throw $e;
}

return $this->mapFromResponse($response, $resultType);
}

/**
* @template T of JsonObject
* @psalm-param ?class-string<T> $resultType
*
* @return PromiseInterface
*/
public function executeAsync(array $options = [], string $resultType = null)
{
return $this->sendAsync($options)->then(
function (ResponseInterface $response) use ($resultType) {
return $this->mapFromResponse($response, $resultType);
},
function (RequestException $e) use ($resultType) {
$response = $e->getResponse();
if ($e instanceof ServerException) {
$e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
}
if ($e instanceof ClientException) {
$e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
}
throw $e;
}
);
}

/**
*
* @psalm-param scalar|scalar[] $where
*/
public function withWhere($where): ByProjectKeyProductTailoringHead
{
return $this->withQueryParam('where', $where);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ public function get($body = null, array $headers = []): ByProjectKeyProductTailo

return new ByProjectKeyProductTailoringGet($args['projectKey'], $body, $headers, $this->getClient());
}
/**
* @psalm-param ?object|array|string $body
* @psalm-param array<string, scalar|scalar[]> $headers
*/
public function head($body = null, array $headers = []): ByProjectKeyProductTailoringHead
{
$args = $this->getArgs();

return new ByProjectKeyProductTailoringHead($args['projectKey'], $body, $headers, $this->getClient());
}
/**
* @psalm-param ?ProductTailoringDraft $body
* @psalm-param array<string, scalar|scalar[]> $headers
Expand Down
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,4 @@ c77ec902f368c2c31505fcb65a835ce148350077
e985f4b7aa55610705ee49bd3eb645c2fd03eb6c
7b61d389a7b8bd5dac2d780c6b6fbea0b881400c
3bde1efd0d5dbff77065d355e9d00e8a0e8f466a
c27603f949e869148570ebb8bd3ec6db34a985b7

0 comments on commit d92c97d

Please sign in to comment.