From 241e778ca768c0f18bab39df70655151c2097a58 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Wed, 3 Mar 2021 16:49:24 +0800 Subject: [PATCH] MDL-61768 repository_googledocs: Rest API function to list shared drives Adds a new rest API function in the googledocs repository which would return the existing shared drives. --- repository/googledocs/classes/rest.php | 16 +++++++++++++++- repository/upgrade.txt | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/repository/googledocs/classes/rest.php b/repository/googledocs/classes/rest.php index 6f46c55c05f..cc42ac38ea3 100644 --- a/repository/googledocs/classes/rest.php +++ b/repository/googledocs/classes/rest.php @@ -51,7 +51,10 @@ class rest extends \core\oauth2\rest { 'pageSize' => PARAM_INT, 'pageToken' => PARAM_RAW, 'q' => PARAM_RAW, - 'spaces' => PARAM_RAW + 'spaces' => PARAM_RAW, + 'supportsAllDrives' => PARAM_RAW, + 'includeItemsFromAllDrives' => PARAM_RAW, + 'corpora' => PARAM_RAW ], 'response' => 'json' ], @@ -123,6 +126,17 @@ class rest extends \core\oauth2\rest { ], 'response' => 'json' ], + 'shared_drives_list' => [ + 'endpoint' => 'https://www.googleapis.com/drive/v3/drives', + 'method' => 'get', + 'args' => [ + 'pageSize' => PARAM_INT, + 'pageToken' => PARAM_RAW, + 'q' => PARAM_RAW, + 'useDomainAdminAccess' => PARAM_RAW, + ], + 'response' => 'json', + ], ]; } } diff --git a/repository/upgrade.txt b/repository/upgrade.txt index da9fa2253d4..7c57e154b22 100644 --- a/repository/upgrade.txt +++ b/repository/upgrade.txt @@ -3,6 +3,10 @@ information provided here is intended especially for developers. Full details of the repository API are available on Moodle docs: http://docs.moodle.org/dev/Repository_API +=== 3.11 === +* The Google Drive repository now includes a new rest API function 'shared_drives_list', which can be used to fetch + a list of existing shared drives. + === 3.4 === Repositories should no longer directly call file_system#add_file_to_pool or file_system#add_string_to_pool instead they should call the stored_file method, set_synchronised_content_from_file or set_synchronised_content_from_string