-
Notifications
You must be signed in to change notification settings - Fork 91
Service Contracts
Stanislav Idolov edited this page May 6, 2019
·
11 revisions
The search API endpoint is the main source of Adobe Stock assets and should be configurable and extensible. We encourage the re-usage of Magento framework interfaces is such cases.
interface GetImageListInterface
{
/**
* @param SearchCriteriaInterface $searchCriteria
* @return SearchResultsInterface
*/
public function execute(SearchCriteriaInterface $searchCriteria) : SearchResultsInterface;
}The interface accepts search criteria object that implements generic framework interface: \Magento\Framework\Api\SearchCriteriaInterface. The returned object will implement \Magento\Framework\Api\SearchResultsInterface interface that also defined in Magento framework.
In order to persist images to the Magento gallery, we defined two interfaces that will provide the ability to save image preview and licensed the image to the filesystem.
interface SaveImagePreviewInterface
{
/**
* @param int $mediaId
* @return bool
*/
public function execute(int $mediaId): bool;
}interface SaveLicensedImageInterface
{
/**
* @param int $mediaId
* @return bool
*/
public function execute(int $mediaId): bool;
}interface ImageMetadataRepositoryInterface
{
/**
* @param DataInterface $entityData
* @return int
*/
public function save(MatadataInterface $entityData) : int;
/**
* @param int $entityId
* @return MatadataInterface
*/
public function get(int $entityId) : MatadataInterface;
/**
* @param MatadataInterface $entityData
* @return void
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\CouldNotDeleteException
*/
public function delete(MatadataInterface $entityData);
/**
* @param int $entityId
* @return void
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\CouldNotDeleteException
*/
public function deleteById(int $entityId);
/**
* @param SearchCriteriaInterface $searchCriteria
* @return SearchResultsInterface
*/
public function getList(SearchCriteriaInterface $searchCriteria) : SearchResultsInterface;
}