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\ChatEmpty;
21use Google\Service\HangoutsChat\Message;
22
23/**
24 * The "messages" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $chatService = new Google\Service\HangoutsChat(...);
28 *   $messages = $chatService->messages;
29 *  </code>
30 */
31class SpacesMessages extends \Google\Service\Resource
32{
33  /**
34   * Creates a message. Requires [service account
35   * authentication](https://developers.google.com/chat/api/guides/auth/service-
36   * accounts). (messages.create)
37   *
38   * @param string $parent Required. Space resource name, in the form "spaces".
39   * Example: spaces/AAAAAAAAAAA
40   * @param Message $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string requestId Optional. A unique request ID for this message.
44   * Specifying an existing request ID returns the message created with that ID
45   * instead of creating a new message.
46   * @opt_param string threadKey Optional. Opaque thread identifier. To start or
47   * add to a thread, create a message and specify a `threadKey` instead of
48   * thread.name. (Setting thread.name has no effect.) The first message with a
49   * given `threadKey` starts a new thread. Subsequent messages with the same
50   * `threadKey` post into the same thread.
51   * @return Message
52   */
53  public function create($parent, Message $postBody, $optParams = [])
54  {
55    $params = ['parent' => $parent, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('create', [$params], Message::class);
58  }
59  /**
60   * Deletes a message. Requires [service account
61   * authentication](https://developers.google.com/chat/api/guides/auth/service-
62   * accounts). (messages.delete)
63   *
64   * @param string $name Required. Resource name of the message to be deleted, in
65   * the form "spaces/messages" Example:
66   * spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB
67   * @param array $optParams Optional parameters.
68   * @return ChatEmpty
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], ChatEmpty::class);
75  }
76  /**
77   * Returns a message. Requires [service account
78   * authentication](https://developers.google.com/chat/api/guides/auth/service-
79   * accounts). (messages.get)
80   *
81   * @param string $name Required. Resource name of the message to be retrieved,
82   * in the form "spaces/messages". Example:
83   * spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB
84   * @param array $optParams Optional parameters.
85   * @return Message
86   */
87  public function get($name, $optParams = [])
88  {
89    $params = ['name' => $name];
90    $params = array_merge($params, $optParams);
91    return $this->call('get', [$params], Message::class);
92  }
93  /**
94   * Updates a message. Requires [service account
95   * authentication](https://developers.google.com/chat/api/guides/auth/service-
96   * accounts). (messages.update)
97   *
98   * @param string $name Resource name in the form `spaces/messages`. Example:
99   * `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`
100   * @param Message $postBody
101   * @param array $optParams Optional parameters.
102   *
103   * @opt_param string updateMask Required. The field paths to be updated, comma
104   * separated if there are multiple. Currently supported field paths: * text *
105   * cards * attachment
106   * @return Message
107   */
108  public function update($name, Message $postBody, $optParams = [])
109  {
110    $params = ['name' => $name, 'postBody' => $postBody];
111    $params = array_merge($params, $optParams);
112    return $this->call('update', [$params], Message::class);
113  }
114}
115
116// Adding a class alias for backwards compatibility with the previous class name.
117class_alias(SpacesMessages::class, 'Google_Service_HangoutsChat_Resource_SpacesMessages');
118