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\GoogleCloudDialogflowCxV3ExportFlowRequest; 21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3Flow; 22use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3FlowValidationResult; 23use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ImportFlowRequest; 24use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListFlowsResponse; 25use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3TrainFlowRequest; 26use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ValidateFlowRequest; 27use Google\Service\Dialogflow\GoogleLongrunningOperation; 28use Google\Service\Dialogflow\GoogleProtobufEmpty; 29 30/** 31 * The "flows" collection of methods. 32 * Typical usage is: 33 * <code> 34 * $dialogflowService = new Google\Service\Dialogflow(...); 35 * $flows = $dialogflowService->flows; 36 * </code> 37 */ 38class ProjectsLocationsAgentsFlows extends \Google\Service\Resource 39{ 40 /** 41 * Creates a flow in the specified agent. Note: You should always train a flow 42 * prior to sending it queries. See the [training 43 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 44 * (flows.create) 45 * 46 * @param string $parent Required. The agent to create a flow for. Format: 47 * `projects//locations//agents/`. 48 * @param GoogleCloudDialogflowCxV3Flow $postBody 49 * @param array $optParams Optional parameters. 50 * 51 * @opt_param string languageCode The language of the following fields in 52 * `flow`: * `Flow.event_handlers.trigger_fulfillment.messages` * 53 * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * 54 * `Flow.transition_routes.trigger_fulfillment.messages` * 55 * `Flow.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 GoogleCloudDialogflowCxV3Flow 61 */ 62 public function create($parent, GoogleCloudDialogflowCxV3Flow $postBody, $optParams = []) 63 { 64 $params = ['parent' => $parent, 'postBody' => $postBody]; 65 $params = array_merge($params, $optParams); 66 return $this->call('create', [$params], GoogleCloudDialogflowCxV3Flow::class); 67 } 68 /** 69 * Deletes a specified flow. (flows.delete) 70 * 71 * @param string $name Required. The name of the flow to delete. Format: 72 * `projects//locations//agents//flows/`. 73 * @param array $optParams Optional parameters. 74 * 75 * @opt_param bool force This field has no effect for flows with no incoming 76 * transitions. For flows with incoming transitions: * If `force` is set to 77 * false, an error will be returned with message indicating the incoming 78 * transitions. * If `force` is set to true, Dialogflow will remove the flow, as 79 * well as any transitions to the flow (i.e. Target flow in event handlers or 80 * Target flow in transition routes that point to this flow will be cleared). 81 * @return GoogleProtobufEmpty 82 */ 83 public function delete($name, $optParams = []) 84 { 85 $params = ['name' => $name]; 86 $params = array_merge($params, $optParams); 87 return $this->call('delete', [$params], GoogleProtobufEmpty::class); 88 } 89 /** 90 * Exports the specified flow to a binary file. This method is a [long-running 91 * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running- 92 * operation). The returned `Operation` type has the following method-specific 93 * fields: - `metadata`: An empty [Struct message](https://developers.google.com 94 * /protocol-buffers/docs/reference/google.protobuf#struct) - `response`: 95 * ExportFlowResponse Note that resources (e.g. intents, entities, webhooks) 96 * that the flow references will also be exported. (flows.export) 97 * 98 * @param string $name Required. The name of the flow to export. Format: 99 * `projects//locations//agents//flows/`. 100 * @param GoogleCloudDialogflowCxV3ExportFlowRequest $postBody 101 * @param array $optParams Optional parameters. 102 * @return GoogleLongrunningOperation 103 */ 104 public function export($name, GoogleCloudDialogflowCxV3ExportFlowRequest $postBody, $optParams = []) 105 { 106 $params = ['name' => $name, 'postBody' => $postBody]; 107 $params = array_merge($params, $optParams); 108 return $this->call('export', [$params], GoogleLongrunningOperation::class); 109 } 110 /** 111 * Retrieves the specified flow. (flows.get) 112 * 113 * @param string $name Required. The name of the flow to get. Format: 114 * `projects//locations//agents//flows/`. 115 * @param array $optParams Optional parameters. 116 * 117 * @opt_param string languageCode The language to retrieve the flow for. The 118 * following fields are language dependent: * 119 * `Flow.event_handlers.trigger_fulfillment.messages` * 120 * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * 121 * `Flow.transition_routes.trigger_fulfillment.messages` * 122 * `Flow.transition_routes.trigger_fulfillment.conditional_cases` If not 123 * specified, the agent's default language is used. [Many 124 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 125 * are supported. Note: languages must be enabled in the agent before they can 126 * be used. 127 * @return GoogleCloudDialogflowCxV3Flow 128 */ 129 public function get($name, $optParams = []) 130 { 131 $params = ['name' => $name]; 132 $params = array_merge($params, $optParams); 133 return $this->call('get', [$params], GoogleCloudDialogflowCxV3Flow::class); 134 } 135 /** 136 * Gets the latest flow validation result. Flow validation is performed when 137 * ValidateFlow is called. (flows.getValidationResult) 138 * 139 * @param string $name Required. The flow name. Format: 140 * `projects//locations//agents//flows//validationResult`. 141 * @param array $optParams Optional parameters. 142 * 143 * @opt_param string languageCode If not specified, the agent's default language 144 * is used. 145 * @return GoogleCloudDialogflowCxV3FlowValidationResult 146 */ 147 public function getValidationResult($name, $optParams = []) 148 { 149 $params = ['name' => $name]; 150 $params = array_merge($params, $optParams); 151 return $this->call('getValidationResult', [$params], GoogleCloudDialogflowCxV3FlowValidationResult::class); 152 } 153 /** 154 * Imports the specified flow to the specified agent from a binary file. This 155 * method is a [long-running 156 * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running- 157 * operation). The returned `Operation` type has the following method-specific 158 * fields: - `metadata`: An empty [Struct message](https://developers.google.com 159 * /protocol-buffers/docs/reference/google.protobuf#struct) - `response`: 160 * ImportFlowResponse Note: You should always train a flow prior to sending it 161 * queries. See the [training 162 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 163 * (flows.import) 164 * 165 * @param string $parent Required. The agent to import the flow into. Format: 166 * `projects//locations//agents/`. 167 * @param GoogleCloudDialogflowCxV3ImportFlowRequest $postBody 168 * @param array $optParams Optional parameters. 169 * @return GoogleLongrunningOperation 170 */ 171 public function import($parent, GoogleCloudDialogflowCxV3ImportFlowRequest $postBody, $optParams = []) 172 { 173 $params = ['parent' => $parent, 'postBody' => $postBody]; 174 $params = array_merge($params, $optParams); 175 return $this->call('import', [$params], GoogleLongrunningOperation::class); 176 } 177 /** 178 * Returns the list of all flows in the specified agent. 179 * (flows.listProjectsLocationsAgentsFlows) 180 * 181 * @param string $parent Required. The agent containing the flows. Format: 182 * `projects//locations//agents/`. 183 * @param array $optParams Optional parameters. 184 * 185 * @opt_param string languageCode The language to list flows for. The following 186 * fields are language dependent: * 187 * `Flow.event_handlers.trigger_fulfillment.messages` * 188 * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * 189 * `Flow.transition_routes.trigger_fulfillment.messages` * 190 * `Flow.transition_routes.trigger_fulfillment.conditional_cases` If not 191 * specified, the agent's default language is used. [Many 192 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 193 * are supported. Note: languages must be enabled in the agent before they can 194 * be used. 195 * @opt_param int pageSize The maximum number of items to return in a single 196 * page. By default 100 and at most 1000. 197 * @opt_param string pageToken The next_page_token value returned from a 198 * previous list request. 199 * @return GoogleCloudDialogflowCxV3ListFlowsResponse 200 */ 201 public function listProjectsLocationsAgentsFlows($parent, $optParams = []) 202 { 203 $params = ['parent' => $parent]; 204 $params = array_merge($params, $optParams); 205 return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListFlowsResponse::class); 206 } 207 /** 208 * Updates the specified flow. Note: You should always train a flow prior to 209 * sending it queries. See the [training 210 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 211 * (flows.patch) 212 * 213 * @param string $name The unique identifier of the flow. Format: 214 * `projects//locations//agents//flows/`. 215 * @param GoogleCloudDialogflowCxV3Flow $postBody 216 * @param array $optParams Optional parameters. 217 * 218 * @opt_param string languageCode The language of the following fields in 219 * `flow`: * `Flow.event_handlers.trigger_fulfillment.messages` * 220 * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * 221 * `Flow.transition_routes.trigger_fulfillment.messages` * 222 * `Flow.transition_routes.trigger_fulfillment.conditional_cases` If not 223 * specified, the agent's default language is used. [Many 224 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 225 * are supported. Note: languages must be enabled in the agent before they can 226 * be used. 227 * @opt_param string updateMask The mask to control which fields get updated. If 228 * the mask is not present, all fields will be updated. 229 * @return GoogleCloudDialogflowCxV3Flow 230 */ 231 public function patch($name, GoogleCloudDialogflowCxV3Flow $postBody, $optParams = []) 232 { 233 $params = ['name' => $name, 'postBody' => $postBody]; 234 $params = array_merge($params, $optParams); 235 return $this->call('patch', [$params], GoogleCloudDialogflowCxV3Flow::class); 236 } 237 /** 238 * Trains the specified flow. Note that only the flow in 'draft' environment is 239 * trained. This method is a [long-running 240 * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running- 241 * operation). The returned `Operation` type has the following method-specific 242 * fields: - `metadata`: An empty [Struct message](https://developers.google.com 243 * /protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An 244 * [Empty message](https://developers.google.com/protocol- 245 * buffers/docs/reference/google.protobuf#empty) Note: You should always train a 246 * flow prior to sending it queries. See the [training 247 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 248 * (flows.train) 249 * 250 * @param string $name Required. The flow to train. Format: 251 * `projects//locations//agents//flows/`. 252 * @param GoogleCloudDialogflowCxV3TrainFlowRequest $postBody 253 * @param array $optParams Optional parameters. 254 * @return GoogleLongrunningOperation 255 */ 256 public function train($name, GoogleCloudDialogflowCxV3TrainFlowRequest $postBody, $optParams = []) 257 { 258 $params = ['name' => $name, 'postBody' => $postBody]; 259 $params = array_merge($params, $optParams); 260 return $this->call('train', [$params], GoogleLongrunningOperation::class); 261 } 262 /** 263 * Validates the specified flow and creates or updates validation results. 264 * Please call this API after the training is completed to get the complete 265 * validation results. (flows.validate) 266 * 267 * @param string $name Required. The flow to validate. Format: 268 * `projects//locations//agents//flows/`. 269 * @param GoogleCloudDialogflowCxV3ValidateFlowRequest $postBody 270 * @param array $optParams Optional parameters. 271 * @return GoogleCloudDialogflowCxV3FlowValidationResult 272 */ 273 public function validate($name, GoogleCloudDialogflowCxV3ValidateFlowRequest $postBody, $optParams = []) 274 { 275 $params = ['name' => $name, 'postBody' => $postBody]; 276 $params = array_merge($params, $optParams); 277 return $this->call('validate', [$params], GoogleCloudDialogflowCxV3FlowValidationResult::class); 278 } 279} 280 281// Adding a class alias for backwards compatibility with the previous class name. 282class_alias(ProjectsLocationsAgentsFlows::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsFlows'); 283