| @@ 27-49 (lines=23) @@ | ||
| 24 | * @method CustomFieldObjectDraft getCustom() |
|
| 25 | * @method ChannelDraft setCustom(CustomFieldObjectDraft $custom = null) |
|
| 26 | */ |
|
| 27 | class ChannelDraft extends JsonObject |
|
| 28 | { |
|
| 29 | public function fieldDefinitions() |
|
| 30 | { |
|
| 31 | return [ |
|
| 32 | 'key' => [static::TYPE => 'string'], |
|
| 33 | 'roles' => [static::TYPE => 'array'], |
|
| 34 | 'name' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'], |
|
| 35 | 'description' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'], |
|
| 36 | 'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'], |
|
| 37 | ]; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param string $key |
|
| 42 | * @param Context|callable $context |
|
| 43 | * @return ChannelDraft |
|
| 44 | */ |
|
| 45 | public static function ofKey($key, $context = null) |
|
| 46 | { |
|
| 47 | return static::of($context)->setKey($key); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 27-53 (lines=27) @@ | ||
| 24 | * @method ChannelReference getSupplyChannel() |
|
| 25 | * @method InventoryDraft setSupplyChannel(ChannelReference $supplyChannel = null) |
|
| 26 | */ |
|
| 27 | class InventoryDraft extends JsonObject |
|
| 28 | { |
|
| 29 | public function fieldDefinitions() |
|
| 30 | { |
|
| 31 | return [ |
|
| 32 | 'sku' => [static::TYPE => 'string'], |
|
| 33 | 'quantityOnStock' => [static::TYPE => 'int'], |
|
| 34 | 'restockableInDays' => [static::TYPE => 'int'], |
|
| 35 | 'expectedDelivery' => [ |
|
| 36 | static::TYPE => '\DateTime', |
|
| 37 | static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator' |
|
| 38 | ], |
|
| 39 | 'supplyChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'], |
|
| 40 | ]; |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * @param string $sku |
|
| 45 | * @param int $quantityOnStock |
|
| 46 | * @param Context|callable $context |
|
| 47 | * @return InventoryDraft |
|
| 48 | */ |
|
| 49 | public static function ofSkuAndQuantityOnStock($sku, $quantityOnStock, $context = null) |
|
| 50 | { |
|
| 51 | return static::of($context)->setSku($sku)->setQuantityOnStock($quantityOnStock); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||