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\Translate\Resource;
19
20use Google\Service\Translate\CancelOperationRequest;
21use Google\Service\Translate\ListOperationsResponse;
22use Google\Service\Translate\Operation;
23use Google\Service\Translate\TranslateEmpty;
24use Google\Service\Translate\WaitOperationRequest;
25
26/**
27 * The "operations" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $translateService = new Google\Service\Translate(...);
31 *   $operations = $translateService->operations;
32 *  </code>
33 */
34class ProjectsLocationsOperations extends \Google\Service\Resource
35{
36  /**
37   * Starts asynchronous cancellation on a long-running operation. The server
38   * makes a best effort to cancel the operation, but success is not guaranteed.
39   * If the server doesn't support this method, it returns
40   * `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
41   * other methods to check whether the cancellation succeeded or whether the
42   * operation completed despite cancellation. On successful cancellation, the
43   * operation is not deleted; instead, it becomes an operation with an
44   * Operation.error value with a google.rpc.Status.code of 1, corresponding to
45   * `Code.CANCELLED`. (operations.cancel)
46   *
47   * @param string $name The name of the operation resource to be cancelled.
48   * @param CancelOperationRequest $postBody
49   * @param array $optParams Optional parameters.
50   * @return TranslateEmpty
51   */
52  public function cancel($name, CancelOperationRequest $postBody, $optParams = [])
53  {
54    $params = ['name' => $name, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('cancel', [$params], TranslateEmpty::class);
57  }
58  /**
59   * Deletes a long-running operation. This method indicates that the client is no
60   * longer interested in the operation result. It does not cancel the operation.
61   * If the server doesn't support this method, it returns
62   * `google.rpc.Code.UNIMPLEMENTED`. (operations.delete)
63   *
64   * @param string $name The name of the operation resource to be deleted.
65   * @param array $optParams Optional parameters.
66   * @return TranslateEmpty
67   */
68  public function delete($name, $optParams = [])
69  {
70    $params = ['name' => $name];
71    $params = array_merge($params, $optParams);
72    return $this->call('delete', [$params], TranslateEmpty::class);
73  }
74  /**
75   * Gets the latest state of a long-running operation. Clients can use this
76   * method to poll the operation result at intervals as recommended by the API
77   * service. (operations.get)
78   *
79   * @param string $name The name of the operation resource.
80   * @param array $optParams Optional parameters.
81   * @return Operation
82   */
83  public function get($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('get', [$params], Operation::class);
88  }
89  /**
90   * Lists operations that match the specified filter in the request. If the
91   * server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the
92   * `name` binding allows API services to override the binding to use different
93   * resource name schemes, such as `users/operations`. To override the binding,
94   * API services can add a binding such as `"/v1/{name=users}/operations"` to
95   * their service configuration. For backwards compatibility, the default name
96   * includes the operations collection id, however overriding users must ensure
97   * the name binding is the parent resource, without the operations collection
98   * id. (operations.listProjectsLocationsOperations)
99   *
100   * @param string $name The name of the operation's parent resource.
101   * @param array $optParams Optional parameters.
102   *
103   * @opt_param string filter The standard list filter.
104   * @opt_param int pageSize The standard list page size.
105   * @opt_param string pageToken The standard list page token.
106   * @return ListOperationsResponse
107   */
108  public function listProjectsLocationsOperations($name, $optParams = [])
109  {
110    $params = ['name' => $name];
111    $params = array_merge($params, $optParams);
112    return $this->call('list', [$params], ListOperationsResponse::class);
113  }
114  /**
115   * Waits until the specified long-running operation is done or reaches at most a
116   * specified timeout, returning the latest state. If the operation is already
117   * done, the latest state is immediately returned. If the timeout specified is
118   * greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If
119   * the server does not support this method, it returns
120   * `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort
121   * basis. It may return the latest state before the specified timeout (including
122   * immediately), meaning even an immediate response is no guarantee that the
123   * operation is done. (operations.wait)
124   *
125   * @param string $name The name of the operation resource to wait on.
126   * @param WaitOperationRequest $postBody
127   * @param array $optParams Optional parameters.
128   * @return Operation
129   */
130  public function wait($name, WaitOperationRequest $postBody, $optParams = [])
131  {
132    $params = ['name' => $name, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('wait', [$params], Operation::class);
135  }
136}
137
138// Adding a class alias for backwards compatibility with the previous class name.
139class_alias(ProjectsLocationsOperations::class, 'Google_Service_Translate_Resource_ProjectsLocationsOperations');
140