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 Sep 18, 2024
1 parent 63fa514 commit cc1d9e0
Show file tree
Hide file tree
Showing 26 changed files with 807 additions and 10 deletions.
10 changes: 10 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,15 @@

- added property `staged` to type `ProductVariantDeletedMessage`
- added property `staged` to type `ProductVariantDeletedMessagePayload`
- added property `warnings` to type `ProductTailoring`
- added property `warnings` to type `Product`
</details>


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

- added type `ImageProcessingOngoingWarning`
- added type `WarningObject`
</details>

Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ function (ApiRequestBuilder $builder): RequestInterface {
},
200
],
'ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesPost_202' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->inStoreKeyWithStoreKeyValue("storeKey")
->products()
->withProductId("productID")
->productTailoring()
->images()
->post(null);
},
202
],
'ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesPost_599' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ function (ApiRequestBuilder $builder): RequestInterface {
},
200
],
'ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesPost_202' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->inStoreKeyWithStoreKeyValue("storeKey")
->products()
->withProductKey("productKey")
->productTailoring()
->images()
->post(null);
},
202
],
'ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesPost_599' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ function (ApiRequestBuilder $builder): RequestInterface {
},
200
],
'ByProjectKeyProductsByIDImagesPost_202' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey("projectKey")
->products()
->withId("ID")
->images()
->post(null);
},
202
],
'ByProjectKeyProductsByIDImagesPost_599' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down
33 changes: 30 additions & 3 deletions lib/commercetools-api/docs/RequestBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -5255,7 +5255,16 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->products()->withProductId("productID")->productTailoring()->images()->post(null)`

Upload a JPEG, PNG and GIF file to a [ProductTailoringVariant](ctp:api:type:ProductTailoringVariant). The maximum file size of the image is 10MB. `variant` or `sku` is required to update a specific ProductVariant. Produces the [ProductTailoringImageAdded](/projects/messages/product-catalog-messages#product-tailoring-image-added) Message when the `Small` version of the image has been uploaded to the CDN.
Uploads a JPEG, PNG and GIF file to a [ProductVariantTailoring](ctp:api:type:ProductVariantTailoring).
The maximum file size of the image is **10MB**.
Either `variant` or `sku` is required to update a specific ProductVariant.
If neither is provided, the image is uploaded to the Master Variant of the Product.

The response status code depends on the size of the original image.
If the image is small, the API responds with `200 OK`, and if the image is larger, it responds with `202 Accepted`.
The Product returned with a `202 Accepted` status code contains a `warnings` field with an [ImageProcessingOngoing](ctp:api:type:ImageProcessingOngoingWarning) Warning.

Produces the [ProductTailoringImageAdded](/projects/messages/product-catalog-messages#product-tailoring-image-added) Message.


### Example
Expand Down Expand Up @@ -5328,7 +5337,16 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->products()->withProductKey("productKey")->productTailoring()->images()->post(null)`

Upload a JPEG, PNG and GIF file to a [ProductTailoringVariant](ctp:api:type:ProductTailoringVariant). The maximum file size of the image is 10MB. `variant` or `sku` is required to update a specific ProductVariant. Produces the [ProductTailoringImageAdded](/projects/messages/product-catalog-messages#product-tailoring-image-added) Message when the `Small` version of the image has been uploaded to the CDN.
Uploads a JPEG, PNG and GIF file to a [ProductVariantTailoring](ctp:api:type:ProductVariantTailoring).
The maximum file size of the image is **10MB**.
Either `variant` or `sku` is required to update a specific ProductVariant.
If neither is provided, the image is uploaded to the Master Variant of the Product.

The response status code depends on the size of the original image.
If the image is small, the API responds with `200 OK`, and if the image is larger, it responds with `202 Accepted`.
The Product returned with a `202 Accepted` status code contains a `warnings` field with an [ImageProcessingOngoing](ctp:api:type:ImageProcessingOngoingWarning) Warning.

Produces the [ProductTailoringImageAdded](/projects/messages/product-catalog-messages#product-tailoring-image-added) Message.


### Example
Expand Down Expand Up @@ -9130,7 +9148,16 @@ $request = $builder
```
## `withProjectKey("projectKey")->products()->withId("ID")->images()->post(null)`

Upload a JPEG, PNG and GIF file to a [ProductVariant](ctp:api:type:ProductVariant). The maximum file size of the image is 10MB. `variant` or `sku` is required to update a specific ProductVariant. The image is uploaded to the Master Variant if `variant` or `sku` are not included. Produces the [ProductImageAdded](/projects/messages/product-catalog-messages#product-image-added) Message when the `Small` version of the image has been uploaded to the CDN.
Uploads a JPEG, PNG, or a GIF image file to a [ProductVariant](ctp:api:type:ProductVariant).
The maximum file size of the image is **10MB**.
Either `variant` or `sku` is required to update a specific ProductVariant.
If neither is provided, the image is uploaded to the Master Variant of the Product.

The response status code depends on the size of the original image.
If the image is small, the API responds with `200 OK`, and if the image is larger, it responds with `202 Accepted`.
The Product returned with a `202 Accepted` status code contains a `warnings` field with an [ImageProcessingOngoing](ctp:api:type:ImageProcessingOngoingWarning) Warning.

Produces the [ProductImageAdded](/projects/messages/product-catalog-messages#product-image-added) Message.


### Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function mapFromResponse(?ResponseInterface $response, string $resultType
case '200':
$resultType = ProductTailoringModel::class;

break;
case '202':
$resultType = ProductTailoringModel::class;

break;
default:
$resultType = JsonObjectModel::class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function mapFromResponse(?ResponseInterface $response, string $resultType
case '200':
$resultType = ProductTailoringModel::class;

break;
case '202':
$resultType = ProductTailoringModel::class;

break;
default:
$resultType = JsonObjectModel::class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function mapFromResponse(?ResponseInterface $response, string $resultType
case '200':
$resultType = ProductModel::class;

break;
case '202':
$resultType = ProductModel::class;

break;
default:
$resultType = JsonObjectModel::class;
Expand Down
16 changes: 16 additions & 0 deletions lib/commercetools-api/src/Models/Product/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Commercetools\Api\Models\Review\ReviewRatingStatistics;
use Commercetools\Api\Models\State\StateReference;
use Commercetools\Api\Models\TaxCategory\TaxCategoryReference;
use Commercetools\Api\Models\Warning\WarningObjectCollection;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use DateTimeImmutable;
Expand All @@ -30,6 +31,7 @@ interface Product extends BaseResource
public const FIELD_STATE = 'state';
public const FIELD_REVIEW_RATING_STATISTICS = 'reviewRatingStatistics';
public const FIELD_PRICE_MODE = 'priceMode';
public const FIELD_WARNINGS = 'warnings';

/**
* <p>Unique identifier of the Product.</p>
Expand Down Expand Up @@ -136,6 +138,15 @@ public function getReviewRatingStatistics();
*/
public function getPriceMode();

/**
* <p>Warnings about processing of a request.
* Appears in response to requests with response status code <code>202 Accepted</code>.</p>
*
* @return null|WarningObjectCollection
*/
public function getWarnings();

/**
* @param ?string $id
*/
Expand Down Expand Up @@ -200,4 +211,9 @@ public function setReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingS
* @param ?string $priceMode
*/
public function setPriceMode(?string $priceMode): void;

/**
* @param ?WarningObjectCollection $warnings
*/
public function setWarnings(?WarningObjectCollection $warnings): void;
}
33 changes: 32 additions & 1 deletion lib/commercetools-api/src/Models/Product/ProductBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Commercetools\Api\Models\State\StateReferenceBuilder;
use Commercetools\Api\Models\TaxCategory\TaxCategoryReference;
use Commercetools\Api\Models\TaxCategory\TaxCategoryReferenceBuilder;
use Commercetools\Api\Models\Warning\WarningObjectCollection;
use Commercetools\Base\Builder;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
Expand Down Expand Up @@ -113,6 +114,12 @@ final class ProductBuilder implements Builder
*/
private $priceMode;

/**
* @var ?WarningObjectCollection
*/
private $warnings;

/**
* <p>Unique identifier of the Product.</p>
*
Expand Down Expand Up @@ -257,6 +264,18 @@ public function getPriceMode()
return $this->priceMode;
}

/**
* <p>Warnings about processing of a request.
* Appears in response to requests with response status code <code>202 Accepted</code>.</p>
*
* @return null|WarningObjectCollection
*/
public function getWarnings()

Check warning on line 274 in lib/commercetools-api/src/Models/Product/ProductBuilder.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductBuilder.php#L274

Added line #L274 was not covered by tests
{
return $this->warnings;

Check warning on line 276 in lib/commercetools-api/src/Models/Product/ProductBuilder.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductBuilder.php#L276

Added line #L276 was not covered by tests
}

/**
* @param ?string $id
* @return $this
Expand Down Expand Up @@ -400,6 +419,17 @@ public function withPriceMode(?string $priceMode)
return $this;
}

/**
* @param ?WarningObjectCollection $warnings
* @return $this
*/
public function withWarnings(?WarningObjectCollection $warnings)

Check warning on line 426 in lib/commercetools-api/src/Models/Product/ProductBuilder.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductBuilder.php#L426

Added line #L426 was not covered by tests
{
$this->warnings = $warnings;

Check warning on line 428 in lib/commercetools-api/src/Models/Product/ProductBuilder.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductBuilder.php#L428

Added line #L428 was not covered by tests

return $this;

Check warning on line 430 in lib/commercetools-api/src/Models/Product/ProductBuilder.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductBuilder.php#L430

Added line #L430 was not covered by tests
}

/**
* @deprecated use withLastModifiedBy() instead
* @return $this
Expand Down Expand Up @@ -492,7 +522,8 @@ public function build(): Product
$this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
$this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
$this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics,
$this->priceMode
$this->priceMode,
$this->warnings

Check warning on line 526 in lib/commercetools-api/src/Models/Product/ProductBuilder.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductBuilder.php#L525-L526

Added lines #L525 - L526 were not covered by tests
);
}

Expand Down
40 changes: 39 additions & 1 deletion lib/commercetools-api/src/Models/Product/ProductModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Commercetools\Api\Models\State\StateReferenceModel;
use Commercetools\Api\Models\TaxCategory\TaxCategoryReference;
use Commercetools\Api\Models\TaxCategory\TaxCategoryReferenceModel;
use Commercetools\Api\Models\Warning\WarningObjectCollection;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use Commercetools\Base\JsonObjectModel;
Expand Down Expand Up @@ -112,6 +113,12 @@ final class ProductModel extends JsonObjectModel implements Product
*/
protected $priceMode;

/**
*
* @var ?WarningObjectCollection
*/
protected $warnings;


/**
* @psalm-suppress MissingParamType
Expand All @@ -129,7 +136,8 @@ public function __construct(
?TaxCategoryReference $taxCategory = null,
?StateReference $state = null,
?ReviewRatingStatistics $reviewRatingStatistics = null,
?string $priceMode = null
?string $priceMode = null,
?WarningObjectCollection $warnings = null
) {
$this->id = $id;
$this->version = $version;
Expand All @@ -144,6 +152,7 @@ public function __construct(
$this->state = $state;
$this->reviewRatingStatistics = $reviewRatingStatistics;
$this->priceMode = $priceMode;
$this->warnings = $warnings;

Check warning on line 155 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L155

Added line #L155 was not covered by tests
}

/**
Expand Down Expand Up @@ -422,6 +431,27 @@ public function getPriceMode()
return $this->priceMode;
}

/**
* <p>Warnings about processing of a request.
* Appears in response to requests with response status code <code>202 Accepted</code>.</p>
*
*
* @return null|WarningObjectCollection
*/
public function getWarnings()

Check warning on line 441 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L441

Added line #L441 was not covered by tests
{
if (is_null($this->warnings)) {

Check warning on line 443 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L443

Added line #L443 was not covered by tests
/** @psalm-var ?list<stdClass> $data */
$data = $this->raw(self::FIELD_WARNINGS);
if (is_null($data)) {
return null;

Check warning on line 447 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L445-L447

Added lines #L445 - L447 were not covered by tests
}
$this->warnings = WarningObjectCollection::fromArray($data);

Check warning on line 449 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L449

Added line #L449 was not covered by tests
}

return $this->warnings;

Check warning on line 452 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L452

Added line #L452 was not covered by tests
}


/**
* @param ?string $id
Expand Down Expand Up @@ -527,6 +557,14 @@ public function setPriceMode(?string $priceMode): void
$this->priceMode = $priceMode;
}

/**
* @param ?WarningObjectCollection $warnings
*/
public function setWarnings(?WarningObjectCollection $warnings): void

Check warning on line 563 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L563

Added line #L563 was not covered by tests
{
$this->warnings = $warnings;

Check warning on line 565 in lib/commercetools-api/src/Models/Product/ProductModel.php

View check run for this annotation

Codecov / codecov/patch

lib/commercetools-api/src/Models/Product/ProductModel.php#L565

Added line #L565 was not covered by tests
}


#[\ReturnTypeWillChange]
public function jsonSerialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Commercetools\Api\Models\Common\LastModifiedBy;
use Commercetools\Api\Models\Product\ProductReference;
use Commercetools\Api\Models\Store\StoreKeyReference;
use Commercetools\Api\Models\Warning\WarningObjectCollection;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use DateTimeImmutable;
Expand All @@ -28,6 +29,7 @@ interface ProductTailoring extends BaseResource
public const FIELD_CURRENT = 'current';
public const FIELD_STAGED = 'staged';
public const FIELD_HAS_STAGED_CHANGES = 'hasStagedChanges';
public const FIELD_WARNINGS = 'warnings';

/**
* <p>Unique identifier of the ProductTailoring.</p>
Expand Down Expand Up @@ -133,6 +135,15 @@ public function getStaged();
*/
public function getHasStagedChanges();

/**
* <p>Warnings about processing of a request.
* Appears in response to requests with response status code <code>202 Accepted</code>.</p>
*
* @return null|WarningObjectCollection
*/
public function getWarnings();

/**
* @param ?string $id
*/
Expand Down Expand Up @@ -197,4 +208,9 @@ public function setStaged(?ProductTailoringData $staged): void;
* @param ?bool $hasStagedChanges
*/
public function setHasStagedChanges(?bool $hasStagedChanges): void;

/**
* @param ?WarningObjectCollection $warnings
*/
public function setWarnings(?WarningObjectCollection $warnings): void;
}
Loading

0 comments on commit cc1d9e0

Please sign in to comment.