Skip to content

Commit 10af68d

Browse files
committed
magento-engcom/bulk-api#4 Support for Async operations in WebAPI
- changed interface names per architectural feedback - added statuses tracking for successfull operations
1 parent 7d3a565 commit 10af68d

18 files changed

+124
-151
lines changed

app/code/Magento/AsynchronousOperations/Api/BulkStatusInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface BulkStatusInterface extends \Magento\Framework\Bulk\BulkStatusInterfac
2020
* Get Bulk summary data with list of operations items full data.
2121
*
2222
* @param string $bulkUuid
23-
* @return \Magento\AsynchronousOperations\Api\Data\DetailedBulkStatusInterface
23+
* @return \Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterface
2424
* @throws \Magento\Framework\Exception\NoSuchEntityException
2525
*/
2626
public function getBulkDetailedStatus($bulkUuid);
@@ -29,7 +29,7 @@ public function getBulkDetailedStatus($bulkUuid);
2929
* Get Bulk summary data with list of operations items short data.
3030
*
3131
* @param string $bulkUuid
32-
* @return \Magento\AsynchronousOperations\Api\Data\BulkStatusInterface
32+
* @return \Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface
3333
* @throws \Magento\Framework\Exception\NoSuchEntityException
3434
*/
3535
public function getBulkShortStatus($bulkUuid);

app/code/Magento/AsynchronousOperations/Api/Data/BulkStatusInterface.php renamed to app/code/Magento/AsynchronousOperations/Api/Data/BulkOperationsStatusInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
*
1616
* @api
1717
*/
18-
interface BulkStatusInterface extends BulkSummaryInterface
18+
interface BulkOperationsStatusInterface extends BulkSummaryInterface
1919
{
2020

2121
const OPERATIONS_LIST = 'operations_list';
2222

2323
/**
2424
* Retrieve list of operation with statuses (short data).
2525
*
26-
* @return \Magento\AsynchronousOperations\Api\Data\OperationStatusInterface[]
26+
* @return \Magento\AsynchronousOperations\Api\Data\SummaryOperationStatusInterface[]
2727
*/
2828
public function getOperationsList();
2929

3030
/**
3131
* Set operations list.
3232
*
33-
* @param \Magento\AsynchronousOperations\Api\Data\OperationStatusInterface[] $operationStatusList
33+
* @param \Magento\AsynchronousOperations\Api\Data\SummaryOperationStatusInterface[] $operationStatusList
3434
* @return $this
3535
*/
3636
public function setOperationsList($operationStatusList);

app/code/Magento/AsynchronousOperations/Api/Data/DetailedBulkStatusInterface.php renamed to app/code/Magento/AsynchronousOperations/Api/Data/DetailedBulkOperationsStatusInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
*
1616
* @api
1717
*/
18-
interface DetailedBulkStatusInterface extends BulkSummaryInterface
18+
interface DetailedBulkOperationsStatusInterface extends BulkSummaryInterface
1919
{
2020

2121
const OPERATIONS_LIST = 'operations_list';
2222

2323
/**
2424
* Retrieve operations list.
2525
*
26-
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
26+
* @return \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[]
2727
*/
2828
public function getOperationsList();
2929

3030
/**
3131
* Set operations list.
3232
*
33-
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $operationStatusList
33+
* @param \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[] $operationStatusList
3434
* @return $this
3535
*/
3636
public function setOperationsList($operationStatusList);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AsynchronousOperations\Api\Data;
10+
11+
/**
12+
* @api
13+
*/
14+
interface DetailedOperationStatusInterface extends OperationInterface
15+
{
16+
/**
17+
* Result serialized Data
18+
*
19+
* @return string
20+
*/
21+
public function getResultSerializedData();
22+
23+
/**
24+
* Set result serialized data
25+
*
26+
* @param string $resultSerializedData
27+
* @return $this
28+
*/
29+
public function setResultSerializedData($resultSerializedData);
30+
}
31+

app/code/Magento/AsynchronousOperations/Api/Data/OperationStatusInterface.php renamed to app/code/Magento/AsynchronousOperations/Api/Data/SummaryOperationStatusInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
* without serialized_data and result_serialized_data
1616
*
1717
* @api
18-
* @see \Magento\AsynchronousOperations\Api\Data\OperationInterface
1918
*/
20-
interface OperationStatusInterface
19+
interface SummaryOperationStatusInterface
2120
{
2221
/**
2322
* Operation id

app/code/Magento/AsynchronousOperations/Model/BulkOperationsStatus.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Framework\EntityManager\EntityManager;
13-
use Magento\AsynchronousOperations\Api\Data\BulkStatusInterfaceFactory as BulkStatusShortFactory;
14-
use Magento\AsynchronousOperations\Api\Data\DetailedBulkStatusInterfaceFactory as BulkStatusDetailedFactory;
13+
use Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterfaceFactory as BulkStatusShortFactory;
14+
use Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterfaceFactory as BulkStatusDetailedFactory;
1515
use Magento\AsynchronousOperations\Api\Data\OperationDetailsInterfaceFactory;
1616
use Magento\AsynchronousOperations\Api\BulkStatusInterface;
1717
use Magento\AsynchronousOperations\Model\ResourceModel\Operation\CollectionFactory;
@@ -42,7 +42,7 @@ class BulkOperationsStatus implements BulkStatusInterface
4242
private $bulkStatus;
4343

4444
/**
45-
* @var \Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory
45+
* @var CollectionFactory
4646
*/
4747
private $operationCollectionFactory;
4848

@@ -108,7 +108,7 @@ public function getBulkDetailedStatus($bulkUuid)
108108
{
109109
$bulkSummary = $this->bulkDetailedFactory->create();
110110

111-
/** @var \Magento\AsynchronousOperations\Api\Data\DetailedBulkStatusInterface $bulk */
111+
/** @var \Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterface $bulk */
112112
$bulk = $this->entityManager->load($bulkSummary, $bulkUuid);
113113

114114
if ($bulk->getBulkId() === null) {
@@ -132,7 +132,7 @@ public function getBulkShortStatus($bulkUuid)
132132
{
133133
$bulkSummary = $this->bulkShortFactory->create();
134134

135-
/** @var \Magento\AsynchronousOperations\Api\Data\BulkStatusInterface $bulk */
135+
/** @var \Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface $bulk */
136136
$bulk = $this->entityManager->load($bulkSummary, $bulkUuid);
137137
if ($bulk->getBulkId() === null) {
138138
throw new NoSuchEntityException(

app/code/Magento/AsynchronousOperations/Model/BulkStatus/CalculatedStatusSql.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Magento\AsynchronousOperations\Model\BulkStatus;
88

9-
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
109
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;
1110

1211
class CalculatedStatusSql

app/code/Magento/AsynchronousOperations/Model/BulkStatus/Detailed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
namespace Magento\AsynchronousOperations\Model\BulkStatus;
1010

11-
use Magento\AsynchronousOperations\Api\Data\DetailedBulkStatusInterface;
11+
use Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterface;
1212
use Magento\AsynchronousOperations\Model\BulkSummary;
1313

14-
class Detailed extends BulkSummary implements DetailedBulkStatusInterface
14+
class Detailed extends BulkSummary implements DetailedBulkOperationsStatusInterface
1515
{
1616
/**
1717
* @inheritDoc

app/code/Magento/AsynchronousOperations/Model/BulkStatus/Short.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
namespace Magento\AsynchronousOperations\Model\BulkStatus;
1010

11-
use Magento\AsynchronousOperations\Api\Data\BulkStatusInterface;
11+
use Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface;
1212
use Magento\AsynchronousOperations\Model\BulkSummary;
1313

14-
class Short extends BulkSummary implements BulkStatusInterface
14+
class Short extends BulkSummary implements BulkOperationsStatusInterface
1515
{
1616
/**
1717
* @inheritDoc

app/code/Magento/AsynchronousOperations/Model/Operation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66
namespace Magento\AsynchronousOperations\Model;
77

8-
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
8+
use Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface;
99
use Magento\Framework\DataObject;
1010
use Magento\Framework\Api\ExtensibleDataInterface;
1111

1212
/**
1313
* Class Operation
1414
*/
15-
class Operation extends DataObject implements OperationInterface, ExtensibleDataInterface
15+
class Operation extends DataObject implements DetailedOperationStatusInterface, ExtensibleDataInterface
1616
{
1717
/**
1818
* @inheritDoc

0 commit comments

Comments
 (0)