Add \OCP\Calendar\IMetadataProvider interface and provider for common metadata keys

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2019-07-22 11:36:26 +02:00
parent a1afdac31a
commit 2dc79e5839
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
6 changed files with 235 additions and 4 deletions

View File

@ -100,12 +100,15 @@ return array(
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
'OCP\\Calendar\\ICalendar' => $baseDir . '/lib/public/Calendar/ICalendar.php',
'OCP\\Calendar\\IManager' => $baseDir . '/lib/public/Calendar/IManager.php',
'OCP\\Calendar\\IMetadataProvider' => $baseDir . '/lib/public/Calendar/IMetadataProvider.php',
'OCP\\Calendar\\Resource\\IBackend' => $baseDir . '/lib/public/Calendar/Resource/IBackend.php',
'OCP\\Calendar\\Resource\\IManager' => $baseDir . '/lib/public/Calendar/Resource/IManager.php',
'OCP\\Calendar\\Resource\\IResource' => $baseDir . '/lib/public/Calendar/Resource/IResource.php',
'OCP\\Calendar\\Resource\\IResourceMetadata' => $baseDir . '/lib/public/Calendar/Resource/IResourceMetadata.php',
'OCP\\Calendar\\Room\\IBackend' => $baseDir . '/lib/public/Calendar/Room/IBackend.php',
'OCP\\Calendar\\Room\\IManager' => $baseDir . '/lib/public/Calendar/Room/IManager.php',
'OCP\\Calendar\\Room\\IRoom' => $baseDir . '/lib/public/Calendar/Room/IRoom.php',
'OCP\\Calendar\\Room\\IRoomMetadata' => $baseDir . '/lib/public/Calendar/Room/IRoomMetadata.php',
'OCP\\Capabilities\\ICapability' => $baseDir . '/lib/public/Capabilities/ICapability.php',
'OCP\\Capabilities\\IPublicCapability' => $baseDir . '/lib/public/Capabilities/IPublicCapability.php',
'OCP\\Collaboration\\AutoComplete\\AutoCompleteEvent' => $baseDir . '/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php',

View File

@ -134,12 +134,15 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
'OCP\\Calendar\\ICalendar' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendar.php',
'OCP\\Calendar\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/IManager.php',
'OCP\\Calendar\\IMetadataProvider' => __DIR__ . '/../../..' . '/lib/public/Calendar/IMetadataProvider.php',
'OCP\\Calendar\\Resource\\IBackend' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IBackend.php',
'OCP\\Calendar\\Resource\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IManager.php',
'OCP\\Calendar\\Resource\\IResource' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IResource.php',
'OCP\\Calendar\\Resource\\IResourceMetadata' => __DIR__ . '/../../..' . '/lib/public/Calendar/Resource/IResourceMetadata.php',
'OCP\\Calendar\\Room\\IBackend' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IBackend.php',
'OCP\\Calendar\\Room\\IManager' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IManager.php',
'OCP\\Calendar\\Room\\IRoom' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IRoom.php',
'OCP\\Calendar\\Room\\IRoomMetadata' => __DIR__ . '/../../..' . '/lib/public/Calendar/Room/IRoomMetadata.php',
'OCP\\Capabilities\\ICapability' => __DIR__ . '/../../..' . '/lib/public/Capabilities/ICapability.php',
'OCP\\Capabilities\\IPublicCapability' => __DIR__ . '/../../..' . '/lib/public/Capabilities/IPublicCapability.php',
'OCP\\Collaboration\\AutoComplete\\AutoCompleteEvent' => __DIR__ . '/../../..' . '/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php',

View File

@ -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;
}

View File

@ -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';
}

View File

@ -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

View File

@ -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';
}