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