Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Google Drive Rest API. 19 * 20 * @package repository_googledocs 21 * @copyright 2017 Damyon Wiese 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace repository_googledocs; 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 /** 29 * Google Drive Rest API. 30 * 31 * @copyright 2017 Damyon Wiese 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class rest extends \core\oauth2\rest { 35 36 /** 37 * Define the functions of the rest API. 38 * 39 * @return array Example: 40 * [ 'listFiles' => [ 'method' => 'get', 'endpoint' => 'http://...', 'args' => [ 'folder' => PARAM_STRING ] ] ] 41 */ 42 public function get_api_functions() { 43 return [ 44 'list' => [ 45 'endpoint' => 'https://www.googleapis.com/drive/v3/files', 46 'method' => 'get', 47 'args' => [ 48 'corpus' => PARAM_RAW, 49 'orderBy' => PARAM_RAW, 50 'fields' => PARAM_RAW, 51 'pageSize' => PARAM_INT, 52 'pageToken' => PARAM_RAW, 53 'q' => PARAM_RAW, 54 'spaces' => PARAM_RAW 55 ], 56 'response' => 'json' 57 ], 58 'get' => [ 59 'endpoint' => 'https://www.googleapis.com/drive/v3/files/{fileid}', 60 'method' => 'get', 61 'args' => [ 62 'fields' => PARAM_RAW, 63 'fileid' => PARAM_RAW 64 ], 65 'response' => 'json' 66 ], 67 'copy' => [ 68 'endpoint' => 'https://www.googleapis.com/drive/v3/files/{fileid}/copy', 69 'method' => 'post', 70 'args' => [ 71 'fields' => PARAM_RAW, 72 'fileid' => PARAM_RAW 73 ], 74 'response' => 'json' 75 ], 76 'delete' => [ 77 'endpoint' => 'https://www.googleapis.com/drive/v3/files/{fileid}', 78 'method' => 'delete', 79 'args' => [ 80 'fileid' => PARAM_RAW 81 ], 82 'response' => 'json' 83 ], 84 'create' => [ 85 'endpoint' => 'https://www.googleapis.com/drive/v3/files', 86 'method' => 'post', 87 'args' => [ 88 'fields' => PARAM_RAW 89 ], 90 'response' => 'json' 91 ], 92 'update' => [ 93 'endpoint' => 'https://www.googleapis.com/drive/v3/files/{fileid}', 94 'method' => 'patch', 95 'args' => [ 96 'fileid' => PARAM_RAW, 97 'fields' => PARAM_RAW, 98 'addParents' => PARAM_RAW, 99 'removeParents' => PARAM_RAW 100 ], 101 'response' => 'json' 102 ], 103 'create_permission' => [ 104 'endpoint' => 'https://www.googleapis.com/drive/v3/files/{fileid}/permissions', 105 'method' => 'post', 106 'args' => [ 107 'fileid' => PARAM_RAW, 108 'emailMessage' => PARAM_RAW, 109 'sendNotificationEmail' => PARAM_RAW, 110 'transferOwnership' => PARAM_RAW, 111 ], 112 'response' => 'json' 113 ], 114 'update_permission' => [ 115 'endpoint' => 'https://www.googleapis.com/drive/v3/files/{fileid}/permissions/{permissionid}', 116 'method' => 'patch', 117 'args' => [ 118 'fileid' => PARAM_RAW, 119 'permissionid' => PARAM_RAW, 120 'emailMessage' => PARAM_RAW, 121 'sendNotificationEmail' => PARAM_RAW, 122 'transferOwnership' => PARAM_RAW, 123 ], 124 'response' => 'json' 125 ], 126 ]; 127 } 128 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body