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\HangoutsChat\Resource;
19
20use Google\Service\HangoutsChat\ListSpacesResponse;
21use Google\Service\HangoutsChat\Message;
22use Google\Service\HangoutsChat\Space;
23
24/**
25 * The "spaces" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $chatService = new Google\Service\HangoutsChat(...);
29 *   $spaces = $chatService->spaces;
30 *  </code>
31 */
32class Spaces extends \Google\Service\Resource
33{
34  /**
35   * Returns a space. Requires [service account
36   * authentication](https://developers.google.com/chat/api/guides/auth/service-
37   * accounts). (spaces.get)
38   *
39   * @param string $name Required. Resource name of the space, in the form
40   * "spaces". Example: spaces/AAAAAAAAAAAA
41   * @param array $optParams Optional parameters.
42   * @return Space
43   */
44  public function get($name, $optParams = [])
45  {
46    $params = ['name' => $name];
47    $params = array_merge($params, $optParams);
48    return $this->call('get', [$params], Space::class);
49  }
50  /**
51   * Lists spaces the caller is a member of. Requires [service account
52   * authentication](https://developers.google.com/chat/api/guides/auth/service-
53   * accounts). (spaces.listSpaces)
54   *
55   * @param array $optParams Optional parameters.
56   *
57   * @opt_param int pageSize Requested page size. The value is capped at 1000.
58   * Server may return fewer results than requested. If unspecified, server will
59   * default to 100.
60   * @opt_param string pageToken A token identifying a page of results the server
61   * should return.
62   * @return ListSpacesResponse
63   */
64  public function listSpaces($optParams = [])
65  {
66    $params = [];
67    $params = array_merge($params, $optParams);
68    return $this->call('list', [$params], ListSpacesResponse::class);
69  }
70  /**
71   * Legacy path for creating message. Calling these will result in a BadRequest
72   * response. (spaces.webhooks)
73   *
74   * @param string $parent Required. Space resource name, in the form "spaces".
75   * Example: spaces/AAAAAAAAAAA
76   * @param Message $postBody
77   * @param array $optParams Optional parameters.
78   *
79   * @opt_param string requestId Optional. A unique request ID for this message.
80   * Specifying an existing request ID returns the message created with that ID
81   * instead of creating a new message.
82   * @opt_param string threadKey Optional. Opaque thread identifier. To start or
83   * add to a thread, create a message and specify a `threadKey` instead of
84   * thread.name. (Setting thread.name has no effect.) The first message with a
85   * given `threadKey` starts a new thread. Subsequent messages with the same
86   * `threadKey` post into the same thread.
87   * @return Message
88   */
89  public function webhooks($parent, Message $postBody, $optParams = [])
90  {
91    $params = ['parent' => $parent, 'postBody' => $postBody];
92    $params = array_merge($params, $optParams);
93    return $this->call('webhooks', [$params], Message::class);
94  }
95}
96
97// Adding a class alias for backwards compatibility with the previous class name.
98class_alias(Spaces::class, 'Google_Service_HangoutsChat_Resource_Spaces');
99