From 0bf2ffb231cb21132e83b47e128cec46349ecb00 Mon Sep 17 00:00:00 2001 From: Auto Mation Date: Mon, 14 Jun 2021 13:54:28 +0000 Subject: [PATCH] TASK: Updating SDK --- lib/commercetools-api-tests/gen.properties | 2 +- lib/commercetools-api/gen.properties | 2 +- .../Me/MyCartSetCustomerEmailAction.php | 27 ++++++ .../MyCartSetCustomerEmailActionBuilder.php | 59 +++++++++++++ ...MyCartSetCustomerEmailActionCollection.php | 55 ++++++++++++ .../Me/MyCartSetCustomerEmailActionModel.php | 86 +++++++++++++++++++ .../src/Models/Me/MyCartUpdateActionModel.php | 1 + lib/commercetools-base/gen.properties | 2 +- .../gen.properties | 2 +- lib/commercetools-history/gen.properties | 2 +- lib/commercetools-import-tests/gen.properties | 2 +- lib/commercetools-import/gen.properties | 2 +- lib/commercetools-ml-tests/gen.properties | 2 +- lib/commercetools-ml/gen.properties | 2 +- 14 files changed, 237 insertions(+), 9 deletions(-) create mode 100644 lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php create mode 100644 lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionBuilder.php create mode 100644 lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php create mode 100644 lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php diff --git a/lib/commercetools-api-tests/gen.properties b/lib/commercetools-api-tests/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-api-tests/gen.properties +++ b/lib/commercetools-api-tests/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-api/gen.properties b/lib/commercetools-api/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-api/gen.properties +++ b/lib/commercetools-api/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php new file mode 100644 index 00000000000..1e839b741f6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php @@ -0,0 +1,27 @@ + + */ +final class MyCartSetCustomerEmailActionBuilder implements Builder +{ + /** + * @var ?string + */ + private $email; + + /** + * @return null|string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param ?string $email + * @return $this + */ + public function withEmail(?string $email) + { + $this->email = $email; + + return $this; + } + + + public function build(): MyCartSetCustomerEmailAction + { + return new MyCartSetCustomerEmailActionModel( + $this->email + ); + } + + public static function of(): MyCartSetCustomerEmailActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php new file mode 100644 index 00000000000..a2cb8f79f65 --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php @@ -0,0 +1,55 @@ + + * @method MyCartSetCustomerEmailAction current() + * @method MyCartSetCustomerEmailAction at($offset) + */ +class MyCartSetCustomerEmailActionCollection extends MyCartUpdateActionCollection +{ + /** + * @psalm-assert MyCartSetCustomerEmailAction $value + * @psalm-param MyCartSetCustomerEmailAction|stdClass $value + * @throws InvalidArgumentException + * + * @return MyCartSetCustomerEmailActionCollection + */ + public function add($value) + { + if (!$value instanceof MyCartSetCustomerEmailAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?MyCartSetCustomerEmailAction + */ + protected function mapper() + { + return function (int $index): ?MyCartSetCustomerEmailAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var MyCartSetCustomerEmailAction $data */ + $data = MyCartSetCustomerEmailActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php new file mode 100644 index 00000000000..78d1561dd6c --- /dev/null +++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php @@ -0,0 +1,86 @@ +email = $email; + $this->action = static::DISCRIMINATOR_VALUE; + } + + /** + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + * @return null|string + */ + public function getEmail() + { + if (is_null($this->email)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_EMAIL); + if (is_null($data)) { + return null; + } + $this->email = (string) $data; + } + + return $this->email; + } + + + /** + * @param ?string $email + */ + public function setEmail(?string $email): void + { + $this->email = $email; + } +} diff --git a/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php index e90de392151..85c31f3ab39 100644 --- a/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php +++ b/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php @@ -46,6 +46,7 @@ final class MyCartUpdateActionModel extends JsonObjectModel implements MyCartUpd 'setCountry' => MyCartSetCountryActionModel::class, 'setCustomField' => MyCartSetCustomFieldActionModel::class, 'setCustomType' => MyCartSetCustomTypeActionModel::class, + 'setCustomerEmail' => MyCartSetCustomerEmailActionModel::class, 'setDeleteDaysAfterLastModification' => MyCartSetDeleteDaysAfterLastModificationActionModel::class, 'setLineItemCustomField' => MyCartSetLineItemCustomFieldActionModel::class, 'setLineItemCustomType' => MyCartSetLineItemCustomTypeActionModel::class, diff --git a/lib/commercetools-base/gen.properties b/lib/commercetools-base/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-base/gen.properties +++ b/lib/commercetools-base/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-history-tests/gen.properties b/lib/commercetools-history-tests/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-history-tests/gen.properties +++ b/lib/commercetools-history-tests/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-history/gen.properties b/lib/commercetools-history/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-history/gen.properties +++ b/lib/commercetools-history/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-import-tests/gen.properties b/lib/commercetools-import-tests/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-import-tests/gen.properties +++ b/lib/commercetools-import-tests/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-import/gen.properties b/lib/commercetools-import/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-import/gen.properties +++ b/lib/commercetools-import/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-ml-tests/gen.properties b/lib/commercetools-ml-tests/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-ml-tests/gen.properties +++ b/lib/commercetools-ml-tests/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837 diff --git a/lib/commercetools-ml/gen.properties b/lib/commercetools-ml/gen.properties index f8ebe8caad1..9fb98242987 100644 --- a/lib/commercetools-ml/gen.properties +++ b/lib/commercetools-ml/gen.properties @@ -1 +1 @@ -hash=834776908e37742cb9a8892b57a25733c74eb391 +hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837