diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-06-18 15:26:32 +0300 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-06-25 05:58:08 +0300 |
commit | c83629674eca793cd184462fce5d85902964878c (patch) | |
tree | c8845f1adfdeffc102740bf97be20051c1f8844f /lib/public | |
parent | b832edabbfce23daca6edbb010c4bf180123930f (diff) |
update resource booking interfaces and add managers
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Calendar/Resource/IBackend.php | 12 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IManager.php | 58 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IResource.php | 20 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IBackend.php | 12 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IManager.php | 58 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IRoom.php | 20 |
6 files changed, 166 insertions, 14 deletions
diff --git a/lib/public/Calendar/Resource/IBackend.php b/lib/public/Calendar/Resource/IBackend.php index 99a4ff06332..8b0ea677401 100644 --- a/lib/public/Calendar/Resource/IBackend.php +++ b/lib/public/Calendar/Resource/IBackend.php @@ -36,14 +36,14 @@ interface IBackend { * * @return IResource[] */ - public function getAllResources(); + public function getAllResources():array; /** * get a list of all resource identifiers in this backend * * @return string[] */ - public function listAllResources(); + public function listAllResources():array; /** * get a resource by it's id @@ -52,4 +52,12 @@ interface IBackend { * @return IResource|null */ public function getResource($id); + + /** + * Get unique identifier of the backend + * + * @return string + * @since 14.0.0 + */ + public function getBackendIdentifier():string; } diff --git a/lib/public/Calendar/Resource/IManager.php b/lib/public/Calendar/Resource/IManager.php new file mode 100644 index 00000000000..dc52b269ad4 --- /dev/null +++ b/lib/public/Calendar/Resource/IManager.php @@ -0,0 +1,58 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.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/>. + * + */ + +namespace OCP\Calendar\Resource; + +interface IManager { + + /** + * Registers a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function registerBackend(IBackend $backend); + + /** + * Unregisters a resource backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function unregisterBackend(IBackend $backend); + + /** + * @return IBackend[] + * @since 14.0.0 + */ + public function getBackends():array; + + /** + * removes all registered backend instances + * @return void + * @since 14.0.0 + */ + public function clear(); +} diff --git a/lib/public/Calendar/Resource/IResource.php b/lib/public/Calendar/Resource/IResource.php index a60378435b4..1f588ccb48d 100644 --- a/lib/public/Calendar/Resource/IResource.php +++ b/lib/public/Calendar/Resource/IResource.php @@ -39,7 +39,7 @@ interface IResource { * @return string * @since 14.0.0 */ - public function getId(); + public function getId():string; /** * get the display name for a resource @@ -47,7 +47,7 @@ interface IResource { * @return string * @since 14.0.0 */ - public function getDisplayName(); + public function getDisplayName():string; /** * Get a list of groupIds that are allowed to access this resource @@ -58,13 +58,23 @@ interface IResource { * @return string[] * @since 14.0.0 */ - public function getGroupRestrictions(); + public function getGroupRestrictions():array; /** - * Get the name of the backend class the room is connected with + * get email-address for resource + * + * The email address has to be globally unique * * @return string * @since 14.0.0 */ - public function getBackendClassName(); + public function getEMail():string; + + /** + * Get corresponding backend object + * + * @return IBackend + * @since 14.0.0 + */ + public function getBackend():IBackend; } diff --git a/lib/public/Calendar/Room/IBackend.php b/lib/public/Calendar/Room/IBackend.php index a7550347c74..84e01f6e320 100644 --- a/lib/public/Calendar/Room/IBackend.php +++ b/lib/public/Calendar/Room/IBackend.php @@ -36,14 +36,14 @@ interface IBackend { * * @return IRoom[] */ - public function getAllRooms(); + public function getAllRooms():array; /** * get a list of all room identifiers in this backend * * @return string[] */ - public function listAllRooms(); + public function listAllRooms():array; /** * get a room by it's id @@ -52,4 +52,12 @@ interface IBackend { * @return IRoom|null */ public function getRoom($id); + + /** + * Get unique identifier of the backend + * + * @return string + * @since 14.0.0 + */ + public function getBackendIdentifier():string; } diff --git a/lib/public/Calendar/Room/IManager.php b/lib/public/Calendar/Room/IManager.php new file mode 100644 index 00000000000..a04e75c41b4 --- /dev/null +++ b/lib/public/Calendar/Room/IManager.php @@ -0,0 +1,58 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.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/>. + * + */ + +namespace OCP\Calendar\Room; + +interface IManager { + + /** + * Registers a room backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function registerBackend(IBackend $backend); + + /** + * Unregisters a room backend + * + * @param IBackend $backend + * @return void + * @since 14.0.0 + */ + public function unregisterBackend(IBackend $backend); + + /** + * @return IBackend[] + * @since 14.0.0 + */ + public function getBackends():array; + + /** + * removes all registered backend instances + * @return void + * @since 14.0.0 + */ + public function clear(); +} diff --git a/lib/public/Calendar/Room/IRoom.php b/lib/public/Calendar/Room/IRoom.php index deac92a79d2..d860bb6fc57 100644 --- a/lib/public/Calendar/Room/IRoom.php +++ b/lib/public/Calendar/Room/IRoom.php @@ -39,7 +39,7 @@ interface IRoom { * @return string * @since 14.0.0 */ - public function getId(); + public function getId():string; /** * get the display name for a room @@ -47,7 +47,7 @@ interface IRoom { * @return string * @since 14.0.0 */ - public function getDisplayName(); + public function getDisplayName():string; /** * Get a list of groupIds that are allowed to access this room @@ -58,13 +58,23 @@ interface IRoom { * @return string[] * @since 14.0.0 */ - public function getGroupRestrictions(); + public function getGroupRestrictions():array; /** - * Get the name of the backend class the room is connected with + * get email-address for room + * + * The email address has to be globally unique * * @return string * @since 14.0.0 */ - public function getBackendClassName(); + public function getEMail():string; + + /** + * Get corresponding backend object + * + * @return IBackend + * @since 14.0.0 + */ + public function getBackend():IBackend; } |