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\Gmail\Resource;
19
20use Google\Service\Gmail\ListHistoryResponse;
21
22/**
23 * The "history" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $gmailService = new Google\Service\Gmail(...);
27 *   $history = $gmailService->history;
28 *  </code>
29 */
30class UsersHistory extends \Google\Service\Resource
31{
32  /**
33   * Lists the history of all changes to the given mailbox. History results are
34   * returned in chronological order (increasing `historyId`).
35   * (history.listUsersHistory)
36   *
37   * @param string $userId The user's email address. The special value `me` can be
38   * used to indicate the authenticated user.
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string historyTypes History types to be returned by the function
42   * @opt_param string labelId Only return messages with a label matching the ID.
43   * @opt_param string maxResults Maximum number of history records to return.
44   * This field defaults to 100. The maximum allowed value for this field is 500.
45   * @opt_param string pageToken Page token to retrieve a specific page of results
46   * in the list.
47   * @opt_param string startHistoryId Required. Returns history records after the
48   * specified `startHistoryId`. The supplied `startHistoryId` should be obtained
49   * from the `historyId` of a message, thread, or previous `list` response.
50   * History IDs increase chronologically but are not contiguous with random gaps
51   * in between valid IDs. Supplying an invalid or out of date `startHistoryId`
52   * typically returns an `HTTP 404` error code. A `historyId` is typically valid
53   * for at least a week, but in some rare circumstances may be valid for only a
54   * few hours. If you receive an `HTTP 404` error response, your application
55   * should perform a full sync. If you receive no `nextPageToken` in the
56   * response, there are no updates to retrieve and you can store the returned
57   * `historyId` for a future request.
58   * @return ListHistoryResponse
59   */
60  public function listUsersHistory($userId, $optParams = [])
61  {
62    $params = ['userId' => $userId];
63    $params = array_merge($params, $optParams);
64    return $this->call('list', [$params], ListHistoryResponse::class);
65  }
66}
67
68// Adding a class alias for backwards compatibility with the previous class name.
69class_alias(UsersHistory::class, 'Google_Service_Gmail_Resource_UsersHistory');
70