2013-09-06 18:38:59 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Robin Appelman <icewind@owncloud.com>
|
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
2013-11-03 12:51:39 +00:00
|
|
|
*
|
2016-01-12 14:02:16 +00:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
2015-03-26 10:44:34 +00:00
|
|
|
* @license AGPL-3.0
|
2013-11-03 12:51:39 +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-11-03 12:51:39 +00:00
|
|
|
*
|
2015-03-26 10:44:34 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2013-11-03 12:51:39 +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-11-03 12:51:39 +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-11-03 12:51:39 +00:00
|
|
|
*
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
2015-02-26 10:37:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Public interface of ownCloud for apps to use.
|
|
|
|
* Files/Folder interface
|
|
|
|
*/
|
|
|
|
|
2013-11-03 12:51:39 +00:00
|
|
|
// use OCP namespace for all classes that are considered public.
|
|
|
|
// This means that they should be used by apps instead of the internal ownCloud classes
|
2013-09-10 17:34:38 +00:00
|
|
|
namespace OCP\Files;
|
2013-09-06 18:38:59 +00:00
|
|
|
|
2015-04-16 15:00:08 +00:00
|
|
|
/**
|
|
|
|
* @since 6.0.0
|
|
|
|
*/
|
2013-09-06 18:38:59 +00:00
|
|
|
interface Folder extends Node {
|
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* Get the full path of an item in the folder within owncloud's filesystem
|
|
|
|
*
|
|
|
|
* @param string $path relative path of an item in the folder
|
2013-09-06 18:38:59 +00:00
|
|
|
* @return string
|
2013-09-10 18:02:15 +00:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function getFullPath($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* Get the path of an item in the folder relative to the folder
|
|
|
|
*
|
|
|
|
* @param string $path absolute path of an item in the folder
|
|
|
|
* @throws \OCP\Files\NotFoundException
|
2013-09-06 18:38:59 +00:00
|
|
|
* @return string
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function getRelativePath($path);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* check if a node is a (grand-)child of the folder
|
|
|
|
*
|
2013-09-10 17:34:38 +00:00
|
|
|
* @param \OCP\Files\Node $node
|
2013-09-06 18:38:59 +00:00
|
|
|
* @return bool
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function isSubNode($node);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get the content of this directory
|
|
|
|
*
|
2013-09-10 18:02:15 +00:00
|
|
|
* @throws \OCP\Files\NotFoundException
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function getDirectoryListing();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the node at $path
|
|
|
|
*
|
2013-09-10 18:02:15 +00:00
|
|
|
* @param string $path relative path of the file or folder
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\Node
|
2013-09-10 18:02:15 +00:00
|
|
|
* @throws \OCP\Files\NotFoundException
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function get($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* Check if a file or folder exists in the folder
|
|
|
|
*
|
|
|
|
* @param string $path relative path of the file or folder
|
2013-09-06 18:38:59 +00:00
|
|
|
* @return bool
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function nodeExists($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* Create a new folder
|
|
|
|
*
|
|
|
|
* @param string $path relative path of the new folder
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\Folder
|
2013-09-10 18:02:15 +00:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function newFolder($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* Create a new file
|
|
|
|
*
|
|
|
|
* @param string $path relative path of the new file
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\File
|
2013-09-10 18:02:15 +00:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-06-19 08:51:36 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function newFile($path);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* search for files with the name matching $query
|
|
|
|
*
|
|
|
|
* @param string $query
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function search($query);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* search for files by mimetype
|
2013-09-10 18:02:15 +00:00
|
|
|
* $mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
|
2013-09-06 18:38:59 +00:00
|
|
|
*
|
|
|
|
* @param string $mimetype
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function searchByMime($mimetype);
|
|
|
|
|
2014-12-04 13:01:15 +00:00
|
|
|
/**
|
|
|
|
* search for files by tag
|
|
|
|
*
|
|
|
|
* @param string|int $tag tag name or tag id
|
2014-12-12 10:18:35 +00:00
|
|
|
* @param string $userId owner of the tags
|
2014-12-04 13:01:15 +00:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.0.0
|
2014-12-04 13:01:15 +00:00
|
|
|
*/
|
2014-12-12 10:18:35 +00:00
|
|
|
public function searchByTag($tag, $userId);
|
2014-12-04 13:01:15 +00:00
|
|
|
|
2013-09-06 18:38:59 +00:00
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* get a file or folder inside the folder by it's internal id
|
|
|
|
*
|
|
|
|
* @param int $id
|
2013-09-10 17:34:38 +00:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function getById($id);
|
|
|
|
|
2013-09-10 18:02:15 +00:00
|
|
|
/**
|
|
|
|
* Get the amount of free space inside the folder
|
|
|
|
*
|
|
|
|
* @return int
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-10 18:02:15 +00:00
|
|
|
*/
|
2013-09-06 18:38:59 +00:00
|
|
|
public function getFreeSpace();
|
|
|
|
|
|
|
|
/**
|
2013-09-10 18:02:15 +00:00
|
|
|
* Check if new files or folders can be created within the folder
|
|
|
|
*
|
2013-09-06 18:38:59 +00:00
|
|
|
* @return bool
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 6.0.0
|
2013-09-06 18:38:59 +00:00
|
|
|
*/
|
|
|
|
public function isCreatable();
|
2015-03-24 14:00:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a suffix to the name in case the file exists
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @return string
|
|
|
|
* @throws NotPermittedException
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-03-24 14:00:36 +00:00
|
|
|
*/
|
|
|
|
public function getNonExistingName($name);
|
2013-09-06 18:38:59 +00:00
|
|
|
}
|