Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Bulk api status #6

Merged
merged 11 commits into from
Mar 30, 2018
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AsynchronousOperations\Api;

/**
* @api
* @since 100.3.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to put @since annotation, it will be added automatically by release publication tools.

*/
interface BulkRepositoryInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not look like repository, which usually has CRUD operations. How about BlulkStatusInterface? Then methods could be named getStatus and getDetailedStatus.

{

/**
* @param string $bulkUuid
* @return \Magento\AsynchronousOperations\Api\Data\BulkStatus\DetailedInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @since 100.3.0
*/
public function getBulkDetailedStatus($bulkUuid);

/**
* @param string $bulkUuid
* @return \Magento\AsynchronousOperations\Api\Data\BulkStatus\ShortInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @since 100.3.0
*/
public function getBulkShortStatus($bulkUuid);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AsynchronousOperations\Api\Data\BulkStatus;

use Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface;
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;

/**
* Interface BulkStatusInterface
*
* @api
* @since 100.3.0
*/
interface DetailedInterface extends BulkSummaryInterface
{

const OPERATIONS_LIST = 'operations_list';
const OPERATIONS_COUNTER = 'operations_counter';

/**
* Retrieve operations list.
*
* @return \Magento\AsynchronousOperations\Api\Data\OperationStatus\DetailedInterface[]
* @since 100.3.0
*/
public function getOperationsList();

/**
* Set operations list.
*
* @param \Magento\AsynchronousOperations\Api\Data\OperationStatus\DetailedInterface[] $operationStatusList
* @return $this
* @since 100.3.0
*/
public function setOperationsList($operationStatusList);

/**
* Retrieve operations counter object.
*
* @return \Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface|null
* @since 100.3.0
*/
public function getOperationsCounter();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear why counter type is OperationDetailedInterface


/**
* Set operations counter object.
*
* @param \Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface $operationDetails
* @return $this
* @since 100.3.0
*/
public function setOperationsCounter(OperationDetailsInterface $operationDetails
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AsynchronousOperations\Api\Data\BulkStatus;

use Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface;
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;

/**
* Interface BulkStatusInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add proper description for all classes/interfaces, especially @api ones.

*
* @api
* @since 100.3.0
*/
interface ShortInterface extends BulkSummaryInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interfaces could be renamed to Api/Data/BulkStatusInterface and Api/Data/DetailedBulkStatusInterface

{

const OPERATIONS_LIST = 'operations_list';
const OPERATIONS_COUNTER = 'operations_counter';

/**
* Retrieve operations list.
*
* @return \Magento\AsynchronousOperations\Api\Data\OperationStatus\ShortInterface[]
* @since 100.3.0
*/
public function getOperationsList();

/**
* Set operations list.
*
* @param \Magento\AsynchronousOperations\Api\Data\OperationStatus\ShortInterface[] $operationStatusList
* @return $this
* @since 100.3.0
*/
public function setOperationsList($operationStatusList);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the method be named setOperationStatusList? The same relates to other occurrences of this method.


/**
* Retrieve operations counter object.
*
* @return \Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface|null
* @since 100.3.0
*/
public function getOperationsCounter();

/**
* Set operations counter object.
*
* @param \Magento\AsynchronousOperations\Api\Data\OperationDetailsInterface $operationDetails
* @return $this
* @since 100.3.0
*/
public function setOperationsCounter(OperationDetailsInterface $operationDetails
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AsynchronousOperations\Api\Data;

/**
* Provide details of operations
*
* @api
* @since 100.3.0
*/
interface OperationDetailsInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the interface and some of its methods does not sound logical. It does not represent details for single operation, it represents status of the bulk of operations, there is no bulk in the namespace. How about OperationBulkStatusInterface? Please confirm names for interfaces and methods with @vrann.

{
/**
* Total operations count
*
* @return int
* @since 100.3.0
*/
public function getOperationsTotal();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTotalCount?


/**
* Open operations count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct description

*
* @return int
* @since 100.3.0
*/
public function getOpen();

/**
* Successfully completed operations count
*
* @return int
* @since 100.3.0
*/
public function getOperationsSuccessful();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSuccessfulCount?


/**
* Total failed operations count
*
* @return int
* @since 100.3.0
*/
public function getTotalFailed();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getFailedCount? And same pattern for the rest of the operations in the interface.


/**
* Failed not retriable operations count
*
* @return int
* @since 100.3.0
*/
public function getFailedNotRetriable();

/**
* Failed retriable operations count
*
* @return int
* @since 100.3.0
*/
public function getFailedRetriable();

/**
* Rejected operations count
*
* @return int
* @since 100.3.0
*/
public function getRejected();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AsynchronousOperations\Api\Data\OperationStatus;

/**
* Getter Class OperationsStatusInterface
* Instead of OperationInterface this class don't provide all operation data
* and not responsive to set any data, just to get operation data
* without serialized_data and result_serialized_data
*
* @api
* @since 100.3.0
* @see \Magento\AsynchronousOperations\Api\Data\OperationInterface
*/
interface DetailedInterface
{
/**
* Operation id
*
* @return int
* @since 100.3.0
*/
public function getId();

/**
* Message Queue Topic
*
* @return string
* @since 100.3.0
*/
public function getTopicName();

/**
* Get operation status
*
* OPEN | COMPLETE | RETRIABLY_FAILED | NOT_RETRIABLY_FAILED
*
* @return int
* @since 100.3.0
*/
public function getStatus();

/**
* Result serialized Data
*
* @return string
* @since 100.3.0
*/
public function getResultSerializedData();

/**
* Get result message
*
* @return string
* @since 100.3.0
*/
public function getResultMessage();

/**
* Get error code
*
* @return int
* @since 100.3.0
*/
public function getErrorCode();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\AsynchronousOperations\Api\Data\OperationStatus;

/**
* Getter Class OperationsStatusInterface
* Instead of OperationInterface this class don't provide all operation data
* and not responsive to set any data, just to get operation data
* without serialized_data and result_serialized_data
*
* @api
* @since 100.3.0
* @see \Magento\AsynchronousOperations\Api\Data\OperationInterface
*/
interface ShortInterface
{
/**
* Operation id
*
* @return int
* @since 100.3.0
*/
public function getId();

/**
* Get operation status
*
* OPEN | COMPLETE | RETRIABLY_FAILED | NOT_RETRIABLY_FAILED
*
* @return int
* @since 100.3.0
*/
public function getStatus();

/**
* Get result message
*
* @return string
* @since 100.3.0
*/
public function getResultMessage();

/**
* Get error code
*
* @return int
* @since 100.3.0
*/
public function getErrorCode();
}
Loading