123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <?php
- /**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Vincent Petry <vincent@nextcloud.com>
- *
- * @license AGPL-3.0
- *
- * 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.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
- // 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
- namespace OCP\Files;
- use OCP\Files\Search\ISearchQuery;
- /**
- * @since 6.0.0
- */
- interface Folder extends Node {
- /**
- * 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
- * @return string
- * @throws \OCP\Files\NotPermittedException
- * @since 6.0.0
- */
- public function getFullPath($path);
- /**
- * 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
- * @return string|null
- * @since 6.0.0
- */
- public function getRelativePath($path);
- /**
- * check if a node is a (grand-)child of the folder
- *
- * @param \OCP\Files\Node $node
- * @return bool
- * @since 6.0.0
- */
- public function isSubNode($node);
- /**
- * get the content of this directory
- *
- * @throws \OCP\Files\NotFoundException
- * @return \OCP\Files\Node[]
- * @since 6.0.0
- */
- public function getDirectoryListing();
- /**
- * Get the node at $path
- *
- * @param string $path relative path of the file or folder
- * @return \OCP\Files\Node
- * @throws \OCP\Files\NotFoundException
- * @since 6.0.0
- */
- public function get($path);
- /**
- * Check if a file or folder exists in the folder
- *
- * @param string $path relative path of the file or folder
- * @return bool
- * @since 6.0.0
- */
- public function nodeExists($path);
- /**
- * Create a new folder
- *
- * @param string $path relative path of the new folder
- * @return \OCP\Files\Folder
- * @throws \OCP\Files\NotPermittedException
- * @since 6.0.0
- */
- public function newFolder($path);
- /**
- * Create a new file
- *
- * @param string $path relative path of the new file
- * @param string|resource|null $content content for the new file, since 19.0.0
- * @return \OCP\Files\File
- * @throws \OCP\Files\NotPermittedException
- * @since 6.0.0
- */
- public function newFile($path, $content = null);
- /**
- * search for files with the name matching $query
- *
- * @param string|ISearchQuery $query
- * @return \OCP\Files\Node[]
- * @since 6.0.0
- */
- public function search($query);
- /**
- * search for files by mimetype
- * $mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
- *
- * @param string $mimetype
- * @return \OCP\Files\Node[]
- * @since 6.0.0
- */
- public function searchByMime($mimetype);
- /**
- * search for files by tag
- *
- * @param string|int $tag tag name or tag id
- * @param string $userId owner of the tags
- * @return \OCP\Files\Node[]
- * @since 8.0.0
- */
- public function searchByTag($tag, $userId);
- /**
- * search for files by system tag
- *
- * @param string|int $tag tag name
- * @param string $userId user id to ensure access on returned nodes
- * @return \OCP\Files\Node[]
- * @since 28.0.0
- */
- public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0);
- /**
- * get a file or folder inside the folder by its internal id
- *
- * This method could return multiple entries. For example once the file/folder
- * is shared or mounted (files_external) to the user multiple times.
- *
- * Note that the different entries can have different permissions.
- *
- * @param int $id
- * @return \OCP\Files\Node[]
- * @since 6.0.0
- */
- public function getById($id);
- /**
- * get a file or folder inside the folder by its internal id
- *
- * Unlike getById, this method only returns a single node even if the user has
- * access to the file with the requested id multiple times.
- *
- * This method provides no guarantee about which of the nodes in returned and the
- * returned node might, for example, have less permissions than other nodes for the same file
- *
- * Apps that require accurate information about the users access to the file should use getById
- * instead of pick the correct node out of the result.
- *
- * @param int $id
- * @return Node|null
- * @since 29.0.0
- */
- public function getFirstNodeById(int $id): ?Node;
- /**
- * Get the amount of free space inside the folder
- *
- * @return int
- * @since 6.0.0
- */
- public function getFreeSpace();
- /**
- * Check if new files or folders can be created within the folder
- *
- * @return bool
- * @since 6.0.0
- */
- public function isCreatable();
- /**
- * Add a suffix to the name in case the file exists
- *
- * @param string $name
- * @return string
- * @throws NotPermittedException
- * @since 8.1.0
- */
- public function getNonExistingName($name);
- /**
- * @param int $limit
- * @param int $offset
- * @return \OCP\Files\Node[]
- * @since 9.1.0
- */
- public function getRecent($limit, $offset = 0);
- }
|