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