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\GoogleCloudDialogflowCxV3DeployFlowRequest;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3Environment;
22use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListEnvironmentsResponse;
23use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3LookupEnvironmentHistoryResponse;
24use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3RunContinuousTestRequest;
25use Google\Service\Dialogflow\GoogleLongrunningOperation;
26use Google\Service\Dialogflow\GoogleProtobufEmpty;
27
28/**
29 * The "environments" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $dialogflowService = new Google\Service\Dialogflow(...);
33 *   $environments = $dialogflowService->environments;
34 *  </code>
35 */
36class ProjectsLocationsAgentsEnvironments extends \Google\Service\Resource
37{
38  /**
39   * Creates an Environment in the specified Agent. This method is a [long-running
40   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
41   * operation). The returned `Operation` type has the following method-specific
42   * fields: - `metadata`: An empty [Struct message](https://developers.google.com
43   * /protocol-buffers/docs/reference/google.protobuf#struct) - `response`:
44   * Environment (environments.create)
45   *
46   * @param string $parent Required. The Agent to create an Environment for.
47   * Format: `projects//locations//agents/`.
48   * @param GoogleCloudDialogflowCxV3Environment $postBody
49   * @param array $optParams Optional parameters.
50   * @return GoogleLongrunningOperation
51   */
52  public function create($parent, GoogleCloudDialogflowCxV3Environment $postBody, $optParams = [])
53  {
54    $params = ['parent' => $parent, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('create', [$params], GoogleLongrunningOperation::class);
57  }
58  /**
59   * Deletes the specified Environment. (environments.delete)
60   *
61   * @param string $name Required. The name of the Environment to delete. Format:
62   * `projects//locations//agents//environments/`.
63   * @param array $optParams Optional parameters.
64   * @return GoogleProtobufEmpty
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
71  }
72  /**
73   * Deploys a flow to the specified Environment. This method is a [long-running
74   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
75   * operation). The returned `Operation` type has the following method-specific
76   * fields: - `metadata`: DeployFlowMetadata - `response`: DeployFlowResponse
77   * (environments.deployFlow)
78   *
79   * @param string $environment Required. The environment to deploy the flow to.
80   * Format: `projects//locations//agents// environments/`.
81   * @param GoogleCloudDialogflowCxV3DeployFlowRequest $postBody
82   * @param array $optParams Optional parameters.
83   * @return GoogleLongrunningOperation
84   */
85  public function deployFlow($environment, GoogleCloudDialogflowCxV3DeployFlowRequest $postBody, $optParams = [])
86  {
87    $params = ['environment' => $environment, 'postBody' => $postBody];
88    $params = array_merge($params, $optParams);
89    return $this->call('deployFlow', [$params], GoogleLongrunningOperation::class);
90  }
91  /**
92   * Retrieves the specified Environment. (environments.get)
93   *
94   * @param string $name Required. The name of the Environment. Format:
95   * `projects//locations//agents//environments/`.
96   * @param array $optParams Optional parameters.
97   * @return GoogleCloudDialogflowCxV3Environment
98   */
99  public function get($name, $optParams = [])
100  {
101    $params = ['name' => $name];
102    $params = array_merge($params, $optParams);
103    return $this->call('get', [$params], GoogleCloudDialogflowCxV3Environment::class);
104  }
105  /**
106   * Returns the list of all environments in the specified Agent.
107   * (environments.listProjectsLocationsAgentsEnvironments)
108   *
109   * @param string $parent Required. The Agent to list all environments for.
110   * Format: `projects//locations//agents/`.
111   * @param array $optParams Optional parameters.
112   *
113   * @opt_param int pageSize The maximum number of items to return in a single
114   * page. By default 20 and at most 100.
115   * @opt_param string pageToken The next_page_token value returned from a
116   * previous list request.
117   * @return GoogleCloudDialogflowCxV3ListEnvironmentsResponse
118   */
119  public function listProjectsLocationsAgentsEnvironments($parent, $optParams = [])
120  {
121    $params = ['parent' => $parent];
122    $params = array_merge($params, $optParams);
123    return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListEnvironmentsResponse::class);
124  }
125  /**
126   * Looks up the history of the specified Environment.
127   * (environments.lookupEnvironmentHistory)
128   *
129   * @param string $name Required. Resource name of the environment to look up the
130   * history for. Format: `projects//locations//agents//environments/`.
131   * @param array $optParams Optional parameters.
132   *
133   * @opt_param int pageSize The maximum number of items to return in a single
134   * page. By default 100 and at most 1000.
135   * @opt_param string pageToken The next_page_token value returned from a
136   * previous list request.
137   * @return GoogleCloudDialogflowCxV3LookupEnvironmentHistoryResponse
138   */
139  public function lookupEnvironmentHistory($name, $optParams = [])
140  {
141    $params = ['name' => $name];
142    $params = array_merge($params, $optParams);
143    return $this->call('lookupEnvironmentHistory', [$params], GoogleCloudDialogflowCxV3LookupEnvironmentHistoryResponse::class);
144  }
145  /**
146   * Updates the specified Environment. This method is a [long-running
147   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
148   * operation). The returned `Operation` type has the following method-specific
149   * fields: - `metadata`: An empty [Struct message](https://developers.google.com
150   * /protocol-buffers/docs/reference/google.protobuf#struct) - `response`:
151   * Environment (environments.patch)
152   *
153   * @param string $name The name of the environment. Format:
154   * `projects//locations//agents//environments/`.
155   * @param GoogleCloudDialogflowCxV3Environment $postBody
156   * @param array $optParams Optional parameters.
157   *
158   * @opt_param string updateMask Required. The mask to control which fields get
159   * updated.
160   * @return GoogleLongrunningOperation
161   */
162  public function patch($name, GoogleCloudDialogflowCxV3Environment $postBody, $optParams = [])
163  {
164    $params = ['name' => $name, 'postBody' => $postBody];
165    $params = array_merge($params, $optParams);
166    return $this->call('patch', [$params], GoogleLongrunningOperation::class);
167  }
168  /**
169   * Kicks off a continuous test under the specified Environment. This method is a
170   * [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how
171   * /long-running-operation). The returned `Operation` type has the following
172   * method-specific fields: - `metadata`: RunContinuousTestMetadata - `response`:
173   * RunContinuousTestResponse (environments.runContinuousTest)
174   *
175   * @param string $environment Required. Format:
176   * `projects//locations//agents//environments/`.
177   * @param GoogleCloudDialogflowCxV3RunContinuousTestRequest $postBody
178   * @param array $optParams Optional parameters.
179   * @return GoogleLongrunningOperation
180   */
181  public function runContinuousTest($environment, GoogleCloudDialogflowCxV3RunContinuousTestRequest $postBody, $optParams = [])
182  {
183    $params = ['environment' => $environment, 'postBody' => $postBody];
184    $params = array_merge($params, $optParams);
185    return $this->call('runContinuousTest', [$params], GoogleLongrunningOperation::class);
186  }
187}
188
189// Adding a class alias for backwards compatibility with the previous class name.
190class_alias(ProjectsLocationsAgentsEnvironments::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsEnvironments');
191