[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\GoogleCloudDialogflowCxV3Agent;
|
---|
| 21 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3AgentValidationResult;
|
---|
| 22 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ExportAgentRequest;
|
---|
| 23 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3GenerativeSettings;
|
---|
| 24 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListAgentsResponse;
|
---|
| 25 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3RestoreAgentRequest;
|
---|
| 26 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ValidateAgentRequest;
|
---|
| 27 | use Google\Service\Dialogflow\GoogleLongrunningOperation;
|
---|
| 28 | use Google\Service\Dialogflow\GoogleProtobufEmpty;
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * The "agents" collection of methods.
|
---|
| 32 | * Typical usage is:
|
---|
| 33 | * <code>
|
---|
| 34 | * $dialogflowService = new Google\Service\Dialogflow(...);
|
---|
| 35 | * $agents = $dialogflowService->projects_locations_agents;
|
---|
| 36 | * </code>
|
---|
| 37 | */
|
---|
| 38 | class ProjectsLocationsAgents extends \Google\Service\Resource
|
---|
| 39 | {
|
---|
| 40 | /**
|
---|
| 41 | * Creates an agent in the specified location. Note: You should always train
|
---|
| 42 | * flows prior to sending them queries. See the [training
|
---|
| 43 | * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
|
---|
| 44 | * (agents.create)
|
---|
| 45 | *
|
---|
| 46 | * @param string $parent Required. The location to create a agent for. Format:
|
---|
| 47 | * `projects//locations/`.
|
---|
| 48 | * @param GoogleCloudDialogflowCxV3Agent $postBody
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | * @return GoogleCloudDialogflowCxV3Agent
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function create($parent, GoogleCloudDialogflowCxV3Agent $postBody, $optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('create', [$params], GoogleCloudDialogflowCxV3Agent::class);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Deletes the specified agent. (agents.delete)
|
---|
| 61 | *
|
---|
| 62 | * @param string $name Required. The name of the agent to delete. Format:
|
---|
| 63 | * `projects//locations//agents/`.
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | * @return GoogleProtobufEmpty
|
---|
| 66 | * @throws \Google\Service\Exception
|
---|
| 67 | */
|
---|
| 68 | public function delete($name, $optParams = [])
|
---|
| 69 | {
|
---|
| 70 | $params = ['name' => $name];
|
---|
| 71 | $params = array_merge($params, $optParams);
|
---|
| 72 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
| 73 | }
|
---|
| 74 | /**
|
---|
| 75 | * Exports the specified agent to a binary file. This method is a [long-running
|
---|
| 76 | * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
|
---|
| 77 | * operation). The returned `Operation` type has the following method-specific
|
---|
| 78 | * fields: - `metadata`: An empty [Struct
|
---|
| 79 | * message](https://developers.google.com/protocol-
|
---|
| 80 | * buffers/docs/reference/google.protobuf#struct) - `response`:
|
---|
| 81 | * ExportAgentResponse (agents.export)
|
---|
| 82 | *
|
---|
| 83 | * @param string $name Required. The name of the agent to export. Format:
|
---|
| 84 | * `projects//locations//agents/`.
|
---|
| 85 | * @param GoogleCloudDialogflowCxV3ExportAgentRequest $postBody
|
---|
| 86 | * @param array $optParams Optional parameters.
|
---|
| 87 | * @return GoogleLongrunningOperation
|
---|
| 88 | * @throws \Google\Service\Exception
|
---|
| 89 | */
|
---|
| 90 | public function export($name, GoogleCloudDialogflowCxV3ExportAgentRequest $postBody, $optParams = [])
|
---|
| 91 | {
|
---|
| 92 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 93 | $params = array_merge($params, $optParams);
|
---|
| 94 | return $this->call('export', [$params], GoogleLongrunningOperation::class);
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Retrieves the specified agent. (agents.get)
|
---|
| 98 | *
|
---|
| 99 | * @param string $name Required. The name of the agent. Format:
|
---|
| 100 | * `projects//locations//agents/`.
|
---|
| 101 | * @param array $optParams Optional parameters.
|
---|
| 102 | * @return GoogleCloudDialogflowCxV3Agent
|
---|
| 103 | * @throws \Google\Service\Exception
|
---|
| 104 | */
|
---|
| 105 | public function get($name, $optParams = [])
|
---|
| 106 | {
|
---|
| 107 | $params = ['name' => $name];
|
---|
| 108 | $params = array_merge($params, $optParams);
|
---|
| 109 | return $this->call('get', [$params], GoogleCloudDialogflowCxV3Agent::class);
|
---|
| 110 | }
|
---|
| 111 | /**
|
---|
| 112 | * Gets the generative settings for the agent. (agents.getGenerativeSettings)
|
---|
| 113 | *
|
---|
| 114 | * @param string $name Required. Format:
|
---|
| 115 | * `projects//locations//agents//generativeSettings`.
|
---|
| 116 | * @param array $optParams Optional parameters.
|
---|
| 117 | *
|
---|
| 118 | * @opt_param string languageCode Required. Language code of the generative
|
---|
| 119 | * settings.
|
---|
| 120 | * @return GoogleCloudDialogflowCxV3GenerativeSettings
|
---|
| 121 | * @throws \Google\Service\Exception
|
---|
| 122 | */
|
---|
| 123 | public function getGenerativeSettings($name, $optParams = [])
|
---|
| 124 | {
|
---|
| 125 | $params = ['name' => $name];
|
---|
| 126 | $params = array_merge($params, $optParams);
|
---|
| 127 | return $this->call('getGenerativeSettings', [$params], GoogleCloudDialogflowCxV3GenerativeSettings::class);
|
---|
| 128 | }
|
---|
| 129 | /**
|
---|
| 130 | * Gets the latest agent validation result. Agent validation is performed when
|
---|
| 131 | * ValidateAgent is called. (agents.getValidationResult)
|
---|
| 132 | *
|
---|
| 133 | * @param string $name Required. The agent name. Format:
|
---|
| 134 | * `projects//locations//agents//validationResult`.
|
---|
| 135 | * @param array $optParams Optional parameters.
|
---|
| 136 | *
|
---|
| 137 | * @opt_param string languageCode If not specified, the agent's default language
|
---|
| 138 | * is used.
|
---|
| 139 | * @return GoogleCloudDialogflowCxV3AgentValidationResult
|
---|
| 140 | * @throws \Google\Service\Exception
|
---|
| 141 | */
|
---|
| 142 | public function getValidationResult($name, $optParams = [])
|
---|
| 143 | {
|
---|
| 144 | $params = ['name' => $name];
|
---|
| 145 | $params = array_merge($params, $optParams);
|
---|
| 146 | return $this->call('getValidationResult', [$params], GoogleCloudDialogflowCxV3AgentValidationResult::class);
|
---|
| 147 | }
|
---|
| 148 | /**
|
---|
| 149 | * Returns the list of all agents in the specified location.
|
---|
| 150 | * (agents.listProjectsLocationsAgents)
|
---|
| 151 | *
|
---|
| 152 | * @param string $parent Required. The location to list all agents for. Format:
|
---|
| 153 | * `projects//locations/`.
|
---|
| 154 | * @param array $optParams Optional parameters.
|
---|
| 155 | *
|
---|
| 156 | * @opt_param int pageSize The maximum number of items to return in a single
|
---|
| 157 | * page. By default 100 and at most 1000.
|
---|
| 158 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
| 159 | * previous list request.
|
---|
| 160 | * @return GoogleCloudDialogflowCxV3ListAgentsResponse
|
---|
| 161 | * @throws \Google\Service\Exception
|
---|
| 162 | */
|
---|
| 163 | public function listProjectsLocationsAgents($parent, $optParams = [])
|
---|
| 164 | {
|
---|
| 165 | $params = ['parent' => $parent];
|
---|
| 166 | $params = array_merge($params, $optParams);
|
---|
| 167 | return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListAgentsResponse::class);
|
---|
| 168 | }
|
---|
| 169 | /**
|
---|
| 170 | * Updates the specified agent. Note: You should always train flows prior to
|
---|
| 171 | * sending them queries. See the [training
|
---|
| 172 | * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
|
---|
| 173 | * (agents.patch)
|
---|
| 174 | *
|
---|
| 175 | * @param string $name The unique identifier of the agent. Required for the
|
---|
| 176 | * Agents.UpdateAgent method. Agents.CreateAgent populates the name
|
---|
| 177 | * automatically. Format: `projects//locations//agents/`.
|
---|
| 178 | * @param GoogleCloudDialogflowCxV3Agent $postBody
|
---|
| 179 | * @param array $optParams Optional parameters.
|
---|
| 180 | *
|
---|
| 181 | * @opt_param string updateMask The mask to control which fields get updated. If
|
---|
| 182 | * the mask is not present, all fields will be updated.
|
---|
| 183 | * @return GoogleCloudDialogflowCxV3Agent
|
---|
| 184 | * @throws \Google\Service\Exception
|
---|
| 185 | */
|
---|
| 186 | public function patch($name, GoogleCloudDialogflowCxV3Agent $postBody, $optParams = [])
|
---|
| 187 | {
|
---|
| 188 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 189 | $params = array_merge($params, $optParams);
|
---|
| 190 | return $this->call('patch', [$params], GoogleCloudDialogflowCxV3Agent::class);
|
---|
| 191 | }
|
---|
| 192 | /**
|
---|
| 193 | * Restores the specified agent from a binary file. Replaces the current agent
|
---|
| 194 | * with a new one. Note that all existing resources in agent (e.g. intents,
|
---|
| 195 | * entity types, flows) will be removed. This method is a [long-running
|
---|
| 196 | * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
|
---|
| 197 | * operation). The returned `Operation` type has the following method-specific
|
---|
| 198 | * fields: - `metadata`: An empty [Struct
|
---|
| 199 | * message](https://developers.google.com/protocol-
|
---|
| 200 | * buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty
|
---|
| 201 | * message](https://developers.google.com/protocol-
|
---|
| 202 | * buffers/docs/reference/google.protobuf#empty) Note: You should always train
|
---|
| 203 | * flows prior to sending them queries. See the [training
|
---|
| 204 | * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
|
---|
| 205 | * (agents.restore)
|
---|
| 206 | *
|
---|
| 207 | * @param string $name Required. The name of the agent to restore into. Format:
|
---|
| 208 | * `projects//locations//agents/`.
|
---|
| 209 | * @param GoogleCloudDialogflowCxV3RestoreAgentRequest $postBody
|
---|
| 210 | * @param array $optParams Optional parameters.
|
---|
| 211 | * @return GoogleLongrunningOperation
|
---|
| 212 | * @throws \Google\Service\Exception
|
---|
| 213 | */
|
---|
| 214 | public function restore($name, GoogleCloudDialogflowCxV3RestoreAgentRequest $postBody, $optParams = [])
|
---|
| 215 | {
|
---|
| 216 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 217 | $params = array_merge($params, $optParams);
|
---|
| 218 | return $this->call('restore', [$params], GoogleLongrunningOperation::class);
|
---|
| 219 | }
|
---|
| 220 | /**
|
---|
| 221 | * Updates the generative settings for the agent.
|
---|
| 222 | * (agents.updateGenerativeSettings)
|
---|
| 223 | *
|
---|
| 224 | * @param string $name Format:
|
---|
| 225 | * `projects//locations//agents//generativeSettings`.
|
---|
| 226 | * @param GoogleCloudDialogflowCxV3GenerativeSettings $postBody
|
---|
| 227 | * @param array $optParams Optional parameters.
|
---|
| 228 | *
|
---|
| 229 | * @opt_param string updateMask Optional. The mask to control which fields get
|
---|
| 230 | * updated. If the mask is not present, all fields will be updated.
|
---|
| 231 | * @return GoogleCloudDialogflowCxV3GenerativeSettings
|
---|
| 232 | * @throws \Google\Service\Exception
|
---|
| 233 | */
|
---|
| 234 | public function updateGenerativeSettings($name, GoogleCloudDialogflowCxV3GenerativeSettings $postBody, $optParams = [])
|
---|
| 235 | {
|
---|
| 236 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 237 | $params = array_merge($params, $optParams);
|
---|
| 238 | return $this->call('updateGenerativeSettings', [$params], GoogleCloudDialogflowCxV3GenerativeSettings::class);
|
---|
| 239 | }
|
---|
| 240 | /**
|
---|
| 241 | * Validates the specified agent and creates or updates validation results. The
|
---|
| 242 | * agent in draft version is validated. Please call this API after the training
|
---|
| 243 | * is completed to get the complete validation results. (agents.validate)
|
---|
| 244 | *
|
---|
| 245 | * @param string $name Required. The agent to validate. Format:
|
---|
| 246 | * `projects//locations//agents/`.
|
---|
| 247 | * @param GoogleCloudDialogflowCxV3ValidateAgentRequest $postBody
|
---|
| 248 | * @param array $optParams Optional parameters.
|
---|
| 249 | * @return GoogleCloudDialogflowCxV3AgentValidationResult
|
---|
| 250 | * @throws \Google\Service\Exception
|
---|
| 251 | */
|
---|
| 252 | public function validate($name, GoogleCloudDialogflowCxV3ValidateAgentRequest $postBody, $optParams = [])
|
---|
| 253 | {
|
---|
| 254 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 255 | $params = array_merge($params, $optParams);
|
---|
| 256 | return $this->call('validate', [$params], GoogleCloudDialogflowCxV3AgentValidationResult::class);
|
---|
| 257 | }
|
---|
| 258 | }
|
---|
| 259 |
|
---|
| 260 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 261 | class_alias(ProjectsLocationsAgents::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgents');
|
---|