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\ToolResults\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ToolResults\History;
|
---|
21 | use Google\Service\ToolResults\ListHistoriesResponse;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "histories" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $toolresultsService = new Google\Service\ToolResults(...);
|
---|
28 | * $histories = $toolresultsService->projects_histories;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class ProjectsHistories extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Creates a History. The returned History will have the id set. May return any
|
---|
35 | * of the following canonical error codes: - PERMISSION_DENIED - if the user is
|
---|
36 | * not authorized to write to project - INVALID_ARGUMENT - if the request is
|
---|
37 | * malformed - NOT_FOUND - if the containing project does not exist
|
---|
38 | * (histories.create)
|
---|
39 | *
|
---|
40 | * @param string $projectId A Project id. Required.
|
---|
41 | * @param History $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | *
|
---|
44 | * @opt_param string requestId A unique request ID for server to detect
|
---|
45 | * duplicated requests. For example, a UUID. Optional, but strongly recommended.
|
---|
46 | * @return History
|
---|
47 | * @throws \Google\Service\Exception
|
---|
48 | */
|
---|
49 | public function create($projectId, History $postBody, $optParams = [])
|
---|
50 | {
|
---|
51 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
52 | $params = array_merge($params, $optParams);
|
---|
53 | return $this->call('create', [$params], History::class);
|
---|
54 | }
|
---|
55 | /**
|
---|
56 | * Gets a History. May return any of the following canonical error codes: -
|
---|
57 | * PERMISSION_DENIED - if the user is not authorized to read project -
|
---|
58 | * INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the History
|
---|
59 | * does not exist (histories.get)
|
---|
60 | *
|
---|
61 | * @param string $projectId A Project id. Required.
|
---|
62 | * @param string $historyId A History id. Required.
|
---|
63 | * @param array $optParams Optional parameters.
|
---|
64 | * @return History
|
---|
65 | * @throws \Google\Service\Exception
|
---|
66 | */
|
---|
67 | public function get($projectId, $historyId, $optParams = [])
|
---|
68 | {
|
---|
69 | $params = ['projectId' => $projectId, 'historyId' => $historyId];
|
---|
70 | $params = array_merge($params, $optParams);
|
---|
71 | return $this->call('get', [$params], History::class);
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * Lists Histories for a given Project. The histories are sorted by modification
|
---|
75 | * time in descending order. The history_id key will be used to order the
|
---|
76 | * history with the same modification time. May return any of the following
|
---|
77 | * canonical error codes: - PERMISSION_DENIED - if the user is not authorized to
|
---|
78 | * read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND -
|
---|
79 | * if the History does not exist (histories.listProjectsHistories)
|
---|
80 | *
|
---|
81 | * @param string $projectId A Project id. Required.
|
---|
82 | * @param array $optParams Optional parameters.
|
---|
83 | *
|
---|
84 | * @opt_param string filterByName If set, only return histories with the given
|
---|
85 | * name. Optional.
|
---|
86 | * @opt_param int pageSize The maximum number of Histories to fetch. Default
|
---|
87 | * value: 20. The server will use this default if the field is not set or has a
|
---|
88 | * value of 0. Any value greater than 100 will be treated as 100. Optional.
|
---|
89 | * @opt_param string pageToken A continuation token to resume the query at the
|
---|
90 | * next item. Optional.
|
---|
91 | * @return ListHistoriesResponse
|
---|
92 | * @throws \Google\Service\Exception
|
---|
93 | */
|
---|
94 | public function listProjectsHistories($projectId, $optParams = [])
|
---|
95 | {
|
---|
96 | $params = ['projectId' => $projectId];
|
---|
97 | $params = array_merge($params, $optParams);
|
---|
98 | return $this->call('list', [$params], ListHistoriesResponse::class);
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
103 | class_alias(ProjectsHistories::class, 'Google_Service_ToolResults_Resource_ProjectsHistories');
|
---|