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\BatchUpdateFormRequest;
21use Google\Service\Forms\BatchUpdateFormResponse;
22use Google\Service\Forms\Form;
23
24/**
25 * The "forms" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $formsService = new Google\Service\Forms(...);
29 *   $forms = $formsService->forms;
30 *  </code>
31 */
32class Forms extends \Google\Service\Resource
33{
34  /**
35   * Change the form with a batch of updates. (forms.batchUpdate)
36   *
37   * @param string $formId Required. The form ID.
38   * @param BatchUpdateFormRequest $postBody
39   * @param array $optParams Optional parameters.
40   * @return BatchUpdateFormResponse
41   */
42  public function batchUpdate($formId, BatchUpdateFormRequest $postBody, $optParams = [])
43  {
44    $params = ['formId' => $formId, 'postBody' => $postBody];
45    $params = array_merge($params, $optParams);
46    return $this->call('batchUpdate', [$params], BatchUpdateFormResponse::class);
47  }
48  /**
49   * Create a new form using the title given in the provided form message in the
50   * request. *Important:* Only the form.info.title and form.info.document_title
51   * fields are copied to the new form. All other fields including the form
52   * description, items and settings are disallowed. To create a new form and add
53   * items, you must first call forms.create to create an empty form with a title
54   * and (optional) document title, and then call forms.update to add the items.
55   * (forms.create)
56   *
57   * @param Form $postBody
58   * @param array $optParams Optional parameters.
59   * @return Form
60   */
61  public function create(Form $postBody, $optParams = [])
62  {
63    $params = ['postBody' => $postBody];
64    $params = array_merge($params, $optParams);
65    return $this->call('create', [$params], Form::class);
66  }
67  /**
68   * Get a form. (forms.get)
69   *
70   * @param string $formId Required. The form ID.
71   * @param array $optParams Optional parameters.
72   * @return Form
73   */
74  public function get($formId, $optParams = [])
75  {
76    $params = ['formId' => $formId];
77    $params = array_merge($params, $optParams);
78    return $this->call('get', [$params], Form::class);
79  }
80}
81
82// Adding a class alias for backwards compatibility with the previous class name.
83class_alias(Forms::class, 'Google_Service_Forms_Resource_Forms');
84