satana.konst/next-cloud-web-dav-sdk

NextCloud WebDav Api 的Sdk

0.1.2 2020-07-24 08:52 UTC

This package is auto-updated.

Last update: 2024-09-06 20:31:44 UTC


README

#NextCloudWebDavSdk# WebDav 和 Share 类的包装

$sdk = new \NextCloudWebDavSdk\NextCloudWebDavSdk( 'http://192.168.0.1', 'login', 'pass' ); $response = $sdk->webDav->getListingFolder(); $response = $sdk->share->createShare();

下面列出了所有类的方法。

##WebDav##

WebDav 操作文档 https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/index.html

###认证### $webDav = new \NextCloudWebDavSdk\WebDav\Server( 'host', 'login', 'pass' );

###获取文件列表### $response = $webDav->getListingFolder( '/path/to/file' );

###下载文件### $response = $webDav->downloadFile( '/path/to/download/file', 'path/to/save/file' );

###上传文件### $response = $webDav->uploadFile( 'path/to/upload/file/test_upload_pdf.pdf', '/path/for/save/file/' );

###创建文件夹### $response = $webDav->createFolder( '/path/to/new/folder/', );

###删除文件或目录### $response = $webDav->removeFileOrDirectory( '/path/to/file/or/directory', );

###移动文件或目录### $response = $webDav->moveFileOrDirectory( '/path/file/to/move', '/path/file/to/destination' );

###复制文件或目录### $response = $webDav->copyFileOrDirectory( '/path/file/to/copy', '/path/file/to/destination' );

###搜索文件和文件夹 搜索元素的可选属性
$selectProperties = ['{DAV:}getlastmodified','{DAV:}getetag', ... ];

相对于用户根目录的搜索范围
$searchScope = '/path/to/destination/';

搜索的深度
$searchScopeDepth = 'infinity';

搜索条件
$searchWhere = ['eq::{http://owncloud.org/ns}fileid' => 999, ...];

排序
$searchOrderBy = ['{http://owncloud.org/ns}fileid' => 'ascending', ...];

$response = $webDav->search($selectProperties, $searchScope, $searchScopeDepth, $searchWhere, $searchOrderBy);

##Share##

共享文档 https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html

###认证### $share = new \NextCloudWebDavSdk\OCS\Share( 'host', 'login', 'pass' );

###共享文件### $response = $share->createShare( 'path/to/share/file' );

###删除共享### $response = $share->removeShare( 'shareID' );

###获取共享### $response = $share->getShares( 'path/to/share/file' );

###更新共享### $response = $share->updateShare( 'shareID' );