1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service; 19 20use Google\Client; 21 22/** 23 * Service definition for Forms (v1). 24 * 25 * <p> 26 * Reads and writes Google Forms and responses.</p> 27 * 28 * <p> 29 * For more information about this service, see the API 30 * <a href="https://developers.google.com/forms/api" target="_blank">Documentation</a> 31 * </p> 32 * 33 * @author Google, Inc. 34 */ 35class Forms extends \Google\Service 36{ 37 /** See, edit, create, and delete all of your Google Drive files. */ 38 const DRIVE = 39 "https://www.googleapis.com/auth/drive"; 40 /** See, edit, create, and delete only the specific Google Drive files you use with this app. */ 41 const DRIVE_FILE = 42 "https://www.googleapis.com/auth/drive.file"; 43 /** See and download all your Google Drive files. */ 44 const DRIVE_READONLY = 45 "https://www.googleapis.com/auth/drive.readonly"; 46 /** See, edit, create, and delete all your Google Forms forms. */ 47 const FORMS_BODY = 48 "https://www.googleapis.com/auth/forms.body"; 49 /** See all your Google Forms forms. */ 50 const FORMS_BODY_READONLY = 51 "https://www.googleapis.com/auth/forms.body.readonly"; 52 /** See all responses to your Google Forms forms. */ 53 const FORMS_RESPONSES_READONLY = 54 "https://www.googleapis.com/auth/forms.responses.readonly"; 55 56 public $forms; 57 public $forms_responses; 58 public $forms_watches; 59 60 /** 61 * Constructs the internal representation of the Forms service. 62 * 63 * @param Client|array $clientOrConfig The client used to deliver requests, or a 64 * config array to pass to a new Client instance. 65 * @param string $rootUrl The root URL used for requests to the service. 66 */ 67 public function __construct($clientOrConfig = [], $rootUrl = null) 68 { 69 parent::__construct($clientOrConfig); 70 $this->rootUrl = $rootUrl ?: 'https://forms.googleapis.com/'; 71 $this->servicePath = ''; 72 $this->batchPath = 'batch'; 73 $this->version = 'v1'; 74 $this->serviceName = 'forms'; 75 76 $this->forms = new Forms\Resource\Forms( 77 $this, 78 $this->serviceName, 79 'forms', 80 [ 81 'methods' => [ 82 'batchUpdate' => [ 83 'path' => 'v1/forms/{formId}:batchUpdate', 84 'httpMethod' => 'POST', 85 'parameters' => [ 86 'formId' => [ 87 'location' => 'path', 88 'type' => 'string', 89 'required' => true, 90 ], 91 ], 92 ],'create' => [ 93 'path' => 'v1/forms', 94 'httpMethod' => 'POST', 95 'parameters' => [], 96 ],'get' => [ 97 'path' => 'v1/forms/{formId}', 98 'httpMethod' => 'GET', 99 'parameters' => [ 100 'formId' => [ 101 'location' => 'path', 102 'type' => 'string', 103 'required' => true, 104 ], 105 ], 106 ], 107 ] 108 ] 109 ); 110 $this->forms_responses = new Forms\Resource\FormsResponses( 111 $this, 112 $this->serviceName, 113 'responses', 114 [ 115 'methods' => [ 116 'get' => [ 117 'path' => 'v1/forms/{formId}/responses/{responseId}', 118 'httpMethod' => 'GET', 119 'parameters' => [ 120 'formId' => [ 121 'location' => 'path', 122 'type' => 'string', 123 'required' => true, 124 ], 125 'responseId' => [ 126 'location' => 'path', 127 'type' => 'string', 128 'required' => true, 129 ], 130 ], 131 ],'list' => [ 132 'path' => 'v1/forms/{formId}/responses', 133 'httpMethod' => 'GET', 134 'parameters' => [ 135 'formId' => [ 136 'location' => 'path', 137 'type' => 'string', 138 'required' => true, 139 ], 140 'filter' => [ 141 'location' => 'query', 142 'type' => 'string', 143 ], 144 'pageSize' => [ 145 'location' => 'query', 146 'type' => 'integer', 147 ], 148 'pageToken' => [ 149 'location' => 'query', 150 'type' => 'string', 151 ], 152 ], 153 ], 154 ] 155 ] 156 ); 157 $this->forms_watches = new Forms\Resource\FormsWatches( 158 $this, 159 $this->serviceName, 160 'watches', 161 [ 162 'methods' => [ 163 'create' => [ 164 'path' => 'v1/forms/{formId}/watches', 165 'httpMethod' => 'POST', 166 'parameters' => [ 167 'formId' => [ 168 'location' => 'path', 169 'type' => 'string', 170 'required' => true, 171 ], 172 ], 173 ],'delete' => [ 174 'path' => 'v1/forms/{formId}/watches/{watchId}', 175 'httpMethod' => 'DELETE', 176 'parameters' => [ 177 'formId' => [ 178 'location' => 'path', 179 'type' => 'string', 180 'required' => true, 181 ], 182 'watchId' => [ 183 'location' => 'path', 184 'type' => 'string', 185 'required' => true, 186 ], 187 ], 188 ],'list' => [ 189 'path' => 'v1/forms/{formId}/watches', 190 'httpMethod' => 'GET', 191 'parameters' => [ 192 'formId' => [ 193 'location' => 'path', 194 'type' => 'string', 195 'required' => true, 196 ], 197 ], 198 ],'renew' => [ 199 'path' => 'v1/forms/{formId}/watches/{watchId}:renew', 200 'httpMethod' => 'POST', 201 'parameters' => [ 202 'formId' => [ 203 'location' => 'path', 204 'type' => 'string', 205 'required' => true, 206 ], 207 'watchId' => [ 208 'location' => 'path', 209 'type' => 'string', 210 'required' => true, 211 ], 212 ], 213 ], 214 ] 215 ] 216 ); 217 } 218} 219 220// Adding a class alias for backwards compatibility with the previous class name. 221class_alias(Forms::class, 'Google_Service_Forms'); 222