To see example of initialization, please look at Implementation part of our README
Method returns SupplyDelay entity.
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelay = $supplyDelayClient->get();
echo json_encode($supplyDelay, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
Example above prints out
{
"validFrom": "2020-12-22 00:00:00",
"validTo": "2021-01-06 08:00:00"
}
- Upsert is short for Update-Insert
- Performs update of existing entity or creates new one if none exists (this eliminates the need of
create
andupdate
methods)
Method expects and returns SupplyDelay entity.
use MpApiClient\SupplyDelay\Entity\SupplyDelay;
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelay = $supplyDelayClient->upsert(
new SupplyDelay(
new DateTime('now'),
new DateTime('now + 1month'),
)
);
var_dump($supplyDelay);
Example above prints out
{
"validFrom": "2021-01-01 00:00:00",
"validTo": "2021-02-01 00:00:00"
}
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelayClient->delete();
Method returns SupplyDelay entity.
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelay = $supplyDelayClient->getForProduct('product-id');
echo json_encode($supplyDelay, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
Example above prints out
{
"validFrom": "2020-12-22 00:00:00",
"validTo": "2021-01-06 08:00:00"
}
- Upsert is short for Update-Insert
- Performs update of existing entity or creates new one if none exists (this eliminates the need of
create
andupdate
methods)
Method expects and returns SupplyDelay entity.
use MpApiClient\SupplyDelay\Entity\SupplyDelay;
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelay = $supplyDelayClient->upsertForProduct(
'product-id',
new SupplyDelay(
new DateTime('now'),
new DateTime('now + 1month'),
)
);
echo json_encode($supplyDelay, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
Example above prints out
{
"validFrom": "2021-01-01 00:00:00",
"validTo": "2021-02-01 00:00:00"
}
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelayClient->deleteForProduct('product-id');
Method returns SupplyDelay entity.
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelay = $supplyDelayClient->getForVariant('product-id', 'variant-id');
echo json_encode($supplyDelay, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
Example above prints out
{
"validFrom": "2020-12-22 00:00:00",
"validTo": "2021-01-06 08:00:00"
}
- Upsert is short for Update-Insert
- Performs update of existing entity or creates new one if none exists (this eliminates the need of
create
andupdate
methods)
Method expects and returns SupplyDelay entity.
use MpApiClient\SupplyDelay\Entity\SupplyDelay;
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelay = $supplyDelayClient->upsertForVariant(
'product-id',
'variant-id',
new SupplyDelay(
new DateTime('now'),
new DateTime('now + 1month'),
)
);
echo json_encode($supplyDelay, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
Example above prints out
{
"validFrom": "2021-01-01 00:00:00",
"validTo": "2021-02-01 00:00:00"
}
/** @var MpApiClient\Common\Interfaces\SupplyDelayClientInterface $supplyDelayClient */
$supplyDelayClient->deleteForVariant('product-id', 'variant-id');