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\Dialogflow\Resource;
19
20use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListPagesResponse;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3Page;
22use Google\Service\Dialogflow\GoogleProtobufEmpty;
23
24/**
25 * The "pages" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $dialogflowService = new Google\Service\Dialogflow(...);
29 *   $pages = $dialogflowService->pages;
30 *  </code>
31 */
32class ProjectsLocationsAgentsFlowsPages extends \Google\Service\Resource
33{
34  /**
35   * Creates a page in the specified flow. Note: You should always train a flow
36   * prior to sending it queries. See the [training
37   * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
38   * (pages.create)
39   *
40   * @param string $parent Required. The flow to create a page for. Format:
41   * `projects//locations//agents//flows/`.
42   * @param GoogleCloudDialogflowCxV3Page $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string languageCode The language of the following fields in
46   * `page`: * `Page.entry_fulfillment.messages` *
47   * `Page.entry_fulfillment.conditional_cases` *
48   * `Page.event_handlers.trigger_fulfillment.messages` *
49   * `Page.event_handlers.trigger_fulfillment.conditional_cases` *
50   * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` * `P
51   * age.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_case
52   * s` * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` *
53   * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
54   * ` * `Page.transition_routes.trigger_fulfillment.messages` *
55   * `Page.transition_routes.trigger_fulfillment.conditional_cases` If not
56   * specified, the agent's default language is used. [Many
57   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
58   * are supported. Note: languages must be enabled in the agent before they can
59   * be used.
60   * @return GoogleCloudDialogflowCxV3Page
61   */
62  public function create($parent, GoogleCloudDialogflowCxV3Page $postBody, $optParams = [])
63  {
64    $params = ['parent' => $parent, 'postBody' => $postBody];
65    $params = array_merge($params, $optParams);
66    return $this->call('create', [$params], GoogleCloudDialogflowCxV3Page::class);
67  }
68  /**
69   * Deletes the specified page. Note: You should always train a flow prior to
70   * sending it queries. See the [training
71   * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
72   * (pages.delete)
73   *
74   * @param string $name Required. The name of the page to delete. Format:
75   * `projects//locations//agents//Flows//pages/`.
76   * @param array $optParams Optional parameters.
77   *
78   * @opt_param bool force This field has no effect for pages with no incoming
79   * transitions. For pages with incoming transitions: * If `force` is set to
80   * false, an error will be returned with message indicating the incoming
81   * transitions. * If `force` is set to true, Dialogflow will remove the page, as
82   * well as any transitions to the page (i.e. Target page in event handlers or
83   * Target page in transition routes that point to this page will be cleared).
84   * @return GoogleProtobufEmpty
85   */
86  public function delete($name, $optParams = [])
87  {
88    $params = ['name' => $name];
89    $params = array_merge($params, $optParams);
90    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
91  }
92  /**
93   * Retrieves the specified page. (pages.get)
94   *
95   * @param string $name Required. The name of the page. Format:
96   * `projects//locations//agents//flows//pages/`.
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param string languageCode The language to retrieve the page for. The
100   * following fields are language dependent: * `Page.entry_fulfillment.messages`
101   * * `Page.entry_fulfillment.conditional_cases` *
102   * `Page.event_handlers.trigger_fulfillment.messages` *
103   * `Page.event_handlers.trigger_fulfillment.conditional_cases` *
104   * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` * `P
105   * age.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_case
106   * s` * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` *
107   * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
108   * ` * `Page.transition_routes.trigger_fulfillment.messages` *
109   * `Page.transition_routes.trigger_fulfillment.conditional_cases` If not
110   * specified, the agent's default language is used. [Many
111   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
112   * are supported. Note: languages must be enabled in the agent before they can
113   * be used.
114   * @return GoogleCloudDialogflowCxV3Page
115   */
116  public function get($name, $optParams = [])
117  {
118    $params = ['name' => $name];
119    $params = array_merge($params, $optParams);
120    return $this->call('get', [$params], GoogleCloudDialogflowCxV3Page::class);
121  }
122  /**
123   * Returns the list of all pages in the specified flow.
124   * (pages.listProjectsLocationsAgentsFlowsPages)
125   *
126   * @param string $parent Required. The flow to list all pages for. Format:
127   * `projects//locations//agents//flows/`.
128   * @param array $optParams Optional parameters.
129   *
130   * @opt_param string languageCode The language to list pages for. The following
131   * fields are language dependent: * `Page.entry_fulfillment.messages` *
132   * `Page.entry_fulfillment.conditional_cases` *
133   * `Page.event_handlers.trigger_fulfillment.messages` *
134   * `Page.event_handlers.trigger_fulfillment.conditional_cases` *
135   * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` * `P
136   * age.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_case
137   * s` * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` *
138   * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
139   * ` * `Page.transition_routes.trigger_fulfillment.messages` *
140   * `Page.transition_routes.trigger_fulfillment.conditional_cases` If not
141   * specified, the agent's default language is used. [Many
142   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
143   * are supported. Note: languages must be enabled in the agent before they can
144   * be used.
145   * @opt_param int pageSize The maximum number of items to return in a single
146   * page. By default 100 and at most 1000.
147   * @opt_param string pageToken The next_page_token value returned from a
148   * previous list request.
149   * @return GoogleCloudDialogflowCxV3ListPagesResponse
150   */
151  public function listProjectsLocationsAgentsFlowsPages($parent, $optParams = [])
152  {
153    $params = ['parent' => $parent];
154    $params = array_merge($params, $optParams);
155    return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListPagesResponse::class);
156  }
157  /**
158   * Updates the specified page. Note: You should always train a flow prior to
159   * sending it queries. See the [training
160   * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
161   * (pages.patch)
162   *
163   * @param string $name The unique identifier of the page. Required for the
164   * Pages.UpdatePage method. Pages.CreatePage populates the name automatically.
165   * Format: `projects//locations//agents//flows//pages/`.
166   * @param GoogleCloudDialogflowCxV3Page $postBody
167   * @param array $optParams Optional parameters.
168   *
169   * @opt_param string languageCode The language of the following fields in
170   * `page`: * `Page.entry_fulfillment.messages` *
171   * `Page.entry_fulfillment.conditional_cases` *
172   * `Page.event_handlers.trigger_fulfillment.messages` *
173   * `Page.event_handlers.trigger_fulfillment.conditional_cases` *
174   * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` * `P
175   * age.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_case
176   * s` * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` *
177   * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases
178   * ` * `Page.transition_routes.trigger_fulfillment.messages` *
179   * `Page.transition_routes.trigger_fulfillment.conditional_cases` If not
180   * specified, the agent's default language is used. [Many
181   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
182   * are supported. Note: languages must be enabled in the agent before they can
183   * be used.
184   * @opt_param string updateMask The mask to control which fields get updated. If
185   * the mask is not present, all fields will be updated.
186   * @return GoogleCloudDialogflowCxV3Page
187   */
188  public function patch($name, GoogleCloudDialogflowCxV3Page $postBody, $optParams = [])
189  {
190    $params = ['name' => $name, 'postBody' => $postBody];
191    $params = array_merge($params, $optParams);
192    return $this->call('patch', [$params], GoogleCloudDialogflowCxV3Page::class);
193  }
194}
195
196// Adding a class alias for backwards compatibility with the previous class name.
197class_alias(ProjectsLocationsAgentsFlowsPages::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsFlowsPages');
198