diff --git a/changes.md b/changes.md
index 4441b3af51c..bcabc9d92f4 100644
--- a/changes.md
+++ b/changes.md
@@ -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`
+
+
+
+
+Added Type(s)
+
+- added type `ImageProcessingOngoingWarning`
+- added type `WarningObject`
diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesTest.php
index 3d8ab465a3a..72662ed3ae0 100644
--- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesTest.php
+++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesTest.php
@@ -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
diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesTest.php
index c25a574b4c2..76e014f9d82 100644
--- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesTest.php
+++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesTest.php
@@ -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
diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDImagesTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDImagesTest.php
index 1ce670d8883..52dfea13035 100644
--- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDImagesTest.php
+++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDImagesTest.php
@@ -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
diff --git a/lib/commercetools-api/docs/RequestBuilder.md b/lib/commercetools-api/docs/RequestBuilder.md
index f85095a4618..be24ce39e2e 100644
--- a/lib/commercetools-api/docs/RequestBuilder.md
+++ b/lib/commercetools-api/docs/RequestBuilder.md
@@ -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
@@ -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
@@ -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
diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesPost.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesPost.php
index a3f5ec563a4..9d86680b9e1 100644
--- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesPost.php
+++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesPost.php
@@ -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;
diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesPost.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesPost.php
index 6ca48382607..dda23a4981b 100644
--- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesPost.php
+++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesPost.php
@@ -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;
diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDImagesPost.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDImagesPost.php
index ffe85fcb2a6..7d7d25aed81 100644
--- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDImagesPost.php
+++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDImagesPost.php
@@ -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;
diff --git a/lib/commercetools-api/src/Models/Product/Product.php b/lib/commercetools-api/src/Models/Product/Product.php
index 0197541b20c..2cb3ae805ca 100644
--- a/lib/commercetools-api/src/Models/Product/Product.php
+++ b/lib/commercetools-api/src/Models/Product/Product.php
@@ -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;
@@ -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';
/**
*
Unique identifier of the Product.
@@ -136,6 +138,15 @@ public function getReviewRatingStatistics();
*/
public function getPriceMode();
+ /**
+ * Warnings about processing of a request.
+ * Appears in response to requests with response status code 202 Accepted
.
+ *
+
+ * @return null|WarningObjectCollection
+ */
+ public function getWarnings();
+
/**
* @param ?string $id
*/
@@ -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;
}
diff --git a/lib/commercetools-api/src/Models/Product/ProductBuilder.php b/lib/commercetools-api/src/Models/Product/ProductBuilder.php
index f7baf4568c4..0ed73e12e0d 100644
--- a/lib/commercetools-api/src/Models/Product/ProductBuilder.php
+++ b/lib/commercetools-api/src/Models/Product/ProductBuilder.php
@@ -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;
@@ -113,6 +114,12 @@ final class ProductBuilder implements Builder
*/
private $priceMode;
+ /**
+
+ * @var ?WarningObjectCollection
+ */
+ private $warnings;
+
/**
* Unique identifier of the Product.
*
@@ -257,6 +264,18 @@ public function getPriceMode()
return $this->priceMode;
}
+ /**
+ * Warnings about processing of a request.
+ * Appears in response to requests with response status code 202 Accepted
.
+ *
+
+ * @return null|WarningObjectCollection
+ */
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+
/**
* @param ?string $id
* @return $this
@@ -400,6 +419,17 @@ public function withPriceMode(?string $priceMode)
return $this;
}
+ /**
+ * @param ?WarningObjectCollection $warnings
+ * @return $this
+ */
+ public function withWarnings(?WarningObjectCollection $warnings)
+ {
+ $this->warnings = $warnings;
+
+ return $this;
+ }
+
/**
* @deprecated use withLastModifiedBy() instead
* @return $this
@@ -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
);
}
diff --git a/lib/commercetools-api/src/Models/Product/ProductModel.php b/lib/commercetools-api/src/Models/Product/ProductModel.php
index 5f0bfd725a0..0b84de7fda0 100644
--- a/lib/commercetools-api/src/Models/Product/ProductModel.php
+++ b/lib/commercetools-api/src/Models/Product/ProductModel.php
@@ -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;
@@ -112,6 +113,12 @@ final class ProductModel extends JsonObjectModel implements Product
*/
protected $priceMode;
+ /**
+ *
+ * @var ?WarningObjectCollection
+ */
+ protected $warnings;
+
/**
* @psalm-suppress MissingParamType
@@ -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;
@@ -144,6 +152,7 @@ public function __construct(
$this->state = $state;
$this->reviewRatingStatistics = $reviewRatingStatistics;
$this->priceMode = $priceMode;
+ $this->warnings = $warnings;
}
/**
@@ -422,6 +431,27 @@ public function getPriceMode()
return $this->priceMode;
}
+ /**
+ * Warnings about processing of a request.
+ * Appears in response to requests with response status code 202 Accepted
.
+ *
+ *
+ * @return null|WarningObjectCollection
+ */
+ public function getWarnings()
+ {
+ if (is_null($this->warnings)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_WARNINGS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->warnings = WarningObjectCollection::fromArray($data);
+ }
+
+ return $this->warnings;
+ }
+
/**
* @param ?string $id
@@ -527,6 +557,14 @@ public function setPriceMode(?string $priceMode): void
$this->priceMode = $priceMode;
}
+ /**
+ * @param ?WarningObjectCollection $warnings
+ */
+ public function setWarnings(?WarningObjectCollection $warnings): void
+ {
+ $this->warnings = $warnings;
+ }
+
#[\ReturnTypeWillChange]
public function jsonSerialize()
diff --git a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoring.php b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoring.php
index accb2cdd320..b589a8454c9 100644
--- a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoring.php
+++ b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoring.php
@@ -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;
@@ -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';
/**
* Unique identifier of the ProductTailoring.
@@ -133,6 +135,15 @@ public function getStaged();
*/
public function getHasStagedChanges();
+ /**
+ * Warnings about processing of a request.
+ * Appears in response to requests with response status code 202 Accepted
.
+ *
+
+ * @return null|WarningObjectCollection
+ */
+ public function getWarnings();
+
/**
* @param ?string $id
*/
@@ -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;
}
diff --git a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringBuilder.php b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringBuilder.php
index ea1f6c146b4..b6270497d58 100644
--- a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringBuilder.php
+++ b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringBuilder.php
@@ -18,6 +18,7 @@
use Commercetools\Api\Models\Product\ProductReferenceBuilder;
use Commercetools\Api\Models\Store\StoreKeyReference;
use Commercetools\Api\Models\Store\StoreKeyReferenceBuilder;
+use Commercetools\Api\Models\Warning\WarningObjectCollection;
use Commercetools\Base\Builder;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
@@ -109,6 +110,12 @@ final class ProductTailoringBuilder implements Builder
*/
private $hasStagedChanges;
+ /**
+
+ * @var ?WarningObjectCollection
+ */
+ private $warnings;
+
/**
* Unique identifier of the ProductTailoring.
*
@@ -252,6 +259,18 @@ public function getHasStagedChanges()
return $this->hasStagedChanges;
}
+ /**
+ * Warnings about processing of a request.
+ * Appears in response to requests with response status code 202 Accepted
.
+ *
+
+ * @return null|WarningObjectCollection
+ */
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+
/**
* @param ?string $id
* @return $this
@@ -395,6 +414,17 @@ public function withHasStagedChanges(?bool $hasStagedChanges)
return $this;
}
+ /**
+ * @param ?WarningObjectCollection $warnings
+ * @return $this
+ */
+ public function withWarnings(?WarningObjectCollection $warnings)
+ {
+ $this->warnings = $warnings;
+
+ return $this;
+ }
+
/**
* @deprecated use withLastModifiedBy() instead
* @return $this
@@ -476,7 +506,8 @@ public function build(): ProductTailoring
$this->published,
$this->current instanceof ProductTailoringDataBuilder ? $this->current->build() : $this->current,
$this->staged instanceof ProductTailoringDataBuilder ? $this->staged->build() : $this->staged,
- $this->hasStagedChanges
+ $this->hasStagedChanges,
+ $this->warnings
);
}
diff --git a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderAction.php b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderAction.php
index 5f67adc35a7..c2cdb39e863 100644
--- a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderAction.php
+++ b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderAction.php
@@ -43,7 +43,7 @@ public function getSku();
public function getStaged();
/**
- * All existing Asset id
s of the ProductTailoringVariant in the desired new order.
+ * All existing Asset id
s of the ProductVariantTailoring in the desired new order.
*
* @return null|array
diff --git a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionBuilder.php b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionBuilder.php
index f6800d5659e..97dfc2c075c 100644
--- a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionBuilder.php
+++ b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionBuilder.php
@@ -78,7 +78,7 @@ public function getStaged()
}
/**
- * All existing Asset id
s of the ProductTailoringVariant in the desired new order.
+ * All existing Asset id
s of the ProductVariantTailoring in the desired new order.
*
* @return null|array
diff --git a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionModel.php b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionModel.php
index 57abdfb189c..4a69d338617 100644
--- a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionModel.php
+++ b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringChangeAssetOrderActionModel.php
@@ -147,7 +147,7 @@ public function getStaged()
}
/**
- * All existing Asset id
s of the ProductTailoringVariant in the desired new order.
+ * All existing Asset id
s of the ProductVariantTailoring in the desired new order.
*
*
* @return null|array
diff --git a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringModel.php b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringModel.php
index d0e42a1c043..8351b31cc40 100644
--- a/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringModel.php
+++ b/lib/commercetools-api/src/Models/ProductTailoring/ProductTailoringModel.php
@@ -18,6 +18,7 @@
use Commercetools\Api\Models\Product\ProductReferenceModel;
use Commercetools\Api\Models\Store\StoreKeyReference;
use Commercetools\Api\Models\Store\StoreKeyReferenceModel;
+use Commercetools\Api\Models\Warning\WarningObjectCollection;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use Commercetools\Base\JsonObjectModel;
@@ -108,6 +109,12 @@ final class ProductTailoringModel extends JsonObjectModel implements ProductTail
*/
protected $hasStagedChanges;
+ /**
+ *
+ * @var ?WarningObjectCollection
+ */
+ protected $warnings;
+
/**
* @psalm-suppress MissingParamType
@@ -125,7 +132,8 @@ public function __construct(
?bool $published = null,
?ProductTailoringData $current = null,
?ProductTailoringData $staged = null,
- ?bool $hasStagedChanges = null
+ ?bool $hasStagedChanges = null,
+ ?WarningObjectCollection $warnings = null
) {
$this->id = $id;
$this->version = $version;
@@ -140,6 +148,7 @@ public function __construct(
$this->current = $current;
$this->staged = $staged;
$this->hasStagedChanges = $hasStagedChanges;
+ $this->warnings = $warnings;
}
/**
@@ -416,6 +425,27 @@ public function getHasStagedChanges()
return $this->hasStagedChanges;
}
+ /**
+ * Warnings about processing of a request.
+ * Appears in response to requests with response status code 202 Accepted
.
+ *
+ *
+ * @return null|WarningObjectCollection
+ */
+ public function getWarnings()
+ {
+ if (is_null($this->warnings)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_WARNINGS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->warnings = WarningObjectCollection::fromArray($data);
+ }
+
+ return $this->warnings;
+ }
+
/**
* @param ?string $id
@@ -521,6 +551,14 @@ public function setHasStagedChanges(?bool $hasStagedChanges): void
$this->hasStagedChanges = $hasStagedChanges;
}
+ /**
+ * @param ?WarningObjectCollection $warnings
+ */
+ public function setWarnings(?WarningObjectCollection $warnings): void
+ {
+ $this->warnings = $warnings;
+ }
+
#[\ReturnTypeWillChange]
public function jsonSerialize()
diff --git a/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarning.php b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarning.php
new file mode 100644
index 00000000000..89e6bf505fd
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarning.php
@@ -0,0 +1,34 @@
+"The image processing is still ongoing."
+ *
+
+ * @return null|string
+ */
+ public function getMessage();
+
+ /**
+ * @param ?string $message
+ */
+ public function setMessage(?string $message): void;
+}
diff --git a/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningBuilder.php b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningBuilder.php
new file mode 100644
index 00000000000..105dee97cd1
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningBuilder.php
@@ -0,0 +1,63 @@
+
+ */
+final class ImageProcessingOngoingWarningBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $message;
+
+ /**
+ * "The image processing is still ongoing."
+ *
+
+ * @return null|string
+ */
+ public function getMessage()
+ {
+ return $this->message;
+ }
+
+ /**
+ * @param ?string $message
+ * @return $this
+ */
+ public function withMessage(?string $message)
+ {
+ $this->message = $message;
+
+ return $this;
+ }
+
+
+ public function build(): ImageProcessingOngoingWarning
+ {
+ return new ImageProcessingOngoingWarningModel(
+ $this->message
+ );
+ }
+
+ public static function of(): ImageProcessingOngoingWarningBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningCollection.php b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningCollection.php
new file mode 100644
index 00000000000..532467f5fcc
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningCollection.php
@@ -0,0 +1,56 @@
+
+ * @method ImageProcessingOngoingWarning current()
+ * @method ImageProcessingOngoingWarning end()
+ * @method ImageProcessingOngoingWarning at($offset)
+ */
+class ImageProcessingOngoingWarningCollection extends WarningObjectCollection
+{
+ /**
+ * @psalm-assert ImageProcessingOngoingWarning $value
+ * @psalm-param ImageProcessingOngoingWarning|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ImageProcessingOngoingWarningCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ImageProcessingOngoingWarning) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ImageProcessingOngoingWarning
+ */
+ protected function mapper()
+ {
+ return function (?int $index): ?ImageProcessingOngoingWarning {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ImageProcessingOngoingWarning $data */
+ $data = ImageProcessingOngoingWarningModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningModel.php b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningModel.php
new file mode 100644
index 00000000000..676e40f028e
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/ImageProcessingOngoingWarningModel.php
@@ -0,0 +1,93 @@
+message = $message;
+ $this->code = $code ?? self::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ *
+ * @return null|string
+ */
+ public function getCode()
+ {
+ if (is_null($this->code)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_CODE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->code = (string) $data;
+ }
+
+ return $this->code;
+ }
+
+ /**
+ * "The image processing is still ongoing."
+ *
+ *
+ * @return null|string
+ */
+ public function getMessage()
+ {
+ if (is_null($this->message)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_MESSAGE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->message = (string) $data;
+ }
+
+ return $this->message;
+ }
+
+
+ /**
+ * @param ?string $message
+ */
+ public function setMessage(?string $message): void
+ {
+ $this->message = $message;
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Warning/WarningObject.php b/lib/commercetools-api/src/Models/Warning/WarningObject.php
new file mode 100644
index 00000000000..381e0b424ac
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/WarningObject.php
@@ -0,0 +1,40 @@
+Identifier for the type of warning.
+ *
+
+ * @return null|string
+ */
+ public function getCode();
+
+ /**
+ * Contains information about the returned response.
+ *
+
+ * @return null|string
+ */
+ public function getMessage();
+
+ /**
+ * @param ?string $message
+ */
+ public function setMessage(?string $message): void;
+}
diff --git a/lib/commercetools-api/src/Models/Warning/WarningObjectBuilder.php b/lib/commercetools-api/src/Models/Warning/WarningObjectBuilder.php
new file mode 100644
index 00000000000..c8e9971a17f
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/WarningObjectBuilder.php
@@ -0,0 +1,63 @@
+
+ */
+final class WarningObjectBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $message;
+
+ /**
+ * Contains information about the returned response.
+ *
+
+ * @return null|string
+ */
+ public function getMessage()
+ {
+ return $this->message;
+ }
+
+ /**
+ * @param ?string $message
+ * @return $this
+ */
+ public function withMessage(?string $message)
+ {
+ $this->message = $message;
+
+ return $this;
+ }
+
+
+ public function build(): WarningObject
+ {
+ return new WarningObjectModel(
+ $this->message
+ );
+ }
+
+ public static function of(): WarningObjectBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Warning/WarningObjectCollection.php b/lib/commercetools-api/src/Models/Warning/WarningObjectCollection.php
new file mode 100644
index 00000000000..54d84d75ada
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/WarningObjectCollection.php
@@ -0,0 +1,60 @@
+
+ * @psalm-method T current()
+ * @psalm-method T end()
+ * @psalm-method T at($offset)
+ * @method WarningObject current()
+ * @method WarningObject end()
+ * @method WarningObject at($offset)
+ */
+class WarningObjectCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert T $value
+ * @psalm-param T|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return WarningObjectCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof WarningObject) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?T
+ */
+ protected function mapper()
+ {
+ return function (?int $index): ?WarningObject {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var T $data */
+ $data = WarningObjectModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Warning/WarningObjectModel.php b/lib/commercetools-api/src/Models/Warning/WarningObjectModel.php
new file mode 100644
index 00000000000..e845cdc1508
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Warning/WarningObjectModel.php
@@ -0,0 +1,131 @@
+ >
+ *
+ */
+ private static $discriminatorClasses = [
+ 'ImageProcessingOngoing' => ImageProcessingOngoingWarningModel::class,
+ ];
+
+ /**
+ * @psalm-suppress MissingParamType
+ */
+ public function __construct(
+ ?string $message = null,
+ ?string $code = null
+ ) {
+ $this->message = $message;
+ $this->code = $code;
+ }
+
+ /**
+ * Identifier for the type of warning.
+ *
+ *
+ * @return null|string
+ */
+ public function getCode()
+ {
+ if (is_null($this->code)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_CODE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->code = (string) $data;
+ }
+
+ return $this->code;
+ }
+
+ /**
+ * Contains information about the returned response.
+ *
+ *
+ * @return null|string
+ */
+ public function getMessage()
+ {
+ if (is_null($this->message)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_MESSAGE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->message = (string) $data;
+ }
+
+ return $this->message;
+ }
+
+
+ /**
+ * @param ?string $message
+ */
+ public function setMessage(?string $message): void
+ {
+ $this->message = $message;
+ }
+
+
+
+ /**
+ * @psalm-param stdClass|array $value
+ * @psalm-return class-string
+ */
+ public static function resolveDiscriminatorClass($value): string
+ {
+ $fieldName = WarningObject::DISCRIMINATOR_FIELD;
+ if (is_object($value) && isset($value->$fieldName)) {
+ /** @psalm-var string $discriminatorValue */
+ $discriminatorValue = $value->$fieldName;
+ if (isset(self::$discriminatorClasses[$discriminatorValue])) {
+ return self::$discriminatorClasses[$discriminatorValue];
+ }
+ }
+ if (is_array($value) && isset($value[$fieldName])) {
+ /** @psalm-var string $discriminatorValue */
+ $discriminatorValue = $value[$fieldName];
+ if (isset(self::$discriminatorClasses[$discriminatorValue])) {
+ return self::$discriminatorClasses[$discriminatorValue];
+ }
+ }
+
+ /** @psalm-var class-string */
+ $type = WarningObjectModel::class;
+ return $type;
+ }
+}
diff --git a/references.txt b/references.txt
index dffac15768a..ce508b30115 100644
--- a/references.txt
+++ b/references.txt
@@ -299,3 +299,4 @@ ce56ab7c65a688f75d5cd4095378d6647c6bd9ae
3ef50b76d477cff41dcd11f48e8205cd4abd1439
0065cdd802adcbf53195095773ccc5a2becca69e
ce2753aafee0b1d96970abb600b606748ce40568
+d947f454821e0834a2c8a8605d4a0f3347c11d4e