. */ namespace SP\Domain\Account; use Defuse\Crypto\Exception\CryptoException; use Defuse\Crypto\Exception\EnvironmentIsBrokenException; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\DataModel\ItemSearchData; use SP\DataModel\PublicLinkData; use SP\DataModel\PublicLinkListData; use SP\Domain\Account\Services\PublicLinkKey; use SP\Infrastructure\Common\Repositories\NoSuchItemException; use SP\Infrastructure\Database\QueryResult; /** * Class PublicLinkService * * @package SP\Domain\Common\Services\PublicLink */ interface PublicLinkServiceInterface { /** * @throws ConstraintException * @throws QueryException */ public function search(ItemSearchData $itemSearchData): QueryResult; /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function getById(int $id): PublicLinkListData; /** * @throws \Defuse\Crypto\Exception\CryptoException * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Core\Exceptions\SPException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException * @throws \SP\Domain\Common\Services\ServiceException */ public function refresh(int $id): bool; /** * @throws EnvironmentIsBrokenException */ public function getPublicLinkKey(?string $hash = null): PublicLinkKey; /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function delete(int $id): PublicLinkServiceInterface; /** * Deletes all the items for given ids * * @param int[] $ids * * @throws ConstraintException * @throws QueryException * @throws \SP\Domain\Common\Services\ServiceException */ public function deleteByIdBatch(array $ids): int; /** * @throws SPException * @throws CryptoException * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface * @throws ConstraintException * @throws QueryException */ public function create(PublicLinkData $itemData): int; /** * Get all items from the service's repository * * @return PublicLinkListData[] * @throws ConstraintException * @throws QueryException */ public function getAllBasic(): array; /** * Incrementar el contador de visitas de un enlace * * @throws NoSuchItemException * @throws ConstraintException * @throws QueryException */ public function addLinkView(PublicLinkData $publicLinkData): void; /** * @throws SPException */ public function getByHash(string $hash): PublicLinkData; /** * Devolver el hash asociado a un elemento * * @throws ConstraintException * @throws QueryException * @throws NoSuchItemException */ public function getHashForItem(int $itemId): PublicLinkData; /** * Updates an item * * @throws SPException * @throws ConstraintException * @throws QueryException */ public function update(PublicLinkData $itemData): int; }