| 
									
										
										
										
											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); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-09-08 13:46:22 +00:00
										 |  |  |  * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors | 
					
						
							|  |  |  |  * SPDX-License-Identifier: AGPL-3.0-or-later | 
					
						
							| 
									
										
										
										
											2018-09-28 11:41: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
										 |  |  | } |