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\PubsubLite\Resource;
19
20use Google\Service\PubsubLite\ComputeHeadCursorRequest;
21use Google\Service\PubsubLite\ComputeHeadCursorResponse;
22use Google\Service\PubsubLite\ComputeMessageStatsRequest;
23use Google\Service\PubsubLite\ComputeMessageStatsResponse;
24use Google\Service\PubsubLite\ComputeTimeCursorRequest;
25use Google\Service\PubsubLite\ComputeTimeCursorResponse;
26
27/**
28 * The "topics" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $pubsubliteService = new Google\Service\PubsubLite(...);
32 *   $topics = $pubsubliteService->topics;
33 *  </code>
34 */
35class TopicStatsProjectsLocationsTopics extends \Google\Service\Resource
36{
37  /**
38   * Compute the head cursor for the partition. The head cursor's offset is
39   * guaranteed to be less than or equal to all messages which have not yet been
40   * acknowledged as published, and greater than the offset of any message whose
41   * publish has already been acknowledged. It is zero if there have never been
42   * messages in the partition. (topics.computeHeadCursor)
43   *
44   * @param string $topic Required. The topic for which we should compute the head
45   * cursor.
46   * @param ComputeHeadCursorRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return ComputeHeadCursorResponse
49   */
50  public function computeHeadCursor($topic, ComputeHeadCursorRequest $postBody, $optParams = [])
51  {
52    $params = ['topic' => $topic, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('computeHeadCursor', [$params], ComputeHeadCursorResponse::class);
55  }
56  /**
57   * Compute statistics about a range of messages in a given topic and partition.
58   * (topics.computeMessageStats)
59   *
60   * @param string $topic Required. The topic for which we should compute message
61   * stats.
62   * @param ComputeMessageStatsRequest $postBody
63   * @param array $optParams Optional parameters.
64   * @return ComputeMessageStatsResponse
65   */
66  public function computeMessageStats($topic, ComputeMessageStatsRequest $postBody, $optParams = [])
67  {
68    $params = ['topic' => $topic, 'postBody' => $postBody];
69    $params = array_merge($params, $optParams);
70    return $this->call('computeMessageStats', [$params], ComputeMessageStatsResponse::class);
71  }
72  /**
73   * Compute the corresponding cursor for a publish or event time in a topic
74   * partition. (topics.computeTimeCursor)
75   *
76   * @param string $topic Required. The topic for which we should compute the
77   * cursor.
78   * @param ComputeTimeCursorRequest $postBody
79   * @param array $optParams Optional parameters.
80   * @return ComputeTimeCursorResponse
81   */
82  public function computeTimeCursor($topic, ComputeTimeCursorRequest $postBody, $optParams = [])
83  {
84    $params = ['topic' => $topic, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('computeTimeCursor', [$params], ComputeTimeCursorResponse::class);
87  }
88}
89
90// Adding a class alias for backwards compatibility with the previous class name.
91class_alias(TopicStatsProjectsLocationsTopics::class, 'Google_Service_PubsubLite_Resource_TopicStatsProjectsLocationsTopics');
92