diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-07-22 11:36:26 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2019-08-01 10:08:52 +0200 |
commit | 2dc79e583902bd591f9c56943f9296654b0781e5 (patch) | |
tree | 9bfa8d5d3f7a96a53693b808e4cc993b966b7720 /lib/public | |
parent | a1afdac31afd1faa51da5015af158db0e3618883 (diff) | |
download | nextcloud-server-2dc79e583902bd591f9c56943f9296654b0781e5.tar.gz nextcloud-server-2dc79e583902bd591f9c56943f9296654b0781e5.zip |
Add \OCP\Calendar\IMetadataProvider interface and provider for common metadata keys
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Calendar/IMetadataProvider.php | 65 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IResourceMetadata.php | 103 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IRoom.php | 8 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IRoomMetadata.php | 57 |
4 files changed, 229 insertions, 4 deletions
diff --git a/lib/public/Calendar/IMetadataProvider.php b/lib/public/Calendar/IMetadataProvider.php new file mode 100644 index 00000000000..fcf56b47e11 --- /dev/null +++ b/lib/public/Calendar/IMetadataProvider.php @@ -0,0 +1,65 @@ +<?php +/** + * @copyright 2019, 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; + +/** + * Interface IMetadataProvider + * + * Provider for metadata of a resource or a room + * + * @package OCP\Calendar + * @since 17.0.0 + */ +interface IMetadataProvider { + + /** + * Get a list of all metadata keys available for this room + * + * Room backends are allowed to return custom keys, beyond the ones + * defined in this class. If they do, they should make sure to use their + * own namespace. + * + * @return String[] - A list of available keys + * @since 17.0.0 + */ + public function getAllAvailableMetadataKeys():array; + + /** + * Get whether or not a metadata key is set for this room + * + * @param string $key - The key to check for + * @return bool - Whether or not key is available + * @since 17.0.0 + */ + public function hasMetadataForKey(string $key):boolean; + + /** + * Get the value for a metadata key + * + * @param string $key - The key to check for + * @return string|null - The value stored for the key, null if no value stored + * @since 17.0.0 + */ + public function getMetadataForKey(string $key):?string; +} diff --git a/lib/public/Calendar/Resource/IResourceMetadata.php b/lib/public/Calendar/Resource/IResourceMetadata.php new file mode 100644 index 00000000000..a48bcfb6827 --- /dev/null +++ b/lib/public/Calendar/Resource/IResourceMetadata.php @@ -0,0 +1,103 @@ +<?php +/** + * @copyright 2019, 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 IResourceMetadata + * + * This interface provides keys for common metadata. + * Resource Backends are not limited to this list and can provide + * any metadata they want. + * + * @package OCP\Calendar\Resource + * @since 17.0.0 + */ +interface IResourceMetadata { + + /** + * Type of resource + * + * Allowed values for this key include: + * - projector + * - tv + * - vehicle + * - other + * + * @since 17.0.0 + */ + public const RESOURCE_TYPE = '{http://nextcloud.com/ns}resource-type'; + + /** + * If resource is of type vehicle, this describes the type of vehicle + * + * Allowed values: + * - bicycle + * - scooter + * - motorbike + * - car + * - plane + * - helicopter + * - other + * + * @since 17.0.0 + */ + public const VEHICLE_TYPE = '{http://nextcloud.com/ns}resource-vehicle-type'; + + /** + * Make of the vehicle + * + * @since 17.0.0 + */ + public const VEHICLE_MAKE = '{http://nextcloud.com/ns}resource-vehicle-make'; + + /** + * Model of the vehicle + * + * @since 17.0.0 + */ + public const VEHICLE_MODEL = '{http://nextcloud.com/ns}resource-vehicle-model'; + + /** + * Whether or not the car is electric + * + * use '1' for electric, '0' for non-electric + * + * @since 17.0.0 + */ + public const VEHICLE_IS_ELECTRIC = '{http://nextcloud.com/ns}resource-vehicle-is-electric'; + + /** + * Range of vehicle with a full tank + * + * @since 17.0.0 + */ + public const VEHICLE_RANGE = '{http://nextcloud.com/ns}resource-vehicle-range'; + + /** + * Seating capacity of the vehicle + * + * @since 17.0.0 + */ + public const VEHICLE_SEATING_CAPACITY = '{http://nextcloud.com/ns}resource-vehicle-seating-capacity'; +} diff --git a/lib/public/Calendar/Room/IRoom.php b/lib/public/Calendar/Room/IRoom.php index d860bb6fc57..1475f0e7167 100644 --- a/lib/public/Calendar/Room/IRoom.php +++ b/lib/public/Calendar/Room/IRoom.php @@ -32,7 +32,7 @@ namespace OCP\Calendar\Room; interface IRoom { /** - * get the room id + * Get a unique ID for the room * * This id has to be unique within the backend * @@ -42,7 +42,7 @@ interface IRoom { public function getId():string; /** - * get the display name for a room + * Get the display name for the room * * @return string * @since 14.0.0 @@ -61,9 +61,9 @@ interface IRoom { public function getGroupRestrictions():array; /** - * get email-address for room + * Get the email-address for the room * - * The email address has to be globally unique + * The email-address has to be globally unique * * @return string * @since 14.0.0 diff --git a/lib/public/Calendar/Room/IRoomMetadata.php b/lib/public/Calendar/Room/IRoomMetadata.php new file mode 100644 index 00000000000..3d501d4d12f --- /dev/null +++ b/lib/public/Calendar/Room/IRoomMetadata.php @@ -0,0 +1,57 @@ +<?php +/** + * @copyright 2019, 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 IRoomMetadata + * + * This interface provides keys for common metadata. + * Room Backends are not limited to this list and can provide + * any metadata they want. + * + * @package OCP\Calendar\Room + * @since 17.0.0 + */ +interface IRoomMetadata { + + /** + * Type of room + * + * Allowed values for this key include: + * - meeting-room + * - lecture-hall + * - seminar-room + * - other + * + * @since 17.0.0 + */ + public const ROOM_TYPE = '{http://nextcloud.com/ns}room-type'; + + /** + * Seating capacity of the room + * + * @since 17.0.0 + */ + public const CAPACITY = '{http://nextcloud.com/ns}room-seating-capacity'; +} |