Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 415d9c2

Browse files
authored
Merge pull request #2254 from magento-engcom/async-webapi-2
[Engcom] Async WebAPI
2 parents cc617b0 + 6c6e4d4 commit 415d9c2

File tree

123 files changed

+6319
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+6319
-249
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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;
10+
11+
/**
12+
* Interface BulkStatusInterface
13+
* Bulk summary data with list of operations items short data.
14+
*
15+
* @api
16+
*/
17+
interface BulkStatusInterface extends \Magento\Framework\Bulk\BulkStatusInterface
18+
{
19+
/**
20+
* Get Bulk summary data with list of operations items full data.
21+
*
22+
* @param string $bulkUuid
23+
* @return \Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterface
24+
* @throws \Magento\Framework\Exception\NoSuchEntityException
25+
*/
26+
public function getBulkDetailedStatus($bulkUuid);
27+
28+
/**
29+
* Get Bulk summary data with list of operations items short data.
30+
*
31+
* @param string $bulkUuid
32+
* @return \Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface
33+
* @throws \Magento\Framework\Exception\NoSuchEntityException
34+
*/
35+
public function getBulkShortStatus($bulkUuid);
36+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
* Interface AsyncResponseInterface
13+
* Temporary data object to give response from webapi async router
14+
*
15+
* @api
16+
*/
17+
interface AsyncResponseInterface
18+
{
19+
const BULK_UUID = 'bulk_uuid';
20+
const REQUEST_ITEMS = 'request_items';
21+
const ERRORS = 'errors';
22+
23+
/**
24+
* Gets the bulk uuid.
25+
*
26+
* @return string Bulk Uuid.
27+
*/
28+
public function getBulkUuid();
29+
30+
/**
31+
* Sets the bulk uuid.
32+
*
33+
* @param string $bulkUuid
34+
* @return $this
35+
*/
36+
public function setBulkUuid($bulkUuid);
37+
38+
/**
39+
* Gets the list of request items with status data.
40+
*
41+
* @return \Magento\AsynchronousOperations\Api\Data\ItemStatusInterface[]
42+
*/
43+
public function getRequestItems();
44+
45+
/**
46+
* Sets the list of request items with status data.
47+
*
48+
* @param \Magento\AsynchronousOperations\Api\Data\ItemStatusInterface[] $requestItems
49+
* @return $this
50+
*/
51+
public function setRequestItems($requestItems);
52+
53+
/**
54+
* @param bool $isErrors
55+
* @return $this
56+
*/
57+
public function setErrors($isErrors = false);
58+
59+
/**
60+
* Is there errors during processing bulk
61+
*
62+
* @return boolean
63+
*/
64+
public function isErrors();
65+
66+
/**
67+
* Retrieve existing extension attributes object.
68+
*
69+
* @return \Magento\AsynchronousOperations\Api\Data\AsyncResponseExtensionInterface|null
70+
*/
71+
public function getExtensionAttributes();
72+
73+
/**
74+
* Set an extension attributes object.
75+
*
76+
* @param \Magento\AsynchronousOperations\Api\Data\AsyncResponseExtensionInterface $extensionAttributes
77+
* @return $this
78+
*/
79+
public function setExtensionAttributes(
80+
\Magento\AsynchronousOperations\Api\Data\AsyncResponseExtensionInterface $extensionAttributes
81+
);
82+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
* Interface BulkStatusInterface
13+
*
14+
* Bulk summary data with list of operations items summary data.
15+
*
16+
* @api
17+
*/
18+
interface BulkOperationsStatusInterface extends BulkSummaryInterface
19+
{
20+
21+
const OPERATIONS_LIST = 'operations_list';
22+
23+
/**
24+
* Retrieve list of operation with statuses (short data).
25+
*
26+
* @return \Magento\AsynchronousOperations\Api\Data\SummaryOperationStatusInterface[]
27+
*/
28+
public function getOperationsList();
29+
30+
/**
31+
* Set operations list.
32+
*
33+
* @param \Magento\AsynchronousOperations\Api\Data\SummaryOperationStatusInterface[] $operationStatusList
34+
* @return $this
35+
*/
36+
public function setOperationsList($operationStatusList);
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
* Interface BulkStatusInterface
13+
*
14+
* Bulk summary data with list of operations items full data.
15+
*
16+
* @api
17+
*/
18+
interface DetailedBulkOperationsStatusInterface extends BulkSummaryInterface
19+
{
20+
21+
const OPERATIONS_LIST = 'operations_list';
22+
23+
/**
24+
* Retrieve operations list.
25+
*
26+
* @return \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[]
27+
*/
28+
public function getOperationsList();
29+
30+
/**
31+
* Set operations list.
32+
*
33+
* @param \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[] $operationStatusList
34+
* @return $this
35+
*/
36+
public function setOperationsList($operationStatusList);
37+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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+
* ItemStatusInterface interface
13+
* Temporary object with status of requested item.
14+
* Indicate if entity param was Accepted|Rejected to bulk schedule
15+
*
16+
* @api
17+
*/
18+
interface ItemStatusInterface
19+
{
20+
const ENTITY_ID = 'entity_id';
21+
const DATA_HASH = 'data_hash';
22+
const STATUS = 'status';
23+
const ERROR_MESSAGE = 'error_message';
24+
const ERROR_CODE = 'error_code';
25+
26+
const STATUS_ACCEPTED = 'accepted';
27+
const STATUS_REJECTED = 'rejected';
28+
29+
/**
30+
* Get entity Id.
31+
*
32+
* @return int
33+
*/
34+
public function getId();
35+
36+
/**
37+
* Sets entity Id.
38+
*
39+
* @param int $entityId
40+
* @return $this
41+
*/
42+
public function setId($entityId);
43+
44+
/**
45+
* Get hash of entity data.
46+
*
47+
* @return string md5 hash of entity params array.
48+
*/
49+
public function getDataHash();
50+
51+
/**
52+
* Sets hash of entity data.
53+
*
54+
* @param string $hash md5 hash of entity params array.
55+
* @return $this
56+
*/
57+
public function setDataHash($hash);
58+
59+
/**
60+
* Get status.
61+
*
62+
* @return string accepted|rejected
63+
*/
64+
public function getStatus();
65+
66+
/**
67+
* Sets entity status.
68+
*
69+
* @param string $status accepted|rejected
70+
* @return $this
71+
*/
72+
public function setStatus($status = self::STATUS_ACCEPTED);
73+
74+
/**
75+
* Get error information.
76+
*
77+
* @return string|null
78+
*/
79+
public function getErrorMessage();
80+
81+
/**
82+
* Sets error information.
83+
*
84+
* @param string|null|\Exception $error
85+
* @return $this
86+
*/
87+
public function setErrorMessage($error = null);
88+
89+
/**
90+
* Get error code.
91+
*
92+
* @return int|null
93+
*/
94+
public function getErrorCode();
95+
96+
/**
97+
* Sets error information.
98+
*
99+
* @param int|null|\Exception $errorCode Default: null
100+
* @return $this
101+
*/
102+
public function setErrorCode($errorCode = null);
103+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
* Getter Class OperationsStatusInterface
13+
* Instead of OperationInterface this class don't provide all operation data
14+
* and not responsive to set any data, just to get operation data
15+
* without serialized_data and result_serialized_data
16+
*
17+
* @api
18+
*/
19+
interface SummaryOperationStatusInterface
20+
{
21+
/**
22+
* Operation id
23+
*
24+
* @return int
25+
*/
26+
public function getId();
27+
28+
/**
29+
* Get operation status
30+
*
31+
* OPEN | COMPLETE | RETRIABLY_FAILED | NOT_RETRIABLY_FAILED
32+
*
33+
* @return int
34+
*/
35+
public function getStatus();
36+
37+
/**
38+
* Get result message
39+
*
40+
* @return string
41+
*/
42+
public function getResultMessage();
43+
44+
/**
45+
* Get error code
46+
*
47+
* @return int
48+
*/
49+
public function getErrorCode();
50+
}

0 commit comments

Comments
 (0)