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\History;
21use 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->histories;
29 *  </code>
30 */
31class 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   */
48  public function create($projectId, History $postBody, $optParams = [])
49  {
50    $params = ['projectId' => $projectId, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], History::class);
53  }
54  /**
55   * Gets a History. May return any of the following canonical error codes: -
56   * PERMISSION_DENIED - if the user is not authorized to read project -
57   * INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the History
58   * does not exist (histories.get)
59   *
60   * @param string $projectId A Project id. Required.
61   * @param string $historyId A History id. Required.
62   * @param array $optParams Optional parameters.
63   * @return History
64   */
65  public function get($projectId, $historyId, $optParams = [])
66  {
67    $params = ['projectId' => $projectId, 'historyId' => $historyId];
68    $params = array_merge($params, $optParams);
69    return $this->call('get', [$params], History::class);
70  }
71  /**
72   * Lists Histories for a given Project. The histories are sorted by modification
73   * time in descending order. The history_id key will be used to order the
74   * history with the same modification time. May return any of the following
75   * canonical error codes: - PERMISSION_DENIED - if the user is not authorized to
76   * read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND -
77   * if the History does not exist (histories.listProjectsHistories)
78   *
79   * @param string $projectId A Project id. Required.
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param string filterByName If set, only return histories with the given
83   * name. Optional.
84   * @opt_param int pageSize The maximum number of Histories to fetch. Default
85   * value: 20. The server will use this default if the field is not set or has a
86   * value of 0. Any value greater than 100 will be treated as 100. Optional.
87   * @opt_param string pageToken A continuation token to resume the query at the
88   * next item. Optional.
89   * @return ListHistoriesResponse
90   */
91  public function listProjectsHistories($projectId, $optParams = [])
92  {
93    $params = ['projectId' => $projectId];
94    $params = array_merge($params, $optParams);
95    return $this->call('list', [$params], ListHistoriesResponse::class);
96  }
97}
98
99// Adding a class alias for backwards compatibility with the previous class name.
100class_alias(ProjectsHistories::class, 'Google_Service_ToolResults_Resource_ProjectsHistories');
101