From 7d85b381a7cfe325ed8f4ac7374289d1bfc24c14 Mon Sep 17 00:00:00 2001 From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:21:45 +0000 Subject: [PATCH] build(codegen): updating SDK --- changes.md | 2 + .../src/Models/Error/ErrorObjectModel.php | 1 + .../Models/Error/GraphQLErrorObjectModel.php | 1 + .../Error/GraphQLSearchNotReadyError.php | 21 ++++ .../GraphQLSearchNotReadyErrorBuilder.php | 33 ++++++ .../GraphQLSearchNotReadyErrorCollection.php | 56 +++++++++ .../Error/GraphQLSearchNotReadyErrorModel.php | 71 ++++++++++++ .../src/Models/Error/SearchNotReadyError.php | 34 ++++++ .../Error/SearchNotReadyErrorBuilder.php | 63 +++++++++++ .../Error/SearchNotReadyErrorCollection.php | 56 +++++++++ .../Models/Error/SearchNotReadyErrorModel.php | 106 ++++++++++++++++++ references.txt | 1 + 12 files changed, 445 insertions(+) create mode 100644 lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyError.php create mode 100644 lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorBuilder.php create mode 100644 lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorCollection.php create mode 100644 lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorModel.php create mode 100644 lib/commercetools-api/src/Models/Error/SearchNotReadyError.php create mode 100644 lib/commercetools-api/src/Models/Error/SearchNotReadyErrorBuilder.php create mode 100644 lib/commercetools-api/src/Models/Error/SearchNotReadyErrorCollection.php create mode 100644 lib/commercetools-api/src/Models/Error/SearchNotReadyErrorModel.php diff --git a/changes.md b/changes.md index eeba47dbfcd..f8305c9efcb 100644 --- a/changes.md +++ b/changes.md @@ -16,6 +16,8 @@
Added Type(s) +- added type `SearchNotReadyError` +- added type `GraphQLSearchNotReadyError` - added type `ProductTailoringAttribute` - added type `ProductTailoringSetAttributeAction` - added type `ProductTailoringSetAttributeInAllVariantsAction` diff --git a/lib/commercetools-api/src/Models/Error/ErrorObjectModel.php b/lib/commercetools-api/src/Models/Error/ErrorObjectModel.php index c1b8b2efe77..b67434a5749 100644 --- a/lib/commercetools-api/src/Models/Error/ErrorObjectModel.php +++ b/lib/commercetools-api/src/Models/Error/ErrorObjectModel.php @@ -107,6 +107,7 @@ final class ErrorObjectModel extends JsonObjectModel implements ErrorObject 'SearchExecutionFailure' => SearchExecutionFailureErrorModel::class, 'SearchFacetPathNotFound' => SearchFacetPathNotFoundErrorModel::class, 'SearchIndexingInProgress' => SearchIndexingInProgressErrorModel::class, + 'SearchNotReady' => SearchNotReadyErrorModel::class, 'SemanticError' => SemanticErrorErrorModel::class, 'ShippingMethodDoesNotMatchCart' => ShippingMethodDoesNotMatchCartErrorModel::class, 'StoreCartDiscountsLimitReached' => StoreCartDiscountsLimitReachedErrorModel::class, diff --git a/lib/commercetools-api/src/Models/Error/GraphQLErrorObjectModel.php b/lib/commercetools-api/src/Models/Error/GraphQLErrorObjectModel.php index c46e973141a..00a1ec20e38 100644 --- a/lib/commercetools-api/src/Models/Error/GraphQLErrorObjectModel.php +++ b/lib/commercetools-api/src/Models/Error/GraphQLErrorObjectModel.php @@ -101,6 +101,7 @@ final class GraphQLErrorObjectModel extends JsonObjectModel implements GraphQLEr 'SearchExecutionFailure' => GraphQLSearchExecutionFailureErrorModel::class, 'SearchFacetPathNotFound' => GraphQLSearchFacetPathNotFoundErrorModel::class, 'SearchIndexingInProgress' => GraphQLSearchIndexingInProgressErrorModel::class, + 'SearchNotReady' => GraphQLSearchNotReadyErrorModel::class, 'SemanticError' => GraphQLSemanticErrorErrorModel::class, 'ShippingMethodDoesNotMatchCart' => GraphQLShippingMethodDoesNotMatchCartErrorModel::class, 'StoreCartDiscountsLimitReached' => GraphQLStoreCartDiscountsLimitReachedErrorModel::class, diff --git a/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyError.php b/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyError.php new file mode 100644 index 00000000000..4eb3ccfde62 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyError.php @@ -0,0 +1,21 @@ + + */ +final class GraphQLSearchNotReadyErrorBuilder implements Builder +{ + public function build(): GraphQLSearchNotReadyError + { + return new GraphQLSearchNotReadyErrorModel( + ); + } + + public static function of(): GraphQLSearchNotReadyErrorBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorCollection.php b/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorCollection.php new file mode 100644 index 00000000000..5d4a36d5932 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorCollection.php @@ -0,0 +1,56 @@ + + * @method GraphQLSearchNotReadyError current() + * @method GraphQLSearchNotReadyError end() + * @method GraphQLSearchNotReadyError at($offset) + */ +class GraphQLSearchNotReadyErrorCollection extends GraphQLErrorObjectCollection +{ + /** + * @psalm-assert GraphQLSearchNotReadyError $value + * @psalm-param GraphQLSearchNotReadyError|stdClass $value + * @throws InvalidArgumentException + * + * @return GraphQLSearchNotReadyErrorCollection + */ + public function add($value) + { + if (!$value instanceof GraphQLSearchNotReadyError) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?GraphQLSearchNotReadyError + */ + protected function mapper() + { + return function (?int $index): ?GraphQLSearchNotReadyError { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var GraphQLSearchNotReadyError $data */ + $data = GraphQLSearchNotReadyErrorModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorModel.php b/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorModel.php new file mode 100644 index 00000000000..f0d795e4b01 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/GraphQLSearchNotReadyErrorModel.php @@ -0,0 +1,71 @@ +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; + } + + + + /** + * @return mixed + */ + public function by(string $key) + { + $data = $this->raw($key); + if (is_null($data)) { + return null; + } + + return $data; + } +} diff --git a/lib/commercetools-api/src/Models/Error/SearchNotReadyError.php b/lib/commercetools-api/src/Models/Error/SearchNotReadyError.php new file mode 100644 index 00000000000..cedc85103fb --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/SearchNotReadyError.php @@ -0,0 +1,34 @@ +$Search is not ready. Check the indexing-status endpoint and that the feature has been activated in the project settings.

+ * + + * @return null|string + */ + public function getMessage(); + + /** + * @param ?string $message + */ + public function setMessage(?string $message): void; +} diff --git a/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorBuilder.php b/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorBuilder.php new file mode 100644 index 00000000000..59a28f677a4 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorBuilder.php @@ -0,0 +1,63 @@ + + */ +final class SearchNotReadyErrorBuilder implements Builder +{ + /** + + * @var ?string + */ + private $message; + + /** + *

$Search is not ready. Check the indexing-status endpoint and that the feature has been activated in the project settings.

+ * + + * @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(): SearchNotReadyError + { + return new SearchNotReadyErrorModel( + $this->message + ); + } + + public static function of(): SearchNotReadyErrorBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorCollection.php b/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorCollection.php new file mode 100644 index 00000000000..a8e1d6fd1f9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorCollection.php @@ -0,0 +1,56 @@ + + * @method SearchNotReadyError current() + * @method SearchNotReadyError end() + * @method SearchNotReadyError at($offset) + */ +class SearchNotReadyErrorCollection extends ErrorObjectCollection +{ + /** + * @psalm-assert SearchNotReadyError $value + * @psalm-param SearchNotReadyError|stdClass $value + * @throws InvalidArgumentException + * + * @return SearchNotReadyErrorCollection + */ + public function add($value) + { + if (!$value instanceof SearchNotReadyError) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SearchNotReadyError + */ + protected function mapper() + { + return function (?int $index): ?SearchNotReadyError { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SearchNotReadyError $data */ + $data = SearchNotReadyErrorModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorModel.php b/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorModel.php new file mode 100644 index 00000000000..affa2f566b5 --- /dev/null +++ b/lib/commercetools-api/src/Models/Error/SearchNotReadyErrorModel.php @@ -0,0 +1,106 @@ +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; + } + + /** + *

$Search is not ready. Check the indexing-status endpoint and that the feature has been activated in the project settings.

+ * + * + * @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; + } + + /** + * @return mixed + */ + public function by(string $key) + { + $data = $this->raw($key); + if (is_null($data)) { + return null; + } + + return $data; + } +} diff --git a/references.txt b/references.txt index f5d4cd30ec8..e5bd7d53d0c 100644 --- a/references.txt +++ b/references.txt @@ -301,3 +301,4 @@ ce56ab7c65a688f75d5cd4095378d6647c6bd9ae ce2753aafee0b1d96970abb600b606748ce40568 d947f454821e0834a2c8a8605d4a0f3347c11d4e f9461c5c0a8dd0551b9373ad3d59e1e193e47314 +58b253e878bca9833c1735913f764f4f479c1c9a