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