2013-09-20 14:37:52 +00:00
|
|
|
<?php
|
2019-01-24 15:52:38 +00:00
|
|
|
declare(strict_types=1);
|
2013-11-03 12:51:39 +00:00
|
|
|
/**
|
2016-07-21 15:07:57 +00:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2017-11-06 14:56:42 +00:00
|
|
|
* @author Christoph Wurst <christoph@owncloud.com>
|
2016-07-21 15:07:57 +00:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
2013-09-20 14:37:52 +00:00
|
|
|
*
|
2015-03-26 10:44:34 +00:00
|
|
|
* @license AGPL-3.0
|
2013-09-20 14:37:52 +00:00
|
|
|
*
|
2015-03-26 10:44:34 +00: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 14:37:52 +00:00
|
|
|
*
|
2015-03-26 10:44:34 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2013-09-20 14:37:52 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-03-26 10:44:34 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
2013-09-20 14:37:52 +00:00
|
|
|
*
|
2015-03-26 10:44:34 +00:00
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2013-09-20 14:37:52 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-02-26 10:37:37 +00:00
|
|
|
|
2013-09-20 14:37:52 +00:00
|
|
|
namespace OCP\Activity;
|
|
|
|
|
2015-04-16 15:00:08 +00:00
|
|
|
/**
|
|
|
|
* Interface IManager
|
|
|
|
*
|
|
|
|
* @package OCP\Activity
|
|
|
|
* @since 6.0.0
|
|
|
|
*/
|
2013-09-20 14:37:52 +00:00
|
|
|
interface IManager {
|
2015-08-19 15:37:55 +00:00
|
|
|
/**
|
2015-08-20 13:35:24 +00: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 15:37:55 +00:00
|
|
|
* @return IEvent
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function generateEvent(): IEvent;
|
2015-08-19 15:37:55 +00:00
|
|
|
|
|
|
|
/**
|
2015-08-20 13:35:24 +00: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 15:37:55 +00:00
|
|
|
* @param IEvent $event
|
2016-12-19 13:15:19 +00:00
|
|
|
* @throws \BadMethodCallException if required values have not been set
|
2015-08-19 15:37:55 +00:00
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function publish(IEvent $event): void;
|
2013-09-20 14:37:52 +00: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 11:48:15 +00:00
|
|
|
* $callable has to return an instance of \OCP\Activity\IConsumer
|
2013-09-20 14:37:52 +00:00
|
|
|
*
|
|
|
|
* @param \Closure $callable
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-20 14:37:52 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function registerConsumer(\Closure $callable): void;
|
2014-07-03 11:48:15 +00:00
|
|
|
|
2016-10-20 15:57:44 +00:00
|
|
|
/**
|
|
|
|
* @param string $filter Class must implement OCA\Activity\IFilter
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-10-20 15:57:44 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function registerFilter(string $filter): void;
|
2016-10-20 15:57:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return IFilter[]
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-10-20 15:57:44 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function getFilters(): array;
|
2016-10-20 15:57:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $id
|
|
|
|
* @return IFilter
|
|
|
|
* @throws \InvalidArgumentException when the filter was not found
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-10-20 15:57:44 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function getFilterById(string $id): IFilter;
|
2016-10-20 15:57:44 +00:00
|
|
|
|
2016-10-25 16:00:25 +00:00
|
|
|
/**
|
|
|
|
* @param string $setting Class must implement OCA\Activity\ISetting
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-10-25 16:00:25 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function registerSetting(string $setting): void;
|
2016-10-25 16:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ISetting[]
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-10-25 16:00:25 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function getSettings(): array;
|
2016-10-25 16:00:25 +00:00
|
|
|
|
2016-11-04 10:33:33 +00:00
|
|
|
/**
|
|
|
|
* @param string $provider Class must implement OCA\Activity\IProvider
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-11-04 10:33:33 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function registerProvider(string $provider): void;
|
2016-11-04 10:33:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return IProvider[]
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-11-04 10:33:33 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function getProviders(): array;
|
2016-11-04 10:33:33 +00:00
|
|
|
|
2016-10-25 16:00:25 +00:00
|
|
|
/**
|
|
|
|
* @param string $id
|
|
|
|
* @return ISetting
|
|
|
|
* @throws \InvalidArgumentException when the setting was not found
|
2016-11-16 08:29:27 +00:00
|
|
|
* @since 11.0.0
|
2016-10-25 16:00:25 +00:00
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function getSettingById(string $id): ISetting;
|
2014-07-03 11:48:15 +00:00
|
|
|
|
2015-10-02 07:53:39 +00:00
|
|
|
/**
|
|
|
|
* @param string $type
|
|
|
|
* @param int $id
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function setFormattingObject(string $type, int $id): void;
|
2015-10-02 07:53:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function isFormattingFilteredObject(): bool;
|
2015-10-02 07:53:39 +00:00
|
|
|
|
2017-06-20 10:40:45 +00:00
|
|
|
/**
|
|
|
|
* @param bool $status Set to true, when parsing events should not use SVG icons
|
|
|
|
* @since 12.0.1
|
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function setRequirePNG(bool $status): void;
|
2017-06-20 10:40:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
* @since 12.0.1
|
|
|
|
*/
|
2019-01-24 15:52:38 +00:00
|
|
|
public function getRequirePNG(): bool;
|
2016-10-20 15:57:44 +00: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 15:52:38 +00:00
|
|
|
public function setCurrentUserId(string $currentUserId = null): void;
|
2016-10-20 15:57:44 +00: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 15:52:38 +00:00
|
|
|
public function getCurrentUserId(): string;
|
2013-09-20 14:37:52 +00:00
|
|
|
}
|