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\GoogleCloudDialogflowCxV3BatchDeleteTestCasesRequest;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3BatchRunTestCasesRequest;
22use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3CalculateCoverageResponse;
23use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ExportTestCasesRequest;
24use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ImportTestCasesRequest;
25use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListTestCasesResponse;
26use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3RunTestCaseRequest;
27use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3TestCase;
28use Google\Service\Dialogflow\GoogleLongrunningOperation;
29use Google\Service\Dialogflow\GoogleProtobufEmpty;
30
31/**
32 * The "testCases" collection of methods.
33 * Typical usage is:
34 *  <code>
35 *   $dialogflowService = new Google\Service\Dialogflow(...);
36 *   $testCases = $dialogflowService->testCases;
37 *  </code>
38 */
39class ProjectsLocationsAgentsTestCases extends \Google\Service\Resource
40{
41  /**
42   * Batch deletes test cases. (testCases.batchDelete)
43   *
44   * @param string $parent Required. The agent to delete test cases from. Format:
45   * `projects//locations//agents/`.
46   * @param GoogleCloudDialogflowCxV3BatchDeleteTestCasesRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return GoogleProtobufEmpty
49   */
50  public function batchDelete($parent, GoogleCloudDialogflowCxV3BatchDeleteTestCasesRequest $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('batchDelete', [$params], GoogleProtobufEmpty::class);
55  }
56  /**
57   * Kicks off a batch run of test cases. This method is a [long-running
58   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
59   * operation). The returned `Operation` type has the following method-specific
60   * fields: - `metadata`: BatchRunTestCasesMetadata - `response`:
61   * BatchRunTestCasesResponse (testCases.batchRun)
62   *
63   * @param string $parent Required. Agent name. Format:
64   * `projects//locations//agents/ `.
65   * @param GoogleCloudDialogflowCxV3BatchRunTestCasesRequest $postBody
66   * @param array $optParams Optional parameters.
67   * @return GoogleLongrunningOperation
68   */
69  public function batchRun($parent, GoogleCloudDialogflowCxV3BatchRunTestCasesRequest $postBody, $optParams = [])
70  {
71    $params = ['parent' => $parent, 'postBody' => $postBody];
72    $params = array_merge($params, $optParams);
73    return $this->call('batchRun', [$params], GoogleLongrunningOperation::class);
74  }
75  /**
76   * Calculates the test coverage for an agent. (testCases.calculateCoverage)
77   *
78   * @param string $agent Required. The agent to calculate coverage for. Format:
79   * `projects//locations//agents/`.
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param string type Required. The type of coverage requested.
83   * @return GoogleCloudDialogflowCxV3CalculateCoverageResponse
84   */
85  public function calculateCoverage($agent, $optParams = [])
86  {
87    $params = ['agent' => $agent];
88    $params = array_merge($params, $optParams);
89    return $this->call('calculateCoverage', [$params], GoogleCloudDialogflowCxV3CalculateCoverageResponse::class);
90  }
91  /**
92   * Creates a test case for the given agent. (testCases.create)
93   *
94   * @param string $parent Required. The agent to create the test case for.
95   * Format: `projects//locations//agents/`.
96   * @param GoogleCloudDialogflowCxV3TestCase $postBody
97   * @param array $optParams Optional parameters.
98   * @return GoogleCloudDialogflowCxV3TestCase
99   */
100  public function create($parent, GoogleCloudDialogflowCxV3TestCase $postBody, $optParams = [])
101  {
102    $params = ['parent' => $parent, 'postBody' => $postBody];
103    $params = array_merge($params, $optParams);
104    return $this->call('create', [$params], GoogleCloudDialogflowCxV3TestCase::class);
105  }
106  /**
107   * Exports the test cases under the agent to a Cloud Storage bucket or a local
108   * file. Filter can be applied to export a subset of test cases. This method is
109   * a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how
110   * /long-running-operation). The returned `Operation` type has the following
111   * method-specific fields: - `metadata`: ExportTestCasesMetadata - `response`:
112   * ExportTestCasesResponse (testCases.export)
113   *
114   * @param string $parent Required. The agent where to export test cases from.
115   * Format: `projects//locations//agents/`.
116   * @param GoogleCloudDialogflowCxV3ExportTestCasesRequest $postBody
117   * @param array $optParams Optional parameters.
118   * @return GoogleLongrunningOperation
119   */
120  public function export($parent, GoogleCloudDialogflowCxV3ExportTestCasesRequest $postBody, $optParams = [])
121  {
122    $params = ['parent' => $parent, 'postBody' => $postBody];
123    $params = array_merge($params, $optParams);
124    return $this->call('export', [$params], GoogleLongrunningOperation::class);
125  }
126  /**
127   * Gets a test case. (testCases.get)
128   *
129   * @param string $name Required. The name of the testcase. Format:
130   * `projects//locations//agents//testCases/`.
131   * @param array $optParams Optional parameters.
132   * @return GoogleCloudDialogflowCxV3TestCase
133   */
134  public function get($name, $optParams = [])
135  {
136    $params = ['name' => $name];
137    $params = array_merge($params, $optParams);
138    return $this->call('get', [$params], GoogleCloudDialogflowCxV3TestCase::class);
139  }
140  /**
141   * Imports the test cases from a Cloud Storage bucket or a local file. It always
142   * creates new test cases and won't overwrite any existing ones. The provided ID
143   * in the imported test case is neglected. This method is a [long-running
144   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
145   * operation). The returned `Operation` type has the following method-specific
146   * fields: - `metadata`: ImportTestCasesMetadata - `response`:
147   * ImportTestCasesResponse (testCases.import)
148   *
149   * @param string $parent Required. The agent to import test cases to. Format:
150   * `projects//locations//agents/`.
151   * @param GoogleCloudDialogflowCxV3ImportTestCasesRequest $postBody
152   * @param array $optParams Optional parameters.
153   * @return GoogleLongrunningOperation
154   */
155  public function import($parent, GoogleCloudDialogflowCxV3ImportTestCasesRequest $postBody, $optParams = [])
156  {
157    $params = ['parent' => $parent, 'postBody' => $postBody];
158    $params = array_merge($params, $optParams);
159    return $this->call('import', [$params], GoogleLongrunningOperation::class);
160  }
161  /**
162   * Fetches a list of test cases for a given agent.
163   * (testCases.listProjectsLocationsAgentsTestCases)
164   *
165   * @param string $parent Required. The agent to list all pages for. Format:
166   * `projects//locations//agents/`.
167   * @param array $optParams Optional parameters.
168   *
169   * @opt_param int pageSize The maximum number of items to return in a single
170   * page. By default 20. Note that when TestCaseView = FULL, the maximum page
171   * size allowed is 20. When TestCaseView = BASIC, the maximum page size allowed
172   * is 500.
173   * @opt_param string pageToken The next_page_token value returned from a
174   * previous list request.
175   * @opt_param string view Specifies whether response should include all fields
176   * or just the metadata.
177   * @return GoogleCloudDialogflowCxV3ListTestCasesResponse
178   */
179  public function listProjectsLocationsAgentsTestCases($parent, $optParams = [])
180  {
181    $params = ['parent' => $parent];
182    $params = array_merge($params, $optParams);
183    return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListTestCasesResponse::class);
184  }
185  /**
186   * Updates the specified test case. (testCases.patch)
187   *
188   * @param string $name The unique identifier of the test case.
189   * TestCases.CreateTestCase will populate the name automatically. Otherwise use
190   * format: `projects//locations//agents/ /testCases/`.
191   * @param GoogleCloudDialogflowCxV3TestCase $postBody
192   * @param array $optParams Optional parameters.
193   *
194   * @opt_param string updateMask Required. The mask to specify which fields
195   * should be updated. The `creationTime` and `lastTestResult` cannot be updated.
196   * @return GoogleCloudDialogflowCxV3TestCase
197   */
198  public function patch($name, GoogleCloudDialogflowCxV3TestCase $postBody, $optParams = [])
199  {
200    $params = ['name' => $name, 'postBody' => $postBody];
201    $params = array_merge($params, $optParams);
202    return $this->call('patch', [$params], GoogleCloudDialogflowCxV3TestCase::class);
203  }
204  /**
205   * Kicks off a test case run. This method is a [long-running
206   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
207   * operation). The returned `Operation` type has the following method-specific
208   * fields: - `metadata`: RunTestCaseMetadata - `response`: RunTestCaseResponse
209   * (testCases.run)
210   *
211   * @param string $name Required. Format of test case name to run:
212   * `projects//locations/ /agents//testCases/`.
213   * @param GoogleCloudDialogflowCxV3RunTestCaseRequest $postBody
214   * @param array $optParams Optional parameters.
215   * @return GoogleLongrunningOperation
216   */
217  public function run($name, GoogleCloudDialogflowCxV3RunTestCaseRequest $postBody, $optParams = [])
218  {
219    $params = ['name' => $name, 'postBody' => $postBody];
220    $params = array_merge($params, $optParams);
221    return $this->call('run', [$params], GoogleLongrunningOperation::class);
222  }
223}
224
225// Adding a class alias for backwards compatibility with the previous class name.
226class_alias(ProjectsLocationsAgentsTestCases::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsTestCases');
227