2013-09-20 18:37:52 +04:00
|
|
|
<?php
|
2019-12-03 21:57:53 +03:00
|
|
|
|
2019-01-24 18:52:38 +03:00
|
|
|
declare(strict_types=1);
|
2019-12-03 21:57:53 +03:00
|
|
|
|
2013-11-03 16:51:39 +04:00
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2016-07-21 18:07:57 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2020-08-24 15:54:25 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
2013-09-20 18:37:52 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @license AGPL-3.0
|
2013-09-20 18:37:52 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
2013-09-20 18:37:52 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2013-09-20 18:37:52 +04:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-03-26 13:44:34 +03:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
2013-09-20 18:37:52 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2013-09-20 18:37:52 +04:00
|
|
|
*
|
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
2013-09-20 18:37:52 +04:00
|
|
|
namespace OCP\Activity;
|
|
|
|
|
2015-04-16 18:00:08 +03:00
|
|
|
/**
|
|
|
|
* Interface IManager
|
|
|
|
*
|
|
|
|
* @since 6.0.0
|
|
|
|
*/
|
2013-09-20 18:37:52 +04:00
|
|
|
interface IManager {
|
2015-08-19 18:37:55 +03:00
|
|
|
/**
|
2015-08-20 16:35:24 +03:00
|
|
|
* Generates a new IEvent object
|
|
|
|
*
|
|
|
|
* Make sure to call at least the following methods before sending it to the
|
|
|
|
* app with via the publish() method:
|
|
|
|
* - setApp()
|
|
|
|
* - setType()
|
|
|
|
* - setAffectedUser()
|
|
|
|
* - setSubject()
|
|
|
|
*
|
2015-08-19 18:37:55 +03:00
|
|
|
* @return IEvent
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function generateEvent(): IEvent;
|
2015-08-19 18:37:55 +03:00
|
|
|
|
|
|
|
/**
|
2015-08-20 16:35:24 +03:00
|
|
|
* Publish an event to the activity consumers
|
|
|
|
*
|
|
|
|
* Make sure to call at least the following methods before sending an Event:
|
|
|
|
* - setApp()
|
|
|
|
* - setType()
|
|
|
|
* - setAffectedUser()
|
|
|
|
* - setSubject()
|
|
|
|
*
|
2015-08-19 18:37:55 +03:00
|
|
|
* @param IEvent $event
|
2016-12-19 16:15:19 +03:00
|
|
|
* @throws \BadMethodCallException if required values have not been set
|
2015-08-19 18:37:55 +03:00
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function publish(IEvent $event): void;
|
2013-09-20 18:37:52 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* In order to improve lazy loading a closure can be registered which will be called in case
|
|
|
|
* activity consumers are actually requested
|
|
|
|
*
|
2014-07-03 15:48:15 +04:00
|
|
|
* $callable has to return an instance of \OCP\Activity\IConsumer
|
2013-09-20 18:37:52 +04:00
|
|
|
*
|
|
|
|
* @param \Closure $callable
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-20 18:37:52 +04:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function registerConsumer(\Closure $callable): void;
|
2014-07-03 15:48:15 +04:00
|
|
|
|
2016-10-20 18:57:44 +03:00
|
|
|
/**
|
|
|
|
* @param string $filter Class must implement OCA\Activity\IFilter
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-10-20 18:57:44 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function registerFilter(string $filter): void;
|
2016-10-20 18:57:44 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return IFilter[]
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-10-20 18:57:44 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function getFilters(): array;
|
2016-10-20 18:57:44 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $id
|
|
|
|
* @return IFilter
|
|
|
|
* @throws \InvalidArgumentException when the filter was not found
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-10-20 18:57:44 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function getFilterById(string $id): IFilter;
|
2016-10-20 18:57:44 +03:00
|
|
|
|
2016-10-25 19:00:25 +03:00
|
|
|
/**
|
|
|
|
* @param string $setting Class must implement OCA\Activity\ISetting
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-10-25 19:00:25 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function registerSetting(string $setting): void;
|
2016-10-25 19:00:25 +03:00
|
|
|
|
|
|
|
/**
|
2020-06-15 16:01:52 +03:00
|
|
|
* @return ActivitySettings[]
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-10-25 19:00:25 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function getSettings(): array;
|
2016-10-25 19:00:25 +03:00
|
|
|
|
2016-11-04 13:33:33 +03:00
|
|
|
/**
|
|
|
|
* @param string $provider Class must implement OCA\Activity\IProvider
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-11-04 13:33:33 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function registerProvider(string $provider): void;
|
2016-11-04 13:33:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return IProvider[]
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-11-04 13:33:33 +03:00
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function getProviders(): array;
|
2016-11-04 13:33:33 +03:00
|
|
|
|
2016-10-25 19:00:25 +03:00
|
|
|
/**
|
|
|
|
* @param string $id
|
2020-06-15 16:01:52 +03:00
|
|
|
* @return ActivitySettings
|
2016-10-25 19:00:25 +03:00
|
|
|
* @throws \InvalidArgumentException when the setting was not found
|
2016-11-16 11:29:27 +03:00
|
|
|
* @since 11.0.0
|
2016-10-25 19:00:25 +03:00
|
|
|
*/
|
2020-06-15 16:01:52 +03:00
|
|
|
public function getSettingById(string $id): ActivitySettings;
|
2014-07-03 15:48:15 +04:00
|
|
|
|
2015-10-02 10:53:39 +03:00
|
|
|
/**
|
|
|
|
* @param string $type
|
|
|
|
* @param int $id
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function setFormattingObject(string $type, int $id): void;
|
2015-10-02 10:53:39 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function isFormattingFilteredObject(): bool;
|
2015-10-02 10:53:39 +03:00
|
|
|
|
2017-06-20 13:40:45 +03:00
|
|
|
/**
|
|
|
|
* @param bool $status Set to true, when parsing events should not use SVG icons
|
|
|
|
* @since 12.0.1
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function setRequirePNG(bool $status): void;
|
2017-06-20 13:40:45 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
* @since 12.0.1
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function getRequirePNG(): bool;
|
2016-10-20 18:57:44 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the user we need to use
|
|
|
|
*
|
|
|
|
* @param string|null $currentUserId
|
|
|
|
* @throws \UnexpectedValueException If the user is invalid
|
|
|
|
* @since 9.0.1
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function setCurrentUserId(string $currentUserId = null): void;
|
2016-10-20 18:57:44 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the user we need to use
|
|
|
|
*
|
|
|
|
* Either the user is logged in, or we try to get it from the token
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
* @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique
|
|
|
|
* @since 8.1.0
|
|
|
|
*/
|
2019-01-24 18:52:38 +03:00
|
|
|
public function getCurrentUserId(): string;
|
2013-09-20 18:37:52 +04:00
|
|
|
}
|