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 |
|
---|
18 | namespace Google\Service;
|
---|
19 |
|
---|
20 | use 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 | */
|
---|
35 | class 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 | public $rootUrlTemplate;
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Constructs the internal representation of the Forms service.
|
---|
63 | *
|
---|
64 | * @param Client|array $clientOrConfig The client used to deliver requests, or a
|
---|
65 | * config array to pass to a new Client instance.
|
---|
66 | * @param string $rootUrl The root URL used for requests to the service.
|
---|
67 | */
|
---|
68 | public function __construct($clientOrConfig = [], $rootUrl = null)
|
---|
69 | {
|
---|
70 | parent::__construct($clientOrConfig);
|
---|
71 | $this->rootUrl = $rootUrl ?: 'https://forms.googleapis.com/';
|
---|
72 | $this->rootUrlTemplate = $rootUrl ?: 'https://forms.UNIVERSE_DOMAIN/';
|
---|
73 | $this->servicePath = '';
|
---|
74 | $this->batchPath = 'batch';
|
---|
75 | $this->version = 'v1';
|
---|
76 | $this->serviceName = 'forms';
|
---|
77 |
|
---|
78 | $this->forms = new Forms\Resource\Forms(
|
---|
79 | $this,
|
---|
80 | $this->serviceName,
|
---|
81 | 'forms',
|
---|
82 | [
|
---|
83 | 'methods' => [
|
---|
84 | 'batchUpdate' => [
|
---|
85 | 'path' => 'v1/forms/{formId}:batchUpdate',
|
---|
86 | 'httpMethod' => 'POST',
|
---|
87 | 'parameters' => [
|
---|
88 | 'formId' => [
|
---|
89 | 'location' => 'path',
|
---|
90 | 'type' => 'string',
|
---|
91 | 'required' => true,
|
---|
92 | ],
|
---|
93 | ],
|
---|
94 | ],'create' => [
|
---|
95 | 'path' => 'v1/forms',
|
---|
96 | 'httpMethod' => 'POST',
|
---|
97 | 'parameters' => [],
|
---|
98 | ],'get' => [
|
---|
99 | 'path' => 'v1/forms/{formId}',
|
---|
100 | 'httpMethod' => 'GET',
|
---|
101 | 'parameters' => [
|
---|
102 | 'formId' => [
|
---|
103 | 'location' => 'path',
|
---|
104 | 'type' => 'string',
|
---|
105 | 'required' => true,
|
---|
106 | ],
|
---|
107 | ],
|
---|
108 | ],
|
---|
109 | ]
|
---|
110 | ]
|
---|
111 | );
|
---|
112 | $this->forms_responses = new Forms\Resource\FormsResponses(
|
---|
113 | $this,
|
---|
114 | $this->serviceName,
|
---|
115 | 'responses',
|
---|
116 | [
|
---|
117 | 'methods' => [
|
---|
118 | 'get' => [
|
---|
119 | 'path' => 'v1/forms/{formId}/responses/{responseId}',
|
---|
120 | 'httpMethod' => 'GET',
|
---|
121 | 'parameters' => [
|
---|
122 | 'formId' => [
|
---|
123 | 'location' => 'path',
|
---|
124 | 'type' => 'string',
|
---|
125 | 'required' => true,
|
---|
126 | ],
|
---|
127 | 'responseId' => [
|
---|
128 | 'location' => 'path',
|
---|
129 | 'type' => 'string',
|
---|
130 | 'required' => true,
|
---|
131 | ],
|
---|
132 | ],
|
---|
133 | ],'list' => [
|
---|
134 | 'path' => 'v1/forms/{formId}/responses',
|
---|
135 | 'httpMethod' => 'GET',
|
---|
136 | 'parameters' => [
|
---|
137 | 'formId' => [
|
---|
138 | 'location' => 'path',
|
---|
139 | 'type' => 'string',
|
---|
140 | 'required' => true,
|
---|
141 | ],
|
---|
142 | 'filter' => [
|
---|
143 | 'location' => 'query',
|
---|
144 | 'type' => 'string',
|
---|
145 | ],
|
---|
146 | 'pageSize' => [
|
---|
147 | 'location' => 'query',
|
---|
148 | 'type' => 'integer',
|
---|
149 | ],
|
---|
150 | 'pageToken' => [
|
---|
151 | 'location' => 'query',
|
---|
152 | 'type' => 'string',
|
---|
153 | ],
|
---|
154 | ],
|
---|
155 | ],
|
---|
156 | ]
|
---|
157 | ]
|
---|
158 | );
|
---|
159 | $this->forms_watches = new Forms\Resource\FormsWatches(
|
---|
160 | $this,
|
---|
161 | $this->serviceName,
|
---|
162 | 'watches',
|
---|
163 | [
|
---|
164 | 'methods' => [
|
---|
165 | 'create' => [
|
---|
166 | 'path' => 'v1/forms/{formId}/watches',
|
---|
167 | 'httpMethod' => 'POST',
|
---|
168 | 'parameters' => [
|
---|
169 | 'formId' => [
|
---|
170 | 'location' => 'path',
|
---|
171 | 'type' => 'string',
|
---|
172 | 'required' => true,
|
---|
173 | ],
|
---|
174 | ],
|
---|
175 | ],'delete' => [
|
---|
176 | 'path' => 'v1/forms/{formId}/watches/{watchId}',
|
---|
177 | 'httpMethod' => 'DELETE',
|
---|
178 | 'parameters' => [
|
---|
179 | 'formId' => [
|
---|
180 | 'location' => 'path',
|
---|
181 | 'type' => 'string',
|
---|
182 | 'required' => true,
|
---|
183 | ],
|
---|
184 | 'watchId' => [
|
---|
185 | 'location' => 'path',
|
---|
186 | 'type' => 'string',
|
---|
187 | 'required' => true,
|
---|
188 | ],
|
---|
189 | ],
|
---|
190 | ],'list' => [
|
---|
191 | 'path' => 'v1/forms/{formId}/watches',
|
---|
192 | 'httpMethod' => 'GET',
|
---|
193 | 'parameters' => [
|
---|
194 | 'formId' => [
|
---|
195 | 'location' => 'path',
|
---|
196 | 'type' => 'string',
|
---|
197 | 'required' => true,
|
---|
198 | ],
|
---|
199 | ],
|
---|
200 | ],'renew' => [
|
---|
201 | 'path' => 'v1/forms/{formId}/watches/{watchId}:renew',
|
---|
202 | 'httpMethod' => 'POST',
|
---|
203 | 'parameters' => [
|
---|
204 | 'formId' => [
|
---|
205 | 'location' => 'path',
|
---|
206 | 'type' => 'string',
|
---|
207 | 'required' => true,
|
---|
208 | ],
|
---|
209 | 'watchId' => [
|
---|
210 | 'location' => 'path',
|
---|
211 | 'type' => 'string',
|
---|
212 | 'required' => true,
|
---|
213 | ],
|
---|
214 | ],
|
---|
215 | ],
|
---|
216 | ]
|
---|
217 | ]
|
---|
218 | );
|
---|
219 | }
|
---|
220 | }
|
---|
221 |
|
---|
222 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
223 | class_alias(Forms::class, 'Google_Service_Forms');
|
---|