Skip to content

Commit 1ac3492

Browse files
committed
build(codegen): updating SDK
1 parent e840095 commit 1ac3492

File tree

12 files changed

+435
-5
lines changed

12 files changed

+435
-5
lines changed

changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@
788788
- added type `GraphQLTooManyRequestsError`
789789
- added type `DirectDiscount`
790790
- added type `DiscountTypeCombination`
791+
- added type `BestDeal`
792+
- added type `Stacking`
791793
- added type `ShippingMethodLabel`
792794
- added type `AddShippingChange`
793795
- added type `ChangeApprovalRuleModeChange`
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\History\Models\Common;
10+
11+
use Commercetools\Base\JsonObject;
12+
use Commercetools\Base\DateTimeImmutableCollection;
13+
14+
interface BestDeal extends DiscountTypeCombination
15+
{
16+
17+
public const FIELD_CHOSEN_DISCOUNT_TYPE = 'chosenDiscountType';
18+
19+
/**
20+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
21+
*
22+
23+
* @return null|string
24+
*/
25+
public function getChosenDiscountType();
26+
27+
/**
28+
* @param ?string $chosenDiscountType
29+
*/
30+
public function setChosenDiscountType(?string $chosenDiscountType): void;
31+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\History\Models\Common;
10+
11+
use Commercetools\Base\Builder;
12+
use Commercetools\Base\DateTimeImmutableCollection;
13+
use Commercetools\Base\JsonObject;
14+
use Commercetools\Base\JsonObjectModel;
15+
use Commercetools\Base\MapperFactory;
16+
use stdClass;
17+
18+
/**
19+
* @implements Builder<BestDeal>
20+
*/
21+
final class BestDealBuilder implements Builder
22+
{
23+
/**
24+
25+
* @var ?string
26+
*/
27+
private $chosenDiscountType;
28+
29+
/**
30+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
31+
*
32+
33+
* @return null|string
34+
*/
35+
public function getChosenDiscountType()
36+
{
37+
return $this->chosenDiscountType;
38+
}
39+
40+
/**
41+
* @param ?string $chosenDiscountType
42+
* @return $this
43+
*/
44+
public function withChosenDiscountType(?string $chosenDiscountType)
45+
{
46+
$this->chosenDiscountType = $chosenDiscountType;
47+
48+
return $this;
49+
}
50+
51+
52+
public function build(): BestDeal
53+
{
54+
return new BestDealModel(
55+
$this->chosenDiscountType
56+
);
57+
}
58+
59+
public static function of(): BestDealBuilder
60+
{
61+
return new self();
62+
}
63+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\History\Models\Common;
10+
11+
use Commercetools\History\Models\Common\DiscountTypeCombinationCollection;
12+
use Commercetools\Exception\InvalidArgumentException;
13+
use stdClass;
14+
15+
/**
16+
* @extends DiscountTypeCombinationCollection<BestDeal>
17+
* @method BestDeal current()
18+
* @method BestDeal end()
19+
* @method BestDeal at($offset)
20+
*/
21+
class BestDealCollection extends DiscountTypeCombinationCollection
22+
{
23+
/**
24+
* @psalm-assert BestDeal $value
25+
* @psalm-param BestDeal|stdClass $value
26+
* @throws InvalidArgumentException
27+
*
28+
* @return BestDealCollection
29+
*/
30+
public function add($value)
31+
{
32+
if (!$value instanceof BestDeal) {
33+
throw new InvalidArgumentException();
34+
}
35+
$this->store($value);
36+
37+
return $this;
38+
}
39+
40+
/**
41+
* @psalm-return callable(int):?BestDeal
42+
*/
43+
protected function mapper()
44+
{
45+
return function (?int $index): ?BestDeal {
46+
$data = $this->get($index);
47+
if ($data instanceof stdClass) {
48+
/** @var BestDeal $data */
49+
$data = BestDealModel::of($data);
50+
$this->set($data, $index);
51+
}
52+
53+
return $data;
54+
};
55+
}
56+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\History\Models\Common;
10+
11+
use Commercetools\Base\DateTimeImmutableCollection;
12+
use Commercetools\Base\JsonObject;
13+
use Commercetools\Base\JsonObjectModel;
14+
use Commercetools\Base\MapperFactory;
15+
use stdClass;
16+
17+
/**
18+
* @internal
19+
*/
20+
final class BestDealModel extends JsonObjectModel implements BestDeal
21+
{
22+
23+
public const DISCRIMINATOR_VALUE = 'BestDeal';
24+
/**
25+
*
26+
* @var ?string
27+
*/
28+
protected $type;
29+
30+
/**
31+
*
32+
* @var ?string
33+
*/
34+
protected $chosenDiscountType;
35+
36+
37+
/**
38+
* @psalm-suppress MissingParamType
39+
*/
40+
public function __construct(
41+
?string $chosenDiscountType = null,
42+
?string $type = null
43+
) {
44+
$this->chosenDiscountType = $chosenDiscountType;
45+
$this->type = $type ?? self::DISCRIMINATOR_VALUE;
46+
}
47+
48+
/**
49+
*
50+
* @return null|string
51+
*/
52+
public function getType()
53+
{
54+
if (is_null($this->type)) {
55+
/** @psalm-var ?string $data */
56+
$data = $this->raw(self::FIELD_TYPE);
57+
if (is_null($data)) {
58+
return null;
59+
}
60+
$this->type = (string) $data;
61+
}
62+
63+
return $this->type;
64+
}
65+
66+
/**
67+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
68+
*
69+
*
70+
* @return null|string
71+
*/
72+
public function getChosenDiscountType()
73+
{
74+
if (is_null($this->chosenDiscountType)) {
75+
/** @psalm-var ?string $data */
76+
$data = $this->raw(self::FIELD_CHOSEN_DISCOUNT_TYPE);
77+
if (is_null($data)) {
78+
return null;
79+
}
80+
$this->chosenDiscountType = (string) $data;
81+
}
82+
83+
return $this->chosenDiscountType;
84+
}
85+
86+
87+
/**
88+
* @param ?string $chosenDiscountType
89+
*/
90+
public function setChosenDiscountType(?string $chosenDiscountType): void
91+
{
92+
$this->chosenDiscountType = $chosenDiscountType;
93+
}
94+
95+
96+
97+
}

lib/commercetools-history/src/Models/Common/DiscountTypeCombinationCollection.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@
1313
use stdClass;
1414

1515
/**
16-
* @extends MapperSequence<DiscountTypeCombination>
16+
* @template T of DiscountTypeCombination
17+
* @extends MapperSequence<T>
18+
* @psalm-method T current()
19+
* @psalm-method T end()
20+
* @psalm-method T at($offset)
1721
* @method DiscountTypeCombination current()
1822
* @method DiscountTypeCombination end()
1923
* @method DiscountTypeCombination at($offset)
2024
*/
2125
class DiscountTypeCombinationCollection extends MapperSequence
2226
{
2327
/**
24-
* @psalm-assert DiscountTypeCombination $value
25-
* @psalm-param DiscountTypeCombination|stdClass $value
28+
* @psalm-assert T $value
29+
* @psalm-param T|stdClass $value
2630
* @throws InvalidArgumentException
2731
*
2832
* @return DiscountTypeCombinationCollection
@@ -38,14 +42,14 @@ public function add($value)
3842
}
3943

4044
/**
41-
* @psalm-return callable(int):?DiscountTypeCombination
45+
* @psalm-return callable(int):?T
4246
*/
4347
protected function mapper()
4448
{
4549
return function (?int $index): ?DiscountTypeCombination {
4650
$data = $this->get($index);
4751
if ($data instanceof stdClass) {
48-
/** @var DiscountTypeCombination $data */
52+
/** @var T $data */
4953
$data = DiscountTypeCombinationModel::of($data);
5054
$this->set($data, $index);
5155
}

lib/commercetools-history/src/Models/Common/DiscountTypeCombinationModel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ final class DiscountTypeCombinationModel extends JsonObjectModel implements Disc
3232
*
3333
*/
3434
private static $discriminatorClasses = [
35+
'BestDeal' => BestDealModel::class,
36+
'Stacking' => StackingModel::class,
3537
];
3638

3739
/**
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\History\Models\Common;
10+
11+
use Commercetools\Base\JsonObject;
12+
use Commercetools\Base\DateTimeImmutableCollection;
13+
14+
interface Stacking extends DiscountTypeCombination
15+
{
16+
17+
18+
19+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file has been auto generated
6+
* Do not change it.
7+
*/
8+
9+
namespace Commercetools\History\Models\Common;
10+
11+
use Commercetools\Base\Builder;
12+
use Commercetools\Base\DateTimeImmutableCollection;
13+
use Commercetools\Base\JsonObject;
14+
use Commercetools\Base\JsonObjectModel;
15+
use Commercetools\Base\MapperFactory;
16+
use stdClass;
17+
18+
/**
19+
* @implements Builder<Stacking>
20+
*/
21+
final class StackingBuilder implements Builder
22+
{
23+
24+
25+
26+
27+
public function build(): Stacking
28+
{
29+
return new StackingModel(
30+
);
31+
}
32+
33+
public static function of(): StackingBuilder
34+
{
35+
return new self();
36+
}
37+
}

0 commit comments

Comments
 (0)