google-apps-chat-v1 0.a → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/apps/chat/v1/chat_service/client.rb +3663 -0
- data/lib/google/apps/chat/v1/chat_service/credentials.rb +63 -0
- data/lib/google/apps/chat/v1/chat_service/paths.rb +191 -0
- data/lib/google/apps/chat/v1/chat_service/rest/client.rb +3487 -0
- data/lib/google/apps/chat/v1/chat_service/rest/service_stub.rb +1614 -0
- data/lib/google/apps/chat/v1/chat_service/rest.rb +53 -0
- data/lib/google/apps/chat/v1/chat_service.rb +56 -0
- data/lib/google/apps/chat/v1/rest.rb +37 -0
- data/lib/google/apps/chat/v1/version.rb +7 -2
- data/lib/google/apps/chat/v1.rb +45 -0
- data/lib/google/chat/v1/action_status_pb.rb +44 -0
- data/lib/google/chat/v1/annotation_pb.rb +55 -0
- data/lib/google/chat/v1/attachment_pb.rb +51 -0
- data/lib/google/chat/v1/chat_service_pb.rb +53 -0
- data/lib/google/chat/v1/chat_service_services_pb.rb +359 -0
- data/lib/google/chat/v1/contextual_addon_pb.rb +50 -0
- data/lib/google/chat/v1/deletion_metadata_pb.rb +43 -0
- data/lib/google/chat/v1/group_pb.rb +42 -0
- data/lib/google/chat/v1/history_state_pb.rb +42 -0
- data/lib/google/chat/v1/matched_url_pb.rb +44 -0
- data/lib/google/chat/v1/membership_pb.rb +61 -0
- data/lib/google/chat/v1/message_pb.rb +89 -0
- data/lib/google/chat/v1/reaction_pb.rb +54 -0
- data/lib/google/chat/v1/slash_command_pb.rb +42 -0
- data/lib/google/chat/v1/space_pb.rb +63 -0
- data/lib/google/chat/v1/space_read_state_pb.rb +51 -0
- data/lib/google/chat/v1/space_setup_pb.rb +48 -0
- data/lib/google/chat/v1/thread_read_state_pb.rb +48 -0
- data/lib/google/chat/v1/user_pb.rb +46 -0
- data/lib/google/chat/v1/widgets_pb.rb +53 -0
- data/lib/google-apps-chat-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/apps/card/v1/card.rb +2076 -0
- data/proto_docs/google/chat/v1/action_status.rb +40 -0
- data/proto_docs/google/chat/v1/annotation.rb +186 -0
- data/proto_docs/google/chat/v1/attachment.rb +131 -0
- data/proto_docs/google/chat/v1/contextual_addon.rb +120 -0
- data/proto_docs/google/chat/v1/deletion_metadata.rb +60 -0
- data/proto_docs/google/chat/v1/group.rb +41 -0
- data/proto_docs/google/chat/v1/history_state.rb +42 -0
- data/proto_docs/google/chat/v1/matched_url.rb +37 -0
- data/proto_docs/google/chat/v1/membership.rb +294 -0
- data/proto_docs/google/chat/v1/message.rb +657 -0
- data/proto_docs/google/chat/v1/reaction.rb +185 -0
- data/proto_docs/google/chat/v1/slash_command.rb +37 -0
- data/proto_docs/google/chat/v1/space.rb +382 -0
- data/proto_docs/google/chat/v1/space_read_state.rb +104 -0
- data/proto_docs/google/chat/v1/space_setup.rb +92 -0
- data/proto_docs/google/chat/v1/thread_read_state.rb +66 -0
- data/proto_docs/google/chat/v1/user.rb +84 -0
- data/proto_docs/google/chat/v1/widgets.rb +293 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/rpc/code.rb +185 -0
- data/proto_docs/google/type/color.rb +173 -0
- metadata +128 -10
@@ -0,0 +1,3487 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://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,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/chat/v1/chat_service_pb"
|
21
|
+
require "google/apps/chat/v1/chat_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Apps
|
25
|
+
module Chat
|
26
|
+
module V1
|
27
|
+
module ChatService
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the ChatService service.
|
31
|
+
#
|
32
|
+
# Enables developers to build Chat apps and
|
33
|
+
# integrations on Google Chat Platform.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "chat.$UNIVERSE_DOMAIN$"
|
38
|
+
|
39
|
+
include Paths
|
40
|
+
|
41
|
+
# @private
|
42
|
+
attr_reader :chat_service_stub
|
43
|
+
|
44
|
+
##
|
45
|
+
# Configure the ChatService Client class.
|
46
|
+
#
|
47
|
+
# See {::Google::Apps::Chat::V1::ChatService::Rest::Client::Configuration}
|
48
|
+
# for a description of the configuration fields.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# # Modify the configuration for all ChatService clients
|
53
|
+
# ::Google::Apps::Chat::V1::ChatService::Rest::Client.configure do |config|
|
54
|
+
# config.timeout = 10.0
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# @yield [config] Configure the Client client.
|
58
|
+
# @yieldparam config [Client::Configuration]
|
59
|
+
#
|
60
|
+
# @return [Client::Configuration]
|
61
|
+
#
|
62
|
+
def self.configure
|
63
|
+
@configure ||= begin
|
64
|
+
namespace = ["Google", "Apps", "Chat", "V1"]
|
65
|
+
parent_config = while namespace.any?
|
66
|
+
parent_name = namespace.join "::"
|
67
|
+
parent_const = const_get parent_name
|
68
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
69
|
+
namespace.pop
|
70
|
+
end
|
71
|
+
default_config = Client::Configuration.new parent_config
|
72
|
+
|
73
|
+
default_config.rpcs.create_message.timeout = 30.0
|
74
|
+
default_config.rpcs.create_message.retry_policy = {
|
75
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
76
|
+
}
|
77
|
+
|
78
|
+
default_config.rpcs.list_messages.timeout = 30.0
|
79
|
+
default_config.rpcs.list_messages.retry_policy = {
|
80
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
81
|
+
}
|
82
|
+
|
83
|
+
default_config.rpcs.list_memberships.timeout = 30.0
|
84
|
+
default_config.rpcs.list_memberships.retry_policy = {
|
85
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
86
|
+
}
|
87
|
+
|
88
|
+
default_config.rpcs.get_membership.timeout = 30.0
|
89
|
+
default_config.rpcs.get_membership.retry_policy = {
|
90
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
91
|
+
}
|
92
|
+
|
93
|
+
default_config.rpcs.get_message.timeout = 30.0
|
94
|
+
default_config.rpcs.get_message.retry_policy = {
|
95
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
96
|
+
}
|
97
|
+
|
98
|
+
default_config.rpcs.update_message.timeout = 30.0
|
99
|
+
default_config.rpcs.update_message.retry_policy = {
|
100
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
101
|
+
}
|
102
|
+
|
103
|
+
default_config.rpcs.delete_message.timeout = 30.0
|
104
|
+
default_config.rpcs.delete_message.retry_policy = {
|
105
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
106
|
+
}
|
107
|
+
|
108
|
+
default_config.rpcs.get_attachment.timeout = 30.0
|
109
|
+
default_config.rpcs.get_attachment.retry_policy = {
|
110
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
111
|
+
}
|
112
|
+
|
113
|
+
default_config.rpcs.upload_attachment.timeout = 30.0
|
114
|
+
default_config.rpcs.upload_attachment.retry_policy = {
|
115
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
116
|
+
}
|
117
|
+
|
118
|
+
default_config.rpcs.list_spaces.timeout = 30.0
|
119
|
+
default_config.rpcs.list_spaces.retry_policy = {
|
120
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
121
|
+
}
|
122
|
+
|
123
|
+
default_config.rpcs.get_space.timeout = 30.0
|
124
|
+
default_config.rpcs.get_space.retry_policy = {
|
125
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
126
|
+
}
|
127
|
+
|
128
|
+
default_config.rpcs.create_space.timeout = 30.0
|
129
|
+
default_config.rpcs.create_space.retry_policy = {
|
130
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
131
|
+
}
|
132
|
+
|
133
|
+
default_config.rpcs.set_up_space.timeout = 30.0
|
134
|
+
default_config.rpcs.set_up_space.retry_policy = {
|
135
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
136
|
+
}
|
137
|
+
|
138
|
+
default_config.rpcs.update_space.timeout = 30.0
|
139
|
+
default_config.rpcs.update_space.retry_policy = {
|
140
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
141
|
+
}
|
142
|
+
|
143
|
+
default_config.rpcs.delete_space.timeout = 30.0
|
144
|
+
default_config.rpcs.delete_space.retry_policy = {
|
145
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
146
|
+
}
|
147
|
+
|
148
|
+
default_config.rpcs.complete_import_space.timeout = 30.0
|
149
|
+
default_config.rpcs.complete_import_space.retry_policy = {
|
150
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
151
|
+
}
|
152
|
+
|
153
|
+
default_config.rpcs.find_direct_message.timeout = 30.0
|
154
|
+
default_config.rpcs.find_direct_message.retry_policy = {
|
155
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
156
|
+
}
|
157
|
+
|
158
|
+
default_config.rpcs.create_membership.timeout = 30.0
|
159
|
+
default_config.rpcs.create_membership.retry_policy = {
|
160
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
161
|
+
}
|
162
|
+
|
163
|
+
default_config.rpcs.update_membership.timeout = 30.0
|
164
|
+
default_config.rpcs.update_membership.retry_policy = {
|
165
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
166
|
+
}
|
167
|
+
|
168
|
+
default_config.rpcs.delete_membership.timeout = 30.0
|
169
|
+
default_config.rpcs.delete_membership.retry_policy = {
|
170
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
171
|
+
}
|
172
|
+
|
173
|
+
default_config.rpcs.create_reaction.timeout = 30.0
|
174
|
+
default_config.rpcs.create_reaction.retry_policy = {
|
175
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
176
|
+
}
|
177
|
+
|
178
|
+
default_config.rpcs.list_reactions.timeout = 30.0
|
179
|
+
default_config.rpcs.list_reactions.retry_policy = {
|
180
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
181
|
+
}
|
182
|
+
|
183
|
+
default_config.rpcs.delete_reaction.timeout = 30.0
|
184
|
+
default_config.rpcs.delete_reaction.retry_policy = {
|
185
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
186
|
+
}
|
187
|
+
|
188
|
+
default_config.rpcs.get_space_read_state.timeout = 30.0
|
189
|
+
default_config.rpcs.get_space_read_state.retry_policy = {
|
190
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
191
|
+
}
|
192
|
+
|
193
|
+
default_config.rpcs.update_space_read_state.timeout = 30.0
|
194
|
+
default_config.rpcs.update_space_read_state.retry_policy = {
|
195
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
196
|
+
}
|
197
|
+
|
198
|
+
default_config.rpcs.get_thread_read_state.timeout = 30.0
|
199
|
+
default_config.rpcs.get_thread_read_state.retry_policy = {
|
200
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
201
|
+
}
|
202
|
+
|
203
|
+
default_config
|
204
|
+
end
|
205
|
+
yield @configure if block_given?
|
206
|
+
@configure
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Configure the ChatService Client instance.
|
211
|
+
#
|
212
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
213
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
214
|
+
# should be made on {Client.configure}.
|
215
|
+
#
|
216
|
+
# See {::Google::Apps::Chat::V1::ChatService::Rest::Client::Configuration}
|
217
|
+
# for a description of the configuration fields.
|
218
|
+
#
|
219
|
+
# @yield [config] Configure the Client client.
|
220
|
+
# @yieldparam config [Client::Configuration]
|
221
|
+
#
|
222
|
+
# @return [Client::Configuration]
|
223
|
+
#
|
224
|
+
def configure
|
225
|
+
yield @config if block_given?
|
226
|
+
@config
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# The effective universe domain
|
231
|
+
#
|
232
|
+
# @return [String]
|
233
|
+
#
|
234
|
+
def universe_domain
|
235
|
+
@chat_service_stub.universe_domain
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# Create a new ChatService REST client object.
|
240
|
+
#
|
241
|
+
# @example
|
242
|
+
#
|
243
|
+
# # Create a client using the default configuration
|
244
|
+
# client = ::Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
245
|
+
#
|
246
|
+
# # Create a client using a custom configuration
|
247
|
+
# client = ::Google::Apps::Chat::V1::ChatService::Rest::Client.new do |config|
|
248
|
+
# config.timeout = 10.0
|
249
|
+
# end
|
250
|
+
#
|
251
|
+
# @yield [config] Configure the ChatService client.
|
252
|
+
# @yieldparam config [Client::Configuration]
|
253
|
+
#
|
254
|
+
def initialize
|
255
|
+
# Create the configuration object
|
256
|
+
@config = Configuration.new Client.configure
|
257
|
+
|
258
|
+
# Yield the configuration if needed
|
259
|
+
yield @config if block_given?
|
260
|
+
|
261
|
+
# Create credentials
|
262
|
+
credentials = @config.credentials
|
263
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
264
|
+
# but only if the default endpoint does not have a region prefix.
|
265
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
266
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
267
|
+
!@config.endpoint.split(".").first.include?("-"))
|
268
|
+
credentials ||= Credentials.default scope: @config.scope,
|
269
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
270
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
271
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
272
|
+
end
|
273
|
+
|
274
|
+
@quota_project_id = @config.quota_project
|
275
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
276
|
+
|
277
|
+
@chat_service_stub = ::Google::Apps::Chat::V1::ChatService::Rest::ServiceStub.new(
|
278
|
+
endpoint: @config.endpoint,
|
279
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
280
|
+
universe_domain: @config.universe_domain,
|
281
|
+
credentials: credentials
|
282
|
+
)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Service calls
|
286
|
+
|
287
|
+
##
|
288
|
+
# Creates a message in a Google Chat space. For an example, see [Send a
|
289
|
+
# message](https://developers.google.com/workspace/chat/create-messages).
|
290
|
+
#
|
291
|
+
# Calling this method requires
|
292
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize)
|
293
|
+
# and supports the following authentication types:
|
294
|
+
#
|
295
|
+
# - For text messages, user authentication or app authentication are
|
296
|
+
# supported.
|
297
|
+
# - For card messages, only app authentication is supported. (Only Chat apps
|
298
|
+
# can create card messages.)
|
299
|
+
#
|
300
|
+
# @overload create_message(request, options = nil)
|
301
|
+
# Pass arguments to `create_message` via a request object, either of type
|
302
|
+
# {::Google::Apps::Chat::V1::CreateMessageRequest} or an equivalent Hash.
|
303
|
+
#
|
304
|
+
# @param request [::Google::Apps::Chat::V1::CreateMessageRequest, ::Hash]
|
305
|
+
# A request object representing the call parameters. Required. To specify no
|
306
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
307
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
308
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
309
|
+
#
|
310
|
+
# @overload create_message(parent: nil, message: nil, thread_key: nil, request_id: nil, message_reply_option: nil, message_id: nil)
|
311
|
+
# Pass arguments to `create_message` via keyword arguments. Note that at
|
312
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
313
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
314
|
+
#
|
315
|
+
# @param parent [::String]
|
316
|
+
# Required. The resource name of the space in which to create a message.
|
317
|
+
#
|
318
|
+
# Format: `spaces/{space}`
|
319
|
+
# @param message [::Google::Apps::Chat::V1::Message, ::Hash]
|
320
|
+
# Required. Message body.
|
321
|
+
# @param thread_key [::String]
|
322
|
+
# Optional. Deprecated: Use
|
323
|
+
# {::Google::Apps::Chat::V1::Thread#thread_key thread.thread_key} instead. ID for the
|
324
|
+
# thread. Supports up to 4000 characters. To start or add to a thread, create
|
325
|
+
# a message and specify a `threadKey` or the
|
326
|
+
# {::Google::Apps::Chat::V1::Thread#name thread.name}. For example usage, see [Start or
|
327
|
+
# reply to a message
|
328
|
+
# thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread).
|
329
|
+
# @param request_id [::String]
|
330
|
+
# Optional. A unique request ID for this message. Specifying an existing
|
331
|
+
# request ID returns the message created with that ID instead of creating a
|
332
|
+
# new message.
|
333
|
+
# @param message_reply_option [::Google::Apps::Chat::V1::CreateMessageRequest::MessageReplyOption]
|
334
|
+
# Optional. Specifies whether a message starts a thread or replies to one.
|
335
|
+
# Only supported in named spaces.
|
336
|
+
# @param message_id [::String]
|
337
|
+
# Optional. A custom ID for a message. Lets Chat apps get, update, or delete
|
338
|
+
# a message without needing to store the system-assigned ID in the message's
|
339
|
+
# resource name (represented in the message `name` field).
|
340
|
+
#
|
341
|
+
# The value for this field must meet the following requirements:
|
342
|
+
#
|
343
|
+
# * Begins with `client-`. For example, `client-custom-name` is a valid
|
344
|
+
# custom ID, but `custom-name` is not.
|
345
|
+
# * Contains up to 63 characters and only lowercase letters, numbers, and
|
346
|
+
# hyphens.
|
347
|
+
# * Is unique within a space. A Chat app can't use the same custom ID for
|
348
|
+
# different messages.
|
349
|
+
#
|
350
|
+
# For details, see [Name a
|
351
|
+
# message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
|
352
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
353
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Message]
|
354
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
355
|
+
#
|
356
|
+
# @return [::Google::Apps::Chat::V1::Message]
|
357
|
+
#
|
358
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
359
|
+
#
|
360
|
+
# @example Basic example
|
361
|
+
# require "google/apps/chat/v1"
|
362
|
+
#
|
363
|
+
# # Create a client object. The client can be reused for multiple calls.
|
364
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
365
|
+
#
|
366
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
367
|
+
# request = Google::Apps::Chat::V1::CreateMessageRequest.new
|
368
|
+
#
|
369
|
+
# # Call the create_message method.
|
370
|
+
# result = client.create_message request
|
371
|
+
#
|
372
|
+
# # The returned object is of type Google::Apps::Chat::V1::Message.
|
373
|
+
# p result
|
374
|
+
#
|
375
|
+
def create_message request, options = nil
|
376
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
377
|
+
|
378
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateMessageRequest
|
379
|
+
|
380
|
+
# Converts hash and nil to an options object
|
381
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
382
|
+
|
383
|
+
# Customize the options with defaults
|
384
|
+
call_metadata = @config.rpcs.create_message.metadata.to_h
|
385
|
+
|
386
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
387
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
388
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
389
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
390
|
+
transports_version_send: [:rest]
|
391
|
+
|
392
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
393
|
+
|
394
|
+
options.apply_defaults timeout: @config.rpcs.create_message.timeout,
|
395
|
+
metadata: call_metadata,
|
396
|
+
retry_policy: @config.rpcs.create_message.retry_policy
|
397
|
+
|
398
|
+
options.apply_defaults timeout: @config.timeout,
|
399
|
+
metadata: @config.metadata,
|
400
|
+
retry_policy: @config.retry_policy
|
401
|
+
|
402
|
+
@chat_service_stub.create_message request, options do |result, operation|
|
403
|
+
yield result, operation if block_given?
|
404
|
+
return result
|
405
|
+
end
|
406
|
+
rescue ::Gapic::Rest::Error => e
|
407
|
+
raise ::Google::Cloud::Error.from_error(e)
|
408
|
+
end
|
409
|
+
|
410
|
+
##
|
411
|
+
# Lists messages in a space that the caller is a member of, including
|
412
|
+
# messages from blocked members and spaces. For an example, see
|
413
|
+
# [List messages](/chat/api/guides/v1/messages/list).
|
414
|
+
# Requires [user
|
415
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
416
|
+
#
|
417
|
+
# @overload list_messages(request, options = nil)
|
418
|
+
# Pass arguments to `list_messages` via a request object, either of type
|
419
|
+
# {::Google::Apps::Chat::V1::ListMessagesRequest} or an equivalent Hash.
|
420
|
+
#
|
421
|
+
# @param request [::Google::Apps::Chat::V1::ListMessagesRequest, ::Hash]
|
422
|
+
# A request object representing the call parameters. Required. To specify no
|
423
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
424
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
425
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
426
|
+
#
|
427
|
+
# @overload list_messages(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, show_deleted: nil)
|
428
|
+
# Pass arguments to `list_messages` via keyword arguments. Note that at
|
429
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
430
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
431
|
+
#
|
432
|
+
# @param parent [::String]
|
433
|
+
# Required. The resource name of the space to list messages from.
|
434
|
+
#
|
435
|
+
# Format: `spaces/{space}`
|
436
|
+
# @param page_size [::Integer]
|
437
|
+
# The maximum number of messages returned. The service might return fewer
|
438
|
+
# messages than this value.
|
439
|
+
#
|
440
|
+
# If unspecified, at most 25 are returned.
|
441
|
+
#
|
442
|
+
# The maximum value is 1000. If you use a value more than 1000, it's
|
443
|
+
# automatically changed to 1000.
|
444
|
+
#
|
445
|
+
# Negative values return an `INVALID_ARGUMENT` error.
|
446
|
+
# @param page_token [::String]
|
447
|
+
# Optional, if resuming from a previous query.
|
448
|
+
#
|
449
|
+
# A page token received from a previous list messages call. Provide this
|
450
|
+
# parameter to retrieve the subsequent page.
|
451
|
+
#
|
452
|
+
# When paginating, all other parameters provided should match the call that
|
453
|
+
# provided the page token. Passing different values to the other parameters
|
454
|
+
# might lead to unexpected results.
|
455
|
+
# @param filter [::String]
|
456
|
+
# A query filter.
|
457
|
+
#
|
458
|
+
# You can filter messages by date (`create_time`) and thread (`thread.name`).
|
459
|
+
#
|
460
|
+
# To filter messages by the date they were created, specify the `create_time`
|
461
|
+
# with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339)
|
462
|
+
# format and double quotation marks. For example,
|
463
|
+
# `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to
|
464
|
+
# list messages that were created after a timestamp, or the less than
|
465
|
+
# operator `<` to list messages that were created before a timestamp. To
|
466
|
+
# filter messages within a time interval, use the `AND` operator between two
|
467
|
+
# timestamps.
|
468
|
+
#
|
469
|
+
# To filter by thread, specify the `thread.name`, formatted as
|
470
|
+
# `spaces/{space}/threads/{thread}`. You can only specify one
|
471
|
+
# `thread.name` per query.
|
472
|
+
#
|
473
|
+
# To filter by both thread and date, use the `AND` operator in your query.
|
474
|
+
#
|
475
|
+
# For example, the following queries are valid:
|
476
|
+
#
|
477
|
+
# ```
|
478
|
+
# create_time > "2012-04-21T11:30:00-04:00"
|
479
|
+
#
|
480
|
+
# create_time > "2012-04-21T11:30:00-04:00" AND
|
481
|
+
# thread.name = spaces/AAAAAAAAAAA/threads/123
|
482
|
+
#
|
483
|
+
# create_time > "2012-04-21T11:30:00+00:00" AND
|
484
|
+
#
|
485
|
+
# create_time < "2013-01-01T00:00:00+00:00" AND
|
486
|
+
# thread.name = spaces/AAAAAAAAAAA/threads/123
|
487
|
+
#
|
488
|
+
# thread.name = spaces/AAAAAAAAAAA/threads/123
|
489
|
+
# ```
|
490
|
+
#
|
491
|
+
# Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
|
492
|
+
# error.
|
493
|
+
# @param order_by [::String]
|
494
|
+
# Optional, if resuming from a previous query.
|
495
|
+
#
|
496
|
+
# How the list of messages is ordered. Specify a value to order by an
|
497
|
+
# ordering operation. Valid ordering operation values are as follows:
|
498
|
+
#
|
499
|
+
# - `ASC` for ascending.
|
500
|
+
#
|
501
|
+
# - `DESC` for descending.
|
502
|
+
#
|
503
|
+
# The default ordering is `create_time ASC`.
|
504
|
+
# @param show_deleted [::Boolean]
|
505
|
+
# Whether to include deleted messages. Deleted messages include deleted time
|
506
|
+
# and metadata about their deletion, but message content is unavailable.
|
507
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
508
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Message>]
|
509
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
510
|
+
#
|
511
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Message>]
|
512
|
+
#
|
513
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
514
|
+
#
|
515
|
+
# @example Basic example
|
516
|
+
# require "google/apps/chat/v1"
|
517
|
+
#
|
518
|
+
# # Create a client object. The client can be reused for multiple calls.
|
519
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
520
|
+
#
|
521
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
522
|
+
# request = Google::Apps::Chat::V1::ListMessagesRequest.new
|
523
|
+
#
|
524
|
+
# # Call the list_messages method.
|
525
|
+
# result = client.list_messages request
|
526
|
+
#
|
527
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
528
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
529
|
+
# result.each do |item|
|
530
|
+
# # Each element is of type ::Google::Apps::Chat::V1::Message.
|
531
|
+
# p item
|
532
|
+
# end
|
533
|
+
#
|
534
|
+
def list_messages request, options = nil
|
535
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
536
|
+
|
537
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListMessagesRequest
|
538
|
+
|
539
|
+
# Converts hash and nil to an options object
|
540
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
541
|
+
|
542
|
+
# Customize the options with defaults
|
543
|
+
call_metadata = @config.rpcs.list_messages.metadata.to_h
|
544
|
+
|
545
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
546
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
547
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
548
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
549
|
+
transports_version_send: [:rest]
|
550
|
+
|
551
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
552
|
+
|
553
|
+
options.apply_defaults timeout: @config.rpcs.list_messages.timeout,
|
554
|
+
metadata: call_metadata,
|
555
|
+
retry_policy: @config.rpcs.list_messages.retry_policy
|
556
|
+
|
557
|
+
options.apply_defaults timeout: @config.timeout,
|
558
|
+
metadata: @config.metadata,
|
559
|
+
retry_policy: @config.retry_policy
|
560
|
+
|
561
|
+
@chat_service_stub.list_messages request, options do |result, operation|
|
562
|
+
result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_messages, "messages", request, result, options
|
563
|
+
yield result, operation if block_given?
|
564
|
+
return result
|
565
|
+
end
|
566
|
+
rescue ::Gapic::Rest::Error => e
|
567
|
+
raise ::Google::Cloud::Error.from_error(e)
|
568
|
+
end
|
569
|
+
|
570
|
+
##
|
571
|
+
# Lists memberships in a space. For an example, see [List users and Google
|
572
|
+
# Chat apps in a
|
573
|
+
# space](https://developers.google.com/workspace/chat/list-members). Listing
|
574
|
+
# memberships with [app
|
575
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
576
|
+
# lists memberships in spaces that the Chat app has
|
577
|
+
# access to, but excludes Chat app memberships,
|
578
|
+
# including its own. Listing memberships with
|
579
|
+
# [User
|
580
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
|
581
|
+
# lists memberships in spaces that the authenticated user has access to.
|
582
|
+
#
|
583
|
+
# Requires
|
584
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
585
|
+
# Supports
|
586
|
+
# [app
|
587
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
588
|
+
# and [user
|
589
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
590
|
+
#
|
591
|
+
# @overload list_memberships(request, options = nil)
|
592
|
+
# Pass arguments to `list_memberships` via a request object, either of type
|
593
|
+
# {::Google::Apps::Chat::V1::ListMembershipsRequest} or an equivalent Hash.
|
594
|
+
#
|
595
|
+
# @param request [::Google::Apps::Chat::V1::ListMembershipsRequest, ::Hash]
|
596
|
+
# A request object representing the call parameters. Required. To specify no
|
597
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
598
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
599
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
600
|
+
#
|
601
|
+
# @overload list_memberships(parent: nil, page_size: nil, page_token: nil, filter: nil, show_groups: nil, show_invited: nil)
|
602
|
+
# Pass arguments to `list_memberships` via keyword arguments. Note that at
|
603
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
604
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
605
|
+
#
|
606
|
+
# @param parent [::String]
|
607
|
+
# Required. The resource name of the space for which to fetch a membership
|
608
|
+
# list.
|
609
|
+
#
|
610
|
+
# Format: spaces/\\{space}
|
611
|
+
# @param page_size [::Integer]
|
612
|
+
# Optional. The maximum number of memberships to return. The service might
|
613
|
+
# return fewer than this value.
|
614
|
+
#
|
615
|
+
# If unspecified, at most 100 memberships are returned.
|
616
|
+
#
|
617
|
+
# The maximum value is 1000. If you use a value more than 1000, it's
|
618
|
+
# automatically changed to 1000.
|
619
|
+
#
|
620
|
+
# Negative values return an `INVALID_ARGUMENT` error.
|
621
|
+
# @param page_token [::String]
|
622
|
+
# Optional. A page token, received from a previous call to list memberships.
|
623
|
+
# Provide this parameter to retrieve the subsequent page.
|
624
|
+
#
|
625
|
+
# When paginating, all other parameters provided should match the call that
|
626
|
+
# provided the page token. Passing different values to the other parameters
|
627
|
+
# might lead to unexpected results.
|
628
|
+
# @param filter [::String]
|
629
|
+
# Optional. A query filter.
|
630
|
+
#
|
631
|
+
# You can filter memberships by a member's role
|
632
|
+
# ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole))
|
633
|
+
# and type
|
634
|
+
# ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)).
|
635
|
+
#
|
636
|
+
# To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`.
|
637
|
+
#
|
638
|
+
# To filter by type, set `member.type` to `HUMAN` or `BOT`.
|
639
|
+
#
|
640
|
+
# To filter by both role and type, use the `AND` operator. To filter by
|
641
|
+
# either role or type, use the `OR` operator.
|
642
|
+
#
|
643
|
+
# For example, the following queries are valid:
|
644
|
+
#
|
645
|
+
# ```
|
646
|
+
# role = "ROLE_MANAGER" OR role = "ROLE_MEMBER"
|
647
|
+
# member.type = "HUMAN" AND role = "ROLE_MANAGER"
|
648
|
+
# ```
|
649
|
+
#
|
650
|
+
# The following queries are invalid:
|
651
|
+
#
|
652
|
+
# ```
|
653
|
+
# member.type = "HUMAN" AND member.type = "BOT"
|
654
|
+
# role = "ROLE_MANAGER" AND role = "ROLE_MEMBER"
|
655
|
+
# ```
|
656
|
+
#
|
657
|
+
#
|
658
|
+
# Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
|
659
|
+
# error.
|
660
|
+
# @param show_groups [::Boolean]
|
661
|
+
# Optional. When `true`, also returns memberships associated with a
|
662
|
+
# {::Google::Apps::Chat::V1::Membership#group_member Google Group}, in
|
663
|
+
# addition to other types of memberships. If a
|
664
|
+
# {::Google::Apps::Chat::V1::ListMembershipsRequest#filter filter} is set,
|
665
|
+
# {::Google::Apps::Chat::V1::Membership#group_member Google Group}
|
666
|
+
# memberships that don't match the filter criteria aren't returned.
|
667
|
+
# @param show_invited [::Boolean]
|
668
|
+
# Optional. When `true`, also returns memberships associated with
|
669
|
+
# {::Google::Apps::Chat::V1::Membership::MembershipState::INVITED invited} members, in
|
670
|
+
# addition to other types of memberships. If a
|
671
|
+
# filter is set,
|
672
|
+
# {::Google::Apps::Chat::V1::Membership::MembershipState::INVITED invited} memberships
|
673
|
+
# that don't match the filter criteria aren't returned.
|
674
|
+
#
|
675
|
+
# Currently requires [user
|
676
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
677
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
678
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Membership>]
|
679
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
680
|
+
#
|
681
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Membership>]
|
682
|
+
#
|
683
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
684
|
+
#
|
685
|
+
# @example Basic example
|
686
|
+
# require "google/apps/chat/v1"
|
687
|
+
#
|
688
|
+
# # Create a client object. The client can be reused for multiple calls.
|
689
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
690
|
+
#
|
691
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
692
|
+
# request = Google::Apps::Chat::V1::ListMembershipsRequest.new
|
693
|
+
#
|
694
|
+
# # Call the list_memberships method.
|
695
|
+
# result = client.list_memberships request
|
696
|
+
#
|
697
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
698
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
699
|
+
# result.each do |item|
|
700
|
+
# # Each element is of type ::Google::Apps::Chat::V1::Membership.
|
701
|
+
# p item
|
702
|
+
# end
|
703
|
+
#
|
704
|
+
def list_memberships request, options = nil
|
705
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
706
|
+
|
707
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListMembershipsRequest
|
708
|
+
|
709
|
+
# Converts hash and nil to an options object
|
710
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
711
|
+
|
712
|
+
# Customize the options with defaults
|
713
|
+
call_metadata = @config.rpcs.list_memberships.metadata.to_h
|
714
|
+
|
715
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
716
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
717
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
718
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
719
|
+
transports_version_send: [:rest]
|
720
|
+
|
721
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
722
|
+
|
723
|
+
options.apply_defaults timeout: @config.rpcs.list_memberships.timeout,
|
724
|
+
metadata: call_metadata,
|
725
|
+
retry_policy: @config.rpcs.list_memberships.retry_policy
|
726
|
+
|
727
|
+
options.apply_defaults timeout: @config.timeout,
|
728
|
+
metadata: @config.metadata,
|
729
|
+
retry_policy: @config.retry_policy
|
730
|
+
|
731
|
+
@chat_service_stub.list_memberships request, options do |result, operation|
|
732
|
+
result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_memberships, "memberships", request, result, options
|
733
|
+
yield result, operation if block_given?
|
734
|
+
return result
|
735
|
+
end
|
736
|
+
rescue ::Gapic::Rest::Error => e
|
737
|
+
raise ::Google::Cloud::Error.from_error(e)
|
738
|
+
end
|
739
|
+
|
740
|
+
##
|
741
|
+
# Returns details about a membership. For an example, see
|
742
|
+
# [Get details about a user's or Google Chat app's
|
743
|
+
# membership](https://developers.google.com/workspace/chat/get-members).
|
744
|
+
#
|
745
|
+
# Requires
|
746
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
747
|
+
# Supports
|
748
|
+
# [app
|
749
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
750
|
+
# and [user
|
751
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
752
|
+
#
|
753
|
+
# @overload get_membership(request, options = nil)
|
754
|
+
# Pass arguments to `get_membership` via a request object, either of type
|
755
|
+
# {::Google::Apps::Chat::V1::GetMembershipRequest} or an equivalent Hash.
|
756
|
+
#
|
757
|
+
# @param request [::Google::Apps::Chat::V1::GetMembershipRequest, ::Hash]
|
758
|
+
# A request object representing the call parameters. Required. To specify no
|
759
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
760
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
761
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
762
|
+
#
|
763
|
+
# @overload get_membership(name: nil)
|
764
|
+
# Pass arguments to `get_membership` via keyword arguments. Note that at
|
765
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
766
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
767
|
+
#
|
768
|
+
# @param name [::String]
|
769
|
+
# Required. Resource name of the membership to retrieve.
|
770
|
+
#
|
771
|
+
# To get the app's own membership, you can optionally use
|
772
|
+
# `spaces/{space}/members/app`.
|
773
|
+
#
|
774
|
+
# Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`
|
775
|
+
#
|
776
|
+
# When [authenticated as a
|
777
|
+
# user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
|
778
|
+
# you can use the user's email as an alias for `{member}`. For example,
|
779
|
+
# `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
|
780
|
+
# email of the Google Chat user.
|
781
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
782
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Membership]
|
783
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
784
|
+
#
|
785
|
+
# @return [::Google::Apps::Chat::V1::Membership]
|
786
|
+
#
|
787
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
788
|
+
#
|
789
|
+
# @example Basic example
|
790
|
+
# require "google/apps/chat/v1"
|
791
|
+
#
|
792
|
+
# # Create a client object. The client can be reused for multiple calls.
|
793
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
794
|
+
#
|
795
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
796
|
+
# request = Google::Apps::Chat::V1::GetMembershipRequest.new
|
797
|
+
#
|
798
|
+
# # Call the get_membership method.
|
799
|
+
# result = client.get_membership request
|
800
|
+
#
|
801
|
+
# # The returned object is of type Google::Apps::Chat::V1::Membership.
|
802
|
+
# p result
|
803
|
+
#
|
804
|
+
def get_membership request, options = nil
|
805
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
806
|
+
|
807
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetMembershipRequest
|
808
|
+
|
809
|
+
# Converts hash and nil to an options object
|
810
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
811
|
+
|
812
|
+
# Customize the options with defaults
|
813
|
+
call_metadata = @config.rpcs.get_membership.metadata.to_h
|
814
|
+
|
815
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
816
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
817
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
818
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
819
|
+
transports_version_send: [:rest]
|
820
|
+
|
821
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
822
|
+
|
823
|
+
options.apply_defaults timeout: @config.rpcs.get_membership.timeout,
|
824
|
+
metadata: call_metadata,
|
825
|
+
retry_policy: @config.rpcs.get_membership.retry_policy
|
826
|
+
|
827
|
+
options.apply_defaults timeout: @config.timeout,
|
828
|
+
metadata: @config.metadata,
|
829
|
+
retry_policy: @config.retry_policy
|
830
|
+
|
831
|
+
@chat_service_stub.get_membership request, options do |result, operation|
|
832
|
+
yield result, operation if block_given?
|
833
|
+
return result
|
834
|
+
end
|
835
|
+
rescue ::Gapic::Rest::Error => e
|
836
|
+
raise ::Google::Cloud::Error.from_error(e)
|
837
|
+
end
|
838
|
+
|
839
|
+
##
|
840
|
+
# Returns details about a message.
|
841
|
+
# For an example, see [Get details about a
|
842
|
+
# message](https://developers.google.com/workspace/chat/get-messages).
|
843
|
+
#
|
844
|
+
# Requires
|
845
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
846
|
+
# Supports
|
847
|
+
# [app
|
848
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
849
|
+
# and [user
|
850
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
851
|
+
#
|
852
|
+
# Note: Might return a message from a blocked member or space.
|
853
|
+
#
|
854
|
+
# @overload get_message(request, options = nil)
|
855
|
+
# Pass arguments to `get_message` via a request object, either of type
|
856
|
+
# {::Google::Apps::Chat::V1::GetMessageRequest} or an equivalent Hash.
|
857
|
+
#
|
858
|
+
# @param request [::Google::Apps::Chat::V1::GetMessageRequest, ::Hash]
|
859
|
+
# A request object representing the call parameters. Required. To specify no
|
860
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
861
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
862
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
863
|
+
#
|
864
|
+
# @overload get_message(name: nil)
|
865
|
+
# Pass arguments to `get_message` via keyword arguments. Note that at
|
866
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
867
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
868
|
+
#
|
869
|
+
# @param name [::String]
|
870
|
+
# Required. Resource name of the message.
|
871
|
+
#
|
872
|
+
# Format: `spaces/{space}/messages/{message}`
|
873
|
+
#
|
874
|
+
# If you've set a custom ID for your message, you can use the value from the
|
875
|
+
# `clientAssignedMessageId` field for `{message}`. For details, see [Name a
|
876
|
+
# message]
|
877
|
+
# (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
|
878
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
879
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Message]
|
880
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
881
|
+
#
|
882
|
+
# @return [::Google::Apps::Chat::V1::Message]
|
883
|
+
#
|
884
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
885
|
+
#
|
886
|
+
# @example Basic example
|
887
|
+
# require "google/apps/chat/v1"
|
888
|
+
#
|
889
|
+
# # Create a client object. The client can be reused for multiple calls.
|
890
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
891
|
+
#
|
892
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
893
|
+
# request = Google::Apps::Chat::V1::GetMessageRequest.new
|
894
|
+
#
|
895
|
+
# # Call the get_message method.
|
896
|
+
# result = client.get_message request
|
897
|
+
#
|
898
|
+
# # The returned object is of type Google::Apps::Chat::V1::Message.
|
899
|
+
# p result
|
900
|
+
#
|
901
|
+
def get_message request, options = nil
|
902
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
903
|
+
|
904
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetMessageRequest
|
905
|
+
|
906
|
+
# Converts hash and nil to an options object
|
907
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
908
|
+
|
909
|
+
# Customize the options with defaults
|
910
|
+
call_metadata = @config.rpcs.get_message.metadata.to_h
|
911
|
+
|
912
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
913
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
914
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
915
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
916
|
+
transports_version_send: [:rest]
|
917
|
+
|
918
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
919
|
+
|
920
|
+
options.apply_defaults timeout: @config.rpcs.get_message.timeout,
|
921
|
+
metadata: call_metadata,
|
922
|
+
retry_policy: @config.rpcs.get_message.retry_policy
|
923
|
+
|
924
|
+
options.apply_defaults timeout: @config.timeout,
|
925
|
+
metadata: @config.metadata,
|
926
|
+
retry_policy: @config.retry_policy
|
927
|
+
|
928
|
+
@chat_service_stub.get_message request, options do |result, operation|
|
929
|
+
yield result, operation if block_given?
|
930
|
+
return result
|
931
|
+
end
|
932
|
+
rescue ::Gapic::Rest::Error => e
|
933
|
+
raise ::Google::Cloud::Error.from_error(e)
|
934
|
+
end
|
935
|
+
|
936
|
+
##
|
937
|
+
# Updates a message. There's a difference between the `patch` and `update`
|
938
|
+
# methods. The `patch`
|
939
|
+
# method uses a `patch` request while the `update` method uses a `put`
|
940
|
+
# request. We recommend using the `patch` method. For an example, see
|
941
|
+
# [Update a
|
942
|
+
# message](https://developers.google.com/workspace/chat/update-messages).
|
943
|
+
#
|
944
|
+
# Requires
|
945
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
946
|
+
# Supports
|
947
|
+
# [app
|
948
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
949
|
+
# and [user
|
950
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
951
|
+
# When using app authentication, requests can only update messages
|
952
|
+
# created by the calling Chat app.
|
953
|
+
#
|
954
|
+
# @overload update_message(request, options = nil)
|
955
|
+
# Pass arguments to `update_message` via a request object, either of type
|
956
|
+
# {::Google::Apps::Chat::V1::UpdateMessageRequest} or an equivalent Hash.
|
957
|
+
#
|
958
|
+
# @param request [::Google::Apps::Chat::V1::UpdateMessageRequest, ::Hash]
|
959
|
+
# A request object representing the call parameters. Required. To specify no
|
960
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
961
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
962
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
963
|
+
#
|
964
|
+
# @overload update_message(message: nil, update_mask: nil, allow_missing: nil)
|
965
|
+
# Pass arguments to `update_message` via keyword arguments. Note that at
|
966
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
967
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
968
|
+
#
|
969
|
+
# @param message [::Google::Apps::Chat::V1::Message, ::Hash]
|
970
|
+
# Required. Message with fields updated.
|
971
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
972
|
+
# Required. The field paths to update. Separate multiple values with commas
|
973
|
+
# or use `*` to update all field paths.
|
974
|
+
#
|
975
|
+
# Currently supported field paths:
|
976
|
+
#
|
977
|
+
# - `text`
|
978
|
+
#
|
979
|
+
# - `attachment`
|
980
|
+
#
|
981
|
+
# - `cards` (Requires [app
|
982
|
+
# authentication](/chat/api/guides/auth/service-accounts).)
|
983
|
+
#
|
984
|
+
# - `cards_v2` (Requires [app
|
985
|
+
# authentication](/chat/api/guides/auth/service-accounts).)
|
986
|
+
#
|
987
|
+
# - `accessory_widgets` (Requires [app
|
988
|
+
# authentication](/chat/api/guides/auth/service-accounts).)
|
989
|
+
# @param allow_missing [::Boolean]
|
990
|
+
# Optional. If `true` and the message isn't found, a new message is created
|
991
|
+
# and `updateMask` is ignored. The specified message ID must be
|
992
|
+
# [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
|
993
|
+
# or the request fails.
|
994
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
995
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Message]
|
996
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
997
|
+
#
|
998
|
+
# @return [::Google::Apps::Chat::V1::Message]
|
999
|
+
#
|
1000
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1001
|
+
#
|
1002
|
+
# @example Basic example
|
1003
|
+
# require "google/apps/chat/v1"
|
1004
|
+
#
|
1005
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1006
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1007
|
+
#
|
1008
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1009
|
+
# request = Google::Apps::Chat::V1::UpdateMessageRequest.new
|
1010
|
+
#
|
1011
|
+
# # Call the update_message method.
|
1012
|
+
# result = client.update_message request
|
1013
|
+
#
|
1014
|
+
# # The returned object is of type Google::Apps::Chat::V1::Message.
|
1015
|
+
# p result
|
1016
|
+
#
|
1017
|
+
def update_message request, options = nil
|
1018
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1019
|
+
|
1020
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateMessageRequest
|
1021
|
+
|
1022
|
+
# Converts hash and nil to an options object
|
1023
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1024
|
+
|
1025
|
+
# Customize the options with defaults
|
1026
|
+
call_metadata = @config.rpcs.update_message.metadata.to_h
|
1027
|
+
|
1028
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1029
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1030
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1031
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1032
|
+
transports_version_send: [:rest]
|
1033
|
+
|
1034
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1035
|
+
|
1036
|
+
options.apply_defaults timeout: @config.rpcs.update_message.timeout,
|
1037
|
+
metadata: call_metadata,
|
1038
|
+
retry_policy: @config.rpcs.update_message.retry_policy
|
1039
|
+
|
1040
|
+
options.apply_defaults timeout: @config.timeout,
|
1041
|
+
metadata: @config.metadata,
|
1042
|
+
retry_policy: @config.retry_policy
|
1043
|
+
|
1044
|
+
@chat_service_stub.update_message request, options do |result, operation|
|
1045
|
+
yield result, operation if block_given?
|
1046
|
+
return result
|
1047
|
+
end
|
1048
|
+
rescue ::Gapic::Rest::Error => e
|
1049
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
##
|
1053
|
+
# Deletes a message.
|
1054
|
+
# For an example, see [Delete a
|
1055
|
+
# message](https://developers.google.com/workspace/chat/delete-messages).
|
1056
|
+
#
|
1057
|
+
# Requires
|
1058
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
1059
|
+
# Supports
|
1060
|
+
# [app
|
1061
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
1062
|
+
# and [user
|
1063
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1064
|
+
# When using app authentication, requests can only delete messages
|
1065
|
+
# created by the calling Chat app.
|
1066
|
+
#
|
1067
|
+
# @overload delete_message(request, options = nil)
|
1068
|
+
# Pass arguments to `delete_message` via a request object, either of type
|
1069
|
+
# {::Google::Apps::Chat::V1::DeleteMessageRequest} or an equivalent Hash.
|
1070
|
+
#
|
1071
|
+
# @param request [::Google::Apps::Chat::V1::DeleteMessageRequest, ::Hash]
|
1072
|
+
# A request object representing the call parameters. Required. To specify no
|
1073
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1074
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1075
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1076
|
+
#
|
1077
|
+
# @overload delete_message(name: nil, force: nil)
|
1078
|
+
# Pass arguments to `delete_message` via keyword arguments. Note that at
|
1079
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1080
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1081
|
+
#
|
1082
|
+
# @param name [::String]
|
1083
|
+
# Required. Resource name of the message.
|
1084
|
+
#
|
1085
|
+
# Format: `spaces/{space}/messages/{message}`
|
1086
|
+
#
|
1087
|
+
# If you've set a custom ID for your message, you can use the value from the
|
1088
|
+
# `clientAssignedMessageId` field for `{message}`. For details, see [Name a
|
1089
|
+
# message]
|
1090
|
+
# (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
|
1091
|
+
# @param force [::Boolean]
|
1092
|
+
# When `true`, deleting a message also deletes its threaded replies. When
|
1093
|
+
# `false`, if a message has threaded replies, deletion fails.
|
1094
|
+
#
|
1095
|
+
# Only applies when [authenticating as a
|
1096
|
+
# user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1097
|
+
# Has no effect when [authenticating as a Chat app]
|
1098
|
+
# (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
|
1099
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1100
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1101
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1102
|
+
#
|
1103
|
+
# @return [::Google::Protobuf::Empty]
|
1104
|
+
#
|
1105
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1106
|
+
#
|
1107
|
+
# @example Basic example
|
1108
|
+
# require "google/apps/chat/v1"
|
1109
|
+
#
|
1110
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1111
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1112
|
+
#
|
1113
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1114
|
+
# request = Google::Apps::Chat::V1::DeleteMessageRequest.new
|
1115
|
+
#
|
1116
|
+
# # Call the delete_message method.
|
1117
|
+
# result = client.delete_message request
|
1118
|
+
#
|
1119
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1120
|
+
# p result
|
1121
|
+
#
|
1122
|
+
def delete_message request, options = nil
|
1123
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1124
|
+
|
1125
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteMessageRequest
|
1126
|
+
|
1127
|
+
# Converts hash and nil to an options object
|
1128
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1129
|
+
|
1130
|
+
# Customize the options with defaults
|
1131
|
+
call_metadata = @config.rpcs.delete_message.metadata.to_h
|
1132
|
+
|
1133
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1134
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1135
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1136
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1137
|
+
transports_version_send: [:rest]
|
1138
|
+
|
1139
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1140
|
+
|
1141
|
+
options.apply_defaults timeout: @config.rpcs.delete_message.timeout,
|
1142
|
+
metadata: call_metadata,
|
1143
|
+
retry_policy: @config.rpcs.delete_message.retry_policy
|
1144
|
+
|
1145
|
+
options.apply_defaults timeout: @config.timeout,
|
1146
|
+
metadata: @config.metadata,
|
1147
|
+
retry_policy: @config.retry_policy
|
1148
|
+
|
1149
|
+
@chat_service_stub.delete_message request, options do |result, operation|
|
1150
|
+
yield result, operation if block_given?
|
1151
|
+
return result
|
1152
|
+
end
|
1153
|
+
rescue ::Gapic::Rest::Error => e
|
1154
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
##
|
1158
|
+
# Gets the metadata of a message attachment. The attachment data is fetched
|
1159
|
+
# using the [media
|
1160
|
+
# API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download).
|
1161
|
+
# For an example, see
|
1162
|
+
# [Get metadata about a message
|
1163
|
+
# attachment](https://developers.google.com/workspace/chat/get-media-attachments).
|
1164
|
+
# Requires [app
|
1165
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
|
1166
|
+
#
|
1167
|
+
# @overload get_attachment(request, options = nil)
|
1168
|
+
# Pass arguments to `get_attachment` via a request object, either of type
|
1169
|
+
# {::Google::Apps::Chat::V1::GetAttachmentRequest} or an equivalent Hash.
|
1170
|
+
#
|
1171
|
+
# @param request [::Google::Apps::Chat::V1::GetAttachmentRequest, ::Hash]
|
1172
|
+
# A request object representing the call parameters. Required. To specify no
|
1173
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1174
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1175
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1176
|
+
#
|
1177
|
+
# @overload get_attachment(name: nil)
|
1178
|
+
# Pass arguments to `get_attachment` via keyword arguments. Note that at
|
1179
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1180
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1181
|
+
#
|
1182
|
+
# @param name [::String]
|
1183
|
+
# Required. Resource name of the attachment, in the form
|
1184
|
+
# `spaces/*/messages/*/attachments/*`.
|
1185
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1186
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Attachment]
|
1187
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1188
|
+
#
|
1189
|
+
# @return [::Google::Apps::Chat::V1::Attachment]
|
1190
|
+
#
|
1191
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1192
|
+
#
|
1193
|
+
# @example Basic example
|
1194
|
+
# require "google/apps/chat/v1"
|
1195
|
+
#
|
1196
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1197
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1198
|
+
#
|
1199
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1200
|
+
# request = Google::Apps::Chat::V1::GetAttachmentRequest.new
|
1201
|
+
#
|
1202
|
+
# # Call the get_attachment method.
|
1203
|
+
# result = client.get_attachment request
|
1204
|
+
#
|
1205
|
+
# # The returned object is of type Google::Apps::Chat::V1::Attachment.
|
1206
|
+
# p result
|
1207
|
+
#
|
1208
|
+
def get_attachment request, options = nil
|
1209
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1210
|
+
|
1211
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetAttachmentRequest
|
1212
|
+
|
1213
|
+
# Converts hash and nil to an options object
|
1214
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1215
|
+
|
1216
|
+
# Customize the options with defaults
|
1217
|
+
call_metadata = @config.rpcs.get_attachment.metadata.to_h
|
1218
|
+
|
1219
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1220
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1221
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1222
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1223
|
+
transports_version_send: [:rest]
|
1224
|
+
|
1225
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1226
|
+
|
1227
|
+
options.apply_defaults timeout: @config.rpcs.get_attachment.timeout,
|
1228
|
+
metadata: call_metadata,
|
1229
|
+
retry_policy: @config.rpcs.get_attachment.retry_policy
|
1230
|
+
|
1231
|
+
options.apply_defaults timeout: @config.timeout,
|
1232
|
+
metadata: @config.metadata,
|
1233
|
+
retry_policy: @config.retry_policy
|
1234
|
+
|
1235
|
+
@chat_service_stub.get_attachment request, options do |result, operation|
|
1236
|
+
yield result, operation if block_given?
|
1237
|
+
return result
|
1238
|
+
end
|
1239
|
+
rescue ::Gapic::Rest::Error => e
|
1240
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
##
|
1244
|
+
# Uploads an attachment. For an example, see
|
1245
|
+
# [Upload media as a file
|
1246
|
+
# attachment](https://developers.google.com/workspace/chat/upload-media-attachments).
|
1247
|
+
# Requires user
|
1248
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1249
|
+
#
|
1250
|
+
# You can upload attachments up to 200 MB. Certain file types aren't
|
1251
|
+
# supported. For details, see [File types blocked by Google
|
1252
|
+
# Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).
|
1253
|
+
#
|
1254
|
+
# @overload upload_attachment(request, options = nil)
|
1255
|
+
# Pass arguments to `upload_attachment` via a request object, either of type
|
1256
|
+
# {::Google::Apps::Chat::V1::UploadAttachmentRequest} or an equivalent Hash.
|
1257
|
+
#
|
1258
|
+
# @param request [::Google::Apps::Chat::V1::UploadAttachmentRequest, ::Hash]
|
1259
|
+
# A request object representing the call parameters. Required. To specify no
|
1260
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1261
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1262
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1263
|
+
#
|
1264
|
+
# @overload upload_attachment(parent: nil, filename: nil)
|
1265
|
+
# Pass arguments to `upload_attachment` via keyword arguments. Note that at
|
1266
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1267
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1268
|
+
#
|
1269
|
+
# @param parent [::String]
|
1270
|
+
# Required. Resource name of the Chat space in which the attachment is
|
1271
|
+
# uploaded. Format "spaces/\\{space}".
|
1272
|
+
# @param filename [::String]
|
1273
|
+
# Required. The filename of the attachment, including the file extension.
|
1274
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1275
|
+
# @yieldparam result [::Google::Apps::Chat::V1::UploadAttachmentResponse]
|
1276
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1277
|
+
#
|
1278
|
+
# @return [::Google::Apps::Chat::V1::UploadAttachmentResponse]
|
1279
|
+
#
|
1280
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1281
|
+
#
|
1282
|
+
# @example Basic example
|
1283
|
+
# require "google/apps/chat/v1"
|
1284
|
+
#
|
1285
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1286
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1287
|
+
#
|
1288
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1289
|
+
# request = Google::Apps::Chat::V1::UploadAttachmentRequest.new
|
1290
|
+
#
|
1291
|
+
# # Call the upload_attachment method.
|
1292
|
+
# result = client.upload_attachment request
|
1293
|
+
#
|
1294
|
+
# # The returned object is of type Google::Apps::Chat::V1::UploadAttachmentResponse.
|
1295
|
+
# p result
|
1296
|
+
#
|
1297
|
+
def upload_attachment request, options = nil
|
1298
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1299
|
+
|
1300
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UploadAttachmentRequest
|
1301
|
+
|
1302
|
+
# Converts hash and nil to an options object
|
1303
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1304
|
+
|
1305
|
+
# Customize the options with defaults
|
1306
|
+
call_metadata = @config.rpcs.upload_attachment.metadata.to_h
|
1307
|
+
|
1308
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1309
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1310
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1311
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1312
|
+
transports_version_send: [:rest]
|
1313
|
+
|
1314
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1315
|
+
|
1316
|
+
options.apply_defaults timeout: @config.rpcs.upload_attachment.timeout,
|
1317
|
+
metadata: call_metadata,
|
1318
|
+
retry_policy: @config.rpcs.upload_attachment.retry_policy
|
1319
|
+
|
1320
|
+
options.apply_defaults timeout: @config.timeout,
|
1321
|
+
metadata: @config.metadata,
|
1322
|
+
retry_policy: @config.retry_policy
|
1323
|
+
|
1324
|
+
@chat_service_stub.upload_attachment request, options do |result, operation|
|
1325
|
+
yield result, operation if block_given?
|
1326
|
+
return result
|
1327
|
+
end
|
1328
|
+
rescue ::Gapic::Rest::Error => e
|
1329
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1330
|
+
end
|
1331
|
+
|
1332
|
+
##
|
1333
|
+
# Lists spaces the caller is a member of. Group chats and DMs aren't listed
|
1334
|
+
# until the first message is sent. For an example, see
|
1335
|
+
# [List
|
1336
|
+
# spaces](https://developers.google.com/workspace/chat/list-spaces).
|
1337
|
+
#
|
1338
|
+
# Requires
|
1339
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
1340
|
+
# Supports
|
1341
|
+
# [app
|
1342
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
1343
|
+
# and [user
|
1344
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1345
|
+
#
|
1346
|
+
# Lists spaces visible to the caller or authenticated user. Group chats
|
1347
|
+
# and DMs aren't listed until the first message is sent.
|
1348
|
+
#
|
1349
|
+
# @overload list_spaces(request, options = nil)
|
1350
|
+
# Pass arguments to `list_spaces` via a request object, either of type
|
1351
|
+
# {::Google::Apps::Chat::V1::ListSpacesRequest} or an equivalent Hash.
|
1352
|
+
#
|
1353
|
+
# @param request [::Google::Apps::Chat::V1::ListSpacesRequest, ::Hash]
|
1354
|
+
# A request object representing the call parameters. Required. To specify no
|
1355
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1356
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1357
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1358
|
+
#
|
1359
|
+
# @overload list_spaces(page_size: nil, page_token: nil, filter: nil)
|
1360
|
+
# Pass arguments to `list_spaces` via keyword arguments. Note that at
|
1361
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1362
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1363
|
+
#
|
1364
|
+
# @param page_size [::Integer]
|
1365
|
+
# Optional. The maximum number of spaces to return. The service might return
|
1366
|
+
# fewer than this value.
|
1367
|
+
#
|
1368
|
+
# If unspecified, at most 100 spaces are returned.
|
1369
|
+
#
|
1370
|
+
# The maximum value is 1000. If you use a value more than 1000, it's
|
1371
|
+
# automatically changed to 1000.
|
1372
|
+
#
|
1373
|
+
# Negative values return an `INVALID_ARGUMENT` error.
|
1374
|
+
# @param page_token [::String]
|
1375
|
+
# Optional. A page token, received from a previous list spaces call.
|
1376
|
+
# Provide this parameter to retrieve the subsequent page.
|
1377
|
+
#
|
1378
|
+
# When paginating, the filter value should match the call that provided the
|
1379
|
+
# page token. Passing a different value may lead to unexpected results.
|
1380
|
+
# @param filter [::String]
|
1381
|
+
# Optional. A query filter.
|
1382
|
+
#
|
1383
|
+
# You can filter spaces by the space type
|
1384
|
+
# ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)).
|
1385
|
+
#
|
1386
|
+
# To filter by space type, you must specify valid enum value, such as
|
1387
|
+
# `SPACE` or `GROUP_CHAT` (the `space_type` can't be
|
1388
|
+
# `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR`
|
1389
|
+
# operator.
|
1390
|
+
#
|
1391
|
+
# For example, the following queries are valid:
|
1392
|
+
#
|
1393
|
+
# ```
|
1394
|
+
# space_type = "SPACE"
|
1395
|
+
# spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"
|
1396
|
+
# ```
|
1397
|
+
#
|
1398
|
+
# Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
|
1399
|
+
# error.
|
1400
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1401
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>]
|
1402
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1403
|
+
#
|
1404
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Space>]
|
1405
|
+
#
|
1406
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1407
|
+
#
|
1408
|
+
# @example Basic example
|
1409
|
+
# require "google/apps/chat/v1"
|
1410
|
+
#
|
1411
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1412
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1413
|
+
#
|
1414
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1415
|
+
# request = Google::Apps::Chat::V1::ListSpacesRequest.new
|
1416
|
+
#
|
1417
|
+
# # Call the list_spaces method.
|
1418
|
+
# result = client.list_spaces request
|
1419
|
+
#
|
1420
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1421
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1422
|
+
# result.each do |item|
|
1423
|
+
# # Each element is of type ::Google::Apps::Chat::V1::Space.
|
1424
|
+
# p item
|
1425
|
+
# end
|
1426
|
+
#
|
1427
|
+
def list_spaces request, options = nil
|
1428
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1429
|
+
|
1430
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListSpacesRequest
|
1431
|
+
|
1432
|
+
# Converts hash and nil to an options object
|
1433
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1434
|
+
|
1435
|
+
# Customize the options with defaults
|
1436
|
+
call_metadata = @config.rpcs.list_spaces.metadata.to_h
|
1437
|
+
|
1438
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1439
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1440
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1441
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1442
|
+
transports_version_send: [:rest]
|
1443
|
+
|
1444
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1445
|
+
|
1446
|
+
options.apply_defaults timeout: @config.rpcs.list_spaces.timeout,
|
1447
|
+
metadata: call_metadata,
|
1448
|
+
retry_policy: @config.rpcs.list_spaces.retry_policy
|
1449
|
+
|
1450
|
+
options.apply_defaults timeout: @config.timeout,
|
1451
|
+
metadata: @config.metadata,
|
1452
|
+
retry_policy: @config.retry_policy
|
1453
|
+
|
1454
|
+
@chat_service_stub.list_spaces request, options do |result, operation|
|
1455
|
+
result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_spaces, "spaces", request, result, options
|
1456
|
+
yield result, operation if block_given?
|
1457
|
+
return result
|
1458
|
+
end
|
1459
|
+
rescue ::Gapic::Rest::Error => e
|
1460
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1461
|
+
end
|
1462
|
+
|
1463
|
+
##
|
1464
|
+
# Returns details about a space. For an example, see
|
1465
|
+
# [Get details about a
|
1466
|
+
# space](https://developers.google.com/workspace/chat/get-spaces).
|
1467
|
+
#
|
1468
|
+
# Requires
|
1469
|
+
# [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
|
1470
|
+
# Supports
|
1471
|
+
# [app
|
1472
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
|
1473
|
+
# and [user
|
1474
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1475
|
+
#
|
1476
|
+
# @overload get_space(request, options = nil)
|
1477
|
+
# Pass arguments to `get_space` via a request object, either of type
|
1478
|
+
# {::Google::Apps::Chat::V1::GetSpaceRequest} or an equivalent Hash.
|
1479
|
+
#
|
1480
|
+
# @param request [::Google::Apps::Chat::V1::GetSpaceRequest, ::Hash]
|
1481
|
+
# A request object representing the call parameters. Required. To specify no
|
1482
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1483
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1484
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1485
|
+
#
|
1486
|
+
# @overload get_space(name: nil)
|
1487
|
+
# Pass arguments to `get_space` via keyword arguments. Note that at
|
1488
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1489
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1490
|
+
#
|
1491
|
+
# @param name [::String]
|
1492
|
+
# Required. Resource name of the space, in the form "spaces/*".
|
1493
|
+
#
|
1494
|
+
# Format: `spaces/{space}`
|
1495
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1496
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Space]
|
1497
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1498
|
+
#
|
1499
|
+
# @return [::Google::Apps::Chat::V1::Space]
|
1500
|
+
#
|
1501
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1502
|
+
#
|
1503
|
+
# @example Basic example
|
1504
|
+
# require "google/apps/chat/v1"
|
1505
|
+
#
|
1506
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1507
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1508
|
+
#
|
1509
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1510
|
+
# request = Google::Apps::Chat::V1::GetSpaceRequest.new
|
1511
|
+
#
|
1512
|
+
# # Call the get_space method.
|
1513
|
+
# result = client.get_space request
|
1514
|
+
#
|
1515
|
+
# # The returned object is of type Google::Apps::Chat::V1::Space.
|
1516
|
+
# p result
|
1517
|
+
#
|
1518
|
+
def get_space request, options = nil
|
1519
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1520
|
+
|
1521
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceRequest
|
1522
|
+
|
1523
|
+
# Converts hash and nil to an options object
|
1524
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1525
|
+
|
1526
|
+
# Customize the options with defaults
|
1527
|
+
call_metadata = @config.rpcs.get_space.metadata.to_h
|
1528
|
+
|
1529
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1530
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1531
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1532
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1533
|
+
transports_version_send: [:rest]
|
1534
|
+
|
1535
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1536
|
+
|
1537
|
+
options.apply_defaults timeout: @config.rpcs.get_space.timeout,
|
1538
|
+
metadata: call_metadata,
|
1539
|
+
retry_policy: @config.rpcs.get_space.retry_policy
|
1540
|
+
|
1541
|
+
options.apply_defaults timeout: @config.timeout,
|
1542
|
+
metadata: @config.metadata,
|
1543
|
+
retry_policy: @config.retry_policy
|
1544
|
+
|
1545
|
+
@chat_service_stub.get_space request, options do |result, operation|
|
1546
|
+
yield result, operation if block_given?
|
1547
|
+
return result
|
1548
|
+
end
|
1549
|
+
rescue ::Gapic::Rest::Error => e
|
1550
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
##
|
1554
|
+
# Creates a named space. Spaces grouped by topics aren't supported. For an
|
1555
|
+
# example, see [Create a
|
1556
|
+
# space](https://developers.google.com/workspace/chat/create-spaces).
|
1557
|
+
#
|
1558
|
+
# If you receive the error message `ALREADY_EXISTS` when creating
|
1559
|
+
# a space, try a different `displayName`. An existing space within
|
1560
|
+
# the Google Workspace organization might already use this display name.
|
1561
|
+
#
|
1562
|
+
# Requires [user
|
1563
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1564
|
+
#
|
1565
|
+
# @overload create_space(request, options = nil)
|
1566
|
+
# Pass arguments to `create_space` via a request object, either of type
|
1567
|
+
# {::Google::Apps::Chat::V1::CreateSpaceRequest} or an equivalent Hash.
|
1568
|
+
#
|
1569
|
+
# @param request [::Google::Apps::Chat::V1::CreateSpaceRequest, ::Hash]
|
1570
|
+
# A request object representing the call parameters. Required. To specify no
|
1571
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1572
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1573
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1574
|
+
#
|
1575
|
+
# @overload create_space(space: nil, request_id: nil)
|
1576
|
+
# Pass arguments to `create_space` via keyword arguments. Note that at
|
1577
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1578
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1579
|
+
#
|
1580
|
+
# @param space [::Google::Apps::Chat::V1::Space, ::Hash]
|
1581
|
+
# Required. The `displayName` and `spaceType` fields must be populated. Only
|
1582
|
+
# `SpaceType.SPACE` is supported.
|
1583
|
+
#
|
1584
|
+
# If you receive the error message `ALREADY_EXISTS` when creating a space,
|
1585
|
+
# try a different `displayName`. An existing space within the Google
|
1586
|
+
# Workspace organization might already use this display name.
|
1587
|
+
#
|
1588
|
+
# The space `name` is assigned on the server so anything specified in this
|
1589
|
+
# field will be ignored.
|
1590
|
+
# @param request_id [::String]
|
1591
|
+
# Optional. A unique identifier for this request.
|
1592
|
+
# A random UUID is recommended.
|
1593
|
+
# Specifying an existing request ID returns the space created with that ID
|
1594
|
+
# instead of creating a new space.
|
1595
|
+
# Specifying an existing request ID from the same Chat app with a different
|
1596
|
+
# authenticated user returns an error.
|
1597
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1598
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Space]
|
1599
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1600
|
+
#
|
1601
|
+
# @return [::Google::Apps::Chat::V1::Space]
|
1602
|
+
#
|
1603
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1604
|
+
#
|
1605
|
+
# @example Basic example
|
1606
|
+
# require "google/apps/chat/v1"
|
1607
|
+
#
|
1608
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1609
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1610
|
+
#
|
1611
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1612
|
+
# request = Google::Apps::Chat::V1::CreateSpaceRequest.new
|
1613
|
+
#
|
1614
|
+
# # Call the create_space method.
|
1615
|
+
# result = client.create_space request
|
1616
|
+
#
|
1617
|
+
# # The returned object is of type Google::Apps::Chat::V1::Space.
|
1618
|
+
# p result
|
1619
|
+
#
|
1620
|
+
def create_space request, options = nil
|
1621
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1622
|
+
|
1623
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateSpaceRequest
|
1624
|
+
|
1625
|
+
# Converts hash and nil to an options object
|
1626
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1627
|
+
|
1628
|
+
# Customize the options with defaults
|
1629
|
+
call_metadata = @config.rpcs.create_space.metadata.to_h
|
1630
|
+
|
1631
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1632
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1633
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1634
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1635
|
+
transports_version_send: [:rest]
|
1636
|
+
|
1637
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1638
|
+
|
1639
|
+
options.apply_defaults timeout: @config.rpcs.create_space.timeout,
|
1640
|
+
metadata: call_metadata,
|
1641
|
+
retry_policy: @config.rpcs.create_space.retry_policy
|
1642
|
+
|
1643
|
+
options.apply_defaults timeout: @config.timeout,
|
1644
|
+
metadata: @config.metadata,
|
1645
|
+
retry_policy: @config.retry_policy
|
1646
|
+
|
1647
|
+
@chat_service_stub.create_space request, options do |result, operation|
|
1648
|
+
yield result, operation if block_given?
|
1649
|
+
return result
|
1650
|
+
end
|
1651
|
+
rescue ::Gapic::Rest::Error => e
|
1652
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1653
|
+
end
|
1654
|
+
|
1655
|
+
##
|
1656
|
+
# Creates a space and adds specified users to it. The calling user is
|
1657
|
+
# automatically added to the space, and shouldn't be specified as a
|
1658
|
+
# membership in the request. For an example, see
|
1659
|
+
# [Set up a space with initial
|
1660
|
+
# members](https://developers.google.com/workspace/chat/set-up-spaces).
|
1661
|
+
#
|
1662
|
+
# To specify the human members to add, add memberships with the appropriate
|
1663
|
+
# `member.name` in the `SetUpSpaceRequest`. To add a human user, use
|
1664
|
+
# `users/{user}`, where `{user}` can be the email address for the user. For
|
1665
|
+
# users in the same Workspace organization `{user}` can also be the `id` for
|
1666
|
+
# the person from the People API, or the `id` for the user in the Directory
|
1667
|
+
# API. For example, if the People API Person profile ID for
|
1668
|
+
# `user@example.com` is `123456789`, you can add the user to the space by
|
1669
|
+
# setting the `membership.member.name` to `users/user@example.com` or
|
1670
|
+
# `users/123456789`.
|
1671
|
+
#
|
1672
|
+
# For a space or group chat, if the caller blocks or is blocked by some
|
1673
|
+
# members, then those members aren't added to the created space.
|
1674
|
+
#
|
1675
|
+
# To create a direct message (DM) between the calling user and another human
|
1676
|
+
# user, specify exactly one membership to represent the human user. If
|
1677
|
+
# one user blocks the other, the request fails and the DM isn't created.
|
1678
|
+
#
|
1679
|
+
# To create a DM between the calling user and the calling app, set
|
1680
|
+
# `Space.singleUserBotDm` to `true` and don't specify any memberships. You
|
1681
|
+
# can only use this method to set up a DM with the calling app. To add the
|
1682
|
+
# calling app as a member of a space or an existing DM between two human
|
1683
|
+
# users, see
|
1684
|
+
# [Invite or add a user or app to a
|
1685
|
+
# space](https://developers.google.com/workspace/chat/create-members).
|
1686
|
+
#
|
1687
|
+
# If a DM already exists between two users, even when one user blocks the
|
1688
|
+
# other at the time a request is made, then the existing DM is returned.
|
1689
|
+
#
|
1690
|
+
# Spaces with threaded replies aren't supported. If you receive the error
|
1691
|
+
# message `ALREADY_EXISTS` when setting up a space, try a different
|
1692
|
+
# `displayName`. An existing space within the Google Workspace organization
|
1693
|
+
# might already use this display name.
|
1694
|
+
#
|
1695
|
+
# Requires [user
|
1696
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1697
|
+
#
|
1698
|
+
# @overload set_up_space(request, options = nil)
|
1699
|
+
# Pass arguments to `set_up_space` via a request object, either of type
|
1700
|
+
# {::Google::Apps::Chat::V1::SetUpSpaceRequest} or an equivalent Hash.
|
1701
|
+
#
|
1702
|
+
# @param request [::Google::Apps::Chat::V1::SetUpSpaceRequest, ::Hash]
|
1703
|
+
# A request object representing the call parameters. Required. To specify no
|
1704
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1705
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1706
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1707
|
+
#
|
1708
|
+
# @overload set_up_space(space: nil, request_id: nil, memberships: nil)
|
1709
|
+
# Pass arguments to `set_up_space` via keyword arguments. Note that at
|
1710
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1711
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1712
|
+
#
|
1713
|
+
# @param space [::Google::Apps::Chat::V1::Space, ::Hash]
|
1714
|
+
# Required. The `Space.spaceType` field is required.
|
1715
|
+
#
|
1716
|
+
# To create a space, set `Space.spaceType` to `SPACE` and set
|
1717
|
+
# `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when
|
1718
|
+
# setting up a space, try a different `displayName`. An existing space
|
1719
|
+
# within the Google Workspace organization might already use this display
|
1720
|
+
# name.
|
1721
|
+
#
|
1722
|
+
# To create a group chat, set `Space.spaceType` to
|
1723
|
+
# `GROUP_CHAT`. Don't set `Space.displayName`.
|
1724
|
+
#
|
1725
|
+
# To create a 1:1 conversation between humans,
|
1726
|
+
# set `Space.spaceType` to `DIRECT_MESSAGE` and set
|
1727
|
+
# `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or
|
1728
|
+
# `Space.spaceDetails`.
|
1729
|
+
#
|
1730
|
+
# To create an 1:1 conversation between a human and the calling Chat app, set
|
1731
|
+
# `Space.spaceType` to `DIRECT_MESSAGE` and
|
1732
|
+
# `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or
|
1733
|
+
# `Space.spaceDetails`.
|
1734
|
+
#
|
1735
|
+
# If a `DIRECT_MESSAGE` space already exists, that space is returned instead
|
1736
|
+
# of creating a new space.
|
1737
|
+
# @param request_id [::String]
|
1738
|
+
# Optional. A unique identifier for this request.
|
1739
|
+
# A random UUID is recommended.
|
1740
|
+
# Specifying an existing request ID returns the space created with that ID
|
1741
|
+
# instead of creating a new space.
|
1742
|
+
# Specifying an existing request ID from the same Chat app with a different
|
1743
|
+
# authenticated user returns an error.
|
1744
|
+
# @param memberships [::Array<::Google::Apps::Chat::V1::Membership, ::Hash>]
|
1745
|
+
# Optional. The Google Chat users to invite to join the space. Omit the
|
1746
|
+
# calling user, as they are added automatically.
|
1747
|
+
#
|
1748
|
+
# The set currently allows up to 20 memberships (in addition to the caller).
|
1749
|
+
#
|
1750
|
+
# The `Membership.member` field must contain a `user` with `name` populated
|
1751
|
+
# (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only
|
1752
|
+
# add human users when setting up a space (adding Chat apps is only supported
|
1753
|
+
# for direct message setup with the calling app). You can also add members
|
1754
|
+
# using the user's email as an alias for \\{user}. For example, the `user.name`
|
1755
|
+
# can be `users/example@gmail.com`." To invite Gmail users or users from
|
1756
|
+
# external Google Workspace domains, user's email must be used for
|
1757
|
+
# `{user}`.
|
1758
|
+
#
|
1759
|
+
# Optional when setting `Space.spaceType` to `SPACE`.
|
1760
|
+
#
|
1761
|
+
# Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at
|
1762
|
+
# least two memberships.
|
1763
|
+
#
|
1764
|
+
# Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human
|
1765
|
+
# user, along with exactly one membership.
|
1766
|
+
#
|
1767
|
+
# Must be empty when creating a 1:1 conversation between a human and the
|
1768
|
+
# calling Chat app (when setting `Space.spaceType` to
|
1769
|
+
# `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`).
|
1770
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1771
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Space]
|
1772
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1773
|
+
#
|
1774
|
+
# @return [::Google::Apps::Chat::V1::Space]
|
1775
|
+
#
|
1776
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1777
|
+
#
|
1778
|
+
# @example Basic example
|
1779
|
+
# require "google/apps/chat/v1"
|
1780
|
+
#
|
1781
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1782
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1783
|
+
#
|
1784
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1785
|
+
# request = Google::Apps::Chat::V1::SetUpSpaceRequest.new
|
1786
|
+
#
|
1787
|
+
# # Call the set_up_space method.
|
1788
|
+
# result = client.set_up_space request
|
1789
|
+
#
|
1790
|
+
# # The returned object is of type Google::Apps::Chat::V1::Space.
|
1791
|
+
# p result
|
1792
|
+
#
|
1793
|
+
def set_up_space request, options = nil
|
1794
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1795
|
+
|
1796
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::SetUpSpaceRequest
|
1797
|
+
|
1798
|
+
# Converts hash and nil to an options object
|
1799
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1800
|
+
|
1801
|
+
# Customize the options with defaults
|
1802
|
+
call_metadata = @config.rpcs.set_up_space.metadata.to_h
|
1803
|
+
|
1804
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1805
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1806
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1807
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1808
|
+
transports_version_send: [:rest]
|
1809
|
+
|
1810
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1811
|
+
|
1812
|
+
options.apply_defaults timeout: @config.rpcs.set_up_space.timeout,
|
1813
|
+
metadata: call_metadata,
|
1814
|
+
retry_policy: @config.rpcs.set_up_space.retry_policy
|
1815
|
+
|
1816
|
+
options.apply_defaults timeout: @config.timeout,
|
1817
|
+
metadata: @config.metadata,
|
1818
|
+
retry_policy: @config.retry_policy
|
1819
|
+
|
1820
|
+
@chat_service_stub.set_up_space request, options do |result, operation|
|
1821
|
+
yield result, operation if block_given?
|
1822
|
+
return result
|
1823
|
+
end
|
1824
|
+
rescue ::Gapic::Rest::Error => e
|
1825
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1826
|
+
end
|
1827
|
+
|
1828
|
+
##
|
1829
|
+
# Updates a space. For an example, see
|
1830
|
+
# [Update a
|
1831
|
+
# space](https://developers.google.com/workspace/chat/update-spaces).
|
1832
|
+
#
|
1833
|
+
# If you're updating the `displayName` field and receive the error message
|
1834
|
+
# `ALREADY_EXISTS`, try a different display name.. An existing space within
|
1835
|
+
# the Google Workspace organization might already use this display name.
|
1836
|
+
#
|
1837
|
+
# Requires [user
|
1838
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
1839
|
+
#
|
1840
|
+
# @overload update_space(request, options = nil)
|
1841
|
+
# Pass arguments to `update_space` via a request object, either of type
|
1842
|
+
# {::Google::Apps::Chat::V1::UpdateSpaceRequest} or an equivalent Hash.
|
1843
|
+
#
|
1844
|
+
# @param request [::Google::Apps::Chat::V1::UpdateSpaceRequest, ::Hash]
|
1845
|
+
# A request object representing the call parameters. Required. To specify no
|
1846
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1847
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1848
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1849
|
+
#
|
1850
|
+
# @overload update_space(space: nil, update_mask: nil)
|
1851
|
+
# Pass arguments to `update_space` via keyword arguments. Note that at
|
1852
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1853
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1854
|
+
#
|
1855
|
+
# @param space [::Google::Apps::Chat::V1::Space, ::Hash]
|
1856
|
+
# Required. Space with fields to be updated. `Space.name` must be
|
1857
|
+
# populated in the form of `spaces/{space}`. Only fields
|
1858
|
+
# specified by `update_mask` are updated.
|
1859
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1860
|
+
# Required. The updated field paths, comma separated if there are
|
1861
|
+
# multiple.
|
1862
|
+
#
|
1863
|
+
# Currently supported field paths:
|
1864
|
+
#
|
1865
|
+
# - `display_name` (Only supports changing the display name of a space with
|
1866
|
+
# the `SPACE` type, or when also including the `space_type` mask to change a
|
1867
|
+
# `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a
|
1868
|
+
# `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument
|
1869
|
+
# error. If you receive the error message `ALREADY_EXISTS` when updating the
|
1870
|
+
# `displayName`, try a different `displayName`. An existing space within the
|
1871
|
+
# Google Workspace organization might already use this display name.)
|
1872
|
+
#
|
1873
|
+
# - `space_type` (Only supports changing a `GROUP_CHAT` space type to
|
1874
|
+
# `SPACE`. Include `display_name` together
|
1875
|
+
# with `space_type` in the update mask and ensure that the specified space
|
1876
|
+
# has a non-empty display name and the `SPACE` space type. Including the
|
1877
|
+
# `space_type` mask and the `SPACE` type in the specified space when updating
|
1878
|
+
# the display name is optional if the existing space already has the `SPACE`
|
1879
|
+
# type. Trying to update the space type in other ways results in an invalid
|
1880
|
+
# argument error).
|
1881
|
+
#
|
1882
|
+
# - `space_details`
|
1883
|
+
#
|
1884
|
+
# - `space_history_state` (Supports [turning history on or off for the
|
1885
|
+
# space](https://support.google.com/chat/answer/7664687) if [the organization
|
1886
|
+
# allows users to change their history
|
1887
|
+
# setting](https://support.google.com/a/answer/7664184).
|
1888
|
+
# Warning: mutually exclusive with all other field paths.)
|
1889
|
+
#
|
1890
|
+
# - Developer Preview: `access_settings.audience` (Supports changing the
|
1891
|
+
# [access setting](https://support.google.com/chat/answer/11971020) of a
|
1892
|
+
# space. If no audience is specified in the access setting, the space's
|
1893
|
+
# access setting is updated to restricted. Warning: mutually exclusive with
|
1894
|
+
# all other field paths.)
|
1895
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1896
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Space]
|
1897
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1898
|
+
#
|
1899
|
+
# @return [::Google::Apps::Chat::V1::Space]
|
1900
|
+
#
|
1901
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1902
|
+
#
|
1903
|
+
# @example Basic example
|
1904
|
+
# require "google/apps/chat/v1"
|
1905
|
+
#
|
1906
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1907
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1908
|
+
#
|
1909
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1910
|
+
# request = Google::Apps::Chat::V1::UpdateSpaceRequest.new
|
1911
|
+
#
|
1912
|
+
# # Call the update_space method.
|
1913
|
+
# result = client.update_space request
|
1914
|
+
#
|
1915
|
+
# # The returned object is of type Google::Apps::Chat::V1::Space.
|
1916
|
+
# p result
|
1917
|
+
#
|
1918
|
+
def update_space request, options = nil
|
1919
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1920
|
+
|
1921
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceRequest
|
1922
|
+
|
1923
|
+
# Converts hash and nil to an options object
|
1924
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1925
|
+
|
1926
|
+
# Customize the options with defaults
|
1927
|
+
call_metadata = @config.rpcs.update_space.metadata.to_h
|
1928
|
+
|
1929
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1930
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1931
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1932
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
1933
|
+
transports_version_send: [:rest]
|
1934
|
+
|
1935
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1936
|
+
|
1937
|
+
options.apply_defaults timeout: @config.rpcs.update_space.timeout,
|
1938
|
+
metadata: call_metadata,
|
1939
|
+
retry_policy: @config.rpcs.update_space.retry_policy
|
1940
|
+
|
1941
|
+
options.apply_defaults timeout: @config.timeout,
|
1942
|
+
metadata: @config.metadata,
|
1943
|
+
retry_policy: @config.retry_policy
|
1944
|
+
|
1945
|
+
@chat_service_stub.update_space request, options do |result, operation|
|
1946
|
+
yield result, operation if block_given?
|
1947
|
+
return result
|
1948
|
+
end
|
1949
|
+
rescue ::Gapic::Rest::Error => e
|
1950
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1951
|
+
end
|
1952
|
+
|
1953
|
+
##
|
1954
|
+
# Deletes a named space. Always performs a cascading delete, which means
|
1955
|
+
# that the space's child resources—like messages posted in the space and
|
1956
|
+
# memberships in the space—are also deleted. For an example, see
|
1957
|
+
# [Delete a
|
1958
|
+
# space](https://developers.google.com/workspace/chat/delete-spaces).
|
1959
|
+
# Requires [user
|
1960
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
|
1961
|
+
# from a user who has permission to delete the space.
|
1962
|
+
#
|
1963
|
+
# @overload delete_space(request, options = nil)
|
1964
|
+
# Pass arguments to `delete_space` via a request object, either of type
|
1965
|
+
# {::Google::Apps::Chat::V1::DeleteSpaceRequest} or an equivalent Hash.
|
1966
|
+
#
|
1967
|
+
# @param request [::Google::Apps::Chat::V1::DeleteSpaceRequest, ::Hash]
|
1968
|
+
# A request object representing the call parameters. Required. To specify no
|
1969
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1970
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1971
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1972
|
+
#
|
1973
|
+
# @overload delete_space(name: nil)
|
1974
|
+
# Pass arguments to `delete_space` via keyword arguments. Note that at
|
1975
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1976
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1977
|
+
#
|
1978
|
+
# @param name [::String]
|
1979
|
+
# Required. Resource name of the space to delete.
|
1980
|
+
#
|
1981
|
+
# Format: `spaces/{space}`
|
1982
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1983
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1984
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1985
|
+
#
|
1986
|
+
# @return [::Google::Protobuf::Empty]
|
1987
|
+
#
|
1988
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1989
|
+
#
|
1990
|
+
# @example Basic example
|
1991
|
+
# require "google/apps/chat/v1"
|
1992
|
+
#
|
1993
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1994
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
1995
|
+
#
|
1996
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1997
|
+
# request = Google::Apps::Chat::V1::DeleteSpaceRequest.new
|
1998
|
+
#
|
1999
|
+
# # Call the delete_space method.
|
2000
|
+
# result = client.delete_space request
|
2001
|
+
#
|
2002
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
2003
|
+
# p result
|
2004
|
+
#
|
2005
|
+
def delete_space request, options = nil
|
2006
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2007
|
+
|
2008
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteSpaceRequest
|
2009
|
+
|
2010
|
+
# Converts hash and nil to an options object
|
2011
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2012
|
+
|
2013
|
+
# Customize the options with defaults
|
2014
|
+
call_metadata = @config.rpcs.delete_space.metadata.to_h
|
2015
|
+
|
2016
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2017
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2018
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2019
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2020
|
+
transports_version_send: [:rest]
|
2021
|
+
|
2022
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2023
|
+
|
2024
|
+
options.apply_defaults timeout: @config.rpcs.delete_space.timeout,
|
2025
|
+
metadata: call_metadata,
|
2026
|
+
retry_policy: @config.rpcs.delete_space.retry_policy
|
2027
|
+
|
2028
|
+
options.apply_defaults timeout: @config.timeout,
|
2029
|
+
metadata: @config.metadata,
|
2030
|
+
retry_policy: @config.retry_policy
|
2031
|
+
|
2032
|
+
@chat_service_stub.delete_space request, options do |result, operation|
|
2033
|
+
yield result, operation if block_given?
|
2034
|
+
return result
|
2035
|
+
end
|
2036
|
+
rescue ::Gapic::Rest::Error => e
|
2037
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2038
|
+
end
|
2039
|
+
|
2040
|
+
##
|
2041
|
+
# Completes the
|
2042
|
+
# [import process](https://developers.google.com/workspace/chat/import-data)
|
2043
|
+
# for the specified space and makes it visible to users.
|
2044
|
+
# Requires app authentication and domain-wide delegation. For more
|
2045
|
+
# information, see [Authorize Google Chat apps to import
|
2046
|
+
# data](https://developers.google.com/workspace/chat/authorize-import).
|
2047
|
+
#
|
2048
|
+
# @overload complete_import_space(request, options = nil)
|
2049
|
+
# Pass arguments to `complete_import_space` via a request object, either of type
|
2050
|
+
# {::Google::Apps::Chat::V1::CompleteImportSpaceRequest} or an equivalent Hash.
|
2051
|
+
#
|
2052
|
+
# @param request [::Google::Apps::Chat::V1::CompleteImportSpaceRequest, ::Hash]
|
2053
|
+
# A request object representing the call parameters. Required. To specify no
|
2054
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2055
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2056
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2057
|
+
#
|
2058
|
+
# @overload complete_import_space(name: nil)
|
2059
|
+
# Pass arguments to `complete_import_space` via keyword arguments. Note that at
|
2060
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2061
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2062
|
+
#
|
2063
|
+
# @param name [::String]
|
2064
|
+
# Required. Resource name of the import mode space.
|
2065
|
+
#
|
2066
|
+
# Format: `spaces/{space}`
|
2067
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2068
|
+
# @yieldparam result [::Google::Apps::Chat::V1::CompleteImportSpaceResponse]
|
2069
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2070
|
+
#
|
2071
|
+
# @return [::Google::Apps::Chat::V1::CompleteImportSpaceResponse]
|
2072
|
+
#
|
2073
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2074
|
+
#
|
2075
|
+
# @example Basic example
|
2076
|
+
# require "google/apps/chat/v1"
|
2077
|
+
#
|
2078
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2079
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2080
|
+
#
|
2081
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2082
|
+
# request = Google::Apps::Chat::V1::CompleteImportSpaceRequest.new
|
2083
|
+
#
|
2084
|
+
# # Call the complete_import_space method.
|
2085
|
+
# result = client.complete_import_space request
|
2086
|
+
#
|
2087
|
+
# # The returned object is of type Google::Apps::Chat::V1::CompleteImportSpaceResponse.
|
2088
|
+
# p result
|
2089
|
+
#
|
2090
|
+
def complete_import_space request, options = nil
|
2091
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2092
|
+
|
2093
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CompleteImportSpaceRequest
|
2094
|
+
|
2095
|
+
# Converts hash and nil to an options object
|
2096
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2097
|
+
|
2098
|
+
# Customize the options with defaults
|
2099
|
+
call_metadata = @config.rpcs.complete_import_space.metadata.to_h
|
2100
|
+
|
2101
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2102
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2103
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2104
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2105
|
+
transports_version_send: [:rest]
|
2106
|
+
|
2107
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2108
|
+
|
2109
|
+
options.apply_defaults timeout: @config.rpcs.complete_import_space.timeout,
|
2110
|
+
metadata: call_metadata,
|
2111
|
+
retry_policy: @config.rpcs.complete_import_space.retry_policy
|
2112
|
+
|
2113
|
+
options.apply_defaults timeout: @config.timeout,
|
2114
|
+
metadata: @config.metadata,
|
2115
|
+
retry_policy: @config.retry_policy
|
2116
|
+
|
2117
|
+
@chat_service_stub.complete_import_space request, options do |result, operation|
|
2118
|
+
yield result, operation if block_given?
|
2119
|
+
return result
|
2120
|
+
end
|
2121
|
+
rescue ::Gapic::Rest::Error => e
|
2122
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2123
|
+
end
|
2124
|
+
|
2125
|
+
##
|
2126
|
+
# Returns the existing direct message with the specified user. If no direct
|
2127
|
+
# message space is found, returns a `404 NOT_FOUND` error. For an example,
|
2128
|
+
# see
|
2129
|
+
# [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message).
|
2130
|
+
#
|
2131
|
+
# With [user
|
2132
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
|
2133
|
+
# returns the direct message space between the specified user and the
|
2134
|
+
# authenticated user.
|
2135
|
+
#
|
2136
|
+
# With [app
|
2137
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app),
|
2138
|
+
# returns the direct message space between the specified user and the calling
|
2139
|
+
# Chat app.
|
2140
|
+
#
|
2141
|
+
# Requires [user
|
2142
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
|
2143
|
+
# or [app
|
2144
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
|
2145
|
+
#
|
2146
|
+
# @overload find_direct_message(request, options = nil)
|
2147
|
+
# Pass arguments to `find_direct_message` via a request object, either of type
|
2148
|
+
# {::Google::Apps::Chat::V1::FindDirectMessageRequest} or an equivalent Hash.
|
2149
|
+
#
|
2150
|
+
# @param request [::Google::Apps::Chat::V1::FindDirectMessageRequest, ::Hash]
|
2151
|
+
# A request object representing the call parameters. Required. To specify no
|
2152
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2153
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2154
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2155
|
+
#
|
2156
|
+
# @overload find_direct_message(name: nil)
|
2157
|
+
# Pass arguments to `find_direct_message` via keyword arguments. Note that at
|
2158
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2159
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2160
|
+
#
|
2161
|
+
# @param name [::String]
|
2162
|
+
# Required. Resource name of the user to find direct message with.
|
2163
|
+
#
|
2164
|
+
# Format: `users/{user}`, where `{user}` is either the `id` for the
|
2165
|
+
# [person](https://developers.google.com/people/api/rest/v1/people) from the
|
2166
|
+
# People API, or the `id` for the
|
2167
|
+
# [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
|
2168
|
+
# in the Directory API. For example, if the People API profile ID is
|
2169
|
+
# `123456789`, you can find a direct message with that person by using
|
2170
|
+
# `users/123456789` as the `name`. When [authenticated as a
|
2171
|
+
# user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
|
2172
|
+
# you can use the email as an alias for `{user}`. For example,
|
2173
|
+
# `users/example@gmail.com` where `example@gmail.com` is the email of the
|
2174
|
+
# Google Chat user.
|
2175
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2176
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Space]
|
2177
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2178
|
+
#
|
2179
|
+
# @return [::Google::Apps::Chat::V1::Space]
|
2180
|
+
#
|
2181
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2182
|
+
#
|
2183
|
+
# @example Basic example
|
2184
|
+
# require "google/apps/chat/v1"
|
2185
|
+
#
|
2186
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2187
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2188
|
+
#
|
2189
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2190
|
+
# request = Google::Apps::Chat::V1::FindDirectMessageRequest.new
|
2191
|
+
#
|
2192
|
+
# # Call the find_direct_message method.
|
2193
|
+
# result = client.find_direct_message request
|
2194
|
+
#
|
2195
|
+
# # The returned object is of type Google::Apps::Chat::V1::Space.
|
2196
|
+
# p result
|
2197
|
+
#
|
2198
|
+
def find_direct_message request, options = nil
|
2199
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2200
|
+
|
2201
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::FindDirectMessageRequest
|
2202
|
+
|
2203
|
+
# Converts hash and nil to an options object
|
2204
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2205
|
+
|
2206
|
+
# Customize the options with defaults
|
2207
|
+
call_metadata = @config.rpcs.find_direct_message.metadata.to_h
|
2208
|
+
|
2209
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2210
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2211
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2212
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2213
|
+
transports_version_send: [:rest]
|
2214
|
+
|
2215
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2216
|
+
|
2217
|
+
options.apply_defaults timeout: @config.rpcs.find_direct_message.timeout,
|
2218
|
+
metadata: call_metadata,
|
2219
|
+
retry_policy: @config.rpcs.find_direct_message.retry_policy
|
2220
|
+
|
2221
|
+
options.apply_defaults timeout: @config.timeout,
|
2222
|
+
metadata: @config.metadata,
|
2223
|
+
retry_policy: @config.retry_policy
|
2224
|
+
|
2225
|
+
@chat_service_stub.find_direct_message request, options do |result, operation|
|
2226
|
+
yield result, operation if block_given?
|
2227
|
+
return result
|
2228
|
+
end
|
2229
|
+
rescue ::Gapic::Rest::Error => e
|
2230
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2231
|
+
end
|
2232
|
+
|
2233
|
+
##
|
2234
|
+
# Creates a human membership or app membership for the calling app. Creating
|
2235
|
+
# memberships for other apps isn't supported. For an example, see
|
2236
|
+
# [Invite or add a user or a Google Chat app to a
|
2237
|
+
# space](https://developers.google.com/workspace/chat/create-members).
|
2238
|
+
# When creating a membership, if the specified member has their auto-accept
|
2239
|
+
# policy turned off, then they're invited, and must accept the space
|
2240
|
+
# invitation before joining. Otherwise, creating a membership adds the member
|
2241
|
+
# directly to the specified space. Requires [user
|
2242
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2243
|
+
#
|
2244
|
+
# To specify the member to add, set the `membership.member.name` in the
|
2245
|
+
# `CreateMembershipRequest`:
|
2246
|
+
#
|
2247
|
+
# - To add the calling app to a space or a direct message between two human
|
2248
|
+
# users, use `users/app`. Unable to add other
|
2249
|
+
# apps to the space.
|
2250
|
+
#
|
2251
|
+
# - To add a human user, use `users/{user}`, where `{user}` can be the email
|
2252
|
+
# address for the user. For users in the same Workspace organization `{user}`
|
2253
|
+
# can also be the `id` for the person from the People API, or the `id` for
|
2254
|
+
# the user in the Directory API. For example, if the People API Person
|
2255
|
+
# profile ID for `user@example.com` is `123456789`, you can add the user to
|
2256
|
+
# the space by setting the `membership.member.name` to
|
2257
|
+
# `users/user@example.com` or `users/123456789`.
|
2258
|
+
#
|
2259
|
+
# @overload create_membership(request, options = nil)
|
2260
|
+
# Pass arguments to `create_membership` via a request object, either of type
|
2261
|
+
# {::Google::Apps::Chat::V1::CreateMembershipRequest} or an equivalent Hash.
|
2262
|
+
#
|
2263
|
+
# @param request [::Google::Apps::Chat::V1::CreateMembershipRequest, ::Hash]
|
2264
|
+
# A request object representing the call parameters. Required. To specify no
|
2265
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2266
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2267
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2268
|
+
#
|
2269
|
+
# @overload create_membership(parent: nil, membership: nil)
|
2270
|
+
# Pass arguments to `create_membership` via keyword arguments. Note that at
|
2271
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2272
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2273
|
+
#
|
2274
|
+
# @param parent [::String]
|
2275
|
+
# Required. The resource name of the space for which to create the
|
2276
|
+
# membership.
|
2277
|
+
#
|
2278
|
+
# Format: spaces/\\{space}
|
2279
|
+
# @param membership [::Google::Apps::Chat::V1::Membership, ::Hash]
|
2280
|
+
# Required. The membership relation to create.
|
2281
|
+
# The `memberType` field must contain a user with the `user.name` and
|
2282
|
+
# `user.type` fields populated. The server will assign a resource name
|
2283
|
+
# and overwrite anything specified.
|
2284
|
+
# When a Chat app creates a membership relation for a human user, it must use
|
2285
|
+
# the `chat.memberships` scope, set `user.type` to `HUMAN`, and set
|
2286
|
+
# `user.name` with format `users/{user}`, where `{user}` can be the email
|
2287
|
+
# address for the user. For users in the same Workspace organization `{user}`
|
2288
|
+
# can also be the `id` of the
|
2289
|
+
# [person](https://developers.google.com/people/api/rest/v1/people) from the
|
2290
|
+
# People API, or the `id` for the user in the Directory API. For example, if
|
2291
|
+
# the People API Person profile ID for `user@example.com` is `123456789`, you
|
2292
|
+
# can add the user to the space by setting the `membership.member.name` to
|
2293
|
+
# `users/user@example.com` or `users/123456789`. When a Chat app creates a
|
2294
|
+
# membership relation for itself, it must use the `chat.memberships.app`
|
2295
|
+
# scope, set `user.type` to `BOT`, and set `user.name` to `users/app`.
|
2296
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2297
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Membership]
|
2298
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2299
|
+
#
|
2300
|
+
# @return [::Google::Apps::Chat::V1::Membership]
|
2301
|
+
#
|
2302
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2303
|
+
#
|
2304
|
+
# @example Basic example
|
2305
|
+
# require "google/apps/chat/v1"
|
2306
|
+
#
|
2307
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2308
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2309
|
+
#
|
2310
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2311
|
+
# request = Google::Apps::Chat::V1::CreateMembershipRequest.new
|
2312
|
+
#
|
2313
|
+
# # Call the create_membership method.
|
2314
|
+
# result = client.create_membership request
|
2315
|
+
#
|
2316
|
+
# # The returned object is of type Google::Apps::Chat::V1::Membership.
|
2317
|
+
# p result
|
2318
|
+
#
|
2319
|
+
def create_membership request, options = nil
|
2320
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2321
|
+
|
2322
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateMembershipRequest
|
2323
|
+
|
2324
|
+
# Converts hash and nil to an options object
|
2325
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2326
|
+
|
2327
|
+
# Customize the options with defaults
|
2328
|
+
call_metadata = @config.rpcs.create_membership.metadata.to_h
|
2329
|
+
|
2330
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2331
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2332
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2333
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2334
|
+
transports_version_send: [:rest]
|
2335
|
+
|
2336
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2337
|
+
|
2338
|
+
options.apply_defaults timeout: @config.rpcs.create_membership.timeout,
|
2339
|
+
metadata: call_metadata,
|
2340
|
+
retry_policy: @config.rpcs.create_membership.retry_policy
|
2341
|
+
|
2342
|
+
options.apply_defaults timeout: @config.timeout,
|
2343
|
+
metadata: @config.metadata,
|
2344
|
+
retry_policy: @config.retry_policy
|
2345
|
+
|
2346
|
+
@chat_service_stub.create_membership request, options do |result, operation|
|
2347
|
+
yield result, operation if block_given?
|
2348
|
+
return result
|
2349
|
+
end
|
2350
|
+
rescue ::Gapic::Rest::Error => e
|
2351
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2352
|
+
end
|
2353
|
+
|
2354
|
+
##
|
2355
|
+
# Updates a membership. Requires [user
|
2356
|
+
# authentication](https://developers.google.com/chat/api/guides/auth/users).
|
2357
|
+
#
|
2358
|
+
# @overload update_membership(request, options = nil)
|
2359
|
+
# Pass arguments to `update_membership` via a request object, either of type
|
2360
|
+
# {::Google::Apps::Chat::V1::UpdateMembershipRequest} or an equivalent Hash.
|
2361
|
+
#
|
2362
|
+
# @param request [::Google::Apps::Chat::V1::UpdateMembershipRequest, ::Hash]
|
2363
|
+
# A request object representing the call parameters. Required. To specify no
|
2364
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2365
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2366
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2367
|
+
#
|
2368
|
+
# @overload update_membership(membership: nil, update_mask: nil)
|
2369
|
+
# Pass arguments to `update_membership` via keyword arguments. Note that at
|
2370
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2371
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2372
|
+
#
|
2373
|
+
# @param membership [::Google::Apps::Chat::V1::Membership, ::Hash]
|
2374
|
+
# Required. The membership to update. Only fields specified by `update_mask`
|
2375
|
+
# are updated.
|
2376
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
2377
|
+
# Required. The field paths to update. Separate multiple values with commas
|
2378
|
+
# or use `*` to update all field paths.
|
2379
|
+
#
|
2380
|
+
# Currently supported field paths:
|
2381
|
+
#
|
2382
|
+
# - `role`
|
2383
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2384
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Membership]
|
2385
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2386
|
+
#
|
2387
|
+
# @return [::Google::Apps::Chat::V1::Membership]
|
2388
|
+
#
|
2389
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2390
|
+
#
|
2391
|
+
# @example Basic example
|
2392
|
+
# require "google/apps/chat/v1"
|
2393
|
+
#
|
2394
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2395
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2396
|
+
#
|
2397
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2398
|
+
# request = Google::Apps::Chat::V1::UpdateMembershipRequest.new
|
2399
|
+
#
|
2400
|
+
# # Call the update_membership method.
|
2401
|
+
# result = client.update_membership request
|
2402
|
+
#
|
2403
|
+
# # The returned object is of type Google::Apps::Chat::V1::Membership.
|
2404
|
+
# p result
|
2405
|
+
#
|
2406
|
+
def update_membership request, options = nil
|
2407
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2408
|
+
|
2409
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateMembershipRequest
|
2410
|
+
|
2411
|
+
# Converts hash and nil to an options object
|
2412
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2413
|
+
|
2414
|
+
# Customize the options with defaults
|
2415
|
+
call_metadata = @config.rpcs.update_membership.metadata.to_h
|
2416
|
+
|
2417
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2418
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2419
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2420
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2421
|
+
transports_version_send: [:rest]
|
2422
|
+
|
2423
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2424
|
+
|
2425
|
+
options.apply_defaults timeout: @config.rpcs.update_membership.timeout,
|
2426
|
+
metadata: call_metadata,
|
2427
|
+
retry_policy: @config.rpcs.update_membership.retry_policy
|
2428
|
+
|
2429
|
+
options.apply_defaults timeout: @config.timeout,
|
2430
|
+
metadata: @config.metadata,
|
2431
|
+
retry_policy: @config.retry_policy
|
2432
|
+
|
2433
|
+
@chat_service_stub.update_membership request, options do |result, operation|
|
2434
|
+
yield result, operation if block_given?
|
2435
|
+
return result
|
2436
|
+
end
|
2437
|
+
rescue ::Gapic::Rest::Error => e
|
2438
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2439
|
+
end
|
2440
|
+
|
2441
|
+
##
|
2442
|
+
# Deletes a membership. For an example, see
|
2443
|
+
# [Remove a user or a Google Chat app from a
|
2444
|
+
# space](https://developers.google.com/workspace/chat/delete-members).
|
2445
|
+
#
|
2446
|
+
# Requires [user
|
2447
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2448
|
+
#
|
2449
|
+
# @overload delete_membership(request, options = nil)
|
2450
|
+
# Pass arguments to `delete_membership` via a request object, either of type
|
2451
|
+
# {::Google::Apps::Chat::V1::DeleteMembershipRequest} or an equivalent Hash.
|
2452
|
+
#
|
2453
|
+
# @param request [::Google::Apps::Chat::V1::DeleteMembershipRequest, ::Hash]
|
2454
|
+
# A request object representing the call parameters. Required. To specify no
|
2455
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2456
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2457
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2458
|
+
#
|
2459
|
+
# @overload delete_membership(name: nil)
|
2460
|
+
# Pass arguments to `delete_membership` via keyword arguments. Note that at
|
2461
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2462
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2463
|
+
#
|
2464
|
+
# @param name [::String]
|
2465
|
+
# Required. Resource name of the membership to delete. Chat apps can delete
|
2466
|
+
# human users' or their own memberships. Chat apps can't delete other apps'
|
2467
|
+
# memberships.
|
2468
|
+
#
|
2469
|
+
# When deleting a human membership, requires the `chat.memberships` scope and
|
2470
|
+
# `spaces/{space}/members/{member}` format. You can use the email as an
|
2471
|
+
# alias for `{member}`. For example,
|
2472
|
+
# `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
|
2473
|
+
# email of the Google Chat user.
|
2474
|
+
#
|
2475
|
+
# When deleting an app membership, requires the `chat.memberships.app` scope
|
2476
|
+
# and `spaces/{space}/members/app` format.
|
2477
|
+
#
|
2478
|
+
# Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`.
|
2479
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2480
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Membership]
|
2481
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2482
|
+
#
|
2483
|
+
# @return [::Google::Apps::Chat::V1::Membership]
|
2484
|
+
#
|
2485
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2486
|
+
#
|
2487
|
+
# @example Basic example
|
2488
|
+
# require "google/apps/chat/v1"
|
2489
|
+
#
|
2490
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2491
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2492
|
+
#
|
2493
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2494
|
+
# request = Google::Apps::Chat::V1::DeleteMembershipRequest.new
|
2495
|
+
#
|
2496
|
+
# # Call the delete_membership method.
|
2497
|
+
# result = client.delete_membership request
|
2498
|
+
#
|
2499
|
+
# # The returned object is of type Google::Apps::Chat::V1::Membership.
|
2500
|
+
# p result
|
2501
|
+
#
|
2502
|
+
def delete_membership request, options = nil
|
2503
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2504
|
+
|
2505
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteMembershipRequest
|
2506
|
+
|
2507
|
+
# Converts hash and nil to an options object
|
2508
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2509
|
+
|
2510
|
+
# Customize the options with defaults
|
2511
|
+
call_metadata = @config.rpcs.delete_membership.metadata.to_h
|
2512
|
+
|
2513
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2514
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2515
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2516
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2517
|
+
transports_version_send: [:rest]
|
2518
|
+
|
2519
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2520
|
+
|
2521
|
+
options.apply_defaults timeout: @config.rpcs.delete_membership.timeout,
|
2522
|
+
metadata: call_metadata,
|
2523
|
+
retry_policy: @config.rpcs.delete_membership.retry_policy
|
2524
|
+
|
2525
|
+
options.apply_defaults timeout: @config.timeout,
|
2526
|
+
metadata: @config.metadata,
|
2527
|
+
retry_policy: @config.retry_policy
|
2528
|
+
|
2529
|
+
@chat_service_stub.delete_membership request, options do |result, operation|
|
2530
|
+
yield result, operation if block_given?
|
2531
|
+
return result
|
2532
|
+
end
|
2533
|
+
rescue ::Gapic::Rest::Error => e
|
2534
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2535
|
+
end
|
2536
|
+
|
2537
|
+
##
|
2538
|
+
# Creates a reaction and adds it to a message. Only unicode emojis are
|
2539
|
+
# supported. For an example, see
|
2540
|
+
# [Add a reaction to a
|
2541
|
+
# message](https://developers.google.com/workspace/chat/create-reactions).
|
2542
|
+
# Requires [user
|
2543
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2544
|
+
#
|
2545
|
+
# @overload create_reaction(request, options = nil)
|
2546
|
+
# Pass arguments to `create_reaction` via a request object, either of type
|
2547
|
+
# {::Google::Apps::Chat::V1::CreateReactionRequest} or an equivalent Hash.
|
2548
|
+
#
|
2549
|
+
# @param request [::Google::Apps::Chat::V1::CreateReactionRequest, ::Hash]
|
2550
|
+
# A request object representing the call parameters. Required. To specify no
|
2551
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2552
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2553
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2554
|
+
#
|
2555
|
+
# @overload create_reaction(parent: nil, reaction: nil)
|
2556
|
+
# Pass arguments to `create_reaction` via keyword arguments. Note that at
|
2557
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2558
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2559
|
+
#
|
2560
|
+
# @param parent [::String]
|
2561
|
+
# Required. The message where the reaction is created.
|
2562
|
+
#
|
2563
|
+
# Format: `spaces/{space}/messages/{message}`
|
2564
|
+
# @param reaction [::Google::Apps::Chat::V1::Reaction, ::Hash]
|
2565
|
+
# Required. The reaction to create.
|
2566
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2567
|
+
# @yieldparam result [::Google::Apps::Chat::V1::Reaction]
|
2568
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2569
|
+
#
|
2570
|
+
# @return [::Google::Apps::Chat::V1::Reaction]
|
2571
|
+
#
|
2572
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2573
|
+
#
|
2574
|
+
# @example Basic example
|
2575
|
+
# require "google/apps/chat/v1"
|
2576
|
+
#
|
2577
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2578
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2579
|
+
#
|
2580
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2581
|
+
# request = Google::Apps::Chat::V1::CreateReactionRequest.new
|
2582
|
+
#
|
2583
|
+
# # Call the create_reaction method.
|
2584
|
+
# result = client.create_reaction request
|
2585
|
+
#
|
2586
|
+
# # The returned object is of type Google::Apps::Chat::V1::Reaction.
|
2587
|
+
# p result
|
2588
|
+
#
|
2589
|
+
def create_reaction request, options = nil
|
2590
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2591
|
+
|
2592
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateReactionRequest
|
2593
|
+
|
2594
|
+
# Converts hash and nil to an options object
|
2595
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2596
|
+
|
2597
|
+
# Customize the options with defaults
|
2598
|
+
call_metadata = @config.rpcs.create_reaction.metadata.to_h
|
2599
|
+
|
2600
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2601
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2602
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2603
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2604
|
+
transports_version_send: [:rest]
|
2605
|
+
|
2606
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2607
|
+
|
2608
|
+
options.apply_defaults timeout: @config.rpcs.create_reaction.timeout,
|
2609
|
+
metadata: call_metadata,
|
2610
|
+
retry_policy: @config.rpcs.create_reaction.retry_policy
|
2611
|
+
|
2612
|
+
options.apply_defaults timeout: @config.timeout,
|
2613
|
+
metadata: @config.metadata,
|
2614
|
+
retry_policy: @config.retry_policy
|
2615
|
+
|
2616
|
+
@chat_service_stub.create_reaction request, options do |result, operation|
|
2617
|
+
yield result, operation if block_given?
|
2618
|
+
return result
|
2619
|
+
end
|
2620
|
+
rescue ::Gapic::Rest::Error => e
|
2621
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2622
|
+
end
|
2623
|
+
|
2624
|
+
##
|
2625
|
+
# Lists reactions to a message. For an example, see
|
2626
|
+
# [List reactions for a
|
2627
|
+
# message](https://developers.google.com/workspace/chat/list-reactions).
|
2628
|
+
# Requires [user
|
2629
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2630
|
+
#
|
2631
|
+
# @overload list_reactions(request, options = nil)
|
2632
|
+
# Pass arguments to `list_reactions` via a request object, either of type
|
2633
|
+
# {::Google::Apps::Chat::V1::ListReactionsRequest} or an equivalent Hash.
|
2634
|
+
#
|
2635
|
+
# @param request [::Google::Apps::Chat::V1::ListReactionsRequest, ::Hash]
|
2636
|
+
# A request object representing the call parameters. Required. To specify no
|
2637
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2638
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2639
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2640
|
+
#
|
2641
|
+
# @overload list_reactions(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
2642
|
+
# Pass arguments to `list_reactions` via keyword arguments. Note that at
|
2643
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2644
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2645
|
+
#
|
2646
|
+
# @param parent [::String]
|
2647
|
+
# Required. The message users reacted to.
|
2648
|
+
#
|
2649
|
+
# Format: `spaces/{space}/messages/{message}`
|
2650
|
+
# @param page_size [::Integer]
|
2651
|
+
# Optional. The maximum number of reactions returned. The service can return
|
2652
|
+
# fewer reactions than this value. If unspecified, the default value is 25.
|
2653
|
+
# The maximum value is 200; values above 200 are changed to 200.
|
2654
|
+
# @param page_token [::String]
|
2655
|
+
# Optional. (If resuming from a previous query.)
|
2656
|
+
#
|
2657
|
+
# A page token received from a previous list reactions call. Provide this
|
2658
|
+
# to retrieve the subsequent page.
|
2659
|
+
#
|
2660
|
+
# When paginating, the filter value should match the call that provided the
|
2661
|
+
# page token. Passing a different value might lead to unexpected results.
|
2662
|
+
# @param filter [::String]
|
2663
|
+
# Optional. A query filter.
|
2664
|
+
#
|
2665
|
+
# You can filter reactions by
|
2666
|
+
# [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji)
|
2667
|
+
# (either `emoji.unicode` or `emoji.custom_emoji.uid`) and
|
2668
|
+
# [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
|
2669
|
+
# (`user.name`).
|
2670
|
+
#
|
2671
|
+
# To filter reactions for multiple emojis or users, join similar fields
|
2672
|
+
# with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode =
|
2673
|
+
# "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`.
|
2674
|
+
#
|
2675
|
+
# To filter reactions by emoji and user, use the `AND` operator, such as
|
2676
|
+
# `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`.
|
2677
|
+
#
|
2678
|
+
# If your query uses both `AND` and `OR`, group them with parentheses.
|
2679
|
+
#
|
2680
|
+
# For example, the following queries are valid:
|
2681
|
+
#
|
2682
|
+
# ```
|
2683
|
+
# user.name = "users/\\{user}"
|
2684
|
+
# emoji.unicode = "🙂"
|
2685
|
+
# emoji.custom_emoji.uid = "\\{uid}"
|
2686
|
+
# emoji.unicode = "🙂" OR emoji.unicode = "👍"
|
2687
|
+
# emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}"
|
2688
|
+
# emoji.unicode = "🙂" AND user.name = "users/\\{user}"
|
2689
|
+
# (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}")
|
2690
|
+
# AND user.name = "users/\\{user}"
|
2691
|
+
# ```
|
2692
|
+
#
|
2693
|
+
# The following queries are invalid:
|
2694
|
+
#
|
2695
|
+
# ```
|
2696
|
+
# emoji.unicode = "🙂" AND emoji.unicode = "👍"
|
2697
|
+
# emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "\\{uid}"
|
2698
|
+
# emoji.unicode = "🙂" OR user.name = "users/\\{user}"
|
2699
|
+
# emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}" OR
|
2700
|
+
# user.name = "users/\\{user}"
|
2701
|
+
# emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}"
|
2702
|
+
# AND user.name = "users/\\{user}"
|
2703
|
+
# ```
|
2704
|
+
#
|
2705
|
+
# Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
|
2706
|
+
# error.
|
2707
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2708
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>]
|
2709
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2710
|
+
#
|
2711
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>]
|
2712
|
+
#
|
2713
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2714
|
+
#
|
2715
|
+
# @example Basic example
|
2716
|
+
# require "google/apps/chat/v1"
|
2717
|
+
#
|
2718
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2719
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2720
|
+
#
|
2721
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2722
|
+
# request = Google::Apps::Chat::V1::ListReactionsRequest.new
|
2723
|
+
#
|
2724
|
+
# # Call the list_reactions method.
|
2725
|
+
# result = client.list_reactions request
|
2726
|
+
#
|
2727
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2728
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2729
|
+
# result.each do |item|
|
2730
|
+
# # Each element is of type ::Google::Apps::Chat::V1::Reaction.
|
2731
|
+
# p item
|
2732
|
+
# end
|
2733
|
+
#
|
2734
|
+
def list_reactions request, options = nil
|
2735
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2736
|
+
|
2737
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListReactionsRequest
|
2738
|
+
|
2739
|
+
# Converts hash and nil to an options object
|
2740
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2741
|
+
|
2742
|
+
# Customize the options with defaults
|
2743
|
+
call_metadata = @config.rpcs.list_reactions.metadata.to_h
|
2744
|
+
|
2745
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2746
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2747
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2748
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2749
|
+
transports_version_send: [:rest]
|
2750
|
+
|
2751
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2752
|
+
|
2753
|
+
options.apply_defaults timeout: @config.rpcs.list_reactions.timeout,
|
2754
|
+
metadata: call_metadata,
|
2755
|
+
retry_policy: @config.rpcs.list_reactions.retry_policy
|
2756
|
+
|
2757
|
+
options.apply_defaults timeout: @config.timeout,
|
2758
|
+
metadata: @config.metadata,
|
2759
|
+
retry_policy: @config.retry_policy
|
2760
|
+
|
2761
|
+
@chat_service_stub.list_reactions request, options do |result, operation|
|
2762
|
+
result = ::Gapic::Rest::PagedEnumerable.new @chat_service_stub, :list_reactions, "reactions", request, result, options
|
2763
|
+
yield result, operation if block_given?
|
2764
|
+
return result
|
2765
|
+
end
|
2766
|
+
rescue ::Gapic::Rest::Error => e
|
2767
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2768
|
+
end
|
2769
|
+
|
2770
|
+
##
|
2771
|
+
# Deletes a reaction to a message. Only unicode emojis are supported.
|
2772
|
+
# For an example, see
|
2773
|
+
# [Delete a
|
2774
|
+
# reaction](https://developers.google.com/workspace/chat/delete-reactions).
|
2775
|
+
# Requires [user
|
2776
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2777
|
+
#
|
2778
|
+
# @overload delete_reaction(request, options = nil)
|
2779
|
+
# Pass arguments to `delete_reaction` via a request object, either of type
|
2780
|
+
# {::Google::Apps::Chat::V1::DeleteReactionRequest} or an equivalent Hash.
|
2781
|
+
#
|
2782
|
+
# @param request [::Google::Apps::Chat::V1::DeleteReactionRequest, ::Hash]
|
2783
|
+
# A request object representing the call parameters. Required. To specify no
|
2784
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2785
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2786
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2787
|
+
#
|
2788
|
+
# @overload delete_reaction(name: nil)
|
2789
|
+
# Pass arguments to `delete_reaction` via keyword arguments. Note that at
|
2790
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2791
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2792
|
+
#
|
2793
|
+
# @param name [::String]
|
2794
|
+
# Required. Name of the reaction to delete.
|
2795
|
+
#
|
2796
|
+
# Format: `spaces/{space}/messages/{message}/reactions/{reaction}`
|
2797
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2798
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
2799
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2800
|
+
#
|
2801
|
+
# @return [::Google::Protobuf::Empty]
|
2802
|
+
#
|
2803
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2804
|
+
#
|
2805
|
+
# @example Basic example
|
2806
|
+
# require "google/apps/chat/v1"
|
2807
|
+
#
|
2808
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2809
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2810
|
+
#
|
2811
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2812
|
+
# request = Google::Apps::Chat::V1::DeleteReactionRequest.new
|
2813
|
+
#
|
2814
|
+
# # Call the delete_reaction method.
|
2815
|
+
# result = client.delete_reaction request
|
2816
|
+
#
|
2817
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
2818
|
+
# p result
|
2819
|
+
#
|
2820
|
+
def delete_reaction request, options = nil
|
2821
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2822
|
+
|
2823
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteReactionRequest
|
2824
|
+
|
2825
|
+
# Converts hash and nil to an options object
|
2826
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2827
|
+
|
2828
|
+
# Customize the options with defaults
|
2829
|
+
call_metadata = @config.rpcs.delete_reaction.metadata.to_h
|
2830
|
+
|
2831
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2832
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2833
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2834
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2835
|
+
transports_version_send: [:rest]
|
2836
|
+
|
2837
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2838
|
+
|
2839
|
+
options.apply_defaults timeout: @config.rpcs.delete_reaction.timeout,
|
2840
|
+
metadata: call_metadata,
|
2841
|
+
retry_policy: @config.rpcs.delete_reaction.retry_policy
|
2842
|
+
|
2843
|
+
options.apply_defaults timeout: @config.timeout,
|
2844
|
+
metadata: @config.metadata,
|
2845
|
+
retry_policy: @config.retry_policy
|
2846
|
+
|
2847
|
+
@chat_service_stub.delete_reaction request, options do |result, operation|
|
2848
|
+
yield result, operation if block_given?
|
2849
|
+
return result
|
2850
|
+
end
|
2851
|
+
rescue ::Gapic::Rest::Error => e
|
2852
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2853
|
+
end
|
2854
|
+
|
2855
|
+
##
|
2856
|
+
# Returns details about a user's read state within a space, used to identify
|
2857
|
+
# read and unread messages.
|
2858
|
+
#
|
2859
|
+
# Requires [user
|
2860
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2861
|
+
#
|
2862
|
+
# @overload get_space_read_state(request, options = nil)
|
2863
|
+
# Pass arguments to `get_space_read_state` via a request object, either of type
|
2864
|
+
# {::Google::Apps::Chat::V1::GetSpaceReadStateRequest} or an equivalent Hash.
|
2865
|
+
#
|
2866
|
+
# @param request [::Google::Apps::Chat::V1::GetSpaceReadStateRequest, ::Hash]
|
2867
|
+
# A request object representing the call parameters. Required. To specify no
|
2868
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2869
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2870
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2871
|
+
#
|
2872
|
+
# @overload get_space_read_state(name: nil)
|
2873
|
+
# Pass arguments to `get_space_read_state` via keyword arguments. Note that at
|
2874
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2875
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2876
|
+
#
|
2877
|
+
# @param name [::String]
|
2878
|
+
# Required. Resource name of the space read state to retrieve.
|
2879
|
+
#
|
2880
|
+
# Only supports getting read state for the calling user.
|
2881
|
+
#
|
2882
|
+
# To refer to the calling user, set one of the following:
|
2883
|
+
#
|
2884
|
+
# - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
|
2885
|
+
#
|
2886
|
+
# - Their Workspace email address. For example,
|
2887
|
+
# `users/user@example.com/spaces/{space}/spaceReadState`.
|
2888
|
+
#
|
2889
|
+
# - Their user id. For example,
|
2890
|
+
# `users/123456789/spaces/{space}/spaceReadState`.
|
2891
|
+
#
|
2892
|
+
# Format: users/\\{user}/spaces/\\{space}/spaceReadState
|
2893
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2894
|
+
# @yieldparam result [::Google::Apps::Chat::V1::SpaceReadState]
|
2895
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2896
|
+
#
|
2897
|
+
# @return [::Google::Apps::Chat::V1::SpaceReadState]
|
2898
|
+
#
|
2899
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2900
|
+
#
|
2901
|
+
# @example Basic example
|
2902
|
+
# require "google/apps/chat/v1"
|
2903
|
+
#
|
2904
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2905
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
2906
|
+
#
|
2907
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2908
|
+
# request = Google::Apps::Chat::V1::GetSpaceReadStateRequest.new
|
2909
|
+
#
|
2910
|
+
# # Call the get_space_read_state method.
|
2911
|
+
# result = client.get_space_read_state request
|
2912
|
+
#
|
2913
|
+
# # The returned object is of type Google::Apps::Chat::V1::SpaceReadState.
|
2914
|
+
# p result
|
2915
|
+
#
|
2916
|
+
def get_space_read_state request, options = nil
|
2917
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2918
|
+
|
2919
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceReadStateRequest
|
2920
|
+
|
2921
|
+
# Converts hash and nil to an options object
|
2922
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2923
|
+
|
2924
|
+
# Customize the options with defaults
|
2925
|
+
call_metadata = @config.rpcs.get_space_read_state.metadata.to_h
|
2926
|
+
|
2927
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2928
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2929
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2930
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
2931
|
+
transports_version_send: [:rest]
|
2932
|
+
|
2933
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2934
|
+
|
2935
|
+
options.apply_defaults timeout: @config.rpcs.get_space_read_state.timeout,
|
2936
|
+
metadata: call_metadata,
|
2937
|
+
retry_policy: @config.rpcs.get_space_read_state.retry_policy
|
2938
|
+
|
2939
|
+
options.apply_defaults timeout: @config.timeout,
|
2940
|
+
metadata: @config.metadata,
|
2941
|
+
retry_policy: @config.retry_policy
|
2942
|
+
|
2943
|
+
@chat_service_stub.get_space_read_state request, options do |result, operation|
|
2944
|
+
yield result, operation if block_given?
|
2945
|
+
return result
|
2946
|
+
end
|
2947
|
+
rescue ::Gapic::Rest::Error => e
|
2948
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2949
|
+
end
|
2950
|
+
|
2951
|
+
##
|
2952
|
+
# Updates a user's read state within a space, used to identify read and
|
2953
|
+
# unread messages.
|
2954
|
+
#
|
2955
|
+
# Requires [user
|
2956
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
2957
|
+
#
|
2958
|
+
# @overload update_space_read_state(request, options = nil)
|
2959
|
+
# Pass arguments to `update_space_read_state` via a request object, either of type
|
2960
|
+
# {::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest} or an equivalent Hash.
|
2961
|
+
#
|
2962
|
+
# @param request [::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest, ::Hash]
|
2963
|
+
# A request object representing the call parameters. Required. To specify no
|
2964
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2965
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2966
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2967
|
+
#
|
2968
|
+
# @overload update_space_read_state(space_read_state: nil, update_mask: nil)
|
2969
|
+
# Pass arguments to `update_space_read_state` via keyword arguments. Note that at
|
2970
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2971
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2972
|
+
#
|
2973
|
+
# @param space_read_state [::Google::Apps::Chat::V1::SpaceReadState, ::Hash]
|
2974
|
+
# Required. The space read state and fields to update.
|
2975
|
+
#
|
2976
|
+
# Only supports updating read state for the calling user.
|
2977
|
+
#
|
2978
|
+
# To refer to the calling user, set one of the following:
|
2979
|
+
#
|
2980
|
+
# - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
|
2981
|
+
#
|
2982
|
+
# - Their Workspace email address. For example,
|
2983
|
+
# `users/user@example.com/spaces/{space}/spaceReadState`.
|
2984
|
+
#
|
2985
|
+
# - Their user id. For example,
|
2986
|
+
# `users/123456789/spaces/{space}/spaceReadState`.
|
2987
|
+
#
|
2988
|
+
# Format: users/\\{user}/spaces/\\{space}/spaceReadState
|
2989
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
2990
|
+
# Required. The field paths to update. Currently supported field paths:
|
2991
|
+
#
|
2992
|
+
# - `last_read_time`
|
2993
|
+
#
|
2994
|
+
# When the `last_read_time` is before the latest message create time, the
|
2995
|
+
# space appears as unread in the UI.
|
2996
|
+
#
|
2997
|
+
# To mark the space as read, set `last_read_time` to any value later (larger)
|
2998
|
+
# than the latest message create time. The `last_read_time` is coerced to
|
2999
|
+
# match the latest message create time. Note that the space read state only
|
3000
|
+
# affects the read state of messages that are visible in the space's
|
3001
|
+
# top-level conversation. Replies in threads are unaffected by this
|
3002
|
+
# timestamp, and instead rely on the thread read state.
|
3003
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
3004
|
+
# @yieldparam result [::Google::Apps::Chat::V1::SpaceReadState]
|
3005
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
3006
|
+
#
|
3007
|
+
# @return [::Google::Apps::Chat::V1::SpaceReadState]
|
3008
|
+
#
|
3009
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
3010
|
+
#
|
3011
|
+
# @example Basic example
|
3012
|
+
# require "google/apps/chat/v1"
|
3013
|
+
#
|
3014
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3015
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
3016
|
+
#
|
3017
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3018
|
+
# request = Google::Apps::Chat::V1::UpdateSpaceReadStateRequest.new
|
3019
|
+
#
|
3020
|
+
# # Call the update_space_read_state method.
|
3021
|
+
# result = client.update_space_read_state request
|
3022
|
+
#
|
3023
|
+
# # The returned object is of type Google::Apps::Chat::V1::SpaceReadState.
|
3024
|
+
# p result
|
3025
|
+
#
|
3026
|
+
def update_space_read_state request, options = nil
|
3027
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3028
|
+
|
3029
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest
|
3030
|
+
|
3031
|
+
# Converts hash and nil to an options object
|
3032
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3033
|
+
|
3034
|
+
# Customize the options with defaults
|
3035
|
+
call_metadata = @config.rpcs.update_space_read_state.metadata.to_h
|
3036
|
+
|
3037
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
3038
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
3039
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
3040
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
3041
|
+
transports_version_send: [:rest]
|
3042
|
+
|
3043
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
3044
|
+
|
3045
|
+
options.apply_defaults timeout: @config.rpcs.update_space_read_state.timeout,
|
3046
|
+
metadata: call_metadata,
|
3047
|
+
retry_policy: @config.rpcs.update_space_read_state.retry_policy
|
3048
|
+
|
3049
|
+
options.apply_defaults timeout: @config.timeout,
|
3050
|
+
metadata: @config.metadata,
|
3051
|
+
retry_policy: @config.retry_policy
|
3052
|
+
|
3053
|
+
@chat_service_stub.update_space_read_state request, options do |result, operation|
|
3054
|
+
yield result, operation if block_given?
|
3055
|
+
return result
|
3056
|
+
end
|
3057
|
+
rescue ::Gapic::Rest::Error => e
|
3058
|
+
raise ::Google::Cloud::Error.from_error(e)
|
3059
|
+
end
|
3060
|
+
|
3061
|
+
##
|
3062
|
+
# Returns details about a user's read state within a thread, used to identify
|
3063
|
+
# read and unread messages.
|
3064
|
+
#
|
3065
|
+
# Requires [user
|
3066
|
+
# authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
|
3067
|
+
#
|
3068
|
+
# @overload get_thread_read_state(request, options = nil)
|
3069
|
+
# Pass arguments to `get_thread_read_state` via a request object, either of type
|
3070
|
+
# {::Google::Apps::Chat::V1::GetThreadReadStateRequest} or an equivalent Hash.
|
3071
|
+
#
|
3072
|
+
# @param request [::Google::Apps::Chat::V1::GetThreadReadStateRequest, ::Hash]
|
3073
|
+
# A request object representing the call parameters. Required. To specify no
|
3074
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
3075
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
3076
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
3077
|
+
#
|
3078
|
+
# @overload get_thread_read_state(name: nil)
|
3079
|
+
# Pass arguments to `get_thread_read_state` via keyword arguments. Note that at
|
3080
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
3081
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
3082
|
+
#
|
3083
|
+
# @param name [::String]
|
3084
|
+
# Required. Resource name of the thread read state to retrieve.
|
3085
|
+
#
|
3086
|
+
# Only supports getting read state for the calling user.
|
3087
|
+
#
|
3088
|
+
# To refer to the calling user, set one of the following:
|
3089
|
+
#
|
3090
|
+
# - The `me` alias. For example,
|
3091
|
+
# `users/me/spaces/{space}/threads/{thread}/threadReadState`.
|
3092
|
+
#
|
3093
|
+
# - Their Workspace email address. For example,
|
3094
|
+
# `users/user@example.com/spaces/{space}/threads/{thread}/threadReadState`.
|
3095
|
+
#
|
3096
|
+
# - Their user id. For example,
|
3097
|
+
# `users/123456789/spaces/{space}/threads/{thread}/threadReadState`.
|
3098
|
+
#
|
3099
|
+
# Format: users/\\{user}/spaces/\\{space}/threads/\\{thread}/threadReadState
|
3100
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
3101
|
+
# @yieldparam result [::Google::Apps::Chat::V1::ThreadReadState]
|
3102
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
3103
|
+
#
|
3104
|
+
# @return [::Google::Apps::Chat::V1::ThreadReadState]
|
3105
|
+
#
|
3106
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
3107
|
+
#
|
3108
|
+
# @example Basic example
|
3109
|
+
# require "google/apps/chat/v1"
|
3110
|
+
#
|
3111
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3112
|
+
# client = Google::Apps::Chat::V1::ChatService::Rest::Client.new
|
3113
|
+
#
|
3114
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3115
|
+
# request = Google::Apps::Chat::V1::GetThreadReadStateRequest.new
|
3116
|
+
#
|
3117
|
+
# # Call the get_thread_read_state method.
|
3118
|
+
# result = client.get_thread_read_state request
|
3119
|
+
#
|
3120
|
+
# # The returned object is of type Google::Apps::Chat::V1::ThreadReadState.
|
3121
|
+
# p result
|
3122
|
+
#
|
3123
|
+
def get_thread_read_state request, options = nil
|
3124
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3125
|
+
|
3126
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetThreadReadStateRequest
|
3127
|
+
|
3128
|
+
# Converts hash and nil to an options object
|
3129
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3130
|
+
|
3131
|
+
# Customize the options with defaults
|
3132
|
+
call_metadata = @config.rpcs.get_thread_read_state.metadata.to_h
|
3133
|
+
|
3134
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
3135
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
3136
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
3137
|
+
gapic_version: ::Google::Apps::Chat::V1::VERSION,
|
3138
|
+
transports_version_send: [:rest]
|
3139
|
+
|
3140
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
3141
|
+
|
3142
|
+
options.apply_defaults timeout: @config.rpcs.get_thread_read_state.timeout,
|
3143
|
+
metadata: call_metadata,
|
3144
|
+
retry_policy: @config.rpcs.get_thread_read_state.retry_policy
|
3145
|
+
|
3146
|
+
options.apply_defaults timeout: @config.timeout,
|
3147
|
+
metadata: @config.metadata,
|
3148
|
+
retry_policy: @config.retry_policy
|
3149
|
+
|
3150
|
+
@chat_service_stub.get_thread_read_state request, options do |result, operation|
|
3151
|
+
yield result, operation if block_given?
|
3152
|
+
return result
|
3153
|
+
end
|
3154
|
+
rescue ::Gapic::Rest::Error => e
|
3155
|
+
raise ::Google::Cloud::Error.from_error(e)
|
3156
|
+
end
|
3157
|
+
|
3158
|
+
##
|
3159
|
+
# Configuration class for the ChatService REST API.
|
3160
|
+
#
|
3161
|
+
# This class represents the configuration for ChatService REST,
|
3162
|
+
# providing control over timeouts, retry behavior, logging, transport
|
3163
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
3164
|
+
# applied individually to specific RPCs. See
|
3165
|
+
# {::Google::Apps::Chat::V1::ChatService::Rest::Client::Configuration::Rpcs}
|
3166
|
+
# for a list of RPCs that can be configured independently.
|
3167
|
+
#
|
3168
|
+
# Configuration can be applied globally to all clients, or to a single client
|
3169
|
+
# on construction.
|
3170
|
+
#
|
3171
|
+
# @example
|
3172
|
+
#
|
3173
|
+
# # Modify the global config, setting the timeout for
|
3174
|
+
# # create_message to 20 seconds,
|
3175
|
+
# # and all remaining timeouts to 10 seconds.
|
3176
|
+
# ::Google::Apps::Chat::V1::ChatService::Rest::Client.configure do |config|
|
3177
|
+
# config.timeout = 10.0
|
3178
|
+
# config.rpcs.create_message.timeout = 20.0
|
3179
|
+
# end
|
3180
|
+
#
|
3181
|
+
# # Apply the above configuration only to a new client.
|
3182
|
+
# client = ::Google::Apps::Chat::V1::ChatService::Rest::Client.new do |config|
|
3183
|
+
# config.timeout = 10.0
|
3184
|
+
# config.rpcs.create_message.timeout = 20.0
|
3185
|
+
# end
|
3186
|
+
#
|
3187
|
+
# @!attribute [rw] endpoint
|
3188
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
3189
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
3190
|
+
# @return [::String,nil]
|
3191
|
+
# @!attribute [rw] credentials
|
3192
|
+
# Credentials to send with calls. You may provide any of the following types:
|
3193
|
+
# * (`String`) The path to a service account key file in JSON format
|
3194
|
+
# * (`Hash`) A service account key as a Hash
|
3195
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
3196
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
3197
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
3198
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
3199
|
+
# * (`nil`) indicating no credentials
|
3200
|
+
# @return [::Object]
|
3201
|
+
# @!attribute [rw] scope
|
3202
|
+
# The OAuth scopes
|
3203
|
+
# @return [::Array<::String>]
|
3204
|
+
# @!attribute [rw] lib_name
|
3205
|
+
# The library name as recorded in instrumentation and logging
|
3206
|
+
# @return [::String]
|
3207
|
+
# @!attribute [rw] lib_version
|
3208
|
+
# The library version as recorded in instrumentation and logging
|
3209
|
+
# @return [::String]
|
3210
|
+
# @!attribute [rw] timeout
|
3211
|
+
# The call timeout in seconds.
|
3212
|
+
# @return [::Numeric]
|
3213
|
+
# @!attribute [rw] metadata
|
3214
|
+
# Additional headers to be sent with the call.
|
3215
|
+
# @return [::Hash{::Symbol=>::String}]
|
3216
|
+
# @!attribute [rw] retry_policy
|
3217
|
+
# The retry policy. The value is a hash with the following keys:
|
3218
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
3219
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
3220
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
3221
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
3222
|
+
# trigger a retry.
|
3223
|
+
# @return [::Hash]
|
3224
|
+
# @!attribute [rw] quota_project
|
3225
|
+
# A separate project against which to charge quota.
|
3226
|
+
# @return [::String]
|
3227
|
+
# @!attribute [rw] universe_domain
|
3228
|
+
# The universe domain within which to make requests. This determines the
|
3229
|
+
# default endpoint URL. The default value of nil uses the environment
|
3230
|
+
# universe (usually the default "googleapis.com" universe).
|
3231
|
+
# @return [::String,nil]
|
3232
|
+
#
|
3233
|
+
class Configuration
|
3234
|
+
extend ::Gapic::Config
|
3235
|
+
|
3236
|
+
# @private
|
3237
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
3238
|
+
DEFAULT_ENDPOINT = "chat.googleapis.com"
|
3239
|
+
|
3240
|
+
config_attr :endpoint, nil, ::String, nil
|
3241
|
+
config_attr :credentials, nil do |value|
|
3242
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
3243
|
+
allowed.any? { |klass| klass === value }
|
3244
|
+
end
|
3245
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
3246
|
+
config_attr :lib_name, nil, ::String, nil
|
3247
|
+
config_attr :lib_version, nil, ::String, nil
|
3248
|
+
config_attr :timeout, nil, ::Numeric, nil
|
3249
|
+
config_attr :metadata, nil, ::Hash, nil
|
3250
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
3251
|
+
config_attr :quota_project, nil, ::String, nil
|
3252
|
+
config_attr :universe_domain, nil, ::String, nil
|
3253
|
+
|
3254
|
+
# @private
|
3255
|
+
def initialize parent_config = nil
|
3256
|
+
@parent_config = parent_config unless parent_config.nil?
|
3257
|
+
|
3258
|
+
yield self if block_given?
|
3259
|
+
end
|
3260
|
+
|
3261
|
+
##
|
3262
|
+
# Configurations for individual RPCs
|
3263
|
+
# @return [Rpcs]
|
3264
|
+
#
|
3265
|
+
def rpcs
|
3266
|
+
@rpcs ||= begin
|
3267
|
+
parent_rpcs = nil
|
3268
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
3269
|
+
Rpcs.new parent_rpcs
|
3270
|
+
end
|
3271
|
+
end
|
3272
|
+
|
3273
|
+
##
|
3274
|
+
# Configuration RPC class for the ChatService API.
|
3275
|
+
#
|
3276
|
+
# Includes fields providing the configuration for each RPC in this service.
|
3277
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
3278
|
+
# the following configuration fields:
|
3279
|
+
#
|
3280
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
3281
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
3282
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
3283
|
+
# include the following keys:
|
3284
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
3285
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
3286
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
3287
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
3288
|
+
# trigger a retry.
|
3289
|
+
#
|
3290
|
+
class Rpcs
|
3291
|
+
##
|
3292
|
+
# RPC-specific configuration for `create_message`
|
3293
|
+
# @return [::Gapic::Config::Method]
|
3294
|
+
#
|
3295
|
+
attr_reader :create_message
|
3296
|
+
##
|
3297
|
+
# RPC-specific configuration for `list_messages`
|
3298
|
+
# @return [::Gapic::Config::Method]
|
3299
|
+
#
|
3300
|
+
attr_reader :list_messages
|
3301
|
+
##
|
3302
|
+
# RPC-specific configuration for `list_memberships`
|
3303
|
+
# @return [::Gapic::Config::Method]
|
3304
|
+
#
|
3305
|
+
attr_reader :list_memberships
|
3306
|
+
##
|
3307
|
+
# RPC-specific configuration for `get_membership`
|
3308
|
+
# @return [::Gapic::Config::Method]
|
3309
|
+
#
|
3310
|
+
attr_reader :get_membership
|
3311
|
+
##
|
3312
|
+
# RPC-specific configuration for `get_message`
|
3313
|
+
# @return [::Gapic::Config::Method]
|
3314
|
+
#
|
3315
|
+
attr_reader :get_message
|
3316
|
+
##
|
3317
|
+
# RPC-specific configuration for `update_message`
|
3318
|
+
# @return [::Gapic::Config::Method]
|
3319
|
+
#
|
3320
|
+
attr_reader :update_message
|
3321
|
+
##
|
3322
|
+
# RPC-specific configuration for `delete_message`
|
3323
|
+
# @return [::Gapic::Config::Method]
|
3324
|
+
#
|
3325
|
+
attr_reader :delete_message
|
3326
|
+
##
|
3327
|
+
# RPC-specific configuration for `get_attachment`
|
3328
|
+
# @return [::Gapic::Config::Method]
|
3329
|
+
#
|
3330
|
+
attr_reader :get_attachment
|
3331
|
+
##
|
3332
|
+
# RPC-specific configuration for `upload_attachment`
|
3333
|
+
# @return [::Gapic::Config::Method]
|
3334
|
+
#
|
3335
|
+
attr_reader :upload_attachment
|
3336
|
+
##
|
3337
|
+
# RPC-specific configuration for `list_spaces`
|
3338
|
+
# @return [::Gapic::Config::Method]
|
3339
|
+
#
|
3340
|
+
attr_reader :list_spaces
|
3341
|
+
##
|
3342
|
+
# RPC-specific configuration for `get_space`
|
3343
|
+
# @return [::Gapic::Config::Method]
|
3344
|
+
#
|
3345
|
+
attr_reader :get_space
|
3346
|
+
##
|
3347
|
+
# RPC-specific configuration for `create_space`
|
3348
|
+
# @return [::Gapic::Config::Method]
|
3349
|
+
#
|
3350
|
+
attr_reader :create_space
|
3351
|
+
##
|
3352
|
+
# RPC-specific configuration for `set_up_space`
|
3353
|
+
# @return [::Gapic::Config::Method]
|
3354
|
+
#
|
3355
|
+
attr_reader :set_up_space
|
3356
|
+
##
|
3357
|
+
# RPC-specific configuration for `update_space`
|
3358
|
+
# @return [::Gapic::Config::Method]
|
3359
|
+
#
|
3360
|
+
attr_reader :update_space
|
3361
|
+
##
|
3362
|
+
# RPC-specific configuration for `delete_space`
|
3363
|
+
# @return [::Gapic::Config::Method]
|
3364
|
+
#
|
3365
|
+
attr_reader :delete_space
|
3366
|
+
##
|
3367
|
+
# RPC-specific configuration for `complete_import_space`
|
3368
|
+
# @return [::Gapic::Config::Method]
|
3369
|
+
#
|
3370
|
+
attr_reader :complete_import_space
|
3371
|
+
##
|
3372
|
+
# RPC-specific configuration for `find_direct_message`
|
3373
|
+
# @return [::Gapic::Config::Method]
|
3374
|
+
#
|
3375
|
+
attr_reader :find_direct_message
|
3376
|
+
##
|
3377
|
+
# RPC-specific configuration for `create_membership`
|
3378
|
+
# @return [::Gapic::Config::Method]
|
3379
|
+
#
|
3380
|
+
attr_reader :create_membership
|
3381
|
+
##
|
3382
|
+
# RPC-specific configuration for `update_membership`
|
3383
|
+
# @return [::Gapic::Config::Method]
|
3384
|
+
#
|
3385
|
+
attr_reader :update_membership
|
3386
|
+
##
|
3387
|
+
# RPC-specific configuration for `delete_membership`
|
3388
|
+
# @return [::Gapic::Config::Method]
|
3389
|
+
#
|
3390
|
+
attr_reader :delete_membership
|
3391
|
+
##
|
3392
|
+
# RPC-specific configuration for `create_reaction`
|
3393
|
+
# @return [::Gapic::Config::Method]
|
3394
|
+
#
|
3395
|
+
attr_reader :create_reaction
|
3396
|
+
##
|
3397
|
+
# RPC-specific configuration for `list_reactions`
|
3398
|
+
# @return [::Gapic::Config::Method]
|
3399
|
+
#
|
3400
|
+
attr_reader :list_reactions
|
3401
|
+
##
|
3402
|
+
# RPC-specific configuration for `delete_reaction`
|
3403
|
+
# @return [::Gapic::Config::Method]
|
3404
|
+
#
|
3405
|
+
attr_reader :delete_reaction
|
3406
|
+
##
|
3407
|
+
# RPC-specific configuration for `get_space_read_state`
|
3408
|
+
# @return [::Gapic::Config::Method]
|
3409
|
+
#
|
3410
|
+
attr_reader :get_space_read_state
|
3411
|
+
##
|
3412
|
+
# RPC-specific configuration for `update_space_read_state`
|
3413
|
+
# @return [::Gapic::Config::Method]
|
3414
|
+
#
|
3415
|
+
attr_reader :update_space_read_state
|
3416
|
+
##
|
3417
|
+
# RPC-specific configuration for `get_thread_read_state`
|
3418
|
+
# @return [::Gapic::Config::Method]
|
3419
|
+
#
|
3420
|
+
attr_reader :get_thread_read_state
|
3421
|
+
|
3422
|
+
# @private
|
3423
|
+
def initialize parent_rpcs = nil
|
3424
|
+
create_message_config = parent_rpcs.create_message if parent_rpcs.respond_to? :create_message
|
3425
|
+
@create_message = ::Gapic::Config::Method.new create_message_config
|
3426
|
+
list_messages_config = parent_rpcs.list_messages if parent_rpcs.respond_to? :list_messages
|
3427
|
+
@list_messages = ::Gapic::Config::Method.new list_messages_config
|
3428
|
+
list_memberships_config = parent_rpcs.list_memberships if parent_rpcs.respond_to? :list_memberships
|
3429
|
+
@list_memberships = ::Gapic::Config::Method.new list_memberships_config
|
3430
|
+
get_membership_config = parent_rpcs.get_membership if parent_rpcs.respond_to? :get_membership
|
3431
|
+
@get_membership = ::Gapic::Config::Method.new get_membership_config
|
3432
|
+
get_message_config = parent_rpcs.get_message if parent_rpcs.respond_to? :get_message
|
3433
|
+
@get_message = ::Gapic::Config::Method.new get_message_config
|
3434
|
+
update_message_config = parent_rpcs.update_message if parent_rpcs.respond_to? :update_message
|
3435
|
+
@update_message = ::Gapic::Config::Method.new update_message_config
|
3436
|
+
delete_message_config = parent_rpcs.delete_message if parent_rpcs.respond_to? :delete_message
|
3437
|
+
@delete_message = ::Gapic::Config::Method.new delete_message_config
|
3438
|
+
get_attachment_config = parent_rpcs.get_attachment if parent_rpcs.respond_to? :get_attachment
|
3439
|
+
@get_attachment = ::Gapic::Config::Method.new get_attachment_config
|
3440
|
+
upload_attachment_config = parent_rpcs.upload_attachment if parent_rpcs.respond_to? :upload_attachment
|
3441
|
+
@upload_attachment = ::Gapic::Config::Method.new upload_attachment_config
|
3442
|
+
list_spaces_config = parent_rpcs.list_spaces if parent_rpcs.respond_to? :list_spaces
|
3443
|
+
@list_spaces = ::Gapic::Config::Method.new list_spaces_config
|
3444
|
+
get_space_config = parent_rpcs.get_space if parent_rpcs.respond_to? :get_space
|
3445
|
+
@get_space = ::Gapic::Config::Method.new get_space_config
|
3446
|
+
create_space_config = parent_rpcs.create_space if parent_rpcs.respond_to? :create_space
|
3447
|
+
@create_space = ::Gapic::Config::Method.new create_space_config
|
3448
|
+
set_up_space_config = parent_rpcs.set_up_space if parent_rpcs.respond_to? :set_up_space
|
3449
|
+
@set_up_space = ::Gapic::Config::Method.new set_up_space_config
|
3450
|
+
update_space_config = parent_rpcs.update_space if parent_rpcs.respond_to? :update_space
|
3451
|
+
@update_space = ::Gapic::Config::Method.new update_space_config
|
3452
|
+
delete_space_config = parent_rpcs.delete_space if parent_rpcs.respond_to? :delete_space
|
3453
|
+
@delete_space = ::Gapic::Config::Method.new delete_space_config
|
3454
|
+
complete_import_space_config = parent_rpcs.complete_import_space if parent_rpcs.respond_to? :complete_import_space
|
3455
|
+
@complete_import_space = ::Gapic::Config::Method.new complete_import_space_config
|
3456
|
+
find_direct_message_config = parent_rpcs.find_direct_message if parent_rpcs.respond_to? :find_direct_message
|
3457
|
+
@find_direct_message = ::Gapic::Config::Method.new find_direct_message_config
|
3458
|
+
create_membership_config = parent_rpcs.create_membership if parent_rpcs.respond_to? :create_membership
|
3459
|
+
@create_membership = ::Gapic::Config::Method.new create_membership_config
|
3460
|
+
update_membership_config = parent_rpcs.update_membership if parent_rpcs.respond_to? :update_membership
|
3461
|
+
@update_membership = ::Gapic::Config::Method.new update_membership_config
|
3462
|
+
delete_membership_config = parent_rpcs.delete_membership if parent_rpcs.respond_to? :delete_membership
|
3463
|
+
@delete_membership = ::Gapic::Config::Method.new delete_membership_config
|
3464
|
+
create_reaction_config = parent_rpcs.create_reaction if parent_rpcs.respond_to? :create_reaction
|
3465
|
+
@create_reaction = ::Gapic::Config::Method.new create_reaction_config
|
3466
|
+
list_reactions_config = parent_rpcs.list_reactions if parent_rpcs.respond_to? :list_reactions
|
3467
|
+
@list_reactions = ::Gapic::Config::Method.new list_reactions_config
|
3468
|
+
delete_reaction_config = parent_rpcs.delete_reaction if parent_rpcs.respond_to? :delete_reaction
|
3469
|
+
@delete_reaction = ::Gapic::Config::Method.new delete_reaction_config
|
3470
|
+
get_space_read_state_config = parent_rpcs.get_space_read_state if parent_rpcs.respond_to? :get_space_read_state
|
3471
|
+
@get_space_read_state = ::Gapic::Config::Method.new get_space_read_state_config
|
3472
|
+
update_space_read_state_config = parent_rpcs.update_space_read_state if parent_rpcs.respond_to? :update_space_read_state
|
3473
|
+
@update_space_read_state = ::Gapic::Config::Method.new update_space_read_state_config
|
3474
|
+
get_thread_read_state_config = parent_rpcs.get_thread_read_state if parent_rpcs.respond_to? :get_thread_read_state
|
3475
|
+
@get_thread_read_state = ::Gapic::Config::Method.new get_thread_read_state_config
|
3476
|
+
|
3477
|
+
yield self if block_given?
|
3478
|
+
end
|
3479
|
+
end
|
3480
|
+
end
|
3481
|
+
end
|
3482
|
+
end
|
3483
|
+
end
|
3484
|
+
end
|
3485
|
+
end
|
3486
|
+
end
|
3487
|
+
end
|