REST interface to Nextcloud's implementation of Open Collaboration Services.
Copyright: | 2017 Jan Dageförde (Learnweb, University of Münster) |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 179 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
ocs_client:: (4 methods):
__construct()
get_api_functions()
build_share_url()
call()
Class: ocs_client - X-Ref
REST interface to Nextcloud's implementation of Open Collaboration Services.__construct(client $oauthclient) X-Ref |
Get endpoint URLs from the used issuer to use them in get_api_functions(). param: client $oauthclient OAuth-authenticated Nextcloud client |
get_api_functions() X-Ref |
Define relevant functions of the OCS API. Previously, the instruction to create a oauthclient recommended the user to enter the return format (format=xml). However, in this case the shareid is appended at the wrong place. Therefore, a new url is build which inserts the shareid at the suitable place for delete_share and get_information_of_share. create_share docs: https://docs.nextcloud.com/server/13/developer_manual/core/ocs-share-api.html#create-a-new-share |
build_share_url() X-Ref |
Private Function to return a url with the shareid in the path. return: string |
call($functionname, $functionargs, $rawpost = false, $contenttype = false) X-Ref |
In POST requests, Moodle's REST API assumes that params are - transmitted as part of the URL or - expressed in JSON. Neither is true; we are passing an array to $functionargs which is then put into CURLOPT_POSTFIELDS. Curl assumes the content type to be `multipart/form-data` then, but the Moodle REST API tries to put a JSON content type. As a result, clients would fail. To make this less tedious to use, we assume that the params-as-array-in-$functionargs is the default for us. param: string $functionname Name of a function from get_api_functions() param: array $functionargs Request parameters param: bool|string $rawpost Optional param to include in the body of a post param: bool|string $contenttype Content type of the request body. Default: multipart/form-data if !$rawpost, JSON otherwise return: object|string |