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\ToolResults\Resource;
19
20use Google\Service\ToolResults\ListStepAccessibilityClustersResponse;
21use Google\Service\ToolResults\ListStepsResponse;
22use Google\Service\ToolResults\PerfMetricsSummary;
23use Google\Service\ToolResults\PublishXunitXmlFilesRequest;
24use Google\Service\ToolResults\Step;
25
26/**
27 * The "steps" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $toolresultsService = new Google\Service\ToolResults(...);
31 *   $steps = $toolresultsService->steps;
32 *  </code>
33 */
34class ProjectsHistoriesExecutionsSteps extends \Google\Service\Resource
35{
36  /**
37   * Lists accessibility clusters for a given Step May return any of the following
38   * canonical error codes: - PERMISSION_DENIED - if the user is not authorized to
39   * read project - INVALID_ARGUMENT - if the request is malformed -
40   * FAILED_PRECONDITION - if an argument in the request happens to be invalid;
41   * e.g. if the locale format is incorrect - NOT_FOUND - if the containing Step
42   * does not exist (steps.accessibilityClusters)
43   *
44   * @param string $name A full resource name of the step. For example, projects
45   * /my-project/histories/bh.1234567890abcdef/executions/
46   * 1234567890123456789/steps/bs.1234567890abcdef Required.
47   * @param array $optParams Optional parameters.
48   *
49   * @opt_param string locale The accepted format is the canonical Unicode format
50   * with hyphen as a delimiter. Language must be lowercase, Language Script -
51   * Capitalized, Region - UPPERCASE. See
52   * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier for details.
53   * Required.
54   * @return ListStepAccessibilityClustersResponse
55   */
56  public function accessibilityClusters($name, $optParams = [])
57  {
58    $params = ['name' => $name];
59    $params = array_merge($params, $optParams);
60    return $this->call('accessibilityClusters', [$params], ListStepAccessibilityClustersResponse::class);
61  }
62  /**
63   * Creates a Step. The returned Step will have the id set. May return any of the
64   * following canonical error codes: - PERMISSION_DENIED - if the user is not
65   * authorized to write to project - INVALID_ARGUMENT - if the request is
66   * malformed - FAILED_PRECONDITION - if the step is too large (more than 10Mib)
67   * - NOT_FOUND - if the containing Execution does not exist (steps.create)
68   *
69   * @param string $projectId Required. A Project id.
70   * @param string $historyId Required. A History id.
71   * @param string $executionId Required. An Execution id.
72   * @param Step $postBody
73   * @param array $optParams Optional parameters.
74   *
75   * @opt_param string requestId A unique request ID for server to detect
76   * duplicated requests. For example, a UUID. Optional, but strongly recommended.
77   * @return Step
78   */
79  public function create($projectId, $historyId, $executionId, Step $postBody, $optParams = [])
80  {
81    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'postBody' => $postBody];
82    $params = array_merge($params, $optParams);
83    return $this->call('create', [$params], Step::class);
84  }
85  /**
86   * Gets a Step. May return any of the following canonical error codes: -
87   * PERMISSION_DENIED - if the user is not authorized to read project -
88   * INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Step does
89   * not exist (steps.get)
90   *
91   * @param string $projectId A Project id. Required.
92   * @param string $historyId A History id. Required.
93   * @param string $executionId A Execution id. Required.
94   * @param string $stepId A Step id. Required.
95   * @param array $optParams Optional parameters.
96   * @return Step
97   */
98  public function get($projectId, $historyId, $executionId, $stepId, $optParams = [])
99  {
100    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'stepId' => $stepId];
101    $params = array_merge($params, $optParams);
102    return $this->call('get', [$params], Step::class);
103  }
104  /**
105   * Retrieves a PerfMetricsSummary. May return any of the following error
106   * code(s): - NOT_FOUND - The specified PerfMetricsSummary does not exist
107   * (steps.getPerfMetricsSummary)
108   *
109   * @param string $projectId The cloud project
110   * @param string $historyId A tool results history ID.
111   * @param string $executionId A tool results execution ID.
112   * @param string $stepId A tool results step ID.
113   * @param array $optParams Optional parameters.
114   * @return PerfMetricsSummary
115   */
116  public function getPerfMetricsSummary($projectId, $historyId, $executionId, $stepId, $optParams = [])
117  {
118    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'stepId' => $stepId];
119    $params = array_merge($params, $optParams);
120    return $this->call('getPerfMetricsSummary', [$params], PerfMetricsSummary::class);
121  }
122  /**
123   * Lists Steps for a given Execution. The steps are sorted by creation_time in
124   * descending order. The step_id key will be used to order the steps with the
125   * same creation_time. May return any of the following canonical error codes: -
126   * PERMISSION_DENIED - if the user is not authorized to read project -
127   * INVALID_ARGUMENT - if the request is malformed - FAILED_PRECONDITION - if an
128   * argument in the request happens to be invalid; e.g. if an attempt is made to
129   * list the children of a nonexistent Step - NOT_FOUND - if the containing
130   * Execution does not exist (steps.listProjectsHistoriesExecutionsSteps)
131   *
132   * @param string $projectId A Project id. Required.
133   * @param string $historyId A History id. Required.
134   * @param string $executionId A Execution id. Required.
135   * @param array $optParams Optional parameters.
136   *
137   * @opt_param int pageSize The maximum number of Steps to fetch. Default value:
138   * 25. The server will use this default if the field is not set or has a value
139   * of 0. Optional.
140   * @opt_param string pageToken A continuation token to resume the query at the
141   * next item. Optional.
142   * @return ListStepsResponse
143   */
144  public function listProjectsHistoriesExecutionsSteps($projectId, $historyId, $executionId, $optParams = [])
145  {
146    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId];
147    $params = array_merge($params, $optParams);
148    return $this->call('list', [$params], ListStepsResponse::class);
149  }
150  /**
151   * Updates an existing Step with the supplied partial entity. May return any of
152   * the following canonical error codes: - PERMISSION_DENIED - if the user is not
153   * authorized to write project - INVALID_ARGUMENT - if the request is malformed
154   * - FAILED_PRECONDITION - if the requested state transition is illegal (e.g try
155   * to upload a duplicate xml file), if the updated step is too large (more than
156   * 10Mib) - NOT_FOUND - if the containing Execution does not exist (steps.patch)
157   *
158   * @param string $projectId A Project id. Required.
159   * @param string $historyId A History id. Required.
160   * @param string $executionId A Execution id. Required.
161   * @param string $stepId A Step id. Required.
162   * @param Step $postBody
163   * @param array $optParams Optional parameters.
164   *
165   * @opt_param string requestId A unique request ID for server to detect
166   * duplicated requests. For example, a UUID. Optional, but strongly recommended.
167   * @return Step
168   */
169  public function patch($projectId, $historyId, $executionId, $stepId, Step $postBody, $optParams = [])
170  {
171    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'stepId' => $stepId, 'postBody' => $postBody];
172    $params = array_merge($params, $optParams);
173    return $this->call('patch', [$params], Step::class);
174  }
175  /**
176   * Publish xml files to an existing Step. May return any of the following
177   * canonical error codes: - PERMISSION_DENIED - if the user is not authorized to
178   * write project - INVALID_ARGUMENT - if the request is malformed -
179   * FAILED_PRECONDITION - if the requested state transition is illegal, e.g try
180   * to upload a duplicate xml file or a file too large. - NOT_FOUND - if the
181   * containing Execution does not exist (steps.publishXunitXmlFiles)
182   *
183   * @param string $projectId A Project id. Required.
184   * @param string $historyId A History id. Required.
185   * @param string $executionId A Execution id. Required.
186   * @param string $stepId A Step id. Note: This step must include a
187   * TestExecutionStep. Required.
188   * @param PublishXunitXmlFilesRequest $postBody
189   * @param array $optParams Optional parameters.
190   * @return Step
191   */
192  public function publishXunitXmlFiles($projectId, $historyId, $executionId, $stepId, PublishXunitXmlFilesRequest $postBody, $optParams = [])
193  {
194    $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'stepId' => $stepId, 'postBody' => $postBody];
195    $params = array_merge($params, $optParams);
196    return $this->call('publishXunitXmlFiles', [$params], Step::class);
197  }
198}
199
200// Adding a class alias for backwards compatibility with the previous class name.
201class_alias(ProjectsHistoriesExecutionsSteps::class, 'Google_Service_ToolResults_Resource_ProjectsHistoriesExecutionsSteps');
202