2018-09-28 11:41:24 +00:00
|
|
|
<?php
|
2022-04-15 11:34:01 +00:00
|
|
|
|
2018-09-28 11:41:24 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Nextcloud - Social Support
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later. See the COPYING file.
|
|
|
|
*
|
|
|
|
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
|
|
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-11-20 12:52:24 +00:00
|
|
|
|
2018-12-16 22:53:00 +00:00
|
|
|
namespace OCA\Social\Interfaces;
|
2018-09-28 11:41:24 +00:00
|
|
|
|
2019-07-08 14:42:16 +00:00
|
|
|
use OCA\Social\Exceptions\ItemAlreadyExistsException;
|
2018-12-27 11:04:03 +00:00
|
|
|
use OCA\Social\Exceptions\ItemNotFoundException;
|
2018-11-12 22:57:32 +00:00
|
|
|
use OCA\Social\Model\ActivityPub\ACore;
|
2018-09-28 11:41:24 +00:00
|
|
|
|
2018-11-20 12:52:24 +00:00
|
|
|
/**
|
|
|
|
* Interface ICoreService
|
|
|
|
*
|
|
|
|
* @package OCA\Social\Service
|
|
|
|
*/
|
2018-12-16 22:53:00 +00:00
|
|
|
interface IActivityPubInterface {
|
2018-11-20 12:52:24 +00:00
|
|
|
/**
|
2018-12-13 09:40:27 +00:00
|
|
|
* Freshly imported item can be processed/parsed on incoming Request.
|
2018-11-20 12:52:24 +00:00
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function processIncomingRequest(ACore $item): void;
|
2018-11-20 12:52:24 +00:00
|
|
|
|
|
|
|
|
2018-12-03 21:03:22 +00:00
|
|
|
/**
|
2018-12-13 09:40:27 +00:00
|
|
|
* Freshly imported item can be processed/parsed on result of outgoing request.
|
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function processResult(ACore $item): void;
|
2018-12-16 22:53:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-08 14:42:16 +00:00
|
|
|
* When an activity is triggered by an 'Model\ActivityPub\Activity' model.
|
|
|
|
*
|
|
|
|
* !! This should be the only way of interaction between 2 IActivityPubInterface !!
|
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function activity(ACore $activity, ACore $item): void;
|
2019-07-08 14:42:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2022-04-15 16:13:33 +00:00
|
|
|
* Get Item by its Id.
|
2019-06-20 23:59:40 +00:00
|
|
|
* @throws ItemNotFoundException
|
2018-12-16 22:53:00 +00:00
|
|
|
*/
|
|
|
|
public function getItemById(string $id): ACore;
|
2018-12-13 09:40:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2022-04-15 16:13:33 +00:00
|
|
|
* Get Item when Id is not known.
|
2019-07-08 14:42:16 +00:00
|
|
|
* @throws ItemNotFoundException
|
2018-12-13 09:40:27 +00:00
|
|
|
*/
|
2019-07-08 14:42:16 +00:00
|
|
|
public function getItem(ACore $item): ACore;
|
2018-12-13 09:40:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the current item.
|
|
|
|
*
|
2019-07-08 14:42:16 +00:00
|
|
|
* !! Should not be called from an other IActivityPubInterface !!
|
|
|
|
*
|
|
|
|
* @throws ItemAlreadyExistsException
|
2018-12-03 21:03:22 +00:00
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function save(ACore $item): void;
|
2018-12-03 21:03:22 +00:00
|
|
|
|
|
|
|
|
2019-06-20 23:59:40 +00:00
|
|
|
/**
|
|
|
|
* Update the current item.
|
|
|
|
*
|
2019-07-08 14:42:16 +00:00
|
|
|
* !! Should not be called from an other IActivityPubInterface !!
|
|
|
|
*
|
|
|
|
* @throws ItemNotFoundException
|
2019-06-20 23:59:40 +00:00
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function update(ACore $item): void;
|
2019-06-20 23:59:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event on the current item.
|
|
|
|
*
|
2019-07-08 14:42:16 +00:00
|
|
|
* !! Should not be called from an other IActivityPubInterface !!
|
2019-06-20 23:59:40 +00:00
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function event(ACore $item, string $source): void;
|
2019-06-20 23:59:40 +00:00
|
|
|
|
|
|
|
|
2018-11-20 12:52:24 +00:00
|
|
|
/**
|
2018-12-13 09:40:27 +00:00
|
|
|
* Delete the current item.
|
|
|
|
*
|
2019-07-08 14:42:16 +00:00
|
|
|
* !! Should not be called from an other IActivityPubInterface !!
|
2018-11-20 12:52:24 +00:00
|
|
|
*/
|
2022-04-15 16:13:33 +00:00
|
|
|
public function delete(ACore $item): void;
|
2018-09-28 11:41:24 +00:00
|
|
|
}
|