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\Forms\Resource;
19
20use Google\Service\Forms\FormResponse;
21use Google\Service\Forms\ListFormResponsesResponse;
22
23/**
24 * The "responses" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $formsService = new Google\Service\Forms(...);
28 *   $responses = $formsService->responses;
29 *  </code>
30 */
31class FormsResponses extends \Google\Service\Resource
32{
33  /**
34   * Get one response from the form. (responses.get)
35   *
36   * @param string $formId Required. The form ID.
37   * @param string $responseId Required. The response ID within the form.
38   * @param array $optParams Optional parameters.
39   * @return FormResponse
40   */
41  public function get($formId, $responseId, $optParams = [])
42  {
43    $params = ['formId' => $formId, 'responseId' => $responseId];
44    $params = array_merge($params, $optParams);
45    return $this->call('get', [$params], FormResponse::class);
46  }
47  /**
48   * List a form's responses. (responses.listFormsResponses)
49   *
50   * @param string $formId Required. ID of the Form whose responses to list.
51   * @param array $optParams Optional parameters.
52   *
53   * @opt_param string filter Which form responses to return. Currently, the only
54   * supported filters are: * timestamp > *N* which means to get all form
55   * responses submitted after (but not at) timestamp *N*. * timestamp >= *N*
56   * which means to get all form responses submitted at and after timestamp *N*.
57   * For both supported filters, timestamp must be formatted in RFC3339 UTC "Zulu"
58   * format. Examples: "2014-10-02T15:01:23Z" and
59   * "2014-10-02T15:01:23.045123456Z".
60   * @opt_param int pageSize The maximum number of responses to return. The
61   * service may return fewer than this value. If unspecified or zero, at most
62   * 5000 responses are returned.
63   * @opt_param string pageToken A page token returned by a previous list
64   * response. If this field is set, the form and the values of the filter must be
65   * the same as for the original request.
66   * @return ListFormResponsesResponse
67   */
68  public function listFormsResponses($formId, $optParams = [])
69  {
70    $params = ['formId' => $formId];
71    $params = array_merge($params, $optParams);
72    return $this->call('list', [$params], ListFormResponsesResponse::class);
73  }
74}
75
76// Adding a class alias for backwards compatibility with the previous class name.
77class_alias(FormsResponses::class, 'Google_Service_Forms_Resource_FormsResponses');
78