Files
sysPass/lib/SP/Domain/Client/ClientServiceInterface.php
Rubén D 1c8fb0ea1a refactor: [WIP] Use hexagonal architecture and implement interfaces for services and repositories.
Controllers are being splited into commands to better dependency management.

Signed-off-by: Rubén D <nuxsmin@syspass.org>
2022-06-06 08:17:34 +02:00

117 lines
3.1 KiB
PHP

<?php
/*
* sysPass
*
* @author nuxsmin
* @link https://syspass.org
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Domain\Client;
use SP\Core\Exceptions\ConstraintException;
use SP\Core\Exceptions\QueryException;
use SP\Core\Exceptions\SPException;
use SP\DataModel\ClientData;
use SP\DataModel\ItemData;
use SP\DataModel\ItemSearchData;
use SP\Domain\Common\Services\ServiceException;
use SP\Infrastructure\Common\Repositories\DuplicatedItemException;
use SP\Infrastructure\Common\Repositories\NoSuchItemException;
use SP\Infrastructure\Database\QueryResult;
/**
* Class ClientService
*
* @package SP\Domain\Client\Services
*/
interface ClientServiceInterface
{
/**
* @throws ConstraintException
* @throws QueryException
*/
public function search(ItemSearchData $itemSearchData): QueryResult;
/**
* @throws NoSuchItemException
* @throws ConstraintException
* @throws QueryException
*/
public function getById(int $id): ClientData;
/**
* Returns the item for given name
*
* @throws ConstraintException
* @throws QueryException
* @throws NoSuchItemException
*/
public function getByName(string $name): ?ClientData;
/**
* @throws \SP\Core\Exceptions\ConstraintException
* @throws \SP\Core\Exceptions\QueryException
* @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException
*/
public function delete(int $id): ClientServiceInterface;
/**
* @param int[] $ids
*
* @throws ServiceException
* @throws ConstraintException
* @throws QueryException
*/
public function deleteByIdBatch(array $ids): int;
/**
* @throws SPException
* @throws DuplicatedItemException
*/
public function create($itemData): int;
/**
* @param ClientData $itemData
*
* @return int
* @throws SPException
* @throws ConstraintException
* @throws QueryException
*/
public function update(ClientData $itemData): int;
/**
* Get all items from the service's repository
*
* @return ClientData[]
* @throws ConstraintException
* @throws QueryException
*/
public function getAllBasic(): array;
/**
* Returns all clients visible for a given user
*
* @return ItemData[]
* @throws QueryException
* @throws ConstraintException
*/
public function getAllForUser(): array;
}