ItemStatusInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\AsynchronousOperations\Api\Data;
  8. /**
  9. * ItemStatusInterface interface
  10. * Temporary object with status of requested item.
  11. * Indicate if entity param was Accepted|Rejected to bulk schedule
  12. *
  13. * @api
  14. * @since 100.2.3
  15. */
  16. interface ItemStatusInterface
  17. {
  18. const ENTITY_ID = 'entity_id';
  19. const DATA_HASH = 'data_hash';
  20. const STATUS = 'status';
  21. const ERROR_MESSAGE = 'error_message';
  22. const ERROR_CODE = 'error_code';
  23. const STATUS_ACCEPTED = 'accepted';
  24. const STATUS_REJECTED = 'rejected';
  25. /**
  26. * Get entity Id.
  27. *
  28. * @return int
  29. * @since 100.2.3
  30. */
  31. public function getId();
  32. /**
  33. * Sets entity Id.
  34. *
  35. * @param int $entityId
  36. * @return $this
  37. * @since 100.2.3
  38. */
  39. public function setId($entityId);
  40. /**
  41. * Get hash of entity data.
  42. *
  43. * @return string md5 hash of entity params array.
  44. * @since 100.2.3
  45. */
  46. public function getDataHash();
  47. /**
  48. * Sets hash of entity data.
  49. *
  50. * @param string $hash md5 hash of entity params array.
  51. * @return $this
  52. * @since 100.2.3
  53. */
  54. public function setDataHash($hash);
  55. /**
  56. * Get status.
  57. *
  58. * @return string accepted|rejected
  59. * @since 100.2.3
  60. */
  61. public function getStatus();
  62. /**
  63. * Sets entity status.
  64. *
  65. * @param string $status accepted|rejected
  66. * @return $this
  67. * @since 100.2.3
  68. */
  69. public function setStatus($status = self::STATUS_ACCEPTED);
  70. /**
  71. * Get error information.
  72. *
  73. * @return string|null
  74. * @since 100.2.3
  75. */
  76. public function getErrorMessage();
  77. /**
  78. * Sets error information.
  79. *
  80. * @param string|null|\Exception $error
  81. * @return $this
  82. * @since 100.2.3
  83. */
  84. public function setErrorMessage($error = null);
  85. /**
  86. * Get error code.
  87. *
  88. * @return int|null
  89. * @since 100.2.3
  90. */
  91. public function getErrorCode();
  92. /**
  93. * Sets error information.
  94. *
  95. * @param int|null|\Exception $errorCode Default: null
  96. * @return $this
  97. * @since 100.2.3
  98. */
  99. public function setErrorCode($errorCode = null);
  100. }